// Town 10: South River
begintownscript;

variables;

short choice,dummy,i;
string dlgstr;

body;

beginstate INIT_STATE;
turn_off_training(1);
	
if ((get_flag(11,13) == 1) && (get_flag(10,3) == 0))
	{message_dialog("This area seems nice and peaceful. Somewhere around here, you probably could rest.","");
	set_flag(11,10,0);
	set_flag(10,3,1);
	}

if (get_flag(10,0) == 1)
	end();

	message_dialog("You begin to head south along the river. As you look ahead of you, you can see it winding south for a while, but then it goes into a cave, and you can't see past that.","The ground you just crossed is very unsteady, probably because it used to be underneath the river, when the river was larger in the past. You will not be able to run back this way if you are in a hurry, if you are, for example, in combat.");
	set_flag(10,0,1);
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;
if (is_combat() == 1)
	{block_entry(1);
	message_dialog("The ground here is too slippery and muddy to get through in a hurry. You can't go here in combat.","");
	end(); }
	
if ((get_flag(250,4) == 1) && (has_item(451) == 0))
	{message_dialog("You can't just leave Phaedra behind. You must take her with you to the guardpost immediately or she will die.","");
	block_entry(1);
	end();
	}
	
	reset_dialog();
	add_dialog_str(0,"You have reached the slippery, muddy path of narrow riverbank that leads back to the guardpost. Do you wish to head back?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Continue north to the guardpost.");
	choice = run_dialog(1);
	if (choice == 1)
		block_entry(1);
	if (choice == 2)
		{set_flag(10,4,1);
		move_to_new_town(9,8,37);
		}
break;

beginstate 11;
if ((char_ok(6)) || (char_ok(7)) || (char_ok(8)) || (char_ok(9)) || (char_ok(10)) || (char_ok(11)) || (char_ok(12)) || (char_ok(13)) || (char_ok(14)) || (char_ok(15)) || (char_ok(16)))
	{block_entry(1);
	message_dialog("There are still monsters after you. To proceed down this narrow, enclosed tunnel with monsters behind you would be suicide.","");
	end(); }
	
	reset_dialog();
	if (get_flag(250,4) != 1) // Phaedra okay
		{add_dialog_str(0,"There is a small, narrow tunnel here. Do you wish to continue?",0);
		add_dialog_choice(0,"Leave.");
		add_dialog_choice(1,"Continue south.");
		if (run_dialog(1) == 1)
			block_entry(1);
		else
			{set_flag(10,1,1);
			move_to_new_town(11,30,8);
			}
		}
	else // Phaedra dead
		{add_dialog_str(0,"There is a small, narrow tunnel here. However, you can't go this way: Phaedra needs you to bring her back to the guardpost.",0);
		dummy = run_dialog(1);
		block_entry(1);
		}
		
break;

beginstate 12;
if (get_flag(10,6) == 1)
	end();

	message_dialog("Here in the junk in these basilisk nests, you find a shiny ring! One of the ur-basilisks must have gotten it somewhere and stored it here.","");
	set_flag(10,6,1);
break;

beginstate 13;
if ((get_flag(250,4) == 1) && (has_item(451) == 0))
	{message_dialog("You can't just leave Phaedra behind. You must take her with you to the guardpost immediately or she will die.","");
	block_entry(1);
	end();
	}
	
	reset_dialog();
	add_dialog_str(0,"There is a small, narrow tunnel here. Do you wish to continue?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Continue south.");
		if (run_dialog(1) == 1)
		block_entry(1);
	else
		{set_flag(10,2,1);
		move_to_new_town(11,6,6);
		}
		
break;

beginstate 14;
if (get_flag(250,2) == 0)
	message_dialog("This gravestone has writing on it, but you can't read the ancient script.","");
if (get_flag(250,2) == 1)
	message_dialog("This gravestone has writing on it. The letters are the same as what you learned in Ancient Bahssikava, but the words are a bit different. Perhaps homeland sliths wrote it; they might speak a different dialect after two hundred years of separation.","From what you can read, the slith who is buried here died sixty years ago.");
if (get_flag(250,2) == 2)
	message_dialog("This gravestone has writing on it. The letters are the same as what you learned in Ancient Bahssikava, but the words are a bit different. Perhaps homeland sliths wrote it; they might speak a different dialect after two hundred years of separation.","The gravestone says: _HERE LIES SIMILOS, WHO DIED BY WOUNDS INFLICTED BY THE CAVEQUAKE._ The date of death is about sixty years ago.");
break;

beginstate 15;
if (get_flag(10,5) == 1)
	end();

	message_dialog("Now this is odd. There is a gravestone here. The monsters around here certainly don't bury their dead. It must be a slith. But this area was inaccessible before the river reduced in size, which was probably after the cavequake.","That means... this is a recent grave! This was made by either released Bahssikavans or homeland sliths!");
	set_flag(10,5,1);
break;

beginstate 16;
	message_dialog("The mighty beast falls with your final blow. His blood covers the entire area, drenching the ground and making you almost physically ill.","You have slain this ancient beast, but you cannot rejoice in your victory. The smell of fresh blood fills the room.");
break;

beginstate 17;
if (get_flag(10,8) == 0) {
	set_flag(10,8,1);
	message_dialog("On this beach, two varieties of potion-making herbs grow! They seem to grow rather slowly, so if you take them now, you won't be able to get more for a long time, but enough plants are ready for a potion or two.","");
	}
break;

beginstate 18;
	reset_dialog();
	if (get_flag(10,7) == 0) {
		add_dialog_str(0,"This area looks like a former nest of a drake or perhaps an even larger drake-like creature. Judging by the total lack of possessions and the general disrepair of the area, this nest has been abandoned for some time.",0);
		add_dialog_str(1,"You could rest here undisturbed for a while. Would you like to?",0);
		set_flag(10,7,1);
		}
	else
		add_dialog_str(0,"You return to the former nest. Would you like to rest?",0);
	add_dialog_choice(0,"Don't rest.");
	add_dialog_choice(1,"Rest.");
	if (run_dialog(1) == 2)
		{revive_party();
		set_ticks_forward(5000);
		message_dialog("You rest peacefully and uninterrupted for a brief while.","");
		}
break;

beginstate 19;
if (get_flag(10,9) == 0) {
	set_flag(10,9,1);
	message_dialog("The area in front of you seems exceedingly desolate. For as far ahead of you as you can see, the ground is laden with exotic skeletons of strange monsters. It seems dry everywhere except right next to the river.","This is a wasteland. Whatever you're supposed to find down this way is far off, yet. Judging by the sounds you hear in the distance, there are some motley monsters in between you and it, too.");
	}
break;