// TOWN SCRIPT
//    Town 15: Westmirror

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

short i,j,k,r1,choice;

body;

beginstate INIT_STATE;
// This state called whenever this town is entered.
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// This state is called every turn the party is in this town.
break;

beginstate 10;
	reset_dialog();
	add_dialog_str(0,"Space contorts between the two great stones. Vision is blurred. There seems to be a force drawing you inward...",0);
	add_dialog_choice(0,"OK.");
	add_dialog_choice(1,"Enter.");
	choice = run_dialog(1);
	if (choice == 2)
		set_state_continue(12);
	set_state_continue(11);
break;

beginstate 11;
	block_entry(1);
break;

beginstate 12;
	block_entry(1);
		move_to_new_town(23,5,57);
		end();
break;

beginstate 13;
	if (get_flag(100,0) == 16)
		set_state_continue(16);
	set_state_continue(14);
break;

beginstate 14;
	reset_dialog();
	add_dialog_str(0,"You pass between the two stones. Nothing immediate happens.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
break;

beginstate 15;
	if (is_combat()) {
	block_entry(1);
	end();
	}
	set_state_continue(13);
break;

beginstate 16;
	if (has_special_item(4) > 0)
		set_state_continue(17);
	set_state_continue(10);
break;

beginstate 17;
	reset_dialog();
	add_dialog_str(0,"You attempt to approach the gate again. The obsidian orb pulses powerfully, driving you back, forbidding you from entering it again.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
	block_entry(1);
break;

