// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,0) == 0;
	question = "special";
	text1 = "__";
	action = SET_SDF 70 0 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,1) == 0;
	question = "special";
	text1 = "You emerge from this narrow, overgrown tunnel into a broad, much more overgrown cavern. A river flows swiftly by to the west, and the moisture has encouraged an impossible tangle of cavewood trees and thickets of long, ropy fungus.";
	text2 = "There are no signs of settlers from the Abyss coming out here, and you can see why. Bones litter the paths, and ominous figures lope through the undergrowth.";
	text3 = "This is one of those areas in Avernum where, no matter which direction you travel, you feel like you are being hunted. And you probably are.";
	action = SET_SDF 70 1 1;

begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You open this box and find a thick stack of papyrus stationery and several pens. Not particularly interesting.";
	text2 = "But one partially completed letter, shoved off to one side, gets your interest. It says:";
	text3 = "_Your actions so far, in a place so fragile and so important to the defenses of Avernum, shame you. You barely deserve to call yourself Darkside Loyalists._";
	text4 = "_All you have done is encourage pitiful refugees, hiding in the sewers, trusting them to do your work instead._";
	text5 = "It trails off there. Interesting.";
	code =
		if (gf(70,2) == 0)
			sf(70,2,1);
			else {
				rs(2); rs(3); rs(4); rs(5);
				}
	BREAK;

begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,3) == 0 && gf(70,22) == 0;
	question = "special";
	text1 = "Some brave souls have constructed a small outpost here, deep within the thickets. Piles of lizard hides dry outside. A single young warrior stands just outside the front gate, and you can see several archers just inside.";
	text2 = "And yet, something about them seems off. They look and act like simple hunters and trappers, but there is something about their movements. The look in their eyes. The way they watch you.";
	text3 = "A few months ago, you would have been fooled. Now, with all you have seen, you know to be on your guard.";
	action = SET_SDF 70 3 1;

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,4) == 0;
	question = "special";
	text1 = "Under the modest fort above, you discover a much larger complex. Beyond the barriers to the west, manned by skilled archers, you can see a huge gallery, stretching west and north.";
	text2 = "The warriors down here are very different from those above. They are older. They bear more scars. Their weapons and armor look like they've been used for many years.";
	text3 = "They look much colder and much crueler. And much, much more dangerous.";
	action = SET_SDF 70 4 1;

begintalknode 6;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,5) == 0;
	question = "special";
	text1 = "There is a gate blocking your escape from the gallery just ahead. The warriors down here have tired of your intrusion. You arrive just in time to see the gate slide all the way closed. Several warriors have just stepped through it.";
	text2 = "As they advance carefully toward you, you hear a horn sound. It comes from the far end of the long passage behind you. Then you hear shouting and running.";
	text3 = "Someone else has joined the hunt, coming from the passage behind you. The echoing sound of their approach carries easily to you. They are a fair distance away, but closing quickly.";
	action = SET_SDF 70 5 1;


begintalknode 7;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,6) == 0;
	question = "special";
	text1 = "This room is different from all the others in this hidden fortress. It was locked off and abandoned. The floor is covered with dust and moss. None of the humans come back here.";
	text2 = "And that is probably wise. A pair of sentinels have been left by the west door. They stand perfectly immobile. You haven't gotten close enough to activate them. Yet.";
	action = SET_SDF 70 6 1;

begintalknode 8;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,7) == 0;
	question = "special";
	text1 = "You emerge from the tunnels into the ruins of a tower. It was once a beautiful structure, a glorious center of magical power. The walls still glow, very faintly, with the power they contained.";
	text2 = "Now the tower lies in ruins, overgrown by thick clumps of fungus.";
	text3 = "And yet, the energy remains, waiting for someone to come here and harness it.";
	action = SET_SDF 70 7 1;

begintalknode 9;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,8) == 0;
	question = "special";
	text1 = "Under the ruins of the tower, one chamber remains intact. It is a huge hall. The ceiling arches high overhead. Your hair stands on end. This tower was built on a locus of powerful, natural magic, and this chamber is at the center of it.";
	text2 = "And you are not the first creature here. Something has already come to claim it. A creature stands in the circle in the center. A withered form, dried bones covered with scraps of dessicated flesh and rotting cloth.";
	text3 = "At first, you are optimistic and hope that the creature was a wizard who came here, tried to master the power, and was killed by it. And then the undead horror turns and looks at you. Its eyes glow fiery red.";
	text4 = "It makes a sound, a long, moaning exhalation. Bits of dust blow out of its skeletal jaw. Then it raises a hand and motions for you to approach.";
	action = SET_SDF 70 8 1;




//

begintalknode 10; // spellbook
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "This old, crumbling book is full of many obscure and powerful magical rituals. Most of them are beyond even your considerable skill.";
	text2 = "With great effort, you manage to understand the simplest of the spells within. You can call a powerful shade to aid you. (Your skill with the spell Divine Host 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(70,26) == 0) {
			rs(3);
			if (get_stat_total(13) < 16)
				rs(2);
				else {
					rs(4);
					sf(70,26,1);
					alter_stat(30000,79,1);
					}
			}
			else {
				rs(1); rs(2); rs(4);
				}
	break;

begintalknode 11;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You try to talk to one of the trappers. A sneer is all you get in response.";

begintalknode 12;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The trappers (or whatever they are) here have had enough of you. One of them shouts, _You've made your last mistake, worm. This is our land!_";
	text2 = "And then they attack. Trappers or not, they are sadly competent with their weapons.";

begintalknode 13;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Suddenly, Gavrahoss freezes. A magical shield appears around him. He barely moves, but you think you can see his lips moving.";
	text2 = "Then four shades emerge from Gavrahoss, flowing gently out of him. He is projecting parts of his spirit, manifestations of pure power, to attack you.";
	text3 = "Though they are powerful and dangerous, they might be vulnerable in ways that their creator isn't.";

begintalknode 14;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The shield around Gavrahoss fades. The shades float back into his body. Their spirits rejoin with his.";
	text2 = "The spell he was casting is complete. A pair of infernal creatures appear in clouds of sulfurous smoke. Gavrahoss cackles. _Now the battle resumes. Prepare to be ended, worm!_";

begintalknode 15;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Gavrahoss has collapsed. Even all of his years of training and stored energy are unable to help him to resist the grievous wounds you have inflicted upon him.";
	text2 = "_No ..._ he gasps. _No successor ... No time ... None left ... The Darkside Loyalists end. Redmark ascends. No hope. No ... Empire ..._";
	text3 = "He dies with his eyes open. The final expression on his face tells you that, in his final moments, he realizes how futile his life's work was. The Darkside Loyalists have finally fallen.";

begintalknode 16;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You get close enough to the lich that it finally has to react to you. Controlling and harnessing the raw power of the tower must be taking a lot of its concentration. Good thing it never has to sleep.";
	text2 = "It turns toward you. The gate behind you slams shut. It steps out of its circle and advances on you. A searing nimbus of flame surrounds the skeleton. Tongues of it leap from its body toward you.";
	text3 = "Now that it is no longer controlling the tower's power, bits of it start to leak out. Orbs of light begin to slowly coalesce into being on the magic circles ringing the chamber.";

begintalknode 17;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "At last, the lich collapses into dust. The tower is, once again, without a master. The effect is immediate. You hear a deafening rumbling sound. The ground shakes under your feet. Dust showers onto you from above.";
	text2 = "Wisps of light appear in the corner, growing slowly larger and brighter. Some of them begin to take on a decidedly infernal shape. You start to consider making a speedy escape, if it's not too late.";
	text3 = "And then someone says, _That is quite enough. Too much chaos is not good, even for me. The wards will come back ... now._ And, in an instant, things calm down. The ominous lights fade.";
	text4 = "And there is someone in the room, standing in the circle in the center.";

begintalknode 18;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Gladwell can hardly believe what has happened. Even with all of the power of the tower at his disposal, he has been slain.";
	text2 = "He doesn't have long to feel bad about it, though. The power he hoped to claim instead claims him. It burns him up from the outside, turning him into ash. In a moment, nothing is left of him. Not flesh, not robes, not even smoke.";
	text3 = "A suitable reward for someone so heartless and ambitious. And, in the end, so careless.";
	text4 = "Happily, the wards he placed on the tower still remain. Thus, you might be able to escape alive.";

begintalknode 19;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "This book is full of chants and rituals. Most of them are simple songs and rites, with no magical strength attached to them.";
	text2 = "One of the songs, however, can restore the strength of all nearby allies. (Your skill with the spell Divine Restoration 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(70,27) == 0) {
			rs(3);
			if (get_stat_total(13) < 14)
				rs(2);
				else {
					rs(4);
					sf(70,27,1);
					alter_stat(30000,78,1);
					}
			}
			else {
				rs(1); rs(2); rs(4);
				}
	break;
	
begintalknode 20;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The ogre's guardwolf snarls at you but, happily, doesn't bite.";

begintalknode 21;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

begintalknode 22;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

begintalknode 23;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

// Gremmin

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Name";
	text1 = "There is a man waiting for you at the entrance to the outpost. He is dressed like a trapper, but he has massive muscles and a killer's eyes. The sword hanging from his belt is a beautiful blade.";
	text2 = "He sneers at you. _You're far from your home territory, Avernite. I am Gremmin. This is our land. It's time for you to turn back. Try to enter, and we'll drive you out._";
	text5 = "Gremmin is still standing guard at the entrance to his outpost. He constantly keeps his hand on the pommel of his blade, as if he hopes you'll try something.";
	action = INTRO;

begintalknode 31;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "What are you doing out here?";
	text1 = "_We're trappers. We kill and skin lizards. We catch fish. And we want our privacy._";

begintalknode 32;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "That's a nice sword.";
	text1 = "He doesn't respond. He just rests his hand on the pommel.";

begintalknode 33;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Will you trade with me?";
	text1 = "_No trading. Just go._ As you talk with him, you notice that his skin isn't actually that pale. It's as if he was on the surface fairly recently.";

begintalknode 34;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "I'm going to enter your fort.";
	text1 = "He takes a step back. You can hear the archers inside the fort drawing back their arrows, ready to fire.";
	text2 = "_I said you were to stay outside, and I meant it. Now turn back. That's the last warning you get._";
	action = END_TALK;
	
begintalknode 35;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "I'll be going, then.";
	text1 = "_That's a wise choice, worm. Keep moving._ He takes a step back.";
	text2 = "Strange. _Worm_ is what people from the Empire usually call Avernites. And they don't mean it kindly.";
	action = END_TALK;

	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Name";
	text1 = "You confront a withered old man in long, flowing robes. He looks at you with pure loathing. His body is hunched and twisted, broken down by long decades of constant battle and hiding in the underworld.";
	text2 = "He points at you and lets out a long, angry shriek. He doesn't have much sanity left. _Worms! Worms! Always worms! Avernum and the Empire, always hunting us._";
	text3 = "_You think you have trapped me. Many have thought they have trapped Loyalist Gavrahoss. But I will not surrender. We will kill you, and we will rebuild!_";
	code =
			sf(70,2,1);
	break;
	
begintalknode 51;
	state = 50;
	nextstate = 51;
	condition = 1;
	question = "Who are you, exactly?";
	text1 = "_We are the Darkside Loyalists, the only true members of the Empire left. One day, we will bring down the Emperor and replace him with one who will raise the Empire back to its true status!_";
	
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "Oh, just die, madman. (Attack.)";
	text1 = "He throws his hands wide and begins to chant. He is broken down and mad, but his fanaticism has only served to focus his power.";
	action = END_TALK;
	
begintalknode 53;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "And what is the Empire's true status?";
	text1 = "_Ascendent, with all others crushed beneath it, and all twisted, non-human monsters destroyed. Dragons, sliths, nephilim, all ground to dust! We will restore Emperor Hawthorne's way!_";
	
begintalknode 54;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "How long have you been hiding down here?";
	text1 = "He shakes his head sadly. _Years, so many years, always hiding from worm soldiers and Redmark's assassins. There are few of us left, but we will rise again! I swear it!_";
	
begintalknode 55;
	state = 51;
	nextstate = 52;
	condition = 1;
	question = "You really think you have a chance to unseat Emperor Redmark?";
	text1 = "_Only Redmark. We do not honor that cowardly wretch, the son of a traitor, with the title Emperor. No! The capital of the Empire is here! Only we have the right to bear the Empire's symbol!_";
	text2 = "_And soon, we will ascend and take our rightful place!_";
	
begintalknode 56;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "You are mad. You have no hope.";
	text1 = "You wonder if, somewhere in the fanatic's brain, he realizes that you are correct. You suspect he does, because your words drive him to an incoherent fury.";
	text2 = "_No ... No ... We will ascend! Our efforts ... not wasted ... We will! And first ... All worms die!_";
	text3 = "He throws his hands wide and begins to chant. He is broken down and mad, but his fanaticism has only served to focus his power.";
	action = END_TALK;
	
begintalknode 57;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "No. I will put you out of your misery. (Attack.)";
	text1 = "He nods. _After so many years, death would be a relief. But no. We must prevail. We must defeat the Emperor. We must ascend. And first, all worms must die!_";
	text3 = "He throws his hands wide and begins to chant. He is broken down and mad, but his fanaticism has only served to focus his power.";
	action = END_TALK;
	
begintalknode 58;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "Very interesting. Now, excuse me. I really need to be going.";
	text1 = "He shakes his head. _No. It is too late for you. We must defeat the Emperor. We must ascend. And first, all worms must die! You will not live to reveal our secrets._";
	text3 = "He throws his hands wide and begins to chant. He is broken down and mad, but his fanaticism has only served to focus his power.";
	action = END_TALK;

// 70

begintalknode 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = "In a remarkable display of magic, Gladwell has managed to teleport himself to the tower. Somehow, he tracked you, could tell that you slew the lich, and brought himself to your location in moments. An amazing feat.";
	text2 = "He brushes the dust off of his cloak, looks around, and smiles. _Yes. Very rough, as I expected. But it will make a lovely home._";
	text3 = "He looks at you. You notice that his body is already covered with an eerie, fiery nimbus. _You have done well for me. Don't worry. Your reward is forthcoming. I honor my debts._";
	text5 = "Gladwell has already forgotten that you are here. He looks around, mentally making contact with the raw power of the tower and deciding how to tame it.";
	text6 = "You clear your throat. He looks over at you, annoyed. _What? You are still here? What else do you want?_";
	action = INTRO;

begintalknode 71;
	state = 70;
	nextstate = -1;
	condition = gf(70,11) == 0;
	question = "I would like my reward.";
	text1 = "Gladwell nods. _That is simple, as I am the master of the tower now._ He waves a hand. The northwest and northeast gates slowly open. _All of my gates will open for you now._";
	text2 = "_Help yourself to what you find, knowledge included._";
	code =
		toggle_quest(47,3);
		sf(158,15,10);
		sf(70,11,1);
		sf(158,27,1);
		award_party_xp(500,50);
	break;
		
begintalknode 72;
	state = 70;
	nextstate = 71;
	condition = 1;
	question = "How did you get here so quickly?";
	text1 = "_Watching you once you reached the tower has taken all of my skill and concentration. I have been marshaling my powers for weeks for just this event._";
	text2 = "_Once the tower was free, I had to act quickly._";

begintalknode 73;
	state = 70;
	nextstate = 73;
	condition = gf(70,11) > 0;
	question = "What will you do now?";
	text1 = "_I will marshall my power. I will control and rebuild the tower. And then I will stretch out my hand, and I will exert my influence over the chaotic underworld._";
	text2 = "_Avernum's time will end, as it must. And I will help create a land of magic, wild and free, full of great danger and reward. With me as the ascendant power._";
	code =
		sf(70,25,1);
	break;
	
begintalknode 74;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "Can I do anything for you?";
	text1 = "Gladwell shakes his head. _At this point, our association can come to an end. I will ask nothing of you. And, as long as you do nothing to act against me, we can be at peace._";

begintalknode 75;
	state = 70;
	nextstate = -1;
	condition = gf(70,25) > 0;
	question = "I can't let you control Avernum. You must die. (Attack.)";
	text1 = "_What? Really? Oh, I suppose I am not surprised. Buyer's remorse is not unusual among those in your position. Come on, then. Let me end all of your doubts._";
	action = END_TALK;
	code =
		set_attitude(7631,10);
	break;
	
	
begintalknode 76;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "I'll be going now.";
	text1 = "Gladwell gives a distracted little nod of his head. In moments, he has forgotten that you are here.";
	action = END_TALK;

begintalknode 77;
	state = 71;
	nextstate = -1;
	condition = 1;
	question = "Why?";
	text1 = "_Because the moment it became uncontrolled, magically attuned creatures all across Avernum were aware of it. But only I was positioned to take control of it immediately._";

begintalknode 78;
	state = 71;
	nextstate = -1;
	condition = 1;
	question = "And can you still spy on me?";
	text1 = "_Of course I can. But I should no longer find it necessary. My concentration must be focused on the tower._";

begintalknode 79;
	state = 73;
	nextstate = -1;
	condition = 1;
	question = "The end of Avernum? You will destroy Avernum?";
	text1 = "_Me? Of course not. The Blight has already done that. These caves simply cannot support that much human life. This reckoning has been inevitable for years._";
	text2 = "_And yet, oddly, only I was wise enough to prepare for it._";

begintalknode 80;
	state = 73;
	nextstate = -1;
	condition = 1;
	question = "You want to be the ruler of the underworld?";
	text1 = "_Of course not. I do not want a petty administrative role. As long as nobody openly challenges or defies me or attempts to disrupt the paradise of chaotic magic I will create, all will be fine._";

begintalknode 81;
	state = 73;
	nextstate = -1;
	condition = 1;
	question = "Won't the underworld be very dangerous?";
	text1 = "_Of course! Horribly so! It is a small price to pay for having one land in the world full of untamed power, like in days of old._";
	text2 = "_And I will make sure it stays that way. Hopefully, nobody will be so foolish as to defy me._";

////

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