// creator  : weidu.exe (version 23100)
// argument : UHFEM02.DLG
// game		 : .
// source	 : ./DATA/DIALOG.BIF
// dialog	 : ./DIALOG.TLK
// dialogF  : (none)

BEGIN ~UHFEM02~ 2 // non-zero flags may indicate non-pausing dialogue
//////////////////////////////////////////////////
// WARNING: this file contains non-trivial WEIGHTs
//////////////////////////////////////////////////

IF ~~ THEN BEGIN 0 // from: UHMAY01:1.0
  SAY #31980 /* ~Oh!  We're doomed!  Doomed!  We must flee the village!~ */
  IF ~~ THEN EXTERN ~UHFARM03~ 0
END

IF ~~ THEN BEGIN 1 // from: UHFARM01:1.0
  SAY #31986 /* ~Yes!  Ever since that band of monsters moved into the area, we have had nothing but trouble!  They're eating people, that's what!~ */
  IF ~~ THEN EXTERN ~UHMAN02~ 2
END

IF WEIGHT #13 /* Triggers after states #: 5 7 8 9 10 11 14 15 16 17 18 19 20 even though they appear after this state */
~Global("VillageSaved","GLOBAL",0)
RandomNum(3,1)
~ THEN BEGIN 2 // from:
  SAY #32587 /* ~I don't see what all the fuss is about.  'Tis the ogres who have been killing everyone... that's what monsters do!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #14 /* Triggers after states #: 5 7 8 9 10 11 14 15 16 17 18 19 20 even though they appear after this state */
~Global("VillageSaved","GLOBAL",0)
RandomNum(3,2)
~ THEN BEGIN 3 // from:
  SAY #32588 /* ~You look like the decent sort who can hold a sword... why don't you go and slaughter those ogres and save us all a lot of trouble?~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #15 /* Triggers after states #: 5 7 8 9 10 11 14 15 16 17 18 19 20 even though they appear after this state */
~Global("VillageSaved","GLOBAL",0)
RandomNum(3,3)
~ THEN BEGIN 4 // from:
  SAY #32589 /* ~It's terrible!  People have been found dead in their homes, with their skins inside out!  And then their bodies even disappear!  Ander and I fled from our farmhold to be safe, here!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #3 /* Triggers after states #: 7 8 9 even though they appear after this state */
~Global("VillageSaved","GLOBAL",1)
!GlobalGT("rangerprotector","GLOBAL",0)
~ THEN BEGIN 5 // from:
  SAY #32590 /* ~We are so thankful that you saved the village!  After that first group of adventurers didn't come back, I was sure we were all lost!~ */
  IF ~Global("OgreAlliance","GLOBAL",1)
~ THEN GOTO 6
  IF ~Global("OgreAlliance","GLOBAL",0)
~ THEN EXIT
END

IF ~~ THEN BEGIN 6 // from: 15.0 11.0 5.0
  SAY #32596 /* ~I don't understand, though, why the mayor made that agreement with the ogres.  They're going to protect us?  More like, they're going to save us for their next dinner!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #0 ~Global("ParentsUpset","GLOBAL",1)
Global("JUpset","LOCALS",0)
~ THEN BEGIN 7 // from:
  SAY #32597 /* ~Somebody gave my poor baby a sword, of all things.  The gods know what he's going to do with it, leading those other boys all over the place!~ */
  IF ~~ THEN DO ~SetGlobal("JUpset","LOCALS",1)
~ EXIT
END

IF WEIGHT #1 ~Global("ParentsUpset","GLOBAL",2)
Global("JUpset","LOCALS",0)
~ THEN BEGIN 8 // from:
  SAY #32598 /* ~Oh!  I can't believe that my poor baby got ahold of a barrel of ale!  When I last saw him, he was so pale it looked like he was going to just up and die, he was so drunk!~ */
  IF ~~ THEN DO ~SetGlobal("JUpset","LOCALS",1)
~ EXIT
END

IF WEIGHT #2 ~Global("ParentsUpset","GLOBAL",3)
Global("JUpset","LOCALS",0)
~ THEN BEGIN 9 // from:
  SAY #32603 /* ~My... my poor drunken baby is leading a pair of other boys around the countryside... and he's armed!  Oh, how did this happen?  I'm so worried... those ogres are going to eat him, I just know it!~ */
  IF ~~ THEN DO ~SetGlobal("JUpset","LOCALS",1)
~ EXIT
END

IF WEIGHT #4 ~InParty("Valygar")
!Dead("Valygar")
See("Valygar")
!StateCheck("Valygar",STATE_SLEEPING)
RandomNum(2,1)
Global("JohannaValygar","LOCALS",0)
~ THEN BEGIN 10 // from:
  SAY #32604 /* ~You... I remember you.  You're the ranger who came to buy some food before you went out into the hills, didn't you?  Are... are you replacing Merella?~ */
  IF ~~ THEN DO ~SetGlobal("JohannaValygar","LOCALS",1)
~ EXTERN ~VALYGARJ~ 24
END

IF WEIGHT #5 ~GlobalGT("rangerprotector","GLOBAL",0)
!Global("umarplot","GLOBAL",1)
!Global("ogronattack","GLOBAL",1)
!GlobalGT("rangerprotector","GLOBAL",4)
!InPartySlot(LastTalkedToBy,0)~ THEN BEGIN 11 // from:
  SAY #37959 /* ~Greetings to you, my <LADYLORD>... I must tell you how grateful I am that you saved us all from those awful... shadows... or whatever they were.~ */
  IF ~Global("ogronattack","GLOBAL",0)
Global("ogrealliance","GLOBAL",1)
!Global("umarplot","GLOBAL",2)~ THEN GOTO 6
  IF ~GlobalGT("ogronattack","GLOBAL",1)
!GlobalGT("ogronattack","GLOBAL",3)
!Global("umarplot","GLOBAL",2)~ THEN GOTO 12
  IF ~Global("umarplot","GLOBAL",2)~ THEN GOTO 13
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 12 // from: 15.1 11.1
  SAY #37960 /* ~I suppose I was wrong about that... that Madulf fellow... and those other creatures, as well.  They saved Atta from those ogrons!  And... and so did you, as well, of course!~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 13 // from: 15.2 11.2
  SAY #37961 /* ~And... and now you've saved us from that person who pretended to be Umar, of all things.  You truly are a marvel!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #6 ~GlobalGT("rangerprotector","GLOBAL",4)
!InPartySlot(LastTalkedToBy,0)~ THEN BEGIN 14 // from:
  SAY #37962 /* ~Good day, my <LADYLORD>.  I... I don't care what other people say... you saved us all, once, no matter what your friend did.  You have my blessing.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #7 ~GlobalGT("rangerprotector","GLOBAL",0)
!Global("umarplot","GLOBAL",1)
!Global("ogronattack","GLOBAL",1)
!GlobalGT("rangerprotector","GLOBAL",4)
InPartySlot(LastTalkedToBy,0)~ THEN BEGIN 15 // from:
  SAY #37963 /* ~Greetings to you, ranger.  I hope you find yourself warmly welcome in our village... especially after all you have done for us.~ */
  IF ~Global("ogronattack","GLOBAL",0)
Global("ogrealliance","GLOBAL",1)
!Global("umarplot","GLOBAL",2)~ THEN GOTO 6
  IF ~GlobalGT("ogronattack","GLOBAL",1)
!GlobalGT("ogronattack","GLOBAL",3)
!Global("umarplot","GLOBAL",2)~ THEN GOTO 12
  IF ~Global("umarplot","GLOBAL",2)~ THEN GOTO 13
  IF ~~ THEN EXIT
END

IF WEIGHT #8 ~GlobalGT("rangerprotector","GLOBAL",4)
InPartySlot(LastTalkedToBy,0)~ THEN BEGIN 16 // from:
  SAY #37964 /* ~Good day to you, my <PRO_LADYLORD>.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #9 ~Global("umarplot","GLOBAL",1)~ THEN BEGIN 17 // from:
  SAY #37965 /* ~Something has to be done about that... that witch, Umar!  She's threatened to kill us all unless we leave... we cannot abandon our village!  Please, you must do something about her!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #10 ~Global("ogronattack","GLOBAL",1)
Global("ogrealliance","GLOBAL",1)
!Dead("Madulf")~ THEN BEGIN 18 // from:
  SAY #37966 /* ~There are a bunch of... of creatures trying to attack the village, my <LADYLORD>... but that ogre, Madulf, has been holding them off!  Please protect us, please!!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #11 ~Global("ogronattack","GLOBAL",1)
Global("ogrealliance","GLOBAL",0)
!Dead("Madulf")~ THEN BEGIN 19 // from:
  SAY #37967 /* ~There are a bunch of... of creatures threatening to attack the village!  That... that ogre has held them off... or tried to eat them, I don't know!  Oh, help us, please!!~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #12 ~Global("ogronattack","GLOBAL",1)
Dead("Madulf")~ THEN BEGIN 20 // from:
  SAY #37977 /* ~There are a group of those... those creatures preparing to attack the village!  The herders say they are near the caves!  Oh, you must help us, please!!~ */
  IF ~~ THEN EXIT
END
