Battledale_PRC8/_removed/nw_s0_resele.nss

78 lines
2.5 KiB
Plaintext
Raw Normal View History

///::///////////////////////////////////////////////
//:: Resist Elements
//:: NW_S0_ResEle
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Offers 20 points of elemental resistance. If 30
points of a single elemental type is done to the
protected creature the spell fades
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 22, 2001
//:://////////////////////////////////////////////
#include "nw_i0_spells"
#include "x2_inc_spellhook"
void main()
{
/*
Spellcast Hook Code
Added 2003-06-23 by GeorgZ
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 oTarget = GetSpellTargetObject();
int nDuration = GetCasterLevel(OBJECT_SELF);
int nAmount = 30;
int nResistance = 20;
int nMetaMagic = GetMetaMagicFeat();
effect eCold = EffectDamageResistance(DAMAGE_TYPE_COLD, nResistance, nAmount);
effect eFire = EffectDamageResistance(DAMAGE_TYPE_FIRE, nResistance, nAmount);
effect eAcid = EffectDamageResistance(DAMAGE_TYPE_ACID, nResistance, nAmount);
effect eSonic = EffectDamageResistance(DAMAGE_TYPE_SONIC, nResistance, nAmount);
effect eElec = EffectDamageResistance(DAMAGE_TYPE_ELECTRICAL, nResistance, nAmount);
effect eDur = EffectVisualEffect(VFX_DUR_PROTECTION_ELEMENTS);
effect eVis = EffectVisualEffect(VFX_IMP_ELEMENTAL_PROTECTION);
effect eDur2 = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_RESIST_ELEMENTS, FALSE));
//Link Effects
effect eLink = EffectLinkEffects(eCold, eFire);
eLink = EffectLinkEffects(eLink, eAcid);
eLink = EffectLinkEffects(eLink, eSonic);
eLink = EffectLinkEffects(eLink, eElec);
eLink = EffectLinkEffects(eLink, eDur);
eLink = EffectLinkEffects(eLink, eDur2);
//Enter Metamagic conditions
if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration *2; //Duration is +100%
}
RemoveEffectsFromSpell(oTarget, GetSpellId());
//Apply the VFX impact and effects
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, TurnsToSeconds(nDuration));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}