from toee import *

def OnBeginSpellCast( spell ):
	print "Death Ward OnBeginSpellCast"
	print "spell.target_list=", spell.target_list
	print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
	game.particles( "sp-necromancy-conjure", spell.caster )

def	OnSpellEffect ( spell ):
	print "Death Ward OnSpellEffect"

#	Dar's level check no longer needed thanks to Spellslinger's dll fix
#	if spell.caster_class == 13: #added to check for proper paladin slot level (darmagon)
#		if spell.spell_level < 4:
#			spell.caster.float_mesfile_line('mes\\spell.mes', 16008)
#			return

	spell.duration = 10 * spell.caster_level

	npc = spell.caster			##  added so NPC's can pre-buff
	if npc.type != obj_t_pc and npc.leader_get() == OBJ_HANDLE_NULL and not game.combat_is_active():
		spell.duration = 2000 * spell.caster_level

	target = spell.target_list[0]

	target.obj.condition_add_with_args( 'sp-Death Ward', spell.id, spell.duration, 0 )
	target.partsys_id = game.particles( 'sp-Death Ward', target.obj )

def OnBeginRound( spell ):
	print "Death Ward OnBeginRound"

def OnEndSpellCast( spell ):
	print "Death Ward OnEndSpellCast"