// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(141,2) == 0;
	question = "special";
	text1 = "You are at the outer edge of a grim fen. Pools of stagnant water have gathered in the low areas here, providing an excellent place for all sorts of algae and fungus to grow. The smell of decay is heavy in the air.";
	text2 = "Sections of ruined, crumbling wall poke out of the muck in places. There was a large settlement here. It was abandoned long ago.";
	text3 = "There are shambling figures moving around slowly in the mist. Beyond them, to the southwest, you think you can see flickering lights.";
	action = SET_SDF 141 2 1;


begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign by the path says:";
	text2 = "  To Leonhardt's Shop";

	
begintalknode 8;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You";

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


//Leonhardt

begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Leonhardt";
	text1 = "There is a man living out here, alone, deep in this grim fen. He wears the robes of a mage and a long dagger hangs from his belt, so he might be able to defend himself. Still, it's a lonely, dangerous life.";
	text2 = "The bottoms of his robes have been permanently stained green by the muck he constantly walks through. When you enter, he is tending to the plants and pots of algae that fill his workshop.";
	text3 = "He is pleased to see you. _Ah, good. A warrior of Avernum. From Dharmon, I hope? My little herb farm is besieged of late, and I still need the help I requested._"; 
	text5 = "You speak with Leonhardt, trying to hide how unpleasant you find the constant, sour smell in the air. Of course, he doesn't seem to notice it.";
	text6 = "_Anything else you wish to talk about, soldier? It's easy to get lonely out here._";
	action = INTRO;

begintalknode 11;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "What is your business here?";
	text1 = "He looks at the vats. _This is my small, humble herb farm. I grow the things alchemists need to do their work. To make potions that sustain the soldiers and agents of Avernum, for example._";
	text2 = "_And, before you ask, no. I have no potions. Only herbs, all but the most precious. The alchemy I leave to others. Growing those precious plants is a skill and a challenge all its own._";

begintalknode 12;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "Do you sell any of the herbs you grow?";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Leonhardt's Herbs",
		  "Leonhardt has a selection of herbs he has grown or foraged. He even occasionally finds a sprig of graymold or two.",
		  31,4,0);	
	break;

begintalknode 13;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "Can you teach me any magic?";
	text1 = "_Alas, no. I have mastered a few spells I can use to defend myself, but, if I tried to teach them to you, I would probably leave a step out. And then you would incinerate yourself, and it would be my fault._";

begintalknode 14;
	state = 10;
	nextstate = 13;
	condition = gf(141,3) < 2;
	question = "You need help? Tell me more.";
	text1 = "He shakes his head. _It is a mystery. My peaceful swamp has been invaded by the undead. Not brigands or goblins, but reanimated dead people. Skeletons or zombies, depending on how much remained of the former person._";
	text2 = "_They are mindless creatures, attracted to sounds. I can avoid them with care, but it makes it extremely difficult to do my work. That is why I asked Dharmon for help. If you could assist me, I could call the creatures to us and destroy them._";

begintalknode 15;
	state = 10;
	nextstate = -1;
	condition = gf(141,3) == 1;
	question = "I am ready to help defend against the undead.";
	text1 = "He nods. _Then I will try my technique for drawing them. Prepare yourself. I don't know how many there will be._ He begins to walk toward the door.";
	action = END_TALK;
	code =
		sf(141,4,1);
		sf(141,3,2);
	break;
	
begintalknode 16;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "I'll be going now.";
	text1 = "He nods. _Back to my solitary work. Safe travels to you._";
	action = END_TALK;
	
begintalknode 17;
	state = 11;
	nextstate = 12;
	condition = 1;
	question = "Isn't it dangerous out here?";
	text1 = "_Yes. But it is dangerous everywhere. I know enough magic to look after myself._";
	text2 = "_Of course, there are the shambling zombie hordes. Those are too much for me to handle myself. I keep asking Dharmon for help dealing with them, but no luck yet._";
	code =
		if (gf(141,3) > 1)
			rs(2);
	break;

begintalknode 18;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "What sort of herbs do you grow?";
	text1 = "_To alchemists, there are three classes of herbs with magical properties: healing, that soothe the body, spiritual, that focus the mind, and energetic, that fill the imbiber with great energy._";
	text2 = "_For each sphere, I can grow a plant that provides the needed energy._";

begintalknode 19;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "You can't grow the most precious herbs?";
	text1 = "_It is not possible, sadly, to domesticate graymold or mandrake root. You simply must find those where you can._";
	text2 = "_Graymold is the most powerful of the healing herbs. Its potency is unmatched. And mandrake root contains pure, concentrated magical power. The true skill comes in extracting the energy while leaving behind the deadly poison._";
	
begintalknode 20;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "Do you ever get lonely?";
	text1 = "_Desperately so. But I use the past trials of the Archmage Solberg as an inspiration to me in the dark times._";
	text2 = "_It was Solberg himself who asked me to come out here, you know. To grow what needed to be grown. When a true hero of Avernum asks your help, who would be black-hearted enough to refuse?_";

begintalknode 21;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "Where did they come from?";
	text1 = "_I don't know. Perhaps someone is creating them. Or perhaps there is some previously unknown dark energy at work here._";

begintalknode 22;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "How will you call them?";
	text1 = "_They are drawn to sounds. I think I have developed a way to summon the creatures. We will see._";

begintalknode 23;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "And what do you need from me?";
	text1 = "_It is simple. Stay with me. Protect me. Destroy the invaders as they come._";

begintalknode 24;
	state = 13;
	nextstate = -1;
	condition = gf(141,3) == 0;
	question = "I don't think I can help.";
	text1 = "He nods, but he can't hide his irritation. _A pity. I thought you had come from Dharmon to aid me. Forgive me for thinking that the army might actually help someone in the Great Cave._";
	text2 = "_Now, if you will excuse me, I'm going to return to work. And wait for someone who is actually useful._";
	action = END_TALK;
	
begintalknode 25;
	state = 13;
	nextstate = 10;
	condition = 1;
	question = "I will help you.";
	text1 = "_I am pleased. Then prepare yourself. I suggest staying in here with me._ He points at the pools in the corner. _Those are filled with restorative liquid. Use them if the onslaught becomes too much, but not before._";
	text2 = "_Tell me when you are ready._";
	action = SET_SDF 141 3 1;

begintalknode 26;
	state = 10;
	nextstate = -1;
	condition = gf(141,1) > 0;
	question = "Any more problems with the undead?";
	text1 = "_I suspect, now that the necromancer is dead, my difficulties have ended. For now._";
	text2 = "_Please take this, as a small gesture of gratitude on my part._ He gives you several pouches of dried herbs.";
	code =
		if (gf(141,5) == 0) {
			sf(141,5,1);
			reward_give(289);
			reward_give(291);
			reward_give(292);
			}
			else rs(2);
	break;


//


begintalknode 30;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Leonhardt is too busy to be able to talk now. _Be ready! They are coming! Aaah!_";

begintalknode 31;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Leonhardt steps out of his workshop and displays his technique for calling the undead: He starts shouting, at the top of his lungs, _Come here! Come here! Here, undead! Come here!_";
	text2 = "Not the most subtle or magically accomplished method of summoning, but, considering how quickly he turns to run back inside, it seems to be having the desired effect.";

begintalknode 32;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You hear a bone-chilling sound, coming from the swamp. It is a long, low moan, emerging from many decaying throats, that echoes easily across the mire.";
	text2 = "Something is coming.";

begintalknode 33;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You can see something moving out in the swamp. Other forms are rising from the mire, far more quietly than the zombies did.";

begintalknode 34;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You hear more moaning. More undead creatures have emerged from the pools where they were hiding.";
	text2 = "The truth is becoming clear. Someone or something has been creating and concealing lots of undead out here. It is fortunate for the Great Cave that you have discovered this horde before it could emerge and do real damage.";

begintalknode 35;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "A shout echoes across the fen to you. A human voice, furious and aggrieved. _Who has done this? Who has called my pets? Who has destroyed them? Oh, my beautiful creatures, you will be avenged!_";

begintalknode 36;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You strike down the necromancer. The madman falls to the floor and expires. No more will he rob graves and turn the results into mindless, bloodthirsty monsters. Why would anyone do that in the first place?";
	text2 = "Anyway. You see that something is hanging from a thin chain around his neck. You look closer and find an iron key. You take it. The necromancer must have lived somewhere. This must open the way to his lair.";
	code =
		set_spec_item(54,1);
	break;
	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

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

	
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 53;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 54;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 55;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 56;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 57;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 58;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

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

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

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

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

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

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

////

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