// creator  : weidu.exe (version 23100)
// argument : GORMAD1.DLG
// game		 : .
// source	 : ./override/GORMAD1.DLG
// dialog	 : ./DIALOG.TLK
// dialogF  : (none)

BEGIN ~GORMAD1~
//////////////////////////////////////////////////
// WARNING: this file contains non-trivial WEIGHTs
//////////////////////////////////////////////////

IF WEIGHT #2 /* Triggers after states #: 6 33 even though they appear after this state */
~NumTimesTalkedTo(0)
Global("Yakman","GLOBAL",0)~ THEN BEGIN 0 // from:
  SAY #63236 /* ~Wh-wh-what?!  Yakman... Yakman sees people before him... but they must be illusions!  Yes, Yakman is seeing illusions!  Delusionary Yakman!~ [GORMAD07] */
  IF ~~ THEN REPLY #63239 /* ~Yakman?  Is that your name, elf?  Yakman?~ */ GOTO 1
  IF ~~ THEN REPLY #63240 /* ~Hold, whoever you are!  I have questions!~ */ GOTO 3
  IF ~~ THEN REPLY #63241 /* ~I am quite real, I assure you.~ */ GOTO 4
  IF ~~ THEN REPLY #63242 /* ~A mad elf?  I'll put you out of your misery soon enough.~ */ GOTO 5
END

IF ~~ THEN BEGIN 1 // from: 0.0
  SAY #63243 /* ~Yakman talk talk talk all the time, he was told... Talkative Yakman!  Once came with party, all looking for treasure, Yakman talk-talk-talk-talk all the time.  Now they are all dead and only Yakman left, lost-lost.  Lonely Yakman!~ [GORMAD08] */
  IF ~~ THEN GOTO 2
END

IF ~~ THEN BEGIN 2 // from: 5.0 4.0 3.0 1.0
  SAY #63244 /* ~W-wait!  You speak?  Illusions that speak?!  No!  Demons covered in illusions!  M-m-must get away from the demons, sneak away!  Sneaky Yakman!!~ [GORMAD12] */
  IF ~~ THEN DO ~DialogueInterrupt(FALSE)
SetGlobal("Yakman","GLOBAL",1)
SetGlobal("Move","LOCALS",1)
~ EXIT
END

IF ~~ THEN BEGIN 3 // from: 0.1
  SAY #63245 /* ~Questions!  Yakman once had questions... talk-talk-talk-talk all the time, his friends say.  We come here, look for treasure... now only Yakman lives. Lonely Yakman!~ [GORMAD09] */
  IF ~~ THEN GOTO 2
END

IF ~~ THEN BEGIN 4 // from: 0.2
  SAY #63246 /* ~Yakman once think he was real.  Talk-talk-talk all the time, his friends say.  We come here to look for treasure... now only Yakman left alive. Lonely Yakman!~ [GORMAD10] */
  IF ~~ THEN GOTO 2
END

IF ~~ THEN BEGIN 5 // from: 0.3
  SAY #63247 /* ~Misery?  Poor, poor, lost Yakman.  Yakman wander-wander, never find way out.  Demons everywhere, all friends dead and gone.  Only Yakman left, Lonely Yakman!~ [GORMAD11] */
  IF ~~ THEN GOTO 2
END

IF WEIGHT #0 ~Global("Attacked","LOCALS",1)~ THEN BEGIN 6 // from: 24.4 23.4 10.2 8.3
  SAY #63248 /* ~Aaaah!!  AAAAHH!!  The illusionary demons are attacking!  Must fight!  Battle Yakman!!  BATTLE YAKMAN!!~ [GORMAD13] */
  IF ~~ THEN DO ~SetGlobal("zGorMad1","GLOBAL",1)
Enemy()
~ EXIT
END

IF WEIGHT #3 /* Triggers after states #: 33 even though they appear after this state */
~Global("Yakman","GLOBAL",1)
!Race(LastTalkedToBy,ELF)
!CheckStatGT(LastTalkedToBy,15,CHR)~ THEN BEGIN 7 // from:
  SAY #63249 /* ~Wh--?  No!  No, get away from me!!  Demons!!  Demons in illusions!!  Aaaah!!  Frightened Yakman!  Must get away!~ [GORMAD15] */
  IF ~~ THEN DO ~RunAwayFrom(LastTalkedToBy,30)~ EXIT
END

IF WEIGHT #4 /* Triggers after states #: 33 even though they appear after this state */
~Global("Yakman","GLOBAL",1)
OR(2)
Race(LastTalkedToBy,ELF)
CheckStatGT(LastTalkedToBy,15,CHR)~ THEN BEGIN 8 // from:
  SAY #63295 /* ~Please don't hurt me, demon!  Don't hurt me!  Helpless Yakman!  Frightened Yakman!!~ [GORMAD16] */
  IF ~True()~ THEN REPLY #63319 /* ~Calm down, calm down.  Look closer at me... not demon, just <RACE>.~ */ GOTO 11
  IF ~True()~ THEN REPLY #63320 /* ~I am not here to harm you.  I do have some questions, however.~ */ GOTO 10
  IF ~True()~ THEN REPLY #63321 /* ~Keep out of my way, madman, lest I be forced to kill you!~ */ GOTO 9
  IF ~True()~ THEN REPLY #63328 /* ~I'll do more than hurt you, pest!!~ */ GOTO 6
  IF ~Name("Viconia",LastTalkedToBy)
GlobalGT("Chapter","GLOBAL",7)
~ THEN EXTERN ~VICON25J~ 28
  IF ~Name("Aerie",LastTalkedToBy)
GlobalGT("Chapter","GLOBAL",7)
~ THEN EXTERN ~AERIE25J~ 27
  IF ~Name("Keldorn",LastTalkedToBy)
GlobalGT("Chapter","GLOBAL",7)
~ THEN EXTERN ~KELDO25J~ 10
END

IF ~~ THEN BEGIN 9 // from: 10.1 8.2
  SAY #63349 /* ~Yes, yes!  Yakman keep away!  Running Yakman, Running Yakman!!~ */
  IF ~~ THEN DO ~RunAwayFrom(LastTalkedToBy,10)~ EXIT
END

IF ~~ THEN BEGIN 10 // from: 8.1
  SAY #63350 /* ~Questions?  Demons with questions?!  Demons never ask questions before!  Nervous Yakman!  Yakman must be clever and lie to demons!  Sneaky Yakman!~ */
  IF ~~ THEN REPLY #63354 /* ~Calm down, calm down!  I'm not a demon!~ */ GOTO 11
  IF ~~ THEN REPLY #63357 /* ~This is pointless.  Begone with you!!~ */ GOTO 9
  IF ~~ THEN REPLY #63359 /* ~I've had enough of this.  Time to die, madman!~ */ GOTO 6
END

IF ~~ THEN BEGIN 11 // from: 10.0 8.0
  SAY #63360 /* ~Oh, well that's okay, then.~ */
  IF ~~ THEN REPLY #63361 /* ~Uhhh... okay.  Just who are you, exactly?~ */ GOTO 12
  IF ~~ THEN REPLY #63362 /* ~I... see.  What were you saying about demons?~ */ GOTO 13
  IF ~~ THEN REPLY #63363 /* ~Well, that was easy.  What can you tell me about this place?~ */ GOTO 14
  IF ~~ THEN REPLY #63364 /* ~Good.  Now why don't you, uh, go to sleep or something.~ */ GOTO 16
END

IF ~~ THEN BEGIN 12 // from: 25.0 20.0 13.0 11.0
  SAY #63365 /* ~Yakman not remember.  Forgetful Yakman.  Yakman has been Yakman for so long, wandering here, he cannot remember being anything other than Yakman.~ */
  IF ~~ THEN REPLY #63366 /* ~Well, just how long have you been here?~ */ GOTO 17
  IF ~~ THEN REPLY #63367 /* ~You mentioned something about demons.~ */ GOTO 13
  IF ~~ THEN REPLY #63368 /* ~What can you tell me about this level?~ */ GOTO 14
  IF ~~ THEN REPLY #63369 /* ~Okay, sure... maybe it's time for you to take a nap.  Sleepy Yakman?~ */ GOTO 16
  IF ~~ THEN REPLY #63370 /* ~Alright, that's all I need to ask.~ */ GOTO 19
END

IF ~~ THEN BEGIN 13 // from: 25.1 18.0 15.1 12.1 11.1
  SAY #63371 /* ~Lots of demons, yes.  Lots of scary demons!  Frightened Yakman!  Yakman run run run away when demons close... that not so hard because demons are always fighting each other!~ */
  IF ~~ THEN REPLY #63372 /* ~Who are you, exactly?~ */ GOTO 12
  IF ~~ THEN REPLY #63373 /* ~Why are the demons fighting each other?~ */ GOTO 20
  IF ~~ THEN REPLY #63374 /* ~What can you tell me about this level?~ */ GOTO 14
  IF ~~ THEN REPLY #63375 /* ~I see.  Maybe it's time for you to sleep for awhile, yes?~ */ GOTO 16
  IF ~~ THEN REPLY #63376 /* ~Alright, that's all I need to ask.~ */ GOTO 19
END

IF ~~ THEN BEGIN 14 // from: 25.2 20.1 18.1 13.2 12.2 11.2
  SAY #63377 /* ~Yakman run run run around all the time.  Yakman knows this place really well, yes indeedy.  Knowledgable Yakman!  Maze of portals, portals lead to rooms rooms and more rooms!~ */
  IF ~~ THEN GOTO 15
END

IF ~~ THEN BEGIN 15 // from: 14.0
  SAY #63378 /* ~Some rooms have demons.  Scary demons.  Demons come through portals, sometimes.  Demons angry, can't get out.  Yakman know way out, though.  Smart Yakman!~ */
  IF ~~ THEN REPLY #63379 /* ~The way out?  To the next level?  How does someone get out?~ */ GOTO 21
  IF ~~ THEN REPLY #63380 /* ~What about these demons?  Are there many of them?~ */ GOTO 13
END

IF ~~ THEN BEGIN 16 // from: 32.1 20.2 18.2 13.3 12.3 11.3
  SAY #63381 /* ~You want Yakman to sleep?  Yakman never sleep!~ */
  IF ~~ THEN REPLY #63382 /* ~You never sleep?  You must sleep.  If you didn't sleep, it would drive you... oh.~ */ GOTO 22
  IF ~~ THEN REPLY #63383 /* ~Then just be quiet.  I have no more questions for you.~ */ GOTO 19
END

IF ~~ THEN BEGIN 17 // from: 12.0
  SAY #63384 /* ~Yakman here a long, long time.  Yakman come with friends long time ago, friends who want to look for treasure.  Yakman want treasure, too!  Rich Yakman!~ */
  IF ~~ THEN GOTO 18
END

IF ~~ THEN BEGIN 18 // from: 17.0
  SAY #63385 /* ~Friends get things for ritual as Yakman watch.  Statues come to life, then, and poor Yakman escape through portal.  Cowardly Yakman!  Friends die.  Yakman stuck here.  Lonely Yakman.~ */
  IF ~~ THEN REPLY #63386 /* ~You mentioned something about demons.~ */ GOTO 13
  IF ~~ THEN REPLY #63387 /* ~What can you tell me about this level, then?~ */ GOTO 14
  IF ~~ THEN REPLY #63388 /* ~Okay, sure... maybe you should go to sleep or something.~ */ GOTO 16
  IF ~~ THEN REPLY #63389 /* ~Alright, that's all I need to ask.~ */ GOTO 19
END

IF ~~ THEN BEGIN 19 // from: 32.2 25.3 24.3 23.3 22.4 20.3 18.3 16.1 13.4 12.4
  SAY #63390 /* ~Yakman wait here, then.  Yakman keep watch for the demons.  Paranoid Yakman.  Well... not really paranoid since demons really come, oh yes.~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 20 // from: 13.1
  SAY #63392 /* ~Some demons just hate other demons.  Demons have own reasons, Yakman guesses.  Yakman not mind.  Being second on lunch menu means Yakman survive.~ */
  IF ~~ THEN REPLY #63393 /* ~Tell me about yourself, then.  Who are you, exactly?~ */ GOTO 12
  IF ~~ THEN REPLY #63394 /* ~What can you tell me about this level?~ */ GOTO 14
  IF ~~ THEN REPLY #63395 /* ~I see.  Maybe it's time for you to sleep for awhile, yes?~ */ GOTO 16
  IF ~~ THEN REPLY #63396 /* ~Alright, that's all I need to ask.~ */ GOTO 19
END

IF ~~ THEN BEGIN 21 // from: 15.0
  SAY #63397 /* ~Yakman know... know way out, but... ummm.  Way out is broken.  Yakman not mean to break it, but is broken.  Stupid, stupid Yakman!~ */
  IF ~~ THEN REPLY #63399 /* ~What's broken?  Is it fixable?~ */ GOTO 29
END

IF ~~ THEN BEGIN 22 // from: 16.0
  SAY #63400 /* ~Yakman used to sleep, long time ago.  But it get cold, so cold.  Frozen Yakman!  Demons come and it get cold.  No sleep make Yakman go crazy, Yakman knows.  Crazy Yakman!~ */
  IF ~~ THEN REPLY #63403 /* ~You can sleep now, if you like.  I'll guard you.~ */ GOTO 23
  IF ~OR(2)
Class(LastTalkedToBy,CLERIC_ALL)
CheckStatGT(LastTalkedToBy,14,WIS)~ THEN REPLY #63408 /* ~Maybe a Heal spell will help restore your sanity?~ */ GOTO 26
  IF ~~ THEN REPLY #63410 /* ~We could destroy the demons around here... then you could sleep.~ */ GOTO 24
  IF ~~ THEN REPLY #63411 /* ~Never mind, then.  I have other questions to ask.~ */ GOTO 25
  IF ~~ THEN REPLY #63412 /* ~Then just be quiet.  I have things to do.~ */ GOTO 19
END

IF ~~ THEN BEGIN 23 // from: 24.1 22.0
  SAY #63413 /* ~Yakman stupid, but not that stupid.~ */
  IF ~OR(2)
Class(LastTalkedToBy,CLERIC_ALL)
CheckStatGT(LastTalkedToBy,14,WIS)~ THEN REPLY #63414 /* ~Maybe a Heal spell will help restore your sanity?~ */ GOTO 26
  IF ~~ THEN REPLY #63415 /* ~I could destroy the demons around here... then you could sleep.~ */ GOTO 24
  IF ~~ THEN REPLY #63416 /* ~Never mind, then.  I have other questions to ask.~ */ GOTO 25
  IF ~~ THEN REPLY #63417 /* ~Then just be quiet.  I have things to do.~ */ GOTO 19
  IF ~~ THEN REPLY #63418 /* ~Then how about I put you out of your misery once and for all, you miserable wretch!~ */ GOTO 6
END

IF ~~ THEN BEGIN 24 // from: 23.1 22.2
  SAY #63419 /* ~That would be nice, but more demons would come.  More demons always come.  This Yakman knows.~ */
  IF ~OR(2)
Class(LastTalkedToBy,CLERIC_ALL)
CheckStatGT(LastTalkedToBy,14,WIS)~ THEN REPLY #63420 /* ~Maybe a Heal spell will help restore your sanity?~ */ GOTO 26
  IF ~~ THEN REPLY #63421 /* ~Perhaps I could guard you while you sleep?~ */ GOTO 23
  IF ~~ THEN REPLY #63422 /* ~Never mind, then.  I have other questions to ask.~ */ GOTO 25
  IF ~~ THEN REPLY #63423 /* ~Then just be quiet.  I have things to do.~ */ GOTO 19
  IF ~~ THEN REPLY #63424 /* ~Then how about I put you out of your misery once and for all, you miserable wretch!~ */ GOTO 6
END

IF ~~ THEN BEGIN 25 // from: 32.0 24.2 23.2 22.3
  SAY #63425 /* ~Okey-dokey, ask away.  Yakman ready, yes <SIRMAAM>.~ */
  IF ~~ THEN REPLY #63427 /* ~Just who are you, exactly?~ */ GOTO 12
  IF ~~ THEN REPLY #63430 /* ~What were you saying about demons?  Are there demons here?~ */ GOTO 13
  IF ~~ THEN REPLY #63431 /* ~What can you tell me about this place?~ */ GOTO 14
  IF ~~ THEN REPLY #63432 /* ~Never mind.~ */ GOTO 19
END

IF ~~ THEN BEGIN 26 // from: 24.0 23.0 22.1
  SAY #63433 /* ~Yakman has no idea.  Yakman not know such a spell.~ */
  IF ~Class(LastTalkedToBy,CLERIC_ALL)~ THEN REPLY #63434 /* ~I meant me, of course.~ */ GOTO 27
  IF ~!Class(LastTalkedToBy,CLERIC_ALL)~ THEN REPLY #63435 /* ~I meant a cleric, of course.~ */ GOTO 27
END

IF ~~ THEN BEGIN 27 // from: 26.1 26.0
  SAY #63437 /* ~Someone else besides Yakman is crazy?  Maybe they are in greater need of Heal spell than Yakman.  Yakman can wait.  Yakman waited long time.  Patient Yakman!~ */
  IF ~~ THEN REPLY #63438 /* ~I meant... oh, never mind.~ */ GOTO 28
END

IF ~~ THEN BEGIN 28 // from: 27.0
  SAY #63439 /* ~And you thinks Yakman is crazy...~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 29 // from: 21.0
  SAY #63441 /* ~Maze lead to big cavern with portal, portal is way out.  Yakman know this!  Smart Yakman!  But... Yakman trip and break portal.  Portal broken!  Clumsy Yakman!~ */
  IF ~~ THEN GOTO 30
END

IF ~~ THEN BEGIN 30 // from: 29.0
  SAY #63443 /* ~Now portal broken.  Demons come through portal.  Demons come and be trapped in maze because portal broken.  Portal must be fixed with rod, Yakman knows!~ */
  IF ~~ THEN REPLY #63444 /* ~Fixed with a rod?  What rod are you talking about?~ */ GOTO 31
END

IF ~~ THEN BEGIN 31 // from: 30.0
  SAY #63445 /* ~Yakman has rod, but... rod broken, too.  Rod need three gems and gems fall off when Yakman run.  Yakman not know where gems are.  You can have rod... in junk pile, it is.  Generous Yakman!~ */
  IF ~~ THEN REPLY #63448 /* ~How do I reach this cavern where the broken portal is?~ */ GOTO 32
END

IF ~~ THEN BEGIN 32 // from: 31.0
  SAY #63449 /* ~Yakman forget.  Yakman always forget.  Forgetful Yakman!  Yakman write it down in journal... must be around here somewhere...~ */
  IF ~~ THEN REPLY #63451 /* ~I see.  I have some more questions for you.~ */ GOTO 25
  IF ~~ THEN REPLY #63452 /* ~Thank you, Yakman.  Why don't you... go to sleep or something?~ */ GOTO 16
  IF ~~ THEN REPLY #63453 /* ~Alright, I have no more questions.~ */ GOTO 19
END

IF WEIGHT #1 ~Global("Healed","LOCALS",1)
Global("Yakman","GLOBAL",1)~ THEN BEGIN 33 // from:
  SAY #63455 /* ~Wh... what?  Who?  ... who are you?~ [GORMAD14] */
  IF ~~ THEN REPLY #63457 /* ~Don't you remember me, Yakman?  I am <GABBER>.~ */ DO ~AddXP2DA("PLOT3C")~ GOTO 34
  IF ~~ THEN REPLY #63458 /* ~I think the spell may have worked.  How do you feel, Yakman?~ */ DO ~AddXP2DA("PLOT3C")~ GOTO 34
  IF ~~ THEN REPLY #63459 /* ~Calm down, Yakman.  I don't need you freaking out again.~ */ DO ~AddXP2DA("PLOT3C")~ GOTO 34
END

IF ~~ THEN BEGIN 34 // from: 33.2 33.1 33.0
  SAY #63462 /* ~'Yakman'?  That... that was that ridiculous nickname that atrocious little halfling kept calling me.  My name is Tamorlin.  Wh... where is my party?  Where am I?~ [GORMAD17] */
  IF ~~ THEN REPLY #63464 /* ~This is the Watcher's Keep.  You've been here alone for quite some time, by the looks of it.~ */ GOTO 35
  IF ~~ THEN REPLY #63465 /* ~Your party is gone.  Do you remember nothing?~ */ GOTO 37
  IF ~~ THEN REPLY #63466 /* ~You've been wandering this maze for years... I just restored your sanity.~ */ GOTO 36
  IF ~!Alignment(LastTalkedToBy,MASK_GOOD)
OR(3)
Alignment(LastTalkedToBy,MASK_EVIL)
Alignment(LastTalkedToBy,MASK_CHAOTIC)
Alignment(LastTalkedToBy,NEUTRAL)~ THEN REPLY #63467 /* ~Never mind that.  I just restored your mind and I expect payment in kind.~ */ GOTO 38
END

IF ~~ THEN BEGIN 35 // from: 34.0
  SAY #63468 /* ~The... Watcher's Keep.  That all seems... so long ago.  I remember I tried to use the Staff of Radiance to restore the damage done to the portal, and... and that's it.~ */
  IF ~~ THEN GOTO 36
END

IF ~~ THEN BEGIN 36 // from: 37.0 35.0 34.2
  SAY #63469 /* ~Thank you, truly, for restoring my mind to one piece.  I... I would have wandered here, forever, I think.  I must get out and return to my life, whatever is left of it.  Is the level above clear?~ */
  IF ~~ THEN REPLY #63472 /* ~Yes, I believe it still is.~ */ GOTO 39
  IF ~~ THEN REPLY #63473 /* ~It might be, I am not sure.~ */ GOTO 39
  IF ~~ THEN REPLY #63474 /* ~Why do you not join with me until we leave here?~ */ GOTO 40
END

IF ~~ THEN BEGIN 37 // from: 34.1
  SAY #63470 /* ~I... bits and pieces, perhaps.  It all seems so long ago.  I remember I tried to use the Staff of Radiance to repair the damage done to the final portal... and then nothing.~ */
  IF ~~ THEN GOTO 36
END

IF ~~ THEN BEGIN 38 // from: 34.3
  SAY #63471 /* ~Payment?  You mean... service?  No!  I must return to my life!  My... my wife and my son!  They must still be alive, I must return to them, I beg you!~ */
  IF ~~ THEN REPLY #63477 /* ~Very well, then, go if you must.~ */ GOTO 39
  IF ~~ THEN REPLY #63478 /* ~I won't force you, but I could use your assistance in my group.~ */ GOTO 40
  IF ~~ THEN REPLY #63479 /* ~You have little choice.  Serve me or die, elf.~ */ GOTO 41
END

IF ~~ THEN BEGIN 39 // from: 38.0 36.1 36.0
  SAY #63475 /* ~Then I shall go through the entrance portal and leave.  I do not know why I didn't, before... too afraid, I suppose.  I cannot thank you enough, my <LADYLORD>, for freeing me.  Fare you well!~ */
  IF ~~ THEN DO ~SetInterrupt(FALSE)
DialogInterrupt(FALSE)
MoveToObject("Tran3003")
CreateVisualEffectObject("ICRMPAR2","Tran3003")
SmallWait(10)
DestroySelf()
~ EXIT
END

IF ~~ THEN BEGIN 40 // from: 38.1 36.2
  SAY #63476 /* ~I... I cannot.  To join another group, I... I must return to my family, my <LADYLORD>.  I truly cannot thank you enough, but I *must* take this chance and go.  Good luck, my <LADYLORD>.~ */
  IF ~~ THEN DO ~SetInterrupt(FALSE)
DialogInterrupt(FALSE)
MoveToObject("Tran3003")
CreateVisualEffectObject("ICRMPAR2","Tran3003")
SmallWait(10)
DestroySelf()
~ EXIT
END

IF ~~ THEN BEGIN 41 // from: 38.2
  SAY #63480 /* ~No!  No, you cannot force me!  I... I will fight you!!~ */
  IF ~~ THEN DO ~Enemy()
SetInterrupt(FALSE)
AttackOneRound(LastTalkedToBy)
RunAwayFrom(LastTalkedToBy,90)
SetInterrupt(TRUE)~ EXIT
END
