//:://////////////////////////////////////////////////////////////////////////
//:: Warlock Greater Invocation: 
//:: nw_s0_iwallflam.nss
//:: Created By: Brock Heinz - OEI
//:: Created On: 08/30/05
//:: Copyright (c) 2005 Obsidian Entertainment Inc.
//:://////////////////////////////////////////////////////////////////////////
/*
        Wall of Perilous Flame
        Complete Arcane, pg. 136
        Spell Level:	5
        Class: 		    Misc

        The warlock can conjure a wall of fire (4th level wizard spell). 
        It behaves identically to the wizard spell, except half of the damage 
        is considered magical energy and fire resistance won't affect it.

*/
//:://////////////////////////////////////////////////////////////////////////

#include "jx_inc_magic"
#include "x2_inc_spellhook" 

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

void mainSpell()
{

    if (!X2PreSpellCastCode())
    {
	// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
        { JXPostSpellCastCode(); return; }
    }


    //Declare Area of Effect object using the appropriate constant
    //Get the location where the wall is to be placed.
    location lTarget = JXGetSpellTargetLocation();
    int nDuration = 3;
    //if(nDuration == 0)
    //{
    //    nDuration = 1;
    //}
	
	//Check fort metamagic
	if (JXGetMetaMagicFeat() & METAMAGIC_EXTEND)
	{
		nDuration = nDuration *2;	//Duration is +100%
	}

    //Create the Area of Effect Object declared above.
    JXApplyAreaEffectAtLocation(AOE_PER_WALL_PERILOUS_FLAME, lTarget, RoundsToSeconds(nDuration));

	JXPostSpellCastCode();
}
