// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(161,4) == 0;
	question = "special";
	text1 = "The land to the south is dry, rocky and unwelcoming. Bones litter the rocky ground. Some of them are old and yellow. Others look much newer.";
	text2 = "In the dim green light, you can barely make out lone humanoid figures prowling the waste. You're too far away to make out any details, but you think that they are holding bows.";
	action = SET_SDF 161 4 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(161,5) == 0;
	question = "special";
	text1 = "How peculiar. Someone has hauled the statue of a slithzerikai out here. It is old and crumbling, and several chunks of it were knocked off in transit.";
	text2 = "Someone has placed a crude iron chain around its neck and a dented bronze circlet on its head. It is not immediately clear what these items are supposed to signify.";
	action = SET_SDF 161 5 1;

begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = get_sdf(161,10) == 0 && gf(115,7) > 0;
	question = "special";
	text1 = "Remembering what you learned in Gnass, you carefully examine the wall behind the statue. Sure enough, one section of the wall is slightly discolored. You never would have spotted it if you hadn't received a hint of what to look for.";
	text2 = "When you push it, there is a brief rumbling noise. A section of wall slides away, only a few inches, to reveal a crack you can just barely fit through.";
	action = SET_SDF 161 10 1;
	code =
		set_terrain(0,482,757,0);
	break;
	
begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = get_sdf(161,6) == 0;
	question = "special";
	text1 = "As you walk past these slithzerikai statues and pillars, you realize that there is a much larger complex hidden down here than you expected. Shouts, hisses, and the sounds of a forge easily echo down the stone corridors to you.";
	text2 = "And, under it all, you can hear chanting. A constant, deep bass sound that makes the floor vibrate.";
	text3 = "This must be where Treviass came. Time to see if he is still here. And alive.";
	action = SET_SDF 161 6 1;

begintalknode 5;
	state = -1;
	condition = get_sdf(161,7) == 0;
	question = "special";
	text1 = "At the end of this passage, you can see a small shrine. There is a basalt altar, and a ring of benches turned to face it. On the far wall, you can see a rack of leather scrolls.";
	text2 = "And, in the middle of the room, inside a magic circle, you see a hellhound curled up on the floor. It is asleep. Or pretending to be asleep. For now."; 
	action = SET_SDF 161 7 1;

begintalknode 6;
	state = -1;
	condition = get_sdf(161,8) == 0;
	question = "special";
	text1 = "The chamber ahead has two gates. The near one is open. The far one is closed. You can sense that someone is watching you.";
	text2 = "You suspect that, if the cult allows you into their chambers, it will be on their terms. And escape might be far more difficult than entry.";
	action = SET_SDF 161 8 1;
	
begintalknode 7;
	state = -1;
	condition = get_sdf(161,22) == 0;
	question = "special";
	text1 = "The gate behind you suddenly clangs shut! You've stumbled into another of the cult's ambushes.";
	text2 = "The rumbling under your feet grows stronger. The fumaroles are starting to hiss. They aren't active yet, but they will be soon. This tunnel is about to become a dangerous place to be.";
	action = SET_SDF 161 22 1;
	code =
		if (party_within_dist(477,721,6))
			sf(161,23,0);
		if (gf(161,23) > 0)
			rs(1);
	break;
	
begintalknode 8;
	state = -1;
	condition = get_sdf(161,11) == 0;
	question = "special";
	text1 = "As you enter this long tunnel, the ground vibrates slightly under your feet. Some of the fumaroles ahead are glowing slightly. Little wisps of steam rise from them. They aren't dormant.";
	action = SET_SDF 161 11 1;


//

begintalknode 10;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  Wishing Well";

begintalknode 11; //crate
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "This crate has been nailed shut. You think you can hear something rustling around inside.";

begintalknode 12;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You suspect that this wheel is here to control the gates that trapped you in here. However, you are unable to turn it. The mechanism seems to be stuck. It won't budge an inch.";

begintalknode 13;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You turn the wheel. You hear the sound of metal scraping over stone, coming from the caldera cave.";
	text2 = "You try to turn the wheel. It doesn't budge.";
	code =
		if (gf(161,23) == 0) {
			rs(2); sf(161,23,1);
			}
			else rs(1);
	break;
	
begintalknode 14;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Without any fanfare, the gate behind you slides closed. There is a long, nervous minute where you are trapped here, wondering if you are going to have to battle someone through the bars.";
	text2 = "Then the east gate slides open. You have been invited inside.";

begintalknode 15;
	state = -1;
	nextstate = -1;
	condition = gf(161,9) == 0;
	question = "special";
	text1 = "You look through the scrolls on the rack behind the altar. It's an eclectic collection of tales from slithzerikai history.";
	text2 = "After a few minutes of searching, you find the scrolls Seleeass asked you to obtain. Five drakeskin scrolls, dyed white, rolled up in one scroll tube. You take them.";
	text3 = "You notice that, while the scrolls are quite old, it looks like someone made some changes to them recently. Seleeass will not be pleased.";
	code =
		rs(2); rs(3);
		if ((gf(115,9) == 1) && (gf(161,9) == 0)) {
			as(2); as(3);
			sf(161,9,1);
			set_spec_item(24,1);
			}
	break;

begintalknode 16;
	state = -1;
	nextstate = -1;
	condition = gf(161,19) == 0;
	question = "special";
	text1 = "You advance slowly through this lovely subterranean garden, waiting for the other shoe to drop and something to attack you. You don't have long to wait.";
	text2 = "By the time you notice the stealthy figures moving in the shadows above, it's too late. You see nephilim archers standing on the ledges above, looking down at you.";
	text3 = "Two of them kick rocks off of the ledge. They fall onto crates below, smashing them. There were creatures concealed inside.";
	action = SET_SDF 161 19 1;
	code =
		kill_object(29016,0);
		kill_object(29017,0);
		activate_hidden_group(43);
	break;
	
begintalknode 17;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";	

begintalknode 18;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "There is a book of slithzerikai rituals on this pedestal. The dialect is very simple, so you set about trying to translate it.";
	text2 = "It takes a little time, but you are able to understand one of the simpler chants, one used to clear the mind and free it from outside influences. (Your skill with the spell Unshackle Mind increases.)";
	text3 = "You browse through the book a bit more, but you don't learn anything new.";
	text4 = "You browse through the book, but you can't understand any of it. You don't know enough magical lore. (Improve your Arcane Lore skill to understand books like these.)";
	code =
		if (gf(161,20) == 0) {
			rs(3);
			if (get_stat_total(13) < 7)
				rs(2);
				else {
					rs(4);
					sf(161,20,1);
					alter_stat(30000,68,1);
					}
			}
			else {
				rs(1); rs(2); rs(4);
				}
	break;
//

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Name";
	text1 = "You are standing next to the Great Cave's famed Wishing Well. Many travelers before you have poured their hopes and dreams into this pit. Fewer these days, of course, because of all the bandits. But still some.";

begintalknode 31;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Throw in a few coins and wish for a magic sword.";
	text1 = "Sadly, you don't have the money to spare.";
	text2 = "You throw in a few coins, close your eyes, and wish with all your might. Then you open them. There isn't a sword there. Oh, well. Maybe if you tried again.";
	action = END_TALK;
	code =
		if (coins_amount() < 5)
			rs(2);
			else {
				change_coins(-5);
				rs(1);
				}
	break;
	
begintalknode 32;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Throw in a few coins and wish for a better future for Avernum.";
	text1 = "Sadly, you don't have the money to spare.";
	text2 = "You throw in a few coins, close your eyes, and wish with all your might. Then you open them. Everything still looks the same. But who knows? Maybe somewhere, a few moments ago, something happened that will totally turn everything around.";
	action = END_TALK;
	code =
		if (coins_amount() < 5)
			rs(2);
			else {
				change_coins(-5);
				rs(1);
				}
	break;
	
begintalknode 33;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Throw in a few coins and wish for a lot of money.";
	text1 = "Sadly, you don't have the money to spare.";
	text2 = "You throw in a few coins, close your eyes, and wish with all your might. Then you open them. Your possessions are unchanged. Oh, well. Maybe if you tried again.";
	action = END_TALK;
	code =
		if (coins_amount() < 5)
			rs(2);
			else {
				change_coins(-5);
				rs(1);
				}
	break;

begintalknode 34;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Throw in a few coins and wish for three more wishes.";
	text1 = "Sadly, you don't have the money to spare.";
	text2 = "You throw in a few coins, close your eyes, and wish with all your might. Then you open them. You don't feel any different, or more, you know, wishy. Maybe if you tried again.";
	action = END_TALK;
	code =
		if (coins_amount() < 5)
			rs(2);
			else {
				change_coins(-5);
				rs(1);
				}
	break;

begintalknode 35;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Leave.";
	text1 = "You turn and put this noted tourist attraction behind you.";
	action = END_TALK;


	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Name";
	text1 = "You approach the throne room ahead. There are two slithzerikai there. One is rising from the throne. The other stands behind and to the side.";
	text2 = "The slith who was in the throne is draped in a long cloak and wears a variety of chains and amulets. When he recognizes you, he bares his claws and lets out a long hiss. He says, _I am Fahdroth Benttail. It isss good to face you at last._";
	text3 = "The slith behind him is far younger and wields a beautifully made two-tined spear. His hands tremble. He looks terrified. This must be Treviass. Considering what you have just done to the other cultists, he is right to be scared.";
	text4 = "Fahdroth continues. _Khrez-Yss told me you would come. You would be the test that shows I am ready to complete the great work. Yesss ... I am glad we let you in. My only fear wasss that you would not reach me._";
	
begintalknode 51;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "Treviass, are you all right?";
	text1 = "Treviass grips his spear tightly with trembling hands. He doesn't respond.";
	text2 = "Fahdroth laughs. _Ahssss ... No, Treviass knows there is no hope for him. No hope except to stay with us. He will not weaken!_ Treviass summons up his resolve and points his spear at you.";

	
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "Who is Khrez-Yss?";
	text1 = "_Khrez-Yss the Shadow, one of the three warlordsss of the mighty Slith Horde!_";
	text2 = "Who is dead, but he doesn't know that.";
	text3 = "_He watched as you slew his pet goblin. He wasss going to slay you. Instead, as he does, he let you live to serve as a test. His weaker enemiesss are used to test his minions. Asss it should be._";
	code =
		if (gf(170,6) == 0)
			rs(2);
	break;
	
begintalknode 53;
	state = 50;
	nextstate = 51;
	condition = 1;
	question = "What is the great work?";
	text1 = "_The Slith Horde has been stopped in the Eastern Gallery, but they will not be held back for long. Avernum is too tired, too full of weaklingsss._";
	text2 = "_I am going to raise up a band of minionsss and undermine Avernum from behind the linesss. Through theft and murder. Through spying and spreading skribbane. Yesss. I will be worthy of the task._";
	text3 = "_First, though, I must complete the test._";
	
begintalknode 54;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "Won't letting me kill all of your nephilim slow you down a little?";
	text1 = "_Hah! It wasss a favor. The brigandsss were useful for a time, but they were becoming lazy and greedy. Treviass and I, we will raise a force of slithzerikai, true and worthy warriorsss, to act._";
	
begintalknode 55;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "You really think you can affect the Great Cave?";
	text1 = "_We will not conquer it, no. But we will spy and sabotage and murder in the night. The forcesss here are weak and confused. We can do much here._";
	text2 = "Based on what you have seen, he is entirely correct. Most skilled soldiers are in the Eastern Gallery. The Great Cave is vulnerable to a small, determined guerilla force.";
	
begintalknode 56;
	state = 51;
	nextstate = 52;
	condition = 1;
	question = "And what is this test you spoke of?";
	text1 = "_When Khrez-Yss saw you, he knew you would find thisss lair soon enough. We are to kill you. Treviass will now prove his loyalty to the future of the slithzerikai by spilling blood._";
	text2 = "_Then we meet with our other recruitsss, and the work beginsss!_";
	
begintalknode 57;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "Treviass will fight on my side.";
	text1 = "Treviass is clearly having second thoughts about joining forces with this mad creature. However, his fear of Khrez-Yss is still greater than his fear of you.";
	text2 = "He shakes his head. _I left home to fight for the glory of my people. We will be slavesss no longer. You should not have come here._ His words come out hollow. His obvious terror takes away a lot of their force.";
	
begintalknode 58;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "I will be happy to kill you both.";
	text1 = "Treviass nods. That must be what Fahdroth told him would happen. Fahdroth says, _It isss time. Khrez-Yss, the mighty horde, now we prove ourselves!_";
	text2 = "They advance upon you.";
	action = END_TALK;
	
begintalknode 59;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "Fahdroth, you're going to die. Then Treviass comes with me.";
	text1 = "Treviass looks at Fahdroth, then back at you. He is clearly torn. Fahdroth says, _No, do not weaken. Do not be fooled by their liesss. If you are, you do not deserve to help our people be free._";
	text2 = "Fahdroth turns to you. _It isss time. Khrez-Yss, the mighty horde, now we prove ourselves!_ Treviass follows him.";
	action = END_TALK;


begintalknode 65;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "Fahdroth lets out a long, angry hiss. _Ahsssss ... You are a worthy foe. Come! Come, my petsss! My wolvesss! Come and attack!_";
	
begintalknode 66;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "Fahdroth is starting to grow weak. He steps back and lets out a long, high-pitched howl. _Aiiiii! Come, creaturesss! Come my scaly minionsss, and help me strike the enemy down!_";

begintalknode 67;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "You strike Treviass in the chest with one final, decisive blow. He slumps to the ground and is dead within moments.";
	text2 = "Fahdroth says, _Ahsss. I thought the son of a chief would be stronger, but he wasss weak. He never showed the will I expected. I will be better off without him._";
	code =
		if (gf(161,1) > 0)
			rs(2);
	break;
	
begintalknode 68;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 69;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = "You strike Fahdroth in the chest with one final, decisive blow. You and Treviass watch as he slumps to the ground. He looks up at you, raises a clawed hand, and lets out a long, hideous gurgle.";
	text2 = "Then he slumps backward. He is dead.";
	text3 = "Treviass backs away from you, waving his spear. He is trembling so badly you're surprised he maintains his grip on it. _I am ... I am ready. I am not afraid. I will die fighting you!_";
	text4 = "Everyone in this small cult is dead now, even young Treviass. You can now return the bitter news to Gless-Thsss.";
	code =
		if (gf(161,2) > 0)
			rs(3);
			else rs(4);
	break;
	
begintalknode 71;
	state = 70;
	nextstate = -1;
	condition = gf(161,2) == 0;
	question = "Why did you come here?";
	text1 = "_My father, he wanted me to be chief. To try to win leadership of Gnass. To spend my life like he did, doing everything the humansss told him to do. Now, no matter what happensss to us, I will never have to be like him!_";
	text2 = "He points his spear at you, expecting your final attack.";

begintalknode 72;
	state = 70;
	nextstate = -1;
	condition = gf(161,2) == 0;
	question = "And how did living with this cult work out for you?";
	text1 = "He shakes his head. _They ... They were savage. I was told how the other slithzerikai were, but I never saw ... What they do ... What they ate ..._";
	text2 = "He lets out a long, agonized wail. _Is there no place for me? None at all?_";

begintalknode 73;
	state = 70;
	nextstate = -1;
	condition = gf(161,2) == 0;
	question = "You are a traitor. You have to die.";
	text1 = "_Yesss. It isss better thisss way. Better that I never face my father'sss shame. Come. Fight me. Let me die with honor. And please, make it quick._";
	action = END_TALK;

begintalknode 74;
	state = 70;
	nextstate = -1;
	condition = gf(161,2) == 0;
	question = "This foolishness is ended. It is time for you to come home.";
	text1 = "Treviass stands still for a long moment. Then his head drops to his chest. The head of his spear droops until it rests on the floor. _Yesss. I tried. And I failed. As I have always and will always._";
	text2 = "Then he straightens up. _I will go. I will face my father and the hatred of my tribe. And I hope, with fortune, some brigand killsss me before I return to Gnass._";
	text3 = "Then Treviass turns and, without another word, leaves the room.";
	action = END_TALK;
	code =
		sf(161,3,1);
		erase_char(17467);
	break;
	
////

begintalknode 299;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
		