// Town 40: Legare's Camp
begintownscript;

variables;

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

body;

beginstate INIT_STATE;
	set_crime_tolerance(2);
	
	if (get_flag(40,0) == 0) {
		force_instant_terrain_redraw();
		set_flag(40,0,1);
		message_dialog("You approach Legare's camp. You can see him in the distance, standing calmly, staring into a fire. He doesn't seem to notice as you are approaching, and although you call out to him, he makes no response.","He must be deep in thought.");
		}
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;
	reset_dialog();
	add_dialog_str(0,"Legare sits in this grove, still silently staring into the fire. What do you do?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Approach him.");
	if (run_dialog(1) == 1) {
		block_entry(1);
		end();
		}
	
	i = 0;
	while (char_ok(i) == 0)
		{i = i + 1; }
	
	march_party(17,12);
	force_view_center(17,12);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(17,11);
	force_view_center(17,11);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(17,10);
	force_view_center(17,10);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(17,9);
	force_view_center(17,9);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(17,8);
	force_view_center(17,8);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(17,7);
	force_view_center(17,7);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(17,6);
	force_view_center(17,6);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	text_bubble_on_char(6,"You have come.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(i,"Yes.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(i,"");
	text_bubble_on_char(6,"Do you believe?");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	force_instant_terrain_redraw();
	
	reset_dialog();
	add_dialog_str(0,"His eyes do not move from the fire. They stare, as if the waltz of the flames could unlock the secrets of the universe and heal the tear in his soul.",0);
	add_dialog_str(1,"You've learned much about the other members of this expedition, but you've hardly had the chance to speak with the one responsible for all of this. Legare's motivations have always seemed transparent: he wants redemption.",0);
	add_dialog_str(2,"The exile, for him as for all Bahssikavans, is a constant reminder of the sins of his ancestors. It is a wound always festering with poison, an agony so terrible that he would do anything to end the pain.",0);
	add_dialog_str(3,"Anything? Even invent a goddess and lie to everyone about his experiences in hiding for twenty years? It seems farfetched, but a desperate man might do a lot of things.",0);
	add_dialog_str(4,"His question hangs in the air. What do you say?",0);
	add_dialog_choice(0,"I'm not really sure.");
	add_dialog_choice(1,"Yes, I have faith.");
	add_dialog_choice(2,"No, I don't believe.");
	choice = run_dialog(1);
	if (choice == 1) {
		text_bubble_on_char(6,"Not sure.");
		force_instant_terrain_redraw();
		pause(get_flag(290,0) * 5);
		
		text_bubble_on_char(6,"");
		text_bubble_on_char(6,"After all you have seen,");
		force_instant_terrain_redraw();
		pause(get_flag(290,0) * 5);
		
		text_bubble_on_char(6,"");
		text_bubble_on_char(6,"you cannot at least bear witness.");
		force_instant_terrain_redraw();
		pause(get_flag(290,0) * 5);
		}
	if (choice == 2) {
		text_bubble_on_char(6,"I appreciate your reply,");
		force_instant_terrain_redraw();
		pause(get_flag(290,0) * 5);
		
		text_bubble_on_char(6,"");
		text_bubble_on_char(6,"though I doubt your sincerity.");
		force_instant_terrain_redraw();
		pause(get_flag(290,0) * 5);
		
		text_bubble_on_char(6,"");
		text_bubble_on_char(6,"Few on this expedition truly believe.");
		force_instant_terrain_redraw();
		pause(get_flag(290,0) * 5);
		}
	if (choice == 3) {
		text_bubble_on_char(6,"You are honest, at least.");
		force_instant_terrain_redraw();
		pause(get_flag(290,0) * 5);
		
		text_bubble_on_char(6,"");
		text_bubble_on_char(6,"I cannot fault you for that.");
		force_instant_terrain_redraw();
		pause(get_flag(290,0) * 5);
		}
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"Do you know what I have been doing?");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	force_instant_terrain_redraw();
	
	reset_dialog();
	add_dialog_str(0,"You shake your head. Seeing your response, he continues, _I have been communicating with the Goddess. I have been questioning. Yes, questioning! I have been asking her the same questions that I have been asked._",0);
	add_dialog_str(1,"He sighs, still staring into the fire. _Why has no one else seen you? Why do you not tell me anything about yourself? I do no even know the proper way to worship you. You tell me only that faith in you will lead us home._",0);
	add_dialog_str(2,"His voice, always strong, always resonant, billows now in challenge to the licks of the flames.",0);
	run_dialog(1);
	
	text_bubble_on_char(6,"WHO ARE YOU?");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"WHAT DO YOU WANT FROM ME?");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"SPEAK TO ME!");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	force_instant_terrain_redraw();
	
	message_dialog("Legare's cry fades out into the mountains. It seems as though the empty beyond pays no heed to his demands, and his shoulders slump.","Then suddenly the answer comes!");
	
	play_sound(162);
	
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	run_animation_sound(-51);
	
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_jagged_zap(16,4,2,25,0);
	put_jagged_zap(16,4,0,1,0);
	put_jagged_zap(16,4,9,26,0);
	put_jagged_zap(16,4,23,26,0);
	put_jagged_zap(16,4,30,16,0);
	put_jagged_zap(16,4,31,1,0);
	run_animation_sound(-51);
	
	// create rubble from (6,1) to (26,14)
	j = 6;
	while (j <= 24) {
		k = 1;
		while (k <= 9) {
			set_terrain(j,get_ran(1,1,14),136 + get_ran(1,1,2));
			k = k + 1;
			}
		j = j + 1;
		}
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_boom_on_space(22,9,1,2);
	put_boom_on_space(24,6,1,2);
	put_boom_on_space(23,3,1,2);
	put_boom_on_space(19,11,1,2);
	put_boom_on_space(14,12,1,2);
	put_boom_on_space(11,8,1,2);
	put_boom_on_space(10,6,1,2);
	put_boom_on_space(10,3,1,2);
	put_jagged_zap(16,4,2,27,0);
	put_jagged_zap(16,4,0,2,0);
	put_jagged_zap(16,4,11,26,0);
	put_jagged_zap(16,4,25,26,0);
	put_jagged_zap(16,4,30,14,0);
	put_jagged_zap(16,4,27,0,0);
	run_animation_sound(51);
	
	reset_dialog();
	add_dialog_str(0,"You stand, still reeling from the onslaught, while realizing that Legare has not twitched. Not a motion, nor a blink. He still stares into the flames, his challenge remaining.",0);
	add_dialog_str(1,"The mountain could be torn from its roots and upended, and the whole cave could be blown apart in an ecstasy of blood and fire, as the demon-worshippers dream, and the shield of Legare's faith would protect him yet.",0);
	add_dialog_str(2,"And then, before you can even collect yourself, a soft, feminine, sibilant voice begins speaking. You hear the voice of the Goddess for the first time, and all moves beyond questions of faith. Now you know.",0);
	
	activate_hidden_group(1);
	text_bubble_on_char(7,"I understand your questions, Legare.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	text_bubble_on_char(7,"I am not without compassion,");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	text_bubble_on_char(7,"nor am I without empathy.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	force_instant_terrain_redraw();
	
	message_dialog("There was an odd tone in that last sentence. Something about what the Goddess was saying struck a chord within her. You feel as though you know what it is, but before you can think it through, she resumes speaking.","");
	
	text_bubble_on_char(7,"Come, Legare,");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	text_bubble_on_char(7,"let us turn DOUBTERS into BELIEVERS!");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	force_instant_terrain_redraw();
	
	set_flag(40,1,1);
	move_to_new_town(29,25,8);
	
break;