forked from Jaysyn/PRC8
139 lines
3.8 KiB
Plaintext
139 lines
3.8 KiB
Plaintext
|
//::///////////////////////////////////////////////
|
||
|
//:: Lesser Mind Blank
|
||
|
//:: NW_S0_LsMndBlk.nss
|
||
|
//:: Copyright (c) 2001 Bioware Corp.
|
||
|
//:://////////////////////////////////////////////
|
||
|
/*
|
||
|
The target is given complete protection
|
||
|
from all mental effects.
|
||
|
*/
|
||
|
//:://////////////////////////////////////////////
|
||
|
//:: Created By: Preston Watamaniuk
|
||
|
//:: Created On: Jan 7, 2002
|
||
|
//:://////////////////////////////////////////////
|
||
|
|
||
|
//:: modified by mr_bumpkin Dec 4, 2003 for PRC stuff
|
||
|
#include "prc_inc_spells"
|
||
|
|
||
|
//::///////////////////////////////////////////////
|
||
|
//:: ApplyMindBlank
|
||
|
//:: Copyright (c) 2001 Bioware Corp.
|
||
|
//:://////////////////////////////////////////////
|
||
|
/*
|
||
|
Applies Mind blank to the target
|
||
|
*/
|
||
|
//:://////////////////////////////////////////////
|
||
|
//:: Created By:
|
||
|
//:: Created On:
|
||
|
//:://////////////////////////////////////////////
|
||
|
void PRCApplyMindBlank(object oTarget, int nSpellId, float fDelay=0.0)
|
||
|
{
|
||
|
effect eImm1 = EffectImmunity(IMMUNITY_TYPE_MIND_SPELLS);
|
||
|
effect eVis = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_POSITIVE);
|
||
|
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
|
||
|
|
||
|
effect eLink = EffectLinkEffects(eImm1, eVis);
|
||
|
eLink = EffectLinkEffects(eLink, eDur);
|
||
|
effect eSearch = GetFirstEffect(oTarget);
|
||
|
int bValid;
|
||
|
int nDuration = PRCGetCasterLevel(OBJECT_SELF);
|
||
|
int nMetaMagic = PRCGetMetaMagicFeat();
|
||
|
//Enter Metamagic conditions
|
||
|
if (nMetaMagic & METAMAGIC_EXTEND)
|
||
|
{
|
||
|
nDuration = nDuration *2; //Duration is +100%
|
||
|
}
|
||
|
|
||
|
//Fire cast spell at event for the specified target
|
||
|
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, nSpellId, FALSE));
|
||
|
//Search through effects
|
||
|
while(GetIsEffectValid(eSearch))
|
||
|
{
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
bValid = FALSE;
|
||
|
//Check to see if the effect matches a particular type defined below
|
||
|
if (GetEffectType(eSearch) == EFFECT_TYPE_DAZED)
|
||
|
{
|
||
|
bValid = TRUE;
|
||
|
}
|
||
|
else if(GetEffectType(eSearch) == EFFECT_TYPE_CHARMED)
|
||
|
{
|
||
|
bValid = TRUE;
|
||
|
}
|
||
|
else if(GetEffectType(eSearch) == EFFECT_TYPE_SLEEP)
|
||
|
{
|
||
|
bValid = TRUE;
|
||
|
}
|
||
|
else if(GetEffectType(eSearch) == EFFECT_TYPE_CONFUSED)
|
||
|
{
|
||
|
bValid = TRUE;
|
||
|
}
|
||
|
else if(GetEffectType(eSearch) == EFFECT_TYPE_STUNNED)
|
||
|
{
|
||
|
bValid = TRUE;
|
||
|
}
|
||
|
else if(GetEffectType(eSearch) == EFFECT_TYPE_DOMINATED)
|
||
|
{
|
||
|
bValid = TRUE;
|
||
|
}
|
||
|
// * Additional March 2003
|
||
|
// * Remove any feeblemind originating effects
|
||
|
else if (GetEffectSpellId(eSearch) == SPELL_FEEBLEMIND)
|
||
|
{
|
||
|
bValid = TRUE;
|
||
|
}
|
||
|
else if (GetEffectSpellId(eSearch) == SPELL_BANE)
|
||
|
{
|
||
|
bValid = TRUE;
|
||
|
}
|
||
|
|
||
|
//Apply damage and remove effect if the effect is a match
|
||
|
if (bValid == TRUE)
|
||
|
{
|
||
|
RemoveEffect(oTarget, eSearch);
|
||
|
}
|
||
|
eSearch = GetNextEffect(oTarget);
|
||
|
}
|
||
|
|
||
|
//After effects are removed we apply the immunity to mind spells to the target
|
||
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, TurnsToSeconds(nDuration)));
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
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-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
|
||
|
|
||
|
object oTarget = PRCGetSpellTargetObject();
|
||
|
|
||
|
PRCApplyMindBlank(oTarget, GetSpellId());
|
||
|
|
||
|
|
||
|
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
|
||
|
// Getting rid of the local integer storing the spellschool name
|
||
|
}
|