// TOWN DIALOGUE SCRIPT
//    Town 82: Barrier Tower

begintalkscript;

variables;

short i,j,k,r1,choice;

// Pyrn

begintalknode;
	tag = 10;
	state = -1;
	nextstate = 1;
	question = "Pyrn";
	text1 = "The man before you is a wreck. He clearly has been without sleep for some time, and (as your nose indicates) he has not bathed for weeks. His wizard's robes are crumpled and stained.";
	text2 = "All of his attention is directed at the man in the circle. It takes some time to get him to notice you. When he does, he gasps, _I am Pyrn._";
	text5 = "Pyrn barely seems to notice that you're there. _I'm Pyrn,_ he says. Then, he says it again, as if he forgot that he told you.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_Are you all right?_";
	text1 = "_Demon._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_What demon? Where?_";
	text1 = "His eyes continue to fail to focus on you. _Demon. Every hour. All time. Must focus._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_How long have you been doing this?_";
	text1 = "_Days and days and days. Not talk. Focus._";

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_What are you focusing on?_";
	text1 = "_Demon will control. Strong. Must battle and battle._";

begintalknode;
	state = 4;
	nextstate = -1;
	question = "_Battling for control of what?_";
	text1 = "_Should not talk. Must focus. Sometimes he controls me. Must focus. Must control it._ His face suddenly started twitching, spasms racing back and forth across his face. Slowly, he regains control, but he also forgets that you are here.";
	action = END_TALK;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(3,8) >= 1;
	question = "_I need to find a book on teleportation portals._";
	text1 = "He suddenly starts to struggle, trying to gain a few moments of lucidity. He looks at you. _On west wall, southernmost bookshelf. Red book._";
	text2 = "Then his eyes glaze over. He groans and grips his head, then moans. It takes some time for him to regain control.";
	action = SET_SDF 82 5 1;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(82,10) >= 1 && gf(82,12) == 0;
	question = "_There's a book in the back room. It's trapped. Can you tell me how to pass the trap?_";
	text1 = "Pyrn makes a brief motion with his hand. _Trap gone. You can read. Just stay away from pentagram._";
	text3 = "_I turned off trap. Stop distracting me._";
	code =
		if (gf(82,12) == 0) {
			sf(82,12,1);
			rs(3);
			}
			else rs(1);
	break;
	
begintalknode;
	state = 4;
	nextstate = -1;
	question = "_How can I help you to defeat the demon?_";
	text1 = "_You can't. I will break its will, but it ... takes ... time. Just don't ... distract me._ Muscles all over his body twitch randomly. _Stay out of circle._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(82,6) >= 1;
	question = "_I found the book. Thank you. How can we leave your tower?_";
	text1 = "_Just... look around. There is way out._ Then he points to the northwest corner of the tower. _Hidden door. There._";
	text2 = "_Just leave now. Will break down demon. Soon._";
	action = END_TALK;
	
begintalknode;
	state = 1;
	nextstate = -1;
	question = "_How can I get back to the Tower of Magi?_";
	text1 = "He shakes his head, pained and distracted. Then he points to the northwest corner of the tower. _Hidden door. There._";
	text2 = "_Just leave now. Will break down demon. Soon._";
	action = END_TALK;

// Pyrn

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 28;
	question = "Pyrn";
	text1 = "A frail man in wizard's robes lies prone inside the pentagram. His robe is torn, and scratches and burns cover his body. He moans. You ask who he is. _I am Pyrn. Must not talk. Must fight._";
	text5 = "Pyrn looks up at you, barely able to turn his head. He doesn't look like he'll be alive for much longer.";
	action = INTRO;

begintalknode;
	state = 28;
	nextstate = 29;
	question = "_What is wrong?_";
	text1 = "_Must gain control. Must be free._";

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_Control what?_";
	text1 = "_Demon. Control demon._";

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_How can I free you?_";
	text1 = "_My pentagram. Must slay demon. Demon tricked me. Put me in my pentagram._ Suddenly a seizure grips him, spasms wrenching him back and forth inside the pentagram. Then, as suddenly as it began, the writhing ends.";

begintalknode;
	state = 30;
	nextstate = 28;
	question = "_What demon? Where is it?_";
	text1 = "The words suddenly become much more painful to say. _Over there._ He points at the distracted wizard standing outside the pentagram. _Don't ... let him ... fool you. Mustn't talk. Too much energy. Need help._ ";

begintalknode;
	state = 28;
	nextstate = -1;
	condition = gf(82,13) >= 1;
	question = "_I need a book about teleportation portals, please can you help?_";
	text1 = "For a moment, it's as if he didn't hear you. Then he says, _First free me. Then I kill demon. Then I get book for you._";

begintalknode;
	state = 28;
	nextstate = -1;
	question = "_What do you want me to do?_";
	text1 = "He speaks through tightly clenched teeth. _Demon put me in here. Free me. Walk into circle. Break circle. Help._ He slips into unconsciousness.";
	action = END_TALK;

