// .txt

beginzonescript;

variables;

short im_hostile = 0;
short max_crime = 4;
short last_abil;
short counter = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_name(14256,"Experimental Slime");
	set_level(14256,20);
	set_boss_level(14256,1);
	
	set_name(14262,"Infernal Sentinel");
	set_level(14262,35);
	set_attack_bonus(14262,50);
	set_boss_level(14262,1);
	set_new_abil(14262,14);
	set_strategy(14262,0);
	alter_stat(14262,29,10);
	
	set_name(14263,"Cave Basilisk");
	set_level(14263,17);
	set_boss_level(14263,1);
	set_attack_bonus(14263,10);

	set_name(14264,"Castle Sentinel");
	set_level(14264,35);
	set_boss_level(14264,1);
	set_new_abil(14264,13);
	set_name(14265,"Castle Sentinel");
	set_level(14265,35);
	set_boss_level(14265,1);
	set_new_abil(14265,14);
	
	set_name(14266,"Commander Meryhew");
	set_name(14267,"Levitt");
	set_name(14268,"King Starrus");
	set_name(14269,"Correlea");
	set_name(14270,"Ghall-Ihrno");
	set_name(14271,"Lark");
	set_name(14272,"Ssem'Ess");
	set_name(14273,"Sage Asta");
	set_name(14274,"Kanox");
	set_name(14275,"Jasmine");
	if (gf(132,22) > 1)
		erase_char(14275);
	if (gf(110,1) > 0)
		erase_char(14275);
	set_name(14276,"Avernite Bureaucrat");
	set_name(14277,"Avernite Bureaucrat");
	set_name(14278,"Caravan Driver");
	set_name(14279,"Caravan Driver");
	set_name(14280,"Caravan Driver");
	set_name(14281,"Caravan Guard");
	set_name(14282,"Caravan Guard");
	set_name(14283,"Avernite Soldier");
	set_name(14284,"Avernite Soldier");

	add_range_to_group(14285,14291,1);
	set_name(30001,"Avernite Soldier");
	set_combat_activity(30001,2);

	add_range_to_group(14292,14298,2);
	set_name(30002,"Castle Guard");
	set_combat_activity(30002,2);

	add_range_to_group(14299,14307,3);
	set_name(30003,"Avernite Soldier");
	set_combat_activity(30003,2);
	
	add_range_to_group(14308,14312,4);
	set_name(30004,"Royal Guard");
	set_combat_activity(30004,2);

	set_name(14313,"Avernite General");
	set_name(14314,"Avernite General");
	set_name(14315,"Avernite General");

	set_name(14319,"Kitchen Worker");
	set_name(14320,"Kitchen Worker");
	set_name(14321,"Kitchen Worker");

	sf(132,28,0);
	
//	add_range_to_group(,,groupn);

	set_crime_tolerance(max_crime);

	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
		
	if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
		make_zone_hostile(); 
		im_hostile = 1;
		//erase_char(30000);
		begin_talk_mode(349);
		}

	if (gf(170,1) < 16) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14266,"You'll work for me.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14266,"Much to be done.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14266,"There is great danger.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14266,"Do not delay.");
		}
	if ((gf(170,1) >= 16) && (gf(170,1) < 25)) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14266,"Levitt is upstairs.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14266,"You're with Levitt now.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14266,"Don't anger him.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14266,"Where's my new recruits?");
		}
	if (gf(170,1) < 25) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14267,"You'll work for me.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14267,"Chaos must be removed.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14267,"The time for mercy is past.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14267,"Avernum will be sustained.");
		}
	if (gf(170,1) >= 25) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14267,"Go see King Starrus.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14267,"Cough. Cough.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14267,"Cough. Hack.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14267,"Starrus is in the throne room.");
		}
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14268,"We must reopen the portal.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14268,"The Slith Horde is weak.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14268,"The portal is our hope.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14268,"Redirect that army.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14268,"Get word to the colony.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14269,"I can train you.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14269,"You are welcome.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14269,"Beware the cells.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14269,"The portal pylon is here.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14270,"Look in the stone ...");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14270,"Hmmmmmm ...");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14270,"I welcome visitors.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14270,"This is a dark time.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14271,"Not another skull.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14271,"This goes to the army.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14271,"Too dented to use.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14271,"This seems useful.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14271,"Oh, the history!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14272,"I am quartermaster.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14272,"Hsssss.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14272,"You need suppliesss?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14273,"Cursed slimes!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14273,"Aaaah! That burns!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14273,"I need more samples.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14273,"A visitor!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14274,"No more for you.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14274,"Lizard stew is served!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14274,"Be patient!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14274,"One roll. Just one.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14275,"I will be heard.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14275,"We need help!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14275,"When will they help us?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14276 + get_ran(1,0,1),"Pass me a pen.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14276 + get_ran(1,0,1),"Where's those requisitions?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14276 + get_ran(1,0,1),"Request denied.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14278 + get_ran(1,0,4),"More ale here!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14278 + get_ran(1,0,4),"Just one roll?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14278 + get_ran(1,0,4),"Where's my rations!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14278 + get_ran(1,0,4),"The roads are rough.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14283 + get_ran(1,0,1),"Swoosh!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14283 + get_ran(1,0,1),"Thud!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14283 + get_ran(1,0,1),"Thwack!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14313 + get_ran(1,0,2),"We must strike there.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14313 + get_ran(1,0,2),"Protect that flank.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14313 + get_ran(1,0,2),"Send archers there.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14313 + get_ran(1,0,2),"We have more mages?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14313 + get_ran(1,0,2),"This is not good.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14316 + get_ran(1,0,2),"Hssss.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14316 + get_ran(1,0,2),"Sss.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(14316 + get_ran(1,0,2),"Sssss!");

	//if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
	//	last_abil = get_current_tick();
	//	}
break;

beginstate 10;
	if ((gf(170,1) >= 4) && (gf(132,9) == 0)) {
		sf(132,9,1);
		print_str_color("The front gate of the Castle begins to open as you approach.",2);
		}
break;

beginstate 11;
	if (gf(132,9) == 0)
		set_terrain_string_range("The gate into the Castle is closed. As you approach, a guard comes out to question you. Once he learns that you have no orders allowing you to enter, you are turned away.",1);
break;

beginstate 12;
break;

beginstate 13;
break;

beginstate 18 ;
	set_terrain_string_range("The sign says - Portal Pylon. PLEASE LEAVE ARRIVAL PLATFORM CLEAR!",1);
break;

beginstate 19 ;
	set_terrain_string_range("The sign says - Barracks Dining Hall.",1);
break;

beginstate 20;
	set_terrain_string_range("The sign says - THRONE ROOM.",1);
break;

beginstate 21;
	set_terrain_string_range("The sign says - ROYAL CHAMBERS.",1);
break;

beginstate 22;
	set_terrain_string_range("The sign says - CASTLE TREASURY. KEEP OUT!",1);
break;

beginstate 23;
	set_terrain_string_range("The sign says - SECURE CHAMBER. Please don protective gear before entering.",1);
break;

beginstate 24;
	set_terrain_string_range("The sign says - Quartermaster.",1);
break;

beginstate 25;
	set_terrain_string_range("The sign says - Lower Laboratory.",1);
break;


beginstate 26;
	set_terrain_string_range("The sign says - Spymaster.",1);
break;

beginstate 27;
	set_terrain_string_range("The sign says - Barracks. Job Board.",1);
break;

beginstate 28;
	set_terrain_string_range("The sign says - Visitor's Dining Hall.",1);
break;

beginstate 29;
	set_terrain_string_range("The sign says - Artifact Procurement.",1);
break;

beginstate 30;
		if (revive_party()) {
			print_str_color("Entering or leaving the Castle heals your wounds",2);
			print_str_color("  and restores your spell energy.",2);
			}
break;

beginstate 31;
	set_terrain_string_range("The hand-written sign says - Levitt.",1);
break;

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