from toee import *

from utilities import *

def san_use( attachee, triggerer ):

	if (attachee.map == 5138):
		npc = find_npc_near(attachee,8802)
		if (npc != OBJ_HANDLE_NULL):
			npc.turn_towards(triggerer)
			npc.attack(triggerer)
	
	elif (attachee.map == 5139):
			npc = find_npc_near(attachee,14472)
			if (npc != OBJ_HANDLE_NULL):
				npc.turn_towards(triggerer)
				npc.attack(triggerer)
	
	game.new_sid = 0
	return SKIP_DEFAULT

def san_spell_cast( attachee, triggerer, spell ):

	if ( ( spell.spell == spell_knock ) or (spell.spell == spell_open_close) ):
		if (attachee.map == 5138):
			npc = find_npc_near(attachee,8802)
			if (npc != OBJ_HANDLE_NULL):
				npc.turn_towards(triggerer)
				npc.attack(triggerer)
		
		elif (attachee.map == 5139):
			npc = find_npc_near(attachee,14472)
			if (npc != OBJ_HANDLE_NULL):
				npc.turn_towards(triggerer)
				npc.attack(triggerer)
		
	return RUN_DEFAULT
