// TOWN DIALOGUE SCRIPT
//    Town 68: Solberg's Tower

begintalkscript;

variables;

short i,j,k,r1,choice;

// Solberg

begintalknode;
	tag = 10;
	state = -1;
	nextstate = 1;
	question = "Solberg";
	text1 = "You meet an elderly wizard, slumped behind his desk. He has spent quite some time in this remote, sweltering tower, free of human company or proper opportunities to bathe.";
	text2 = "You think he's wearing mage's robes, but the stains and tears make it hard to be sure. He is ecstatic to see you. _Visitors! At last! Wonderful! I am Solberg, of the Triad of the Tower of Magi. Welcome to my humble home._";
	text3 = "He leaps up to shake your hand. It takes some effort to get him to stop.";
	text5 = "Solberg tends to you attentively, making you tea and chatting constantly. All the time out here on this lonely spire has starved him for human company.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_May I ask why you are alone here?_";
	text1 = "_A miserable tale. I am still officially a member of the Triad of the Tower of Magi. However, Avernum's foes forced me to be exiled to this miserable tower. Now boredom is my great enemy._";

begintalknode;
	state = 2;
	nextstate = 13;
	question = "_This tower doesn't seem boring._";
	text1 = "_For you, perhaps. This puny tower has been my home for seven years. That is a lot of time._";

begintalknode;
	state = 1;
	nextstate = 3;
	question = "_Can you tell me something about the Triad and the Tower of Magi?_";
	text1 = "_The Tower of Magi is, following the custom for such towers in the surface world, run by three mages. Normally, the system works. However, several years ago we had a disaster._";

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_What was the disaster?_";
	text1 = "_Linda was on the Triad then. She came up with an insane scheme to capture a demon lord in the Tower of Magi and bind it to her will. She imprisoned anyone who questioned the scheme. I came here and built this tower, so that I could repair any damage from a safe distance._";
	text2 = "_Fortunately, the beast was slain._";

begintalknode;
	state = 4;
	nextstate = -1;
	question = "_How did you manage it?_";
	text1 = "_It's a long story and I'd rather not get into all that. But then, after the demon was slain, I still had to remain here._";

begintalknode;
	state = 4;
	nextstate = 6;
	question = "_The demon is gone, but you are still here._";
	text1 = "_Yes. This tower is where I must stay. There is a simple reason. If I leave, I will very likely be assassinated._";

begintalknode;
	state = 6;
	nextstate = 7;
	question = "_Assassinated? Who would want you dead?_";
	text1 = "_Don't think I am being paranoid. Hordes of demons orbit this tower, day and night, waiting for me to leave the safety of my wards so that they may devour me. Would you like to know who their sender was?_";

begintalknode;
	state = 7;
	nextstate = -1;
	question = "_I was attacked by demons outside._";
	text1 = "_My apologies for that. I'm sure they were here to kill me. As you can see, I am not paranoid._";

begintalknode;
	state = 7;
	nextstate = -1;
	question = "_Are the demons out there just to get you?_";
	text1 = "_Yes, and more have arrived by now. Be careful wandering around here. It's me they're after, but demons are notoriously non-picky when presented with food._";

begintalknode;
	state = 7;
	nextstate = 8;
	question = "_Who would dare kill a member of the Triad?_";
	text1 = "_Well I'll tell you. Forgive me if I'm a bit windy. I so seldom get to talk to people. You see, all the most powerful mages in Avernum, me and Erika and Aimee and Patrick, we were colleagues on the surface world long ago. Us, and Garzahd._";

begintalknode;
	state = 8;
	nextstate = 30;
	question = "_What do you think of Erika?_";
	text1 = "_Damned foolish woman! She was the one who masterminded Hawthorne's assassination! She brought this mess down on our heads. We weren't ready to face the Empire!_";

begintalknode;
	state = 30;
	nextstate = 8;
	question = "_How might I reach Erika?_";
	text1 = "He grimaces. _Warriors seeing Erika. That's how we got into this mess in the first place._ He sighs. _Fine. There's an obelisk outside my tower, several miles west of here. Go read it. It might not make sense to you, at first. Remember what it says. Someday, it will help you._";

begintalknode;
	state = 8;
	nextstate = -1;
	question = "_What do you think of Aimee?_";
	text1 = "_I haven't seen her in years. She's a recluse now, traveling the planes beyond our reality. In spirit, of course, not in body._";

begintalknode;
	state = 8;
	nextstate = -1;
	question = "_What do you think of Patrick?_";
	text1 = "_He's still alive, thank the far Heavens. Won't be for long, I fear. His tower is in the southwest corner of the Great Cave. A more loyal servant our nation couldn't hope for._";

begintalknode;
	state = 8;
	nextstate = 9;
	question = "_You knew Garzahd? What was he like?_";
	text1 = "_Garzahd. Poor, foolish, paranoid Garzahd. He worked and learned with us, but could never stand the thought that others could have as much power as him. He also was the only one of us who developed political connections._";
	text2 = "_And he used those connections. Oh yes._";

begintalknode;
	state = 9;
	nextstate = 10;
	question = "_He used his political connections to do what?_";
	text1 = "_He envied our skills. He thought us a challenge to his aspirations. So he spent his time, he and Hawthorne, getting each of us exiled one after another. He did that, and spent years developing protective spells for himself._";
	text2 = "_Such a bright mind, wasted in such petty pursuits._";

begintalknode;
	state = 10;
	nextstate = 11;
	condition = gf(16,11) == 0;
	question = "_What sort of protective spells did he pursue?_";
	text1 = "_Years he spent, infusing himself with protective magics, down to the marrow of his bones. Fire, cold, poison, hostile magics, I don't think any of them can affect him anymore. Blades? Probably not._";
	text2 = "_And that's why he wants to kill me. I'm one of few who can strike him at his weak point._";

begintalknode;
	state = 11;
	nextstate = 12;
	question = "_What is Garzahd's weak point?_";
	text1 = "_His demon blood. Garzahd is half mad, I think. In his paranoid desire to protect himself, he let his essence mingle with the darker powers. Now, only magics which can harm demonkind can wound him seriously._";
	text2 = "_I have great skill dealing with demonkind, but I am trapped here. Someone else must go deal with that scoundrel._";
	code =
		sf(68,11,1);
		toggle_quest(127,3);
		toggle_quest(128,1);
	break;
	
begintalknode;
	state = 12;
	nextstate = -1;
	question = "_Wait. If you're so good at fighting demons, why are you trapped here?_";
	text1 = "_You are skilled at fighting goblins, but if you faced enough of them, they would drown you with sheer numbers. A similar fate would greet me if I dared step outside. Even for a moment._";

begintalknode;
	state = 12;
	nextstate = 15;
	question = "_How could I harm him?_";
	text1 = "_I know of a blade. It is called Demonslayer. It is hidden in Patrick's Tower. If you were to obtain it, you might be able to harm Garzahd. Might, mind you. It's not a sure thing._";

begintalknode;
	state = 13;
	nextstate = 14;
	question = "_Seven years is a lot of time._";
	text1 = "_I do my best to keep busy. I do research. Read and reread books I brought from the surface. Play with Cheeseball._ He sighs. _It would help if I had visitors. Alas, visiting me is very dangerous. The demons, you know._";

begintalknode;
	state = 14;
	nextstate = -1;
	question = "_Who is Cheeseball?_";
	text1 = "_My loyal, loving cat. He's around somewhere._";

begintalknode;
	state = 15;
	nextstate = -1;
	condition = gf(110,9) >= 1;
	question = "_Demonslayer? I have it._";
	text1 = "_Excellent. I'm glad that you were able to get permission to recover it. Now, if you did battle with Garzahd, you would have a reasonable chance of not being slain instantly. Well done._";

begintalknode;
	state = 15;
	nextstate = -1;
	condition = party_has_item(304) <= 0;
	question = "_How could I get to Demonslayer?_";
	text1 = "_I have no idea. The Castle, though, would be a good place to start looking for permission to take it. Without it, you might be able to pierce Garzahd's defenses, but it would take an awesome effort. King Micah sent you here, yes? Return to him._";
	text2 = "_Just remember, if it's extra harmful to demons, it can affect him._";

begintalknode;
	state = 1;
	nextstate = 16;
	question = "_You are a wizard? Can you teach me some spells?_";
	text1 = "_Sadly, the spells I know which might be of use to those in your line of work are not as powerful as you might desire. But I will try to assist you. I can also teach you some tricks that can make your spells more efficient._";

begintalknode;
	state = 16;
	nextstate = -1;
	question = "_I want to learn spells._";
	text1 = "You conclude your training.";
	code =
		begin_shop_mode("Solberg's Spells","Solberg is eager to give you magical training.",16,3,3);
	break;
	
begintalknode;
	state = 16;
	nextstate = -1;
	question = "_Help me make my magic more efficient._";
	text1 = "You conclude your training.";
	code =
		begin_shop_mode("Magery Training","Solberg is eager to give you magical training.",17,5,3);
	break;	
	
begintalknode;
	state = 16;
	nextstate = 1;
	condition = 1;
	question = "_I don't need any training._";
	text1 = "_Oh. Well, let's keep talking then! Have some lichen tea!_";
	
begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(68,6) >= 1;
	question = "_We found this weird orb, and we broke it._";
	text1 = "Solberg gives you a dark look. He was aware of what you did to his scrying orb, and it suddenly becomes clear that he has been exerting a great deal of energy to keep from punishing you. He suddenly needs to turn away and regain his composure.";
	action = END_TALK;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(16,11) >= 1;
	question = "_I have slain Garzahd._";
	text1 = "_I am aware of that. Though I am remote, little escapes me out here. Well done. You have risked all, and done a great deed for all of Avernum._";
	text2 = "_Soon, all of the assassins he sent after me will give up and depart. Then, at last, I can return to the Tower of Magi and the company of humanity. And I have you to thank for it. Thank you._";

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_I need to get going._";
	text1 = "_Oh. Um. You're sure I can't convince you to stay? Well, uh, safe travels to you. Feel free to return. Any time. Really. Any time._";
	action = END_TALK;

// Cheeseball

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 45;
	question = "Cheeseball";
	text1 = "A large calico cat is patrolling the tower. It is a very old cat, and its hair has adhered to every flat surface. When you get close, it looks up at you. _My name is ..._ It hacks editorially. _Cheeseball. Welcome to this horrible tower._";
	text5 = "Cheeseball meows and stretches. This takes about a minute. Then it deigns to give its attention to the conversation. _I see you are still in this miserable tower._";
	action = INTRO;

begintalknode;
	state = 45;
	nextstate = 46;
	question = "_Hello, there. Are you looking for tasty mice?_";
	text1 = "_No, human. Mice, indeed. I guard this pitiful tower._";

begintalknode;
	state = 46;
	nextstate = 47;
	question = "_Oh. Sorry. What are you protecting the tower from?_";
	text1 = "_There are demons everywhere. Pfft._";

begintalknode;
	state = 47;
	nextstate = 48;
	question = "_Yeah, demons are a problem._";
	text1 = "Cheeseball spits. _Demons. Lava. Soot. Lousy food. No lizards to eat. If I wasn't a familiar for that stupid wizard, I'd probably just jump in some lava and end it all._";

begintalknode;
	state = 48;
	nextstate = -1;
	question = "_What's a familiar?_";
	text1 = "_'Familiar.' Wizard term. It means Magical Slave Who Hates His Life._";

begintalknode;
	state = 48;
	nextstate = -1;
	question = "_What do you think of the wizard?_";
	text1 = "_His name's Solberg. He talks to me all the time. And I do mean, all the time. Even when I want to be alone. I'm sick of it._";

begintalknode;
	state = 45;
	nextstate = 49;
	question = "_The tower doesn't seem so bad._";
	text1 = "_Lies! I wonder why I bother! Look at this place! Pathetic!_ It hisses. _The best years of my life, spent here. No catnip! Nobody ever in heat! Pfaugh!_";
	text2 = "It thinks. _Don't you think you should scratch me?_";

begintalknode;
	state = 49;
	nextstate = -1;
	question = "Scratch the cat. _There you go._";
	text1 = "It purrs contentedly. It doesn't thank you. It looks very irritated when you pull your hand away.";

begintalknode;
	state = 45;
	nextstate = -1;
	question = "_Cheeseball? That's a nice name._";
	text1 = "_Hmmph. You're as bad as the wizard. This conversation is no longer worth my time._ Tail in the air, it struts away.";
	action = END_TALK;

begintalknode;
	state = 45;
	nextstate = -1;
	question = "_Cheeseball? What an awful name!_";
	text1 = "_Agreed. You clearly have at least a little more sense than my master._";


begintalknode;
	state = 45;
	nextstate = -1;
	question = "_I'll be going now._";
	text1 = "_The wise choice. I wish I could join you._";
	action = END_TALK;
