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

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

IF WEIGHT #2 /* Triggers after states #: 4 7 even though they appear after this state */
~NumTimesTalkedTo(0)~ THEN BEGIN 0 // from:
  SAY #63391 /* ~Hail, brave <LADYLORD>!  Rest assured, I know your mission.  You seek the path to the Imprisoned One.  But beware: the path before you is difficult, the danger great.~ */
  IF ~~ THEN REPLY #63398 /* ~I am prepared for whatever lies ahead.~ */ GOTO 1
  IF ~~ THEN REPLY #63401 /* ~Imprisoned One?  What are you talking about?~ */ GOTO 1
  IF ~~ THEN REPLY #63402 /* ~That sounds rather ominous.~ */ GOTO 3
  IF ~~ THEN REPLY #63404 /* ~On guard, foul ghost!  I will send you back to the pit from which you emerged!~ */ GOTO 4
  IF ~~ THEN REPLY #63407 /* ~Who are you and what are you doing here?~ */ GOTO 1
END

IF ~~ THEN BEGIN 1 // from: 0.4 0.1 0.0
  SAY #63405 /* ~I am the Keeper of the Key, the One Left Behind.  Duty compels me to remain, to stand guard over one of the keys to the final seal.~ */
  IF ~True()~ THEN GOTO 2
  IF ~IsValidForPartyDialog("Imoen")
GlobalGT("Chapter","GLOBAL",7)
~ THEN EXTERN ~IMOEN25J~ 24
  IF ~IsValidForPartyDialog("Viconia")
GlobalGT("Chapter","GLOBAL",7)
~ THEN EXTERN ~VICON25J~ 22
  IF ~IsValidForPartyDialog("Jaheira")
GlobalGT("Chapter","GLOBAL",7)
~ THEN EXTERN ~JAHEI25J~ 25
  IF ~IsValidForPartyDialog("Mazzy")
GlobalGT("Chapter","GLOBAL",7)
~ THEN EXTERN ~MAZZY25J~ 3
END

IF WEIGHT #3 /* Triggers after states #: 4 7 even though they appear after this state */
~Global("ReadyForChallenge","AR3019",0)
~ THEN BEGIN 2 // from: 1.0
  SAY #63406 /* ~You must be worthy in heart, spirit and mind before the final seal will be unlocked.   My solemn task is to test the perseverance, courage and wisdom of your heart.~ */
  IF ~~ THEN REPLY #63409 /* ~How do I prove myself?~ */ UNSOLVED_JOURNAL #63827 /* ~Unlocking the Final Seal

I will have to prove myself worthy in mind, heart and spirit before I can unlock the Final Seal which guards the stairs to the next level of the dungeon.~ */ GOTO 5
  IF ~~ THEN REPLY #63426 /* ~I fear I may not yet be ready for the trials.~ */ GOTO 3
  IF ~~ THEN REPLY #63428 /* ~I am ready for the challenge!~ */ GOTO 5
  IF ~~ THEN REPLY #63429 /* ~Maybe I can prove my worth by destroying you!~ */ GOTO 4
  IF ~~ THEN REPLY #63436 /* ~I have no need to prove myself to anyone, least of all a ghost!~ */ GOTO 3
END

IF ~~ THEN BEGIN 3 // from: 2.4 2.1 0.2
  SAY #63440 /* ~The trials ahead are not for the reluctant.  If you are unwilling or unsure you must not attempt these tests.  Return when you are ready to face the challenge.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #0 ~Global("Attacked","LOCALS",1)
~ THEN BEGIN 4 // from: 2.3 0.3
  SAY #63442 /* ~You cannot harm me - my spirit is eternally bound to this place by devotion and duty.  Speak with me again when you are ready to face the tests of the gauntlet.~ */
  IF ~~ THEN DO ~SetGlobal("Attacked","LOCALS",0)
~ EXIT
END

IF ~~ THEN BEGIN 5 // from: 2.2 2.0
  SAY #63450 /* ~Behind me are three doors.  I may not speak of the gauntlet of ordeals which lay beyond.  Complete all three challenges and return to me here - only then will your heart be proved worthy.~ */
  IF ~~ THEN DO ~TriggerActivation("Tran3024",TRUE)
TriggerActivation("Tran3025",TRUE)
TriggerActivation("Tran3026",TRUE)
TriggerActivation("IT3024",FALSE)
TriggerActivation("IT3025",FALSE)
TriggerActivation("IT3026",FALSE)
SetGlobal("ReadyForChallenge","AR3019",1)
~ EXIT
  IF ~IsValidForPartyDialog("Imoen")
GlobalGT("Chapter","GLOBAL",7)
~ THEN DO ~SetGlobal("ReadyForChallenge","AR3019",1)
~ EXTERN ~IMOEN25J~ 25
  IF ~IsValidForPartyDialog("Viconia")
GlobalGT("Chapter","GLOBAL",7)
~ THEN DO ~SetGlobal("ReadyForChallenge","AR3019",1)
~ EXTERN ~VICON25J~ 23
  IF ~IsValidForPartyDialog("Jaheira")
GlobalGT("Chapter","GLOBAL",7)
~ THEN DO ~SetGlobal("ReadyForChallenge","AR3019",1)
~ EXTERN ~JAHEI25J~ 26
END

IF WEIGHT #4 /* Triggers after states #: 7 even though they appear after this state */
~Global("ReadyForChallenge","AR3019",1)
~ THEN BEGIN 6 // from:
  SAY #63454 /* ~Your task is begun, but far from over.  You must complete the challenge beyond each door before the worth of your heart is beyond doubt.~ */
  IF ~~ THEN EXIT
END

IF WEIGHT #1 ~Global("FSChallenge","GLOBAL",3)~ THEN BEGIN 7 // from:
  SAY #63456 /* ~You have completed the challenges of the gauntlet and proved your heart is worthy to face the Imprisoned One. The key to the final seal is yours.~ */
  IF ~~ THEN DO ~AddXP2DA("PLOT7E")
GiveItemCreate("PLOT05A",LastTalkedToBy,0,0,0)
DestroySelf()
~ UNSOLVED_JOURNAL #63833 /* ~Unlocking the Final Seal

By running the gauntlet, I have proved my perseverance, my courage and the wisdom of my heart.  However, I suspect I must possess all three keys - heart, mind and spirit - before the Final Seal can be unlocked.~ */ EXIT
END
