from utilities import *
from toee import *

def san_heartbeat( attachee, triggerer ):
	if (attachee.map == 5001):
#		game.global_vars[702] = 0
#		mycr = game.obj_create( 14500, location_from_axis (694L, 512L) )
#		mycr.move(location_from_axis(703, 520))
#		arrows = game.obj_create( 5004, location_from_axis (552L, 356L) )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (641L, 387L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (714L, 381L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (573L, 424L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (617L, 460L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (592L, 485L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (454L, 442L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (472L, 313L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (418L, 378L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		if (game.random_range(1,3) == 1):
#			barrel = game.obj_create( 1049, location_from_axis (364L, 406L) )
#			if (game.random_range(1,3) <= 2):
#				create_item_in_inventory( 5007, barrel )
#		game.global_vars[766] = game.random_range(1,20)
		attachee.destroy()
	if (attachee.map == 5080):
		attachee.destroy()
#		game.global_vars[707] = game.global_vars[707] + 1
#	if (attachee.map == 5080 and game.global_vars[707] >= 3 and game.global_flags[820] == 0):
#		game.global_vars[707] = 0
#		game.particles( 'sp-Call Lightning', attachee )
#		for obj in game.obj_list_vicinity( attachee.location, OLC_CRITTERS ):
#			if (obj.distance_to(attachee) <= 12 and obj.name != attachee.name and obj.name != 14605):
#				game.particles( 'sp-Shocking Grasp', obj )
#				if (obj.stat_level_get( stat_hp_current ) >= -9):
#					loc = obj.location
#					loc = loc - 1
#					obj.turn_towards(loc)
#					for chest in game.obj_list_vicinity(attachee.location,OLC_CONTAINER):
#						if (chest.name == 1055):
#							if (obj.has_los(chest)):	
#								obj.turn_towards(chest)
#					obj.begin_dialog(attachee,1)
#					obj.condition_add_with_args( 'sp-Hold Person', 0, 1, 0 )
#					obj.condition_add_with_args( 'prone', 0, 0)
#					damage_dice = dice_new( '15d4' )
#					if (obj.name == 8035):
#						damage_dice = dice_new('5d4')
#					if obj.reflex_save_and_damage( OBJ_HANDLE_NULL, 20, D20_Save_Reduction_Half, D20STD_F_NONE, damage_dice, D20DT_ELECTRICITY, D20DAP_UNSPECIFIED, 0 , D20DAP_NORMAL ):
#						saving throw successful
#						obj.float_mesfile_line( 'mes\\spell.mes', 30001 )
#					else:
#						saving throw unsuccessful
#						obj.float_mesfile_line( 'mes\\spell.mes', 30002 )
#					obj.damage( OBJ_HANDLE_NULL, D20DT_ELECTRICITY, damage_dice, D20DAP_NORMAL)

	return RUN_DEFAULT

