//::///////////////////////////////////////////////
//:: Dirge
//:: x0_s0_dirge.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    All creatures within the AoE take 2 points of Strength
    and Dexterity ability score damage.
    Lasts 1 round/level
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: July 2002
//:://////////////////////////////////////////////

#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 Area of Effect Object
    int nDuration = JXGetCasterLevel(OBJECT_SELF);
    int nMetaMagic = JXGetMetaMagicFeat();
    //effect eImpact = EffectVisualEffect(257);	// NWN1 VFX
    //effect eCaster = EffectVisualEffect(VFX_DUR_BARD_SONG);	// NWN1 VFX

    //effect eFNF = EffectVisualEffect(VFX_FNF_SOUND_BURST);	// NWN1 VFX
    //Apply the FNF to the spell location
    //JXApplyEffectAtLocation(DURATION_TYPE_INSTANT,eFNF, GetLocation(OBJECT_SELF));	// NWN1 VFX

    
    //JXApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, GetLocation(OBJECT_SELF));	// NWN1 VFX; this is now handled in spells.2da
    //Make sure duration does no equal 0
    if (nDuration < 1)
    {
        nDuration = 1;
    }
    //Check Extend metamagic feat.
    if (nMetaMagic & METAMAGIC_EXTEND)
    {
	   nDuration = nDuration *2;	//Duration is +100%
    }
    //Create an instance of the AOE Object using the Apply Effect function

    //change from AOE_PER_FOGMIND to AOE_MOB_CIRCGOOD
    JXApplyAreaEffectToObject(AOE_MOB_CIRCGOOD, OBJECT_SELF, RoundsToSeconds(nDuration), "x0_s0_dirgeEN", "x0_s0_dirgeHB", "x0_s0_dirgeEX");

	JXPostSpellCastCode();
}

