101 lines
3.9 KiB
Plaintext
101 lines
3.9 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Call Lightning
|
|
//:: NW_S0_CallLghtn.nss
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This spells smites an area around the caster
|
|
with bolts of lightning which strike all enemies.
|
|
Bolts do 1d10 per level up 10d10
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: May 22, 2001
|
|
//:://////////////////////////////////////////////
|
|
//:: VFX Pass By: Preston W, On: June 20, 2001
|
|
|
|
#include "X0_I0_SPELLS"
|
|
#include "x2_inc_spellhook"
|
|
|
|
void main()
|
|
{
|
|
|
|
/*
|
|
Spellcast Hook Code
|
|
Added 2003-06-20 by Georg
|
|
If you want to make changes to all spells,
|
|
check x2_inc_spellhook.nss to find out more
|
|
|
|
*/
|
|
|
|
if (!X2PreSpellCastCode())
|
|
{
|
|
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
|
|
return;
|
|
}
|
|
|
|
// End of Spell Cast Hook
|
|
|
|
|
|
//Declare major variables
|
|
object oCaster = OBJECT_SELF;
|
|
int nCasterLvl = GetCasterLevel(oCaster);
|
|
int nMetaMagic = GetMetaMagicFeat();
|
|
int nDamage;
|
|
float fDelay;
|
|
effect eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
|
|
effect eDam;
|
|
//Get the spell target location as opposed to the spell target.
|
|
location lTarget = GetSpellTargetLocation();
|
|
//Limit Caster level for the purposes of damage
|
|
if (nCasterLvl > 10)
|
|
{
|
|
nCasterLvl = 10;
|
|
}
|
|
//Declare the spell shape, size and the location. Capture the first target object in the shape.
|
|
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
|
//Cycle through the targets within the spell shape until an invalid object is captured.
|
|
while (GetIsObjectValid(oTarget))
|
|
{
|
|
if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF))
|
|
{
|
|
//Fire cast spell at event for the specified target
|
|
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_CALL_LIGHTNING));
|
|
//Get the distance between the explosion and the target to calculate delay
|
|
fDelay = GetRandomDelay(0.4, 1.75);
|
|
if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
|
|
{
|
|
//Roll damage for each target
|
|
nDamage = d6(nCasterLvl);
|
|
//Resolve metamagic
|
|
if (nMetaMagic == METAMAGIC_MAXIMIZE)
|
|
{
|
|
nDamage = 6 * nCasterLvl;
|
|
}
|
|
else if (nMetaMagic == METAMAGIC_EMPOWER)
|
|
{
|
|
nDamage = nDamage + nDamage / 2;
|
|
}
|
|
//Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
|
|
nDamage = GetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ELECTRICITY);
|
|
//Set the damage effect
|
|
eDam = EffectDamage(nDamage, DAMAGE_TYPE_ELECTRICAL);
|
|
if(nDamage > 0)
|
|
{
|
|
// Apply effects to the currently selected target.
|
|
if (GetTag(oTarget)=="cfleshgolem")
|
|
{ // heal
|
|
eDam=EffectHeal((nDamage/3));
|
|
} // heal
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
|
|
//This visual effect is applied to the target object not the location as above. This visual effect
|
|
//represents the flame that erupts on the target not on the ground.
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
|
|
}
|
|
}
|
|
}
|
|
//Select the next target within the spell shape.
|
|
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
|
}
|
|
}
|