89 lines
3.5 KiB
Plaintext
89 lines
3.5 KiB
Plaintext
|
//::///////////////////////////////////////////////
|
||
|
//:: Dispel Magic
|
||
|
//:: NW_S0_DisMagic.nss
|
||
|
//:: Copyright (c) 2001 Bioware Corp.
|
||
|
//:://////////////////////////////////////////////
|
||
|
//:: Attempts to dispel all magic on a targeted
|
||
|
//:: object, or simply the most powerful that it
|
||
|
//:: can on every object in an area if no target
|
||
|
//:: specified.
|
||
|
//:://////////////////////////////////////////////
|
||
|
//:: Created By: Preston Watamaniuk
|
||
|
//:: Created On: Jan 7, 2002
|
||
|
//:: Updated On: Oct 20, 2003, Georg Zoeller
|
||
|
//:://////////////////////////////////////////////
|
||
|
|
||
|
#include "70_inc_spells"
|
||
|
#include "x0_i0_spells"
|
||
|
#include "x2_inc_spellhook"
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
|
||
|
//--------------------------------------------------------------------------
|
||
|
/*
|
||
|
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())
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
// End of Spell Cast Hook
|
||
|
spellsDeclareMajorVariables();
|
||
|
effect eVis = EffectVisualEffect(VFX_IMP_BREACH);
|
||
|
effect eImpact = EffectVisualEffect(VFX_FNF_DISPEL);
|
||
|
int nCasterLevel = spell.Level;
|
||
|
|
||
|
//--------------------------------------------------------------------------
|
||
|
// Dispel Magic is capped at caster level 10
|
||
|
//--------------------------------------------------------------------------
|
||
|
if(nCasterLevel > 10)
|
||
|
{
|
||
|
//High-level shifter version - caster level artificially set to shifter levels + 3
|
||
|
if(GetLevelByClass(CLASS_TYPE_SHIFTER) > 10 && GetRacialType(OBJECT_SELF) == RACIAL_TYPE_OUTSIDER)
|
||
|
nCasterLevel = GetLevelByClass(CLASS_TYPE_SHIFTER)+3;
|
||
|
else nCasterLevel = 10;
|
||
|
}
|
||
|
|
||
|
if (GetIsObjectValid(spell.Target))
|
||
|
{
|
||
|
//----------------------------------------------------------------------
|
||
|
// Targeted Dispel - Dispel all
|
||
|
//----------------------------------------------------------------------
|
||
|
spellsDispelMagic(spell.Target, nCasterLevel, eVis, eImpact);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//----------------------------------------------------------------------
|
||
|
// Area of Effect - Only dispel best effect
|
||
|
//----------------------------------------------------------------------
|
||
|
|
||
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, spell.Loc);
|
||
|
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, spell.Loc, FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_AREA_OF_EFFECT | OBJECT_TYPE_PLACEABLE );
|
||
|
while (GetIsObjectValid(oTarget))
|
||
|
{
|
||
|
if(GetObjectType(oTarget) == OBJECT_TYPE_AREA_OF_EFFECT)
|
||
|
{
|
||
|
//--------------------------------------------------------------
|
||
|
// Handle Area of Effects
|
||
|
//--------------------------------------------------------------
|
||
|
spellsDispelAoE(oTarget, spell.Caster, nCasterLevel);
|
||
|
}
|
||
|
else if (GetObjectType(oTarget) == OBJECT_TYPE_PLACEABLE)
|
||
|
{
|
||
|
SignalEvent(oTarget, EventSpellCastAt(spell.Caster, spell.Id));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
spellsDispelMagic(oTarget, nCasterLevel, eVis, eImpact, FALSE);
|
||
|
}
|
||
|
|
||
|
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE,spell.Loc, FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_AREA_OF_EFFECT | OBJECT_TYPE_PLACEABLE);
|
||
|
}
|
||
|
}
|
||
|
}
|