// TOWN DIALOGUE SCRIPT
//    Town 32: Mancuso

begintalkscript;

variables;

short i,j,k,r1,choice;

begintalknode;
	tag = 1;
	state = -1;
	nextstate = -1;
	condition = 1;
	text1 = "These old, irritable hellhounds are waiting in this pen for their opportunity to be converted into vahnatai food. These creatures are too weak and dispirited to have an opinion about the process.";

begintalknode;
	tag = 2;
	state = -1;
	nextstate = -1;
	condition = 1;
	text1 = "A vahnatai guard stands motionlessly at attention. When you try to speak with him, he ignores you.";

// Aristo

begintalknode;
	tag = 10;
	state = -1;
	nextstate = 1;
	question = "Aristo";
	text1 = "A vahnatai with a sour expression sits at the table, reading a ledger. He looks up when you approach.";
	text2 = "_Oh. Hello, alien. I am Aristo. How may I help you?_ Everyone referring to you as 'alien' and 'outsider' is starting to become tiring.";
	text5 = "Aristo says, without looking up, _Anything else I can do for you, alien?_ He analyzes the contents of the ledger as he speaks with you. Very rude.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What do you have for sale here?_";
	text1 = "He grunts and wriggles uncomfortably in his chair. Strange mannerisms for the normally dignified vahnatai. _I sell supplies and food. You could buy some, if you want._ He belches lightly. _Don't have much, because of the brigands._";
	text2 = "_I really wish I had some wisdom crystals, but I don't._";

begintalknode;
	state = 2;
	nextstate = 4;
	question = "_What is a wisdom crystal?_";
	text1 = "_Ah, powerful magic, made by the wizards. Small amber crystals you look into, and your mind extracts the knowledge of the world. Very prized. Very expensive. Great profit. When everything is rebuilt, the wizards will start making them again._";

begintalknode;
	state = 4;
	nextstate = -1;
	question = "_Crystals like that have been found in Avernum._";
	text1 = "_Not surprising. Vahnatai lived up there, years ago. They probably lost some, and you found them. Lucky you._";

begintalknode;
	state = 2;
	nextstate = 3;
	condition = gf(32,8) < 2;
	question = "_Tell me about your brigand problem._";
	text1 = "_There's a massive fort to the north, in the chasm tunnels, filled with thieves and raiders. They were here when we started building the town. We let the Council know about them, but nothing's been done._";

begintalknode;
	state = 2;
	nextstate = -1;
	condition = gf(32,8) > 1;
	question = "_Tell me about your brigand problem._";
	text1 = "_I hear there was a big fort of thieves up there, but their leader, this Gaddika, got killed. The survivors are still around, though, causing trouble._ He belches angrily.";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_What Council?_";
	text1 = "_In Olgai. Our leaders. They've done us no good, though, not with this problem. They're too busy worrying about other things to care about us._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Do you know anything about the tunnels to the north?_";
	text1 = "_Not much. If you go up there, watch your step. There are chasms everywhere._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Are there many brigands?_";
	text1 = "_Yes. That's why this town is so shoddily built. We had to put it up quickly to have someplace to defend in case we are attacked._";
	text3 = "_I hear there's less of them, now that Gaddika is dead, but there are still a few running around.  That's why this town is so shoddily built. We had to put it up quickly to have someplace to defend in case we are attacked._";
	action = DEP_ON_SDF 32 8 1;

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_I need some supplies._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Aristo's Supplies","Aristo has a random assortment of old equipment. Some of it seems to date from before the last Resting.",34,3,3);
	break;
	
begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I would like to sell something._";
	text1 = "You conclude your business.";	
	code = 
		begin_sell_mode();
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "Aristo nods. He says nothing else. You have been dismissed.";
	action = END_TALK;

// Vine

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 28;
	question = "Vine";
	text1 = "You meet a stocky vahnatai female. Well, stocky by the emaciated standards of the vahnatai. She holds a pitcher carved roughly from a big chunk of flawed crystal. _I am Vine. Welcome to my inn._";
	text5 = "Vine waits patiently. _How else can I help you?_";
	action = INTRO;

begintalknode;
	state = 28;
	nextstate = -1;
	question = "_Why is Mancuso so rough? It seems like it could collapse at any moment._";
	text1 = "_Mancuso is a bit rough now, but we're building quickly! Not much longer now, I suspect. It's dangerous out there. Brigands. Hellhounds. We needed to get defenses as quickly as possible._";

begintalknode;
	state = 28;
	nextstate = 29;
	question = "_What services do you provide?_";
	text1 = "_I run this inn. It's a bit rough now, but it'll be the biggest in this cave someday. We will serve Avernites, because we have been told to._";
	text2 = "_A room is 10 coins, a drink is 2. Good fluid, prepared fresh from Aeon's fields._";

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_Who is Aeon?_";
	text1 = "_My friend and helper. Works the field outside town. The best farmer around!_ She beams.";

begintalknode;
	state = 29;
	nextstate = -1;
	condition = coins_amount() >= 10;
	question = "_I could use a room to rest in._ (Pay 10 coins.)";
	text1 = "You pay the coins, and Vine shows you to your room. There are several of the awkward, fragile, narrow vahnatai beds. You end up sleeping on the floor. You don't get much rest.";
	action = END_TALK;
	code =
		revive_party();
		change_coins(-5);
		relocate_char(get_pc_id(0),16,32,FALSE);
		relocate_char(get_pc_id(1),17,32,FALSE);
		relocate_char(get_pc_id(2),17,33,FALSE);
		relocate_char(get_pc_id(3),16,33,FALSE);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = coins_amount() >= 2;
	question = "_I could use a drink._ (Pay 2 coins.)";
	text1 = "You are brought several bowls of clear, bitter fluid. It goes down easily. Then you start to feel very strange. Not drunk. Much stranger. You stagger around and see pulsating shapes out of the corners of your eyes. Vine nods approvingly. _Good, yes?_";
	code =
		set_char_status(30000,1,25);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "_Then I return to the cleaning and the preparing._";
	action = END_TALK;


// Tokor-Te

begintalknode;
	tag = 50;
	state = -1;
	nextstate = 55;
	question = "Tokor-Te";
	text1 = "There is a vahnatai male sitting here, chanting over a long, delicate waveblade. It glows gently. When you enter, he stops chanting, and the blade stops glowing.";
	text2 = "_I am Tokor-Te. Welcome to my humble shop. I am also the leader of this humble town, until someone more capable is thawed out._";
	text5 = " Tokor-Te looks up at you. His face is pocked and withered with age. You notice that his gray skin has numerous small, black flecks.";
	action = INTRO;

begintalknode;
	state = 55;
	nextstate = 56;
	question = "_May I ask about this forge?_";
	text1 = "_I run this extremely humble shop._ He looks at the shoddy, crumbling walls in distaste. _I usually offer training in the magical arts, but I am forced to spend time putting minor enchantments on our weaponry._";

begintalknode;
	state = 56;
	nextstate = -1;
	question = "_Can you teach me some magic?_";
	text1 = "You conclude your training.";
	code =
		begin_shop_mode("Tokor-Te's Spells","Tokor-Te described the spells he teaches to you. They are very similar to comparable human spells.",35,3,3);
	break;

begintalknode;
	state = 56;
	nextstate = 58;
	question = "_How can you help me become stronger in battle?_";
	text1 = "Tokor-Te stands and starts to move around. You see that he is incredibly nimble. He darts from one end of the room to the other, so fast that your eyes have trouble following him. _I can help you move like this, if you wish._";

begintalknode;
	state = 58;
	nextstate = 56;
	condition = gf(32,8) <= 1;
	question = "_Teach me! Please?_";
	text1 = "_I would like to._ He looks at you shrewdly. _But I am very distracted by our village's problems. There are certain responsibilities which weigh heavily on me._";

begintalknode;
	state = 56;
	nextstate = -1;
	condition = gf(32,8) >= 2;
	question = "_I'd like you to teach me how to fight._";
	text1 = "You conclude your training.";
	code =
		begin_shop_mode("Tokor-Te","Tokor-Te can teach you to move more nimbly in combat.",36,5,3);
	break;

begintalknode;
	state = 56;
	nextstate = 55;
	condition = 1;
	question = "_I don't need any training._";
	text1 = "_I won't force you._";
	
begintalknode;
	state = 55;
	nextstate = 57;
	question = "_Your shop seems very rough._";
	text1 = "_Not long after we awoke, a band of bandits appeared in the tunnels to the north. We had to build this city quickly to have a place to defend._ As if on cue, a stone falls out of the wall and hits the floor with a dispirited thud.";
	text2 = "_It shows._";

begintalknode;
	state = 57;
	nextstate = -1;
	question = "_Who are the bandits?_";
	text1 = "_Who they are and why they are not in harmony with our people, we do not know. All we know is that they are dangerous._";
	text3 = "_I am unsure. Even though their leader was slain, some of the strays still lurk in the passages. They are a danger still._";
	action = DEP_ON_SDF 32 8 1;

begintalknode;
	state = 55;
	nextstate = 59;
	condition = gf(32,8) <= 1;
	question = "_Is there anything I can do for you?_";
	text1 = "He gives this some thought. _I was not expecting to recruit your kind for help, but I have little choice._";
	text2 = "_To the north, there is a fort filled with rogue vahnatai. They are led by a sinister blademaster named Gaddika. They are causing us many problems. Slay Gaddika, and I will reward you as best I can._";
	text3 = "_Go to the fort to the north, in the Chasm Tunnels, and find Gaddika. Slay him. It is the only way for us to be safe._";
	action = SET_SDF 32 8 1;
	code =
		toggle_quest(22,1);
	break;

begintalknode;
	state = 59;
	nextstate = 61;
	condition = 1;
	question = "_Will I be able to enter the fort?_";
	text1 = "_A good question. Our scouts think that the front gate may be locked. For the assault, you may need a key._";

begintalknode;
	state = 61;
	nextstate = 59;
	condition = 1;
	question = "_Do you know where I can find the key?_";
	text1 = "_We do. We found some evidence. I don't want to say too much. I should just call your attention to it._";
	text2 = "_There is a small stone barn in the southeast corner of town. There was a small chamber in the back corner. We found some burned papers in it. You should look at them._";
	
begintalknode;
	state = 59;
	nextstate = 60;
	condition = gf(32,8) >= 1;
	question = "_Why did the vahnatai to the north turn on you?_";
	text1 = "_We don't know. We vahnatai are not fractious and greedy like you aliens. It is very strange that they turned on us. I have only heard one rumor, but it seems too bizarre to be believed._";

begintalknode;
	state = 60;
	nextstate = 62;
	question = "_I've heard lots of strange things in my travels. Try me._";
	text1 = "_I have heard that the rogue vahnatai believe that we should not listen to the Crystal Souls. They think that the leadership and wisdom of the Crystal Souls is not needed. I do not believe it. For a vahnatai to believe this ... It doesn't seem possible._";

begintalknode;
	state = 62;
	nextstate = -1;
	question = "_For this, they must die?_";
	text1 = "_For this, and other reasons. Reasons of private vengeance, that stretch back to before the resting. I choose not to speak of my private ... interests._";

begintalknode;
	state = 55;
	nextstate = -1;
	condition = gf(32,8) == 1 && gf(2,9) >= 1;
	question = "_I did what you asked. I have slain Gaddika._";
	code =
	run_hardcode(15);
	break;
	
begintalknode;
	state = 55;
	nextstate = -1;
	condition = gf(32,8) > 1;
	question = "_Is there anything else I can do for you?_";
	text1 = "_No. We will fight for ourselves now. You must leave us our pride._";

// Partam

begintalknode;
	tag = 70;
	state = -1;
	nextstate = 82;
	question = "Partam";
	text1 = "A vahnatai girl walks up to you and stares at you curiously. You ask her name. She backs away a few feet. _I'm Partam._";
	text5 = "Partam stares at you boldly.";
	action = INTRO;

begintalknode;
	state = 82;
	nextstate = -1;
	condition = 1;
	question = "_Why are you looking at me?_";
	text1 = "_You are interesting. I didn't know things like you existed._";

begintalknode;
	state = 82;
	nextstate = 83;
	question = "_Are you playing?_";
	text1 = "_Ummm. .._ She looks around. _I was chasing Taho. I think he's a liar._";

begintalknode;
	state = 83;
	nextstate = -1;
	question = "_Who is Taho?_";
	text1 = "She rolls her eyes. _He's my friend, but he's silly!_";

begintalknode;
	state = 83;
	nextstate = 84;
	question = "_Why did you call him a liar?_";
	text1 = "_He said he saw some humans once! Not you, others!_ She shakes her head at this. _I'm going to catch him and make him admit he was lying!_ (You take note of this.)";
	action = SET_SDF 32 11 1;

begintalknode;
	state = 84;
	nextstate = -1;
	question = "_Do you remember what he said about the other humans?_";
	text1 = "_Oh, I didn't pay attention! He was being too silly! You should ask him about it. Then beat him up!_ She gives a wicked smile that would be perfectly at home on the face of a human child. Then she runs off.";
	action = END_TALK;

// Taho

begintalknode;
	tag = 90;
	state = -1;
	nextstate = 109;
	question = "Taho";
	text1 = "A vahnatai boy watches you nervously from a safe distance away. You gently approach and ask his name. He backs away a little. You think you hear him say, in a quiet voice, _Taho._";
	text5 = "Taho backs away a little more. You scare him.";
	action = INTRO;

begintalknode;
	state = 109;
	nextstate = 110;
	question = "_Come over here. I'd like to speak with you._";
	text1 = "He makes an odd hand gesture. Then he backs farther away.";

begintalknode;
	state = 110;
	nextstate = -1;
	question = "_What was that gesture?_";
	text1 = "He makes it again. Then he runs away. It didn't seem like an insult, but you can't be sure.";
	action = END_TALK;

begintalknode;
	state = 109;
	nextstate = 112;
	condition = gf(32,11) >= 1;
	question = "_I know who you are, Taho, and what you saw._";
	text1 = "He look surprised, but he doesn't say anything.";

begintalknode;
	state = 112;
	nextstate = 113;
	question = "_I believe that you saw some humans._";
	text1 = "His eyes light up, and he runs up to you. _You know about it? I saw some humans in the silo! I did! They talked to some vahnatai! I saw it! You should believe me!_";
	action = SET_SDF 32 13 1;

begintalknode;
	state = 113;
	nextstate = -1;
	question = "_Where is the silo?_";
	text1 = "_That way! Edge of town._ He points southeast.";

begintalknode;
	state = 113;
	nextstate = -1;
	question = "_Well, I believe you._";
	text1 = "_Nobody else does._ He looks offended at this. _Nobody. But I saw it. With these eyes!_ He points at his eyes, for clarity. Then he runs away.";
	action = END_TALK;

begintalknode;
	state = 113;
	nextstate = -1;
	condition = gf(32,13) == 0;
	question = "_Humans? Down here? You are lying!_";
	text1 = "_I'm not! I'm not! I saw them!_ Upset, he runs away.";
	action = END_TALK;

// Aeon

begintalknode;
	tag = 110;
	state = -1;
	nextstate = 136;
	question = "Aeon";
	text1 = "This vahnatai woman is planting a row of mushrooms. You watch as she lays down a thin layer of fertilizer and then places bits of mushroom spore into it.";
	text2 = "When she sees you, she stands and wipes off her hands. _I am Aeon._ She wears a large waveblade.";
	text5 = "Aeon works hard on her crops. You watch as she smears small lumps of mushroom spores on the bare rock of the cave floors, and then meticulously covers them with fertilizer paste.";
	text6 = "The waveblade hangs heavily at her side. It is slightly pitted and dotted with rust. It isn't as well-maintained as the blades of the guards.";
	action = INTRO;

begintalknode;
	state = 136;
	nextstate = 137;
	question = "_You're a farmer?_";
	text1 = "_I plant and tend my crops. And defend them if necessary._ She looks down at a long waveblade she wears at her side.";

begintalknode;
	state = 137;
	nextstate = 138;
	question = "_Looks like a fine crop._";
	text1 = "_It's a lot of work, but ..._ She looks around at the proud rows of mushrooms around her. _I'm proud to have created all this._";

begintalknode;
	state = 138;
	nextstate = -1;
	question = "_Do you just grow mushrooms?_";
	text1 = "_Mushrooms now. Lichen later._ She pats her stomach in anticipation.";

begintalknode;
	state = 137;
	nextstate = 139;
	question = "_Defend from who?_";
	text1 = "_From hellhounds and brigands._";

begintalknode;
	state = 139;
	nextstate = 141;
	question = "_Sounds pretty messy. Where are they attacking from?_";
	text1 = "_Hellhounds from the south and sometimes the north, brigands from the north. I'm getting good with this thing._ She pats the blade proudly.";

begintalknode;
	state = 141;
	nextstate = -1;
	condition = gf(32,8) < 2;
	question = "_I'd like to know more about the brigands._";
	text1 = "_You should talk to Tokor-Te, inside the town._";

begintalknode;
	state = 136;
	nextstate = 140;
	question = "_That's a nice weapon._";
	text1 = "_It is necessary. Hellhounds are about._";

begintalknode;
	state = 140;
	nextstate = 142;
	condition = gf(32,12) <= 1;
	question = "_I am a brave adventurer. I love to help people with their problems._";
	text1 = "_Really? Well, the hellhounds live in the tunnels to the north. Many packs, though they are young specimens. If you have nothing else to do, I would really appreciate it if you killed them._";
	text2 = "_They wander the halls near the chasms, looking for prey._";
	action = SET_SDF 32 12 1;
	code =
		toggle_quest(23,1);
	break;
	
begintalknode;
	state = 142;
	nextstate = -1;
	condition = gf(32,12) == 0;
	question = "_Oh._";
	text1 = "_Yes, it's a problem. But we'll deal with it in time. Now, if you'll excuse me, I need to return to work._";
	action = END_TALK;

begintalknode;
	state = 136;
	nextstate = -1;
	condition = gf(177,11) >= 1 && gf(32,12) == 1;
	question = "_I killed many hellhounds in the northern tunnels._";
	code =
	run_hardcode(16);
	break;


