// OUTDOOR SECTION SCRIPT
//    Section: X = 0, Y = 4: River Fork

beginoutdoorscript;

variables;

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

body;

beginstate INIT_STATE;
// This state called whenever this section is loaded into memory.
break;

beginstate START_STATE;
// Starting state of the section, called every turn the party 
// stands inside this section until you change the state.
	if (get_flag(12,1) == 1)
		eliminate_outdoor_enc(12,1);
	if (get_flag(204,3) == 1)
		set_terrain(35,12,458);
break;

beginstate 10;
	message_dialog("The path you have been following so far cuts off here. The lava is hotter and more dangerous. You won't be able to proceed safely, so you must turn back.","");
break;

beginstate 11;
if (get_skill_total(16) < 15) {
	message_dialog("You find some strange-looking plants. Unfortunately, you don't know enough about Nature Lore to know what they are or how they might be used.","");
	end();
	}
	
if (get_flag(204,0) == 0) {
	reset_dialog();
	add_dialog_str(0,"You find a patch of Healing Herbs! Your knowledge of Nature Lore extends to how to pick them so that they will keep their vital parts that are useful in potions. Do you wish to pick them?",0);
	add_dialog_choice(0,"No. (Leave them alone.)");
	add_dialog_choice(1,"Yes. (Pick them.)");
	if (run_dialog(1) == 2) {
		set_flag(204,0,reward_give(214));
		reward_give(214);
		}
	}
else
	message_dialog("Healing Herbs grow back slowly, and these have not yet grown back.","");
break;

beginstate 12;
if (get_skill_total(16) < 16) {
	message_dialog("You find some strange-looking plants. Unfortunately, you don't know enough about Nature Lore to know what they are or how they might be used.","");
	end();
	}
	
if (get_flag(204,1) == 0) {
	reset_dialog();
	add_dialog_str(0,"You find a patch of Graymold! Your knowledge of Nature Lore extends to how to pick it so that it will keep its vital parts that are useful in potions. Do you wish to pick it?",0);
	add_dialog_choice(0,"No. (Leave it alone.)");
	add_dialog_choice(1,"Yes. (Pick it.)");
	if (run_dialog(1) == 2) {
		set_flag(204,1,reward_give(217));
		reward_give(217);
		reward_give(217);
		}
	}
else
	message_dialog("Graymold grows back slowly, and this patch has not yet grown back.","");
break;

beginstate 13;
if (get_flag(204,2) == 0) {
	reset_dialog();
	add_dialog_str(0,"As you round this corner, your breath is taken away.",0);
	add_dialog_str(1,"Most of the river turned west and went beyond rocks through which you could not go, but small bit of the overflow turned south, and it pours out to the east of you. It drops an immense distance onto the molten lava below.",0);
	add_dialog_str(2,"As the water hits the lava, it boils away almost instantly into steam. The air is full of this steam, warm, moist, and life-giving. You've seen this happen before, near the Tower of Magi in Avernum, but that was much smaller than this.",0);
	add_dialog_str(3,"You also have a good view from here of the ocean of lava ahead. It stretches on for a vast distance, just an expanse of fiery lava, with a few sparse patches of land here and there.",0);
	set_flag(204,2,run_dialog(1));
	}
break;

beginstate 14;
if (get_skill_total(16) < 15) {
	message_dialog("The ground here is lumpy. Odd.","(Your Nature Lore isn't high enough for you to know what this means.)");
	end();
	}
	
if (get_terrain(35,12) == 396) {
	reset_dialog();
	add_dialog_str(0,"The ground here is lumpy and turned over. Your Nature Lore detects that someone must have buried something here. What do you do?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Dig.");
	if (run_dialog(1) == 2) {
		reset_dialog();
		add_dialog_str(0,"You find a very cold, blue sword! It glints threateningly in the cave-light. It is frosty to the touch and is sure to ice your enemies.",0);
		if (reward_give(345) == 1) { // Icy Longsword
			set_flag(204,3,1);
			set_terrain(35,12,458);
			add_dialog_str(1,"You pack away your discovery.",0);
			}
		else
			add_dialog_str(1,"Unfortunately, you can't carry what you've found, so you leave it buried there.",0);
		run_dialog(1);
		}
	}
break;