RoT2_PRC8/_module/nss/nw_s1_howlfear.nss
Jaysyn904 499aba4eb3 Initial upload
Initial upload
2023-09-25 18:13:22 -04:00

69 lines
2.4 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Howl: Fear
//:: NW_S1_HowlFear
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
A howl emanates from the creature which affects
all within 10ft unless they make a save.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: May 14, 2000
//:://////////////////////////////////////////////
#include "NW_I0_SPELLS"
//#include "wm_include"
#include "prc_inc_spells"
void main()
{
//if (WildMagicOverride()) { return; }
//:: Declare major variables
object oNPC = OBJECT_SELF;
object oTarget;
int nHD = GetHitDice(oNPC);
int nCHAMod = GetAbilityModifier(ABILITY_CHARISMA, oNPC);
int nDC = 10 +nCHAMod+ (nHD/4);
int nDuration = 1 + (nHD/4);
if(nDuration == 0) { nDuration = 1; }
float fDelay;
effect eVis = EffectVisualEffect(VFX_IMP_FEAR_S);
effect eHowl = EffectFrightened();
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
effect eDur2 = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_FEAR);
effect eImpact = EffectVisualEffect(VFX_FNF_HOWL_MIND);
effect eLink = EffectLinkEffects(eHowl, eDur);
eLink = EffectLinkEffects(eLink, eDur2);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eImpact, oNPC);
//Get first target in spell area
oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(oNPC));
while(GetIsObjectValid(oTarget))
{
if(!GetIsReactionTypeFriendly(oTarget) && !GetIsFriend(oTarget) && oTarget != oNPC)
{
fDelay = GetDistanceToObject(oTarget)/10;
nDuration = GetScaledDuration(nDuration , oTarget);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(oNPC, SPELLABILITY_HOWL_FEAR));
//Make a saving throw check
if(!/*Will Save*/ PRCMySavingThrow(SAVING_THROW_WILL, oTarget, nDC, SAVING_THROW_TYPE_FEAR))
{
//Apply the VFX impact and effects
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(nDuration)));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
}
}
//Get next target in spell area
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(oNPC));
}
}