//::///////////////////////////////////////////////
//:: Incendiary Cloud
//:: NW_S0_IncCloud.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Person within the AoE take 4d6 fire damage
    per round.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: May 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 major variables, including the Area of Effect object.
    //Capture the spell target location so that the AoE object can be created.
    location lTarget = JXGetSpellTargetLocation();
    int nDuration = JXGetCasterLevel(OBJECT_SELF);
    if(nDuration < 1)
    {
        nDuration = 1;
    }
    int nMetaMagic = JXGetMetaMagicFeat();
    //Check for metamagic extend
	if (nMetaMagic & METAMAGIC_EXTEND)
	{
		nDuration = nDuration *2;	//Duration is +100%
	}
    //Create the object at the location so that the objects scripts will start working.
    JXApplyAreaEffectAtLocation(AOE_PER_FOGFIRE, lTarget, RoundsToSeconds(nDuration));

	JXPostSpellCastCode();
}
