53 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.7 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
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
#include "x0_i0_spells"
 | 
						|
#include "inc_dispel"
 | 
						|
void main()
 | 
						|
{
 | 
						|
    //Declare major variables
 | 
						|
    effect eVis = EffectVisualEffect(VFX_IMP_HEAD_ODD);
 | 
						|
    effect eImpact = EffectVisualEffect(VFX_FNF_DISPEL);
 | 
						|
    object oTarget = GetSpellTargetObject();
 | 
						|
    location lLocal = GetSpellTargetLocation();
 | 
						|
    int nCasterLevel = GetCasterLevel(OBJECT_SELF);
 | 
						|
 | 
						|
    if(nCasterLevel > 10)
 | 
						|
    {
 | 
						|
        nCasterLevel = 10;
 | 
						|
    }
 | 
						|
    if (GetIsObjectValid(oTarget))
 | 
						|
    {
 | 
						|
        AltspellsDispelMagic(oTarget, nCasterLevel, eVis, eImpact);
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
        //Apply the VFX impact and effects
 | 
						|
        ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, GetSpellTargetLocation());
 | 
						|
        oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, lLocal, FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_AREA_OF_EFFECT);
 | 
						|
        while (GetIsObjectValid(oTarget))
 | 
						|
        {
 | 
						|
            if(GetObjectType(oTarget) == OBJECT_TYPE_AREA_OF_EFFECT)
 | 
						|
            {
 | 
						|
                DestroyObject(oTarget, 0.0);
 | 
						|
            }
 | 
						|
            AltspellsDispelMagic(oTarget, nCasterLevel, eVis, eImpact);
 | 
						|
 | 
						|
            oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE,lLocal, FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_AREA_OF_EFFECT);
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
 |