// Town 43: Thanopolen
begintownscript;

variables;

short choice,i,j,k;
string dlgstr;

body;

beginstate INIT_STATE;
	set_crime_tolerance(2);
	
	change_blocked(20,32,1);
	change_blocked(21,32,1);
	change_blocked(22,32,1);
	change_blocked(20,31,1);
	change_blocked(21,31,1);
	change_blocked(22,31,1);
	
	set_name(6,"Talas"); // type 112
	char_give_item(7,480); // Divine Armor
	add_range_to_group(12,40,1);
	add_range_to_group(41,47,2);
	
	if (get_flag(43,1) == 1)
		erase_char(6);
	
	if (get_flag(43,0) == 0) {
		force_instant_terrain_redraw();
		set_flag(43,0,1);
		message_dialog("You approach this mighty city on a hill, and you notice something peculiar: unlike the other barbarian slith outposts you've seen, this one is in extremely good repair. The walls, save one patch in the north, are maintained well.","This settlement is different, somehow. Before can absorb that in full, however, you notice that Talas is standing to the south! He looks as though he wishes to speak with you.");
		}
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;
	if (get_flag(43,2) == 0) {
		set_flag(43,2,1);
		message_dialog("You enter the city, and you are struck again by how beautiful the buildings are. They shimmer with a celestial radiance, making you wonder if these barbarian sliths really are like the others that you have encountered.","");
		}
break;

beginstate 11;
	inc_flag(292,14,1);
	set_flag(292,0,1);
	message_dialog("As the magic-user falls, he attempts to summon enough energy to cast his terribly destructive spell one last time, but he fails. Just then, you realize that you have seen him cast that spell enough that you can understand a little of how it works.","(You learn a level of Death Knell.)");
break;

beginstate 12;
	message_dialog("This wheel opens the nearby gate. However, it is too heavy for you to turn, so you leave it alone.","");
break;

beginstate 13;
	if (get_flag(43,3) == 0) {
		set_flag(43,3,1);
		message_dialog("You enter a small, tightly-packed room. This must be a personal home. Or no, not exactly: it houses several sliths. They must be very comfortable with each other, since the beds are packed so closely together.","You can only see a few buildings of this shape in the area, far to few to house the number that must live here. Many of them must live in the main building in the center of town.");
		}
break;

beginstate 14;
	if (get_flag(43,4) == 0) {
		set_flag(43,4,1);
		message_dialog("This appears to be a rear entrance. You can't hear any guards over here, but they can't be far away, presumably at the front end.","");
		}
break;

beginstate 15;
	set_flag(43,4,1);
break;

beginstate 16;
	reset_dialog_preset_options(5);
	if (run_dialog(1) == 2)
		move_to_new_town(44,16,15);
	else
		block_entry(1);
break;

beginstate 17;
	message_dialog("You have committed a terrible crime against the expedition! When this member fails to return from his mission, your dark deed will surely be found out. You may find yourself unwelcome back at camp.","");
	set_flag(290,7,1);
break;

beginstate 18;
	if (get_flag(43,5) == 0) {
		set_flag(43,5,1);
		message_dialog("Before you are water-filled trenches. You at first cannot see their purpose, but as you look in, you notice that they are filled with fish! Judging by the pikes around, the sliths raise fish in these trenches for food.","These sliths may be barbaric and cruel, but they are not stupid. This setup requires careful thought.");
		}
break;