// TOWN SPECIAL ENCOUNTERS
//    Town 112: Battle Pit

beginzonescript;

variables;

short im_hostile = 0;
short max_crime = 200;
short last_abil;
short counter = 0;
short set_ter = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

//	set_name(,);
//	add_range_to_group(,,groupn);

	counter = gf(112,0);

	set_crime_tolerance(max_crime);

	break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	set_attack_bonus(30001,5 + (5 * difficulty()));
	
	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 2))) {
		last_abil = get_current_tick();
		
		if (gf(112,0) > 0) {
			inc_flag(112,0,-1);
			
			if (gf(112,0) == counter - 2)
				ok_dlog(34,2);
			
			if (gf(112,0) == counter - 3) {
				activate_hidden_group(1);
				set_name(30001,"Arena Hellhound");
				set_level(30001,28);
				change_max_health(30001,100);
				ok_dlog(24,1);
				}
			if (gf(112,0) == counter - 9) {
				activate_hidden_group(2);
				set_name(30002,"Arena Gazer");
				set_level(30002,28);
				change_max_health(30002,100);
				ok_dlog(26,1);
				}
			if (gf(112,0) == counter - 15) {
				activate_hidden_group(3);
				set_name(30003,"Arena Quickghast");
				set_level(30003,28);
				change_max_health(30003,100);
				ok_dlog(28,1);
				}
			if (gf(112,0) == counter - 21) {
				activate_hidden_group(4);
				set_name(30004,"Arena Mutant");
				set_level(30004,28);
				change_max_health(30004,100);
				ok_dlog(30,1);
				}
			if (gf(112,0) == counter - 27) {
				activate_hidden_group(5);
				set_name(30005,"Arena Construct");
				set_level(30005,28);
				change_max_health(30005,100);

				set_name(11231,"Infernal Commander");
				set_level(11231,30);
				set_boss_level(11231,1);
	
				ok_dlog(32,1);
				}
				
			if (gf(112,0) == 1) {
				set_terrain(0,31,40,0);
				set_terrain(0,32,40,0);
				set_terrain(0,33,40,0);
				ok_dlog(37,1);
				}
			}
		}

break;

beginstate 10;
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

beginstate 14;
break;

//	print_str("");
//	set_terrain_string_range("",1);
//	set_terrain_string_range("The sign says - .",1);

