LoD_PRC8/_module/nss/lod_spell_interv.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

73 lines
3.0 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name: lod_spell_interv
//:://////////////////////////////////////////////
/*
Gets called everytime someone casts a spell.
Should be used to override spellbehaviour in LoD
*/
//:://////////////////////////////////////////////
//:: Created By: Flash
//:: Created On: 01-marsh-2005
//:: Modified By: Flash
//:: Modified On: 14-marsh-2005
//:: Modification: Added spell hook for Shadow Conjuration Mage Armor.
//:://////////////////////////////////////////////
#include "x2_inc_switches"
#include "nw_i0_spells"
void main()
{
//:://////////////////////////////////////////////
//:: Created By: Flash
//:: Created On: 01-marsh-2005
//:: Prevent spellcasting in LoD Welcome area unless it is Resurrection or Raise Dead
//:://////////////////////////////////////////////
if((GetTag(GetArea(OBJECT_SELF)) == "WelcomeToLoD") && (GetSpellId() != SPELL_RESURRECTION) && (GetSpellId() != SPELL_RAISE_DEAD))
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectPolymorph(POLYMORPH_TYPE_PENGUIN, TRUE), OBJECT_SELF, 120.0);
SendMessageToPC(OBJECT_SELF, "Spells cannot be cast here.");
SetModuleOverrideSpellScriptFinished();
return;
}
//:://////////////////////////////////////////////
//:: Created By: Flash
//:: Created On: 14-marsh-2005
//:: Overrides the original script to avoid stacking of dodge ac bonus.
//:://////////////////////////////////////////////
if(GetSpellId() == SPELL_SHADOW_CONJURATION_MAGE_ARMOR)
{
object oTarget = GetSpellTargetObject();
int nDuration = GetCasterLevel(OBJECT_SELF);
int nMetaMagic = GetMetaMagicFeat();
effect eVis = EffectVisualEffect(VFX_IMP_AC_BONUS);
effect eAC1, eAC2, eAC3, eAC4;
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_SHADOW_CONJURATION_MAGE_ARMOR, FALSE));
//Check for metamagic extend
if (nMetaMagic == METAMAGIC_EXTEND) //Duration is +100%
{
nDuration = nDuration * 2;
}
//Set the four unique armor bonuses
eAC1 = EffectACIncrease(1, AC_ARMOUR_ENCHANTMENT_BONUS);
eAC2 = EffectACIncrease(1, AC_DEFLECTION_BONUS);
eAC3 = EffectACIncrease(1, AC_DODGE_BONUS);
eAC4 = EffectACIncrease(1, AC_NATURAL_BONUS);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
effect eLink = EffectLinkEffects(eAC1, eAC2);
eLink = EffectLinkEffects(eLink, eAC3);
eLink = EffectLinkEffects(eLink, eAC4);
eLink = EffectLinkEffects(eLink, eDur);
RemoveEffectsFromSpell(oTarget, SPELL_SHADOW_CONJURATION_MAGE_ARMOR);
//Apply the armor bonuses and the VFX impact
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, HoursToSeconds(nDuration));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
SetModuleOverrideSpellScriptFinished();
return;
}
}