Initial upload.
Adding base PRC 4.19a files to repository.
This commit is contained in:
93
trunk/spells/sp_eimmunity.nss
Normal file
93
trunk/spells/sp_eimmunity.nss
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
sp_eimmunity
|
||||
|
||||
Energy Immunity scripts combined
|
||||
|
||||
By: Flaming_Sword
|
||||
Created: Jul 1, 2006
|
||||
Modified: Aug 26, 2006
|
||||
*/
|
||||
|
||||
#include "prc_sp_func"
|
||||
|
||||
//Implements the spell impact, put code here
|
||||
// if called in many places, return TRUE if
|
||||
// stored charges should be decreased
|
||||
// eg. touch attack hits
|
||||
//
|
||||
// Variables passed may be changed if necessary
|
||||
int DoSpell(object oCaster, object oTarget, int nCasterLevel, int nEvent)
|
||||
{
|
||||
int nSpellID = PRCGetSpellId();
|
||||
int nDamageType, nVfx;
|
||||
switch(nSpellID)
|
||||
{
|
||||
case (3114):
|
||||
{
|
||||
nDamageType = DAMAGE_TYPE_ACID;
|
||||
nVfx = VFX_IMP_ACID_L;
|
||||
break;
|
||||
}
|
||||
case (3115):
|
||||
{
|
||||
nDamageType = DAMAGE_TYPE_COLD;
|
||||
nVfx = VFX_IMP_FROST_L;
|
||||
break;
|
||||
}
|
||||
case (3116):
|
||||
{
|
||||
nDamageType = DAMAGE_TYPE_ELECTRICAL;
|
||||
nVfx = VFX_IMP_LIGHTNING_M;
|
||||
break;
|
||||
}
|
||||
case (3117):
|
||||
{
|
||||
nDamageType = DAMAGE_TYPE_FIRE;
|
||||
nVfx = VFX_IMP_FLAME_M;
|
||||
break;
|
||||
}
|
||||
case (3118):
|
||||
{
|
||||
nDamageType = DAMAGE_TYPE_SONIC;
|
||||
nVfx = VFX_IMP_SONIC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
float fDuration = PRCGetMetaMagicDuration(HoursToSeconds(24));
|
||||
effect eList = EffectDamageResistance(nDamageType, 9999);
|
||||
eList = EffectLinkEffects(eList, EffectVisualEffect(VFX_DUR_PROTECTION_ELEMENTS));
|
||||
eList = EffectLinkEffects(eList, EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE));
|
||||
PRCSignalSpellEvent(oTarget, FALSE, SPELL_ENERGY_IMMUNITY);
|
||||
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eList, oTarget, fDuration,TRUE,-1,nCasterLevel);
|
||||
SPApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nVfx), oTarget);
|
||||
|
||||
return TRUE; //return TRUE if spell charges should be decremented
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oCaster = OBJECT_SELF;
|
||||
int nCasterLevel = PRCGetCasterLevel(oCaster);
|
||||
PRCSetSchool(GetSpellSchool(PRCGetSpellId()));
|
||||
if (!X2PreSpellCastCode()) return;
|
||||
object oTarget = PRCGetSpellTargetObject();
|
||||
int nEvent = GetLocalInt(oCaster, PRC_SPELL_EVENT); //use bitwise & to extract flags
|
||||
if(!nEvent) //normal cast
|
||||
{
|
||||
if(GetLocalInt(oCaster, PRC_SPELL_HOLD) && oCaster == oTarget)
|
||||
{ //holding the charge, casting spell on self
|
||||
SetLocalSpellVariables(oCaster, 1); //change 1 to number of charges
|
||||
return;
|
||||
}
|
||||
DoSpell(oCaster, oTarget, nCasterLevel, nEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nEvent & PRC_SPELL_EVENT_ATTACK)
|
||||
{
|
||||
if(DoSpell(oCaster, oTarget, nCasterLevel, nEvent))
|
||||
DecrementSpellCharges(oCaster);
|
||||
}
|
||||
}
|
||||
PRCSetSchool();
|
||||
}
|
Reference in New Issue
Block a user