Files
PRC8/nwn/nwnprc/trunk/spells/nw_s1_pulselec.nss
Jaysyn904 68ca3a56ca 2026/01/22 Update 2
Mechanatrixes always fail saves vs elecricity.
Incorporated most creature ability scripts into the PRC8 & updated them to use PRCEffect(), SPApplyEffectToObject(), etc.
Updated prc_inc_breath to use PRCEffectDamage()
Updated several spell scripts to use PRCEffectDamage().
2026-01-23 00:03:47 -05:00

59 lines
2.4 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Pulse: Lightning
//:: NW_S0_CallLghtn.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
All creatures within 10ft of the creature take
1d6 per HD up to 10d6
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: May 22, 2001
//:://////////////////////////////////////////////
#include "prc_inc_spells"
void main()
{
//Declare major variables
int nDamage;
effect eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_S);
effect eHowl = EffectVisualEffect(VFX_IMP_PULSE_COLD);
DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eHowl, GetLocation(OBJECT_SELF)));
effect eLightning = EffectBeam(VFX_BEAM_LIGHTNING, OBJECT_SELF,BODY_NODE_CHEST);
float fDelay;
int nHD = GetHitDice(OBJECT_SELF);
int nDC = 10 + nHD;
//Get first target in spell area
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, GetLocation(OBJECT_SELF));
while(GetIsObjectValid(oTarget))
{
if(oTarget != OBJECT_SELF)
{
if(!GetIsReactionTypeFriendly(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_PULSE_LIGHTNING));
//Roll the damage
nDamage = d6(nHD);
//Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
nDamage = PRCGetReflexAdjustedDamage(nDamage, oTarget, nDC, SAVING_THROW_TYPE_ELECTRICITY);
//Determine effect delay
fDelay = GetDistanceBetween(OBJECT_SELF, oTarget)/20;
eHowl = PRCEffectDamage(oTarget, nDamage, DAMAGE_TYPE_ELECTRICAL);
if(nDamage > 0)
{
//Apply the VFX impact and effects
DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eHowl, oTarget));
DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_TEMPORARY,eLightning,oTarget, 0.5));
}
}
}
//Get next target in spell area
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, GetLocation(OBJECT_SELF));
}
}