// TOWN DIALOGUE SCRIPT
//    Town 71: Gunston Homestead

begintalkscript;

variables;

short i,j,k,r1,choice;

// Carol

begintalknode;
	tag = 10;
	state = -1;
	nextstate = 1;
	question = "Carol";
	text1 = "You meet a tall, striking woman with short, dark hair. This apothecary is where she tends to injured farmers and travelers.";
	text2 = "As she walks around her humble clinic, she speaks with you and grinds something up with a mortar and pestle. _Welcome, brave soldiers of Avernum. I'm Carol, of the Hamer clan. Welcome to our humble household._";
	text5 = "Carol continues to tend to her patients and prepare her healing poultices and salves.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What are you doing?_";
	text1 = "_My husband and I look after our farm and the farms around here. We raise livestock and some mushrooms. I'm also a healer. I can help you, if you like._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_Who is your husband?_";
	text1 = "_Tor. We run this farm together. It's been a lot of work because of the salamanders._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Having problems with salamanders?_";
	text1 = "_Yes. Two nasty salamanders snuck in and are holed up in our larder. Talk to Tor about it. He'll tell you how it happened._";
	text3 = "_We're still recovering from losing all the stuff the salamanders ate. We'll get over it, but it'll take time. Still, thank you for your help!_";
	action = DEP_ON_SDF 71 3 1;

begintalknode;
	state = 1;
	nextstate = 4;
	condition = gf(71,5) >= 1;
	question = "_I looked at some of your books. Do you know anything about 'algebra'?_";
	text1 = "_Oh, that! It's a new thing. It's called 'mathematics.' It's recently become an interest of mine. Great fun, really.  Takes a few years to truly master. Someone in Avernum has to think of those things._";

begintalknode;
	state = 4;
	nextstate = -1;
	condition = 1;
	question = "_Why?_";
	text1 = "_We need to keep up with the learning on the surface. It might help to defend us against them._";

begintalknode;
	state = 2;
	nextstate = -1;
	question = "_I could use the help of a healer._";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Carol the Healer",
		  "Carol can sell you some minor poultices and salves to aid you in your battles.",
		  12,4,0);	
	break;
	
begintalknode;
	state = 2;
	nextstate = -1;
	question = "_Can you make potions for me?_";
	text1 = "_Sadly, no. I can make simple poultices, but I can't create the condensed magical healing a warrior like you requires._";
	text2 = "_Take your precious herbs to Formello, to the southeast. The alchemists there can give the help you need._";

begintalknode;
	state = 2;
	nextstate = 1;
	question = "_I don't need any help._";
	text1 = "_I am very glad to hear it._";	

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_Where did all the livestock here come from?_";
	text1 = "_The giant lizards were always here. The cows were sent down through the portal by the Empire, before the war, to help us survive. Most of the cows died. A few of them lived to provide us with bitter milk and unpleasant meat._";

// Tor

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 28;
	question = "Tor";
	text1 = "A dour, exhausted man sits at the end of the table, sipping tea and lost in thought. A heavy blade hangs at his side. When you approach, he nods to you.";
	text2 = "_Always good to see a soldier here. My name's Tor. I served in Fort Avernum. Welcome to the Gunston homestead._";
	text5 = "Tor is a serious fellow. He frowns and stares at the floor, lost in thought. He doesn't seem to mind your company, though. In this time of war, soldiers are always welcome.";
	action = INTRO;

begintalknode;
	state = 28;
	nextstate = 29;
	question = "_Is this your homestead?_";
	text1 = "_Aye. It is. My wife and I settled here a few years back. Do what we can to help._";
	text2 = "He looks like something is making him uncomfortable.";
	code =
		if (nephil_present() == 0)
			rs(2);
	break;
	
begintalknode;
	state = 29;
	nextstate = -1;
	condition = nephil_present() > 0;
	question = "_Is something bothering you?_";
	text1 = "_Sorry. It's just, no offense, but I've fought nephilim too long to be able to accept humans traveling with them. I don't care for their kind at all._";

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_Who is your wife?_";
	text1 = "_Carol. She's the healer for these parts._";

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_How do you help the other farmers?_";
	text1 = "_Well, you see, I was a soldier. I had the know-how, so I was a natural to help the other farmers organize when the nephilim attacks started. Haven't done it much lately, though, 'cause of those damned salamanders._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_What are the nephilim up to?_";
	text1 = "_They haven't given us a moment's peace since they built that fort to the north. I can't stand those nephil bastards._";
	text2 = "He stares pointedly at the nephil in your group. _No offense._";
	code =
		if (nephil_present() == 0)
			rs(2);
	break;

begintalknode;
	state = 28;
	nextstate = 31;
	question = "_You say that you served at Fort Avernum?_";
	text1 = "_Aye. It was where all the humans banished to Avernum by the Empire arrived. I gave weapons and stuff to the new arrivals. Everyone who arrived from the surface world went by me. I gave 'em a knife, food, and directions. Without my stuff, nobody woulda' lived long._";
	text2 = "He looks at you closely. _I think you look a little familiar._ Tor looks familiar too, now that you think of it.";
	text3 = "_Course, the Empire stopped sending people down. Fort Avernum shut down, and I left the army. Oh well. What can you do?_";
	code =
		if (nephil_present() == 0)
			rs(2);
	break;

begintalknode;
	state = 31;
	nextstate = -1;
	question = "_What is at Fort Avernum now?_";
	text1 = "_Nothing. Rubble. Abandoned after the Empire invaded. They stopped sending people to Avernum, of course, so no reason to keep the fort. I can't say that it makes me sad. Nobody new will be trapped down here._";

begintalknode;
	state = 28;
	nextstate = -1;
	condition = gf(71,5) >= 1;
	question = "_Do you know what these 'algebra' books are about?_";
	text1 = "_Those books are Carol's. Don't know nothin' about 'em. We each have our own work._";

begintalknode;
	state = 28;
	nextstate = -1;
	condition = gf(70,10) == 1;
	question = "_Do you have any idea where the magical barriers came from?_";
	text1 = "_Don't know anything about them, except that they're completely cutting us off from the rest of Avernum. Very bad._";

begintalknode;
	state = 28;
	nextstate = -1;
	question = "_Can I buy some provisions from you?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Tor's Farm","Tor can sell you simple rations for your journey.",14,5,3);
	break;
	
begintalknode;
	state = 28;
	nextstate = -1;
	condition = gf(71,3) >= 2 && gf(71,2) == 1;
	question = "_I took care of those salamanders that have been bothering you._";
	text1 = "__";
	code =
	run_hardcode(101);
	break;


begintalknode;
	state = 30;
	nextstate = -1;
	condition = gf(71,2) <= 1;
	question = "_Tell me about your salamander problem._";
	text1 = "He shakes his head. _Not long ago, a mated pair of salamanders broke in here. We tried to drive them out, but they hid in our larder, and we can't get them out. They're eatin' our stores. Kill em', and I'll reward you best I can._";
	text2 = "He points to the northeast. _The larder is down there. Be careful. They're vicious._";
	action = SET_SDF 71 2 1;
	code =
		toggle_quest(7,1);
	break;
	
begintalknode;
	state = 28;
	nextstate = -1;
	condition = gf(71,2) >= 2;
	question = "_Need any help with anything?_";
	text1 = "_Nope. Not that I can think of._";
	text2 = "_And, if it's not too much trouble, I'd appreciate it if I didn't have to spend any more time around nephilim._";
	code =
		if (nephil_present() == 0)
			rs(2);
	break;

begintalknode;
	state = 30;
	nextstate = 34;
	question = "_What did you do as a soldier?_";
	text1 = "_I was the quartermaster. I negotiated and bartered for supplies with people from all over. Listened to stories about the caves. Between that and my travels, I can tell you a lot about the caves of Avernum._";

begintalknode;
	state = 34;
	nextstate = -1;
	condition = gf(71,2) <= 1;
	question = "_Can you teach me what you've learned?_";
	text1 = "_Not now. I'm too busy keeping my farm running. It's those salamanders in the pantry. Just too much trouble._";

begintalknode;
	state = 34;
	nextstate = -1;
	condition = gf(71,2) >= 2;
	question = "_Can you teach me what you've learned?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Tor's Lessons","For a price, Tor can tell you much about what he has learned of the caves of Avernum.",13,5,3);
	break;

begintalknode;
	state = 34;
	nextstate = 28;
	condition = gf(71,2) >= 2;
	question = "_I'm sure it was all very interesting._";
	text1 = "_Avernum is an amazing place. I hope we are able to survive in it. The Empire is determined to make sure we don't._";

begintalknode;
	state = 28;
	nextstate = -1;
	question = "_I'll be going now._";
	text1 = "Tor nods. _Safe travels, soldier. I thank you for your service._";
	action = END_TALK;
	
// Jasmine

begintalknode;
	tag = 50;
	state = -1;
	nextstate = 55;
	question = "Jasmine";
	text1 = "This radiant, red-headed woman, maybe in her very early twenties, is running various farm errands. She has many small scars on her hands and arms. They show up well against the translucent white skin.";
	text2 = "She greets you with a warm smile. _Welcome! A soldier of Avernum is always welcome here. My name is Jasmine._";
	text5 = "Jasmine keeps talking with you. She doesn't seem the slightest bit self-conscious about the many scars on her hands and arms.";
	action = INTRO;

begintalknode;
	state = 55;
	nextstate = 56;
	question = "_What are you doing?_";
	text1 = "_Nicholas and I work for Tor and Carol. It's their farm. I watch the livestock, and he works the mushrooms._";
	text3 = "_Nicholas and I work for Tor and Carol. It's their farm. I watch the livestock, and he works the mushrooms._ She is clearly only still talking to you out of politeness. She doesn't like you.";
	action = DEP_ON_SDF 71 4 1;

begintalknode;
	state = 56;
	nextstate = -1;
	question = "_Tell me more about Nicholas._";
	text1 = "_He and I are engaged to be wed. Nicholas looks after the mushroom patches. There's a bunch of them to the south. Growing mushrooms is a lot of work down here, even though there's no weeds!_";

begintalknode;
	state = 56;
	nextstate = -1;
	question = "_The livestock don't seem friendly._";
	text1 = "She looks at the scars on her hands. _It's sad work. The cows are always sickly and miserable, but they're better than those lizards! Those monsters will take your hand off if you let them! But where else can we get meat?_";

begintalknode;
	state = 56;
	nextstate = 57;
	question = "_What do you think of this farm?_";
	text1 = "_This is the biggest homestead around here. Tor and Carol look after the other farms, organize defenses, that sort of thing. Nicholas and I just work for them. They're good people. They've just been under a lot of strain because of the salamanders._";

begintalknode;
	state = 57;
	nextstate = -1;
	question = "_What salamanders?_";
	text1 = "_They're down in the larder, and they're dangerous. We can't get them out. You should talk to Tor about it._";
	text3 = "She smiles. _The ones you took care of already. Thank you for helping us with those pests!_";
	action = DEP_ON_SDF 71 3 1;

begintalknode;
	state = 55;
	nextstate = 58;
	condition = gf(71,4) == 0;
	question = "_Those scars look painful._";
	text1 = "_Yes. Comes from raising giant lizards. I used to feel sad about them, but I've come to realize that, scarred or not, I look just fine._ She grins.";

begintalknode;
	state = 58;
	nextstate = -1;
	condition = gf(71,4) == 0;
	question = "_You're quite right._";
	text1 = "She blushes. The pink shows up sharply against her pale, pale skin. _You're sweet to say so. But I'm taken, soldier. Just so you know._";
	action = SET_SDF 71 4 1;

begintalknode;
	state = 58;
	nextstate = -1;
	condition = gf(71,4) == 0;
	question = "_Uhhh, if you say so. Because I wouldn't._";
	text1 = "She frowns. _Well, I'd rather have scars on every inch of my body than to be a cretin like you._";
	action = SET_SDF 71 4 2;

begintalknode;
	state = 55;
	nextstate = -1;
	question = "_I need rations._";
	text1 = "_Talk to Tor. He is in the kitchen._";

// Nicholas

begintalknode;
	tag = 70;
	state = -1;
	nextstate = 82;
	question = "Nicholas";
	text1 = "You meet a pale, harried young man. He carries a basket of mushrooms. You greet him. He nods, not setting down the mushrooms. _I'm Nicholas of Cotra._";
	text5 = "Nicholas trades gossip with you, but he's distracted. He is eager to get back to work, but he's too polite to just walk away.";
	action = INTRO;

begintalknode;
	state = 82;
	nextstate = 83;
	question = "_Working hard?_";
	text1 = "_Yes. I look after the mushroom patches. I bet you think it's easy, not like a soldier's work._";
	
begintalknode;
	state = 83;
	nextstate = -1;
	question = "_A lot of people have harder lives than you do._";
	text1 = "He picks up his mushrooms. _Well, I didn't say they didn't. It's not a competition. My life is tough enough, and the Empire is going to murder us all anyway. Good day._ He walks away.";
	action = END_TALK;
	
begintalknode;
	state = 83;
	nextstate = 84;
	question = "_Um, I'm sure farming mushrooms is difficult._";
	text1 = "_Yes! It's hard work! Bats fly down and munch on them. The fungus light is barely sufficient. Stray lizards eat them. And I have two patches to look after outside the farm. They're each a half mile long!_";
	text2 = "He sighs and looks embarrassed. _You probably think I'm being whiny._";

begintalknode;
	state = 84;
	nextstate = 85;
	question = "_Nah._";
	text1 = "_Sorry about that. It's just that we're having a problem with some salamanders. Never had problems like that in Cotra._";

begintalknode;
	state = 85;
	nextstate = -1;
	question = "_Having problems with salamanders?_";
	text1 = "_You should talk to Tor about it. He's looking to hire someone to get rid of them._";
	text3 = "_Not anymore, thanks to you._";
	action = DEP_ON_SDF 71 2 1;

begintalknode;
	state = 82;
	nextstate = 86;
	question = "_You said that you are from Cotra?_";
	text1 = "_Indeed. Jasmine and I are from Cotra, well south of here. Ever been? It's one of the six cities. Sort of out of the way, but a good place._";
	text3 = "He shakes his head sadly. _Yes. And now it is gone, smashed in an Empire raid. Curse the Empire for destroying our home. Several of our friends died in that attack._";
	action = DEP_ON_SDF 70 10 0;

begintalknode;
	state = 86;
	nextstate = -1;
	condition = 1;
	question = "_Why did you leave Cotra?_";
	text1 = "_The Empire raids were getting closer and closer. What could I do? I'm just a farmer. I decided to farm where the invaders wouldn't destroy my work._";
	text2 = "He shakes his head. _A good thing. If my beloved and I had stayed in Cotra, we would be dead now._";
	code =
		if (gf(70,10) == 0)
			rs(2);
	break;

// A Cow

begintalknode;
	tag = 90;
	state = -1;
	nextstate = 160;
	question = "A Cow";
	text1 = "A scrawny cow chews on some mushrooms distastefully.";
	text5 = "The cow looks up at you sadly.";
	action = INTRO;

begintalknode;
	state = 160;
	nextstate = 161;
	question = "_Greetings, fellow denizen of these caves._";
	text1 = "_Moo._";

begintalknode;
	state = 161;
	nextstate = -1;
	question = "_Ah. Yes. What else say you?_";
	text1 = "It chews silently on some lichen. Your conversation is at an impasse.";
	action = END_TALK;
