from utilities import *

from toee import *

def san_enter_combat( attachee, triggerer ):
	return RUN_DEFAULT

def san_start_combat( attachee, triggerer ):
	return RUN_DEFAULT

def san_will_kos( attachee, triggerer ):
	if (game.global_flags[840] == 1 and attachee.map == 5065):
		return SKIP_DEFAULT
	return RUN_DEFAULT

def san_first_heartbeat( attachee, triggerer ):
#	if (attachee.leader_get() == OBJ_HANDLE_NULL and not game.combat_is_active()):
	game.global_vars[717] = 0
	return RUN_DEFAULT

def san_heartbeat( attachee, triggerer ):
#	if (game.global_vars[717] == 0 and attachee.leader_get() == OBJ_HANDLE_NULL and not game.combat_is_active()):
#		attachee.cast_spell(spell_mage_armor, attachee)
#		attachee.spells_pending_to_memorized()
#	if (game.global_vars[717] == 4 and attachee.leader_get() == OBJ_HANDLE_NULL and not game.combat_is_active()):
#		attachee.cast_spell(spell_see_invisibility, attachee)
#		attachee.spells_pending_to_memorized()
#		for obj in game.obj_list_vicinity(attachee.location,OLC_CRITTERS):
#			if (obj.name == 14425 and attachee.map == 5065):
#				obj.cast_spell(spell_endure_elements, obj)
#				obj.spells_pending_to_memorized()
#	if (game.global_vars[717] == 8 and attachee.leader_get() == OBJ_HANDLE_NULL and not game.combat_is_active()):
#		for obj in game.obj_list_vicinity(attachee.location,OLC_CRITTERS):
#			if (obj.name == 14425 and attachee.map == 5065):
#				obj.cast_spell(spell_cats_grace, obj)
#				obj.spells_pending_to_memorized()
#		attachee.cast_spell(spell_protection_from_arrows, attachee)
#		attachee.spells_pending_to_memorized()
#	if (game.global_vars[717] == 12 and attachee.leader_get() == OBJ_HANDLE_NULL and not game.combat_is_active()):
#		attachee.cast_spell(spell_eagles_splendor, attachee)
#		attachee.spells_pending_to_memorized()
#		for obj in game.obj_list_vicinity(attachee.location,OLC_CRITTERS):
#			if (obj.name == 14425 and attachee.map == 5065):
#				obj.cast_spell(spell_owls_wisdom, obj)
#				obj.spells_pending_to_memorized()
#	game.global_vars[717] = game.global_vars[717] + 1
	return RUN_DEFAULT

