//::///////////////////////////////////////////////
//:: Wall of Fire
//:: NW_S0_WallFire.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Creates a wall of fire that burns any creature
    entering the area around the wall.  Those moving
    through the AOE are burned for 4d6 fire damage
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: July 17, 2001
//:://////////////////////////////////////////////

#include "jx_inc_magic"
#include "x2_inc_spellhook" 

void mainSpell();
void main()
{
	AssignCommand(JXGetCaster(), mainSpell());
}

void mainSpell()
{

/* 
  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
        { JXPostSpellCastCode(); return; }
    }

// End of Spell Cast Hook


    //Declare Area of Effect object using the appropriate constant
    //Get the location where the wall is to be placed.
    location lTarget = JXGetSpellTargetLocation();
    int nDuration = JXGetCasterLevel(OBJECT_SELF) / 2;
    if(nDuration == 0)
    {
        nDuration = 1;
    }
    int nMetaMagic = JXGetMetaMagicFeat();

        //Check fort metamagic
        if (nMetaMagic & METAMAGIC_EXTEND)
		{
			nDuration = nDuration *2;	//Duration is +100%
		}
    //Create the Area of Effect Object declared above.
    JXApplyAreaEffectAtLocation(AOE_PER_WALLFIRE, lTarget, RoundsToSeconds(nDuration));

	JXPostSpellCastCode();
}
