begintownscript;

variables;
short lever1;
short hana_story;
short rchar;

body;

beginstate 0;
	set_name(31,"T.J. Eckleburg");
	set_name(35,"Receptionist");
	set_char_dialogue_pic(30,540,0);
	set_char_dialogue_pic(31,542,0);
	set_name(27,"Clark");
	set_char_dialogue_pic(27,1945,0);
	set_name(25,"Blade");
	set_char_dialogue_pic(25,1954,0);
	set_name(43,"Jeremy");
	set_char_dialogue_pic(43,546,0);
	if(get_flag(11,0) == 150){
		activate_hidden_group(1);
		erase_char(32);
		erase_char(30);
	}
	if(get_flag(11,0) == 100){
		activate_hidden_group(1);
		erase_char(32);
		erase_char(30);
	}
	if(get_flag(16,0) > 50){
		set_terrain(33,18,30);
		set_terrain(34,18,30);
	}
	set_crime_tolerance(1);
	if(get_flag(20,0) > 125){
		erase_char(37);
	}
break;

beginstate 1;
break;

beginstate START_STATE;
break;

beginstate 13;
reset_dialog_preset_options(2);
lever1 = run_dialog(0);
if (lever1 == 1)
end();
flip_terrain(19,31);
flip_terrain(7,33);
play_sound(106);
play_sound(99);
print_str_color("You hear the sounds of chains and grinding gears.",2);
break;

beginstate 14;
if(get_flag(3,0) == 250){
end();
}
else{
message_dialog("You enter the city of Ashton for the first time.  It's not the largest city you've ever been in, but it's far from the smallest.  On the up-side, there are enough guards here, little poverty, and basic services all provided.","On the down-side, there is little in the way of amenities.  Torches light the streets because the city hasn't built street lamps yet and the marketplace in the center of town is empty.  Nevertheless, for your purposes, Ashton will be fine.");
print_str_color("Your party has 500 gold to spend in town.",2);
change_coins(500);
set_flag(3,0,250);
}
break;

beginstate 15;
if(get_flag(4,0) == 250){
end();
}
else{
message_dialog("Location makes all of the difference.  This marketplace was set up with the intention that merchants would come to this city and trade.  Unfortunately, this has not been the case thus far, and for a simple reason.","Ashton is too far from any major veins of the Imperial Highway.  What this means to you is that traders won't be wasting their time peddling goods here- bad news if you plan on doing any major spending.");
set_flag(4,0,250);
}
break;

beginstate 16;
if(get_flag(5,0) == 250)
end();
message_dialog("You have stumbled upon a small group of malcontents- amazingly enough, even a town as small as Ashton can have ","");
set_flag(5,0,250);
break;

beginstate 17;
if(get_flag(6,0) == 250)
end();
reset_dialog();
	add_dialog_str(0,"You enter the training hall.  A woman is diligently practicing sword maneuvers as you enter.  She turns her head to you and smiles.",0);
	add_dialog_str(1,"_Hello!  It's strange to see adventurers in these parts, but a pleasant surprise nonetheless.  I'm Hana, and in case you didn't read the sign outside, I'm the town's trainer.  Though by the looks of you folks, I'd say you already know this._",0);
	add_dialog_str(2,"_I can train you in arts of combat, and even how to better cast spells.  If you're looking for the spells themself, you'll have to..._  She pauses, breaking out of her practiced diatribe, and begins sobbing.",0);
	add_dialog_str(3,"_Sorry, you'll have to forgive me, it's just..._  You ask her in simple terms what's bothering her.  _Oh, it's just some sob story...  My husband Kurojutsu and I used to live together.  He was the town mage, he sold spells to travelers.  But now..._",0);
	add_dialog_str(4,"_A few weeks ago, he departed from me.  He left without saying goodbye in his sleep.  It's tough going on while feeling like half of a person, but I have to live on if I want to pay the taxes._",0);
	add_dialog_str(5,"_They're coming up soon, and I need all of the help I'm going to get to pay them off, so don't be shy- I'd love your business!  I think I don't have anything to worry about, but every piece helps._",0);
	add_dialog_choice(0,"How sad.");
	hana_story = run_dialog(1);
	message_dialog("Mm, finally!  A trainer.  After you're through working with Hana, you should also go to the nearby inn for a well-earned rest.","");
print_str_color("HINT: Sleep in the inn to make the scenario progress.",2);
set_flag(6,0,250);
break;

beginstate 18;
if(get_flag(11,0) == 150)
	end();
if(get_flag(11,0) == 100)
	end();
if(get_flag(11,0) == 0)
	end();
		if(is_combat() == 1){
			block_entry(1);
			end();
		}
	set_total_visibility(1);
	force_view_center(36,31);
	pause(5);
	relocate_character(32,36,26);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,27);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,28);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,29);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,30);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,31);
	force_instant_terrain_redraw();
	pause(5);

	march_party(34,33);
	text_bubble_on_char(31,"Hello!");
	force_instant_terrain_redraw();
	pause(5);

	march_party(34,32);
	force_instant_terrain_redraw();
	pause(5);

	text_bubble_on_char(31,"How may I help you?");
	force_instant_terrain_redraw();
	pause(10);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(32,"I'm a representative");
	relocate_character(3,35,33);
	set_character_facing(0,6);
	set_character_facing(1,6);
	set_character_facing(2,7);
	set_character_facing(3,0);
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(32,"from the Empire.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(32,"I'm here to collect taxes.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(31,"What do I owe");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(31,"the venerable Tachyon IV?");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(32,"For the year, you owe him");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(32,"1000 gold.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(31,"Okay, hold one one second...");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(31,"Here you go.");
	play_sound(15);
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(32,"Your Emperor, Tachyon IV,");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(32,"thanks you.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	rchar = random_party_member();
	text_bubble_on_char(rchar,"Have you visisted a");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(rchar,"");
	text_bubble_on_char(rchar,"woman named Hana?");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(rchar,"");
	text_bubble_on_char(32,"Hana?  Why, yes.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(rchar,"");
	rchar = random_party_member();
	text_bubble_on_char(rchar,"What happened?");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(rchar,"");
	text_bubble_on_char(32,"She...");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(rchar,"");
	text_bubble_on_char(32,"Look for yourself.");
	force_instant_terrain_redraw();
	pause(15);

	text_bubble_on_char(31,"");
	text_bubble_on_char(32,"");
	text_bubble_on_char(rchar,"");
	relocate_character(32,36,30);
	set_character_facing(32,0);
	text_bubble_on_char(32,"Farewell.");
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,29);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,28);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,27);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,36,26);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,37,25);
	force_instant_terrain_redraw();
	pause(5);

	relocate_character(32,38,24);
	force_instant_terrain_redraw();
	pause(5);

	set_total_visibility(0);
	erase_char(32);
	erase_char(30);
	set_flag(11,0,150);
	block_entry(1);
	force_view_center(34,32);
	message_dialog("That was ominous.","Perhaps you had better check up on Hana to see how she's doing...");
break;

beginstate 19;
if(get_flag(11,0) == 100){
	message_dialog("You walk up to Hana's home, but the guard stops you before you are able to enter.  _Hana has been sent to jail for not paying her taxes._","");
	block_entry(1);
	}
if(get_flag(11,0) == 150){
	message_dialog("You walk up to Hana's home, but the guard stops you before you are able to enter.  _Hana has been sent to jail for not paying her taxes._","Oh no...  You should probably check on her.");
	set_flag(11,0,100);
	set_flag(16,0,50);
	block_entry(1);
	}
break;

beginstate 20;
	if(get_flag(66,2) > 0)
		end();
	message_dialog("As you enter the Thieve's Guild, the members don't attack you, but you certainly aren't given a warm welcome.","Four brigands at a table play a game of cards, while a man- presumably the leader- sits at a table and watches you idly.  You're no genius, but you know when you aren't wanted.");
	set_flag(66,2,1);
break;