// Town 48: The First Level
begintownscript;

variables;

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

body;

beginstate INIT_STATE;
	set_crime_tolerance(2);
	
	set_name(6,"Siisufoss");
	set_name(7,"Thantaloss");
	set_name(8,"Ikhthioss");
	set_character_pose(8,14);
	
	change_blocked(9,54,1);
	change_blocked(10,54,1);
	change_blocked(11,54,1);
	change_blocked(9,55,1);
	change_blocked(10,55,1);
	change_blocked(11,55,1);
	change_blocked(9,56,1);
	change_blocked(10,56,1);
	change_blocked(11,56,1);
	
	change_blocked(40,3,1);
	change_blocked(40,4,1);
	change_blocked(40,5,1);
	change_blocked(41,3,1);
	change_blocked(41,4,1);
	change_blocked(41,5,1);
	change_blocked(42,3,1);
	change_blocked(42,4,1);
	change_blocked(42,5,1);
	
	if (get_flag(48,0) == 0) {
		force_instant_terrain_redraw();
		reset_dialog();
		add_dialog_str(0,"The moment you step through the portal, you enter a blasted, dead landscape. Nothing grows here. The ground itself looks charred, blackened, obliterated. Phaedra whistles.",0);
		add_dialog_str(1,"To the north, you see a slith trying to push a large boulder up a hill. He looks exhausted. He must have been doing this for a long time.",0);
		add_dialog_str(2,"To the northeast, you see a slith standing on water, liquid water, but not sinking in it. He reaches down hopelessly for the water, but he cannot break the surface. To the southeast, you see a slith chained to a wheel of fire.",0);
		add_dialog_str(3,"These must be the torments of the damned. Perhaps one of them could tell you where you are likely to find Legare's spirit. You can also see two portals, one to the north and one to the southwest, from which it may be possible to leave this place.",0);
		set_flag(48,0,run_dialog(1));
		}
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;
if (get_flag(48,2) == 1)
	end();

	reset_dialog();
	add_dialog_str(0,"There is a large, wooden wheel here, with a long length of iron chain wrapped around it several times. The chain then goes from the wheel into a hole in the groun. The wheel is spinning very quickly.",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Try to stop the wheel.");
	if (run_dialog(1) == 2) {
		reset_dialog();
		add_dialog_str(0,"You try to stop the wheel from moving, but you do not have the strength. You grab it repeatedly and try to shove it, but nothing works. You grab a clod of dirt and try to stuff it in the mechanism, but it just tears through the dirt and sprays it out.",0);
		add_dialog_str(1,"You turn to Ikhthioss, and he seems to acknowledge that you can do nothing. _It is useless,_ he says.",0);
		add_dialog_str(2,"_Do not worry. You have attempted to show pity upon a damned soul. That alone eases my suffering. But one cannot defeat Fate._",0);
		set_flag(48,2,run_dialog(1));
		}
break;

beginstate 11;
	reset_dialog_preset_options(3);
	if (run_dialog(1) == 2) {
		if (get_flag(48,4) == 0)
			if (get_flag(48,1) == 1)
				if (get_flag(48,2) == 1)
					if (get_flag(48,3) == 1) {
						reset_dialog();
						add_dialog_str(0,"You begin to depart from this level filled with the tortures of the damned, but then you hear a soft, sweet, sibilant voice speaking, and you pull up short.",0);
						add_dialog_str(1,"_You have attempted to ease the suffering of the tormented,_ it says. _You have shown mercy and compassion in a place where none exists. For this, you shall be rewarded._",0);
						add_dialog_str(2,"The voice begins explaining, in careful, simple terms, how to cast a powerful spell that blocks out a small area from magical interference for a brief while.",0);
						add_dialog_str(3,"(You learn a level of Anti-Magic Field.)",0);
						set_flag(48,4,run_dialog(1));
						set_flag(292,9,1);
						set_flag(292,0,1);
						}
		move_to_new_town(49,44,42);
		}
	else
		block_entry(1);
break;

beginstate 12;
	reset_dialog_preset_options(3);
	if (run_dialog(1) == 2) {
		if (get_flag(48,4) == 0)
			if (get_flag(48,1) == 1)
				if (get_flag(48,2) == 1)
					if (get_flag(48,3) == 1) {
						reset_dialog();
						add_dialog_str(0,"You begin to depart from this level filled with the tortures of the damned, but then you hear a soft, sweet, sibilant voice speaking, and you pull up short.",0);
						add_dialog_str(1,"_You have attempted to ease the suffering of the tormented,_ it says. _You have shown mercy and compassion in a place where none exists. For this, you shall be rewarded._",0);
						add_dialog_str(2,"The voice begins explaining, in careful, simple terms, how to cast a powerful spell that blocks out a small area from magical interference for a brief while.",0);
						add_dialog_str(3,"(You learn a level of Anti-Magic Field.)",0);
						set_flag(48,4,run_dialog(1));
						set_flag(292,9,1);
						set_flag(292,0,1);
						}
		move_to_new_town(54,59,60);
		}
	else
		block_entry(1);
break;