//::///////////////////////////////////////////////
//:: Cow Drop
//:: shaz_sp_cowdrop.nss
//:://////////////////////////////////////////////
/*
    Drops a cow on the target, knocking them down
	and causing 2d20 damage.
	This isn't a spell meant to be cast by anyone,
	rather it is cast by a wild surge.
*/
//:://////////////////////////////////////////////
//:: Created By: Ken Cockerham
//:: Created On: 5/25/08
//:://////////////////////////////////////////////

#include "ginc_debug"
#include "ginc_math"
#include "jx_inc_magic"
#include "x2_inc_spellhook" 
#include "shaz_inc_forcewall"

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

	object oTarget = JXGetSpellTargetObject();
	
	SignalEvent(oTarget, EventSpellCastAt(JXGetCaster(), JXGetSpellId()));
	
	effect eDam = EffectDamage(d20(2), DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_PLUS_TWO);
 	effect eKnock = EffectKnockdown();
	//effect eLink = EffectLinkEffects(eKnock, eDam);
	
	JXApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
	JXApplyEffectToObject(DURATION_TYPE_TEMPORARY, eKnock, oTarget, 6.0);
	
	JXPostSpellCastCode();
}