begintownscript;

variables;
short choice;

body;

beginstate INIT_STATE;
	if(get_flag(3,1) > 0)
		activate_hidden_group(3);

	if(get_flag(3,20) == 5)
		swap_terrain(18,14,377,378);

	if(get_flag(3,5) == 1)
		set_terrain(20,6,248);

	if(get_flag(11,8) == 1)
		set_terrain(11,8,0);
	if(get_flag(13,8) == 1)
		set_terrain(13,8,0);
	if(get_flag(13,9) == 1)
		set_terrain(13,9,0);
	if(get_flag(13,18) == 1)
		set_terrain(13,18,0);
	if(get_flag(19,19) == 1)
		set_terrain(19,19,0);
	if(get_flag(20,18) == 1)
		set_terrain(20,18,0);
	if(get_flag(23,8) == 1)
		set_terrain(23,8,0);

	if(get_ran(1,1,100) > 70)
		text_bubble_on_char(20,"ooOOOooo...");
	if(get_ran(1,1,100) > 70)
		text_bubble_on_char(20,"I'm a ghoOOst...");
	if(get_ran(1,1,100) == 1)
		text_bubble_on_char(20,"I fucked your mother...");

	if(get_flag(3,1) < 4){
		if(get_ran(1,1,100) > 70)
			text_bubble_on_char(6,"Do you require assistance?");
		if(get_ran(1,1,100) > 70)
			text_bubble_on_char(6,"May I be of service?");
			}
break;

beginstate START_STATE;
break;

beginstate EXIT_STATE;
break;

beginstate 10;
	if(get_flag(3,0) == 0){
		message_dialog("You step into the Necromancer's evil tower, which is scary.  Three doors lead to your destination or possibly your doom.","");
		set_flag(3,0,1);
		}
break;

beginstate 11;
	if(get_flag(3,1) == 0){
		message_dialog("As you step into the tower's center chamber, you hear a sudden fluttering of wings.  You cringe at the thought of what unspeakable horrors might be approaching, but your fears are quickly allayed.","The comical creature lands opposite the lava pool, staring at you inquisitively.  It does not appear hostile or tasty to eat, so you decide to leave it alone.");
		activate_hidden_group(3);
		set_flag(3,1,1);
		}
break;

beginstate 12;
	if(get_flag(3,2) == 0){
		message_dialog("Suddenly, a group of figures arise from the pile of bones.","");
		activate_hidden_group(2);
		set_flag(3,2,1);
		}
break;

beginstate 13;
	if(get_flag(3,3) == 0){
		message_dialog("Suddenly, a group of figures arise from the pile of bones.","");
		activate_hidden_group(1);
		set_flag(3,3,1);
		}
break;

beginstate 14;
	if(get_flag(3,4) == 0){
		message_dialog("This hallway is particularly empty, save for a lone door.  You begin to feel uneasy, at least, less at ease than you would normally be in an evil tower full of undead.","There is something super scary behind this door - so much so that not even the walking dead dare wander back here.");
		set_flag(3,4,1);
		}
break;

beginstate 15;
	if(get_flag(3,5) == 0){
		reset_dialog();
		add_dialog_str(0,"The average humanoid experiences five senses, and the contents of this black cauldron are offensive to six of them.  Strangely, you suddenly remember that you're very hungry.",0);
		add_dialog_str(1,"Considering that there's no other food around, it might be worth your while to sample the unidentifiable sludge.",0);
		add_dialog_str(2,"Om nom nom?",0);
		add_dialog_choice(0,"No, I have no sense of adventure and I like being hungry.");
		add_dialog_choice(1,"Nom!");
		choice = run_dialog(1);

		if(choice == 2){
			message_dialog("The strange substance tastes like troll booger and has the consistency of carpet fuzz, but it kicks your hunger in the nuts.  You feel completely refreshed, albeit slightly constipated.","");
			revive_party();
			set_flag(3,5,1);
			set_terrain(20,6,248);
			end();
			}
		}
	if(get_flag(3,5) == 1)
		print_str("The contents of the cauldron are gone.");
break;

beginstate 30;
	move_to_new_town(4,14,12);
break;

beginstate 31;
	reset_dialog_preset_options(4);
	choice = run_dialog(0);

	if(choice == 2)
		move_to_new_town(2,20,14);
	else
		block_entry(1);
		end();
break;