//::///////////////////////////////////////////////
//:: Electric Jolt
//:: [x0_s0_ElecJolt.nss]
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
1d3 points of electrical damage to one target.
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: July 17 2002
//:://////////////////////////////////////////////

#include "X0_I0_SPELLS"
#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
    object oTarget = JXGetSpellTargetObject();
    int nCasterLevel = JXGetCasterLevel(OBJECT_SELF);


    effect eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_S);
	if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
	{
        //Fire cast spell at event for the specified target
        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_ELECTRIC_JOLT));
        //Make SR Check
        if(!MyResistSpell(OBJECT_SELF, oTarget))
        {
            //Set damage effect
            effect eBad = EffectDamage(MaximizeOrEmpower(3, 1, JXGetMetaMagicFeat()), DAMAGE_TYPE_ELECTRICAL);
            //Apply the VFX impact and damage effect
            JXApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
            JXApplyEffectToObject(DURATION_TYPE_INSTANT, eBad, oTarget);
        }
    }

	JXPostSpellCastCode();
}





