//:://///////////////////////////////////////////// //:: Energy Buffer //:: NW_S0_EneBuffer //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* The caster is protected from all five energy types for up to 3 per caster level. When one element type is spent all five are removed. */ //::////////////////////////////////////////////// //:: Created By: Preston Watamaniuk //:: Created On: Sept 12, 2001 //::////////////////////////////////////////////// //:: modified by mr_bumpkin Dec 4, 2003 for PRC stuff #include "prc_inc_spells" void main() { DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR"); SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_ABJURATION); /* 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 object oTarget = PRCGetSpellTargetObject(); //Declare major variables int CasterLvl = PRCGetCasterLevel(OBJECT_SELF); int nDuration = CasterLvl; int nAmount = 60; int nMetaMagic = PRCGetMetaMagicFeat(); effect eCold = EffectDamageResistance(DAMAGE_TYPE_COLD, 40, nAmount); effect eFire = EffectDamageResistance(DAMAGE_TYPE_FIRE, 40, nAmount); effect eAcid = EffectDamageResistance(DAMAGE_TYPE_ACID, 40, nAmount); effect eSonic = EffectDamageResistance(DAMAGE_TYPE_SONIC, 40, nAmount); effect eElec = EffectDamageResistance(DAMAGE_TYPE_ELECTRICAL, 40, 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_ENERGY_BUFFER, 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% } PRCRemoveEffectsFromSpell(oTarget, GetSpellId()); //Apply the VFX impact and effects SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, TurnsToSeconds(nDuration),TRUE,-1,CasterLvl); SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget); DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR"); // Getting rid of the local integer storing the spellschool name }