begintownscript;

variables;
short i,choice;

body;

beginstate INIT_STATE;

	i = 6;

	set_name(35,"Taskmaster Hurp");
	set_name(68,"Taskmaster Hurp");

	add_range_to_group(6,37,1);
	add_char_to_group(68,1);
break;

beginstate START_STATE;
	if(get_flag(0,0) == 0){
		message_dialog("You're cold so you stand around the firepit, but then a troglodyte guard comes over and tells you that the Taskmaster wants to see you.","");
		set_flag(0,0,1);
		}

	if(get_flag(0,2) < 4){
		while(i < 64){
			if(get_attitude(i) == 10){
				message_dialog("Troglodytes don't like being touched.","");
				kill_char(1000,2,0);
				}
			i = i + 1;
			}
		i = 6;
		}

	if(get_flag(0,2) == 3){
		message_dialog("And then, the last one dies.  The Taskmaster claps his hands together, grinning from ear to ear.","_YOU WIN, DON'T DIE Y- EURRAGGG- YET!_");
		award_party_xp(150,1);

		force_view_center(20,24);
		force_instant_terrain_redraw();

		put_boom_on_space(18,26,1,1);
		put_boom_on_space(18,25,1,1);
		put_boom_on_space(18,24,1,1);
		put_boom_on_space(18,23,1,1);
		put_boom_on_space(18,22,1,1);
		run_animation_sound(-152);

		text_bubble_on_char(68,"AHHHHHH!");
		force_instant_terrain_redraw();

		set_terrain(17,26,40);
		set_terrain(17,25,0);
		set_terrain(17,24,0);
		set_terrain(17,23,0);
		set_terrain(17,22,38);

		set_terrain(18,26,137);
		set_terrain(18,25,137);
		set_terrain(18,24,137);
		set_terrain(18,23,137);
		set_terrain(18,22,137);

		set_terrain(19,27,113);
		set_terrain(19,26,106);
		set_terrain(19,25,106);
		set_terrain(19,24,106);
		set_terrain(19,23,106);
		set_terrain(19,22,106);
		set_terrain(19,21,107);

		set_terrain(20,27,113);
		set_terrain(20,26,106);
		set_terrain(20,25,106);
		set_terrain(20,24,106);
		set_terrain(20,23,106);
		set_terrain(20,22,106);
		set_terrain(20,21,107);

		kill_char(10,2,0);
		kill_char(11,2,0);
		kill_char(13,2,0);
		kill_char(14,2,0);
		kill_char(23,2,0);

		text_bubble_on_char(68,"");
		force_instant_terrain_redraw();
		kill_char(68,2,0);

		set_terrain(22,25,125);

		play_sound(-40);
		large_draw_pic_dialog(302,"RAUGHAGUUARRRRRRR!");

		message_dialog("Oh no, the undead are here!  Time to run.","");

		toggle_quest(1,1);

		activate_hidden_group(1);

		set_attitude(6,10);
		set_attitude(7,10);
		set_attitude(8,10);
		set_attitude(9,10);
		set_attitude(10,10);
		set_attitude(11,10);
		set_attitude(12,10);
		set_attitude(13,10);
		set_attitude(14,10);
		set_attitude(15,10);
		set_attitude(16,10);
		set_attitude(17,10);
		set_attitude(18,10);
		set_attitude(19,10);
		set_attitude(20,10);
		set_attitude(21,10);
		set_attitude(22,10);
		set_attitude(23,10);
		set_attitude(24,10);
		set_attitude(25,10);
		set_attitude(26,10);
		set_attitude(27,10);
		set_attitude(28,10);
		set_attitude(29,10);
		set_attitude(30,10);
		set_attitude(31,10);
		set_attitude(32,10);
		set_attitude(33,10);
		set_attitude(34,10);
		set_attitude(35,10);
		set_attitude(36,10);
		set_attitude(37,10);
		set_attitude(68,10);

		force_view_center(char_loc_x(0),char_loc_y(0));
		force_instant_terrain_redraw();

		set_flag(0,2,4);
		}
break;

beginstate EXIT_STATE;
break;

beginstate 10;
	if(get_flag(0,0) <= 1){
		message_dialog("You aren't allowed back here without permission.  Go any further and the guards will never stop killing you.","");
		block_entry(1);
		}
		else{
			if(get_flag(0,1) < 2)
				set_flag(0,1,1);
			}
break;

beginstate 11;
	if(get_flag(0,1) <= 1){
		message_dialog("You aren't allowed back here without permission.  Go any further and the guards will never stop killing you.","");
		block_entry(1);
		}
break;

beginstate 12;
	if(get_flag(0,1) == 2){
		force_view_center(24,30);
		march_party(24,30);
		force_instant_terrain_redraw();
		play_sound(-50);
		pause(6);

		force_view_center(24,29);
		march_party(24,29);
		force_instant_terrain_redraw();
		play_sound(-49);
		pause(6);

		force_view_center(24,28);
		march_party(24,28);
		force_instant_terrain_redraw();
		play_sound(-50);
		pause(6);

		force_view_center(24,27);
		march_party(24,27);
		force_instant_terrain_redraw();
		play_sound(-49);
		pause(6);

		force_view_center(24,26);
		march_party(24,26);
		force_instant_terrain_redraw();
		play_sound(-50);
		pause(18);

		message_dialog("You stand at the bottom of a pit, surrounded by stands of chairs, complete with sitting troglodytes.  Blood and bodies litter the floor.","A group of rough looking individuals stare at you from across the fire.  From the sidelines, Taskmaster Hurp glares at you eagerly.");

		play_sound(-48);
		large_draw_pic_dialog(301,"THIS HERE'S THE GLADIATOR PITS, YOU GOTTA- ERRAAAUGUGGHGHH- YOU GOTTA FI- TUURRAGGAGG- FIGHT!");

		message_dialog("Amidst a wave of roars and cheers, the opposite group charges you.","");

		block_entry(1);
		set_flag(0,1,3);
		}
			else{
				print_str("Can't go back!");
				block_entry(1);
				}
break;

beginstate 13;
	if(get_flag(0,2) != 4){
		print_str("Can't run away!");
		block_entry(1);
		}
break;

beginstate 20;
	if(is_combat() == TRUE){
		print_str("Can't leave while in combat.");
		block_entry(1);
		}
		else{
			move_to_new_town(1,4,26);
			}
break;