Battledale_PRC8/_module/nss/jw_removepositiv.nss

109 lines
4.3 KiB
Plaintext
Raw Permalink Normal View History

//Jok's great "remove buffs from me so that i dont look like a statue or tree"
//#include "NW_I0_SPELLS"
#include "prc_inc_spells"
int GetSpellBreachProtectionJok(int nLastChecked);
int RemoveProtectionsJok(int nSpell_ID, object oTarget, int nCount);
void DoSpellBreachJok(object oTarget, int nTotal, int nSR);
void main()
{
DoSpellBreachJok(GetPCSpeaker(), 400, 500);
}
//-----------------------------------------------------------------------
void DoSpellBreachJok(object oTarget, int nTotal, int nSR)
{
//effect eSR = EffectSpellResistanceDecrease(nSR);
//effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
//effect eLink = EffectLinkEffects(eDur, eSR);
//effect eVis = EffectVisualEffect(VFX_IMP_BREACH);
int nCnt, nIdx;
// if(!GetIsReactionTypeFriendly(oTarget))
// {
//Fire cast spell at event for the specified target
//SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_GREATER_SPELL_BREACH));
//Search through and remove protections.
while(nCnt <= 30 && nIdx < nTotal)
{
nIdx = nIdx + RemoveProtectionsJok(GetSpellBreachProtectionJok(nCnt), oTarget, nCnt);
nCnt++;
}
//ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(10));
// }
//ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
//------------------------------------------------------------------------
int GetSpellBreachProtectionJok(int nLastChecked)
{
//nLastChecked++;
if(nLastChecked == 1) {return SPELL_GREATER_SPELL_MANTLE;}
else if (nLastChecked == 2){return SPELL_PREMONITION;}
else if(nLastChecked == 3) {return SPELL_SPELL_MANTLE;}
else if(nLastChecked == 4) {return SPELL_SHADOW_SHIELD;}
else if(nLastChecked == 5) {return SPELL_GREATER_STONESKIN;}
else if(nLastChecked == 6) {return SPELL_ETHEREAL_VISAGE;}
else if(nLastChecked == 7) {return SPELL_GLOBE_OF_INVULNERABILITY;}
else if(nLastChecked == 8) {return SPELL_ENERGY_BUFFER;}
else if(nLastChecked == 9) {return SPELL_MINOR_GLOBE_OF_INVULNERABILITY;}
else if(nLastChecked == 10) {return SPELL_STONESKIN;}
else if(nLastChecked == 11) {return SPELL_LESSER_SPELL_MANTLE;}
else if(nLastChecked == 12) {return SPELL_ELEMENTAL_SHIELD;}
else if(nLastChecked == 13) {return SPELL_PROTECTION_FROM_ELEMENTS;}
else if(nLastChecked == 14) {return SPELL_RESIST_ELEMENTS;}
else if(nLastChecked == 15) {return SPELL_GHOSTLY_VISAGE;}
else if(nLastChecked == 16) {return SPELL_ENDURE_ELEMENTS;}
else if(nLastChecked == 17) {return SPELL_FREEDOM_OF_MOVEMENT;}
else if(nLastChecked == 18) {return SPELL_TRUE_SEEING;}
else if(nLastChecked == 19) {return SPELL_BARKSKIN;}
else if(nLastChecked == 20) {return SPELL_MIND_BLANK;}
else if(nLastChecked == 21) {return SPELL_PROTECTION_FROM_SPELLS;}
else if(nLastChecked == 22) {return SPELL_PROTECTION_FROM_EVIL;}
else if(nLastChecked == 23) {return SPELL_PROTECTION_FROM_GOOD;}
else if(nLastChecked == 24) {return SPELL_INVISIBILITY;}
else if(nLastChecked == 25) {return SPELL_INVISIBILITY_SPHERE;}
else if(nLastChecked == 26) {return SPELL_LIGHT;}
else if(nLastChecked == 27) {return SPELL_IMPROVED_INVISIBILITY;}
else if(nLastChecked == 28) {return SPELL_SHIELD;}
else if(nLastChecked == 29) {return SPELL_RESISTANCE;}
else if(nLastChecked == 30) {return SPELL_SPELL_RESISTANCE;}
return nLastChecked;
}
//-------------------------------------------------------------------------
int RemoveProtectionsJok(int nSpell_ID, object oTarget, int nCount)
{
//Declare major variables
effect eProtection;
int nCnt = 0;
if(GetHasSpellEffect(nSpell_ID, oTarget))
{
//Search through the valid effects on the target.
eProtection = GetFirstEffect(oTarget);
while (GetIsEffectValid(eProtection))
{
//If the effect was created by the spell then remove it
if(GetEffectSpellId(eProtection) == nSpell_ID)
{
RemoveEffect(oTarget, eProtection);
//return 1;
nCnt++;
}
//Get next effect on the target
eProtection = GetNextEffect(oTarget);
}
}
if(nCnt > 0)
{
return 1;
}
else
{
return 0;
}
}