PRC8/nwn/nwnprc/trunk/spells/nw_s0_fear.nss
Jaysyn904 6ec137a24e Updated AMS marker feats
Updated AMS marker feats.  Removed arcane & divine marker feats.  Updated Dread Necromancer for epic progression. Updated weapon baseitem models.  Updated new weapons for crafting & npc equip.
 Updated prefix.  Updated release archive.
2024-02-11 14:01:05 -05:00

98 lines
3.3 KiB
Plaintext

//::///////////////////////////////////////////////
//:: [Fear]
//:: [NW_S0_Fear.nss]
//:: Copyright (c) 2000 Bioware Corp.
//:://////////////////////////////////////////////
//:: Causes an area of fear that reduces Will Saves
//:: and applies the frightened effect.
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: April 23, 2001
//:://////////////////////////////////////////////
//:: VFX Pass By: Preston W, On: June 20, 2001
//:: Update Pass By: Preston W, On: July 30, 2001
//:: modified by mr_bumpkin Dec 4, 2003 for PRC stuff
#include "prc_inc_spells"
#include "prc_add_spell_dc"
void main()
{
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_NECROMANCY);
/*
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
int CasterLvl = PRCGetCasterLevel(OBJECT_SELF);
int nMetaMagic = PRCGetMetaMagicFeat();
float fDuration = RoundsToSeconds(CasterLvl);
int nDamage;
effect eVis = EffectVisualEffect(VFX_IMP_FEAR_S);
effect eFear = EffectFrightened();
effect eMind = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_FEAR);
effect eImpact = EffectVisualEffect(VFX_FNF_LOS_NORMAL_20);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
float fDelay;
//Link the fear and mind effects
effect eLink = EffectLinkEffects(eFear, eMind);
eLink = EffectLinkEffects(eLink, eDur);
int nPenetr = CasterLvl + SPGetPenetr();
object oTarget;
//Check for metamagic extend
if (nMetaMagic & METAMAGIC_EXTEND)
{
fDuration = fDuration * 2.0; //Duration is +100%
}
//Apply Impact
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, PRCGetSpellTargetLocation());
//Get first target in the spell cone
oTarget = MyFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, PRCGetSpellTargetLocation(), TRUE);
while(GetIsObjectValid(oTarget))
{
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
{
fDelay = PRCGetRandomDelay();
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_FEAR));
//Make SR Check
if(!PRCDoResistSpell(OBJECT_SELF, oTarget,nPenetr, fDelay))
{
//Make a will save
if(!PRCMySavingThrow(SAVING_THROW_WILL, oTarget, (PRCGetSaveDC(oTarget,OBJECT_SELF)), SAVING_THROW_TYPE_FEAR, OBJECT_SELF, fDelay))
{
//Apply the linked effects and the VFX impact
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, fDuration,TRUE,-1,CasterLvl);
}
}
}
//Get next target in the spell cone
oTarget = MyNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, PRCGetSpellTargetLocation(), TRUE);
}
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
// Getting rid of the local integer storing the spellschool name
}