BEGIN ~RUKRAP~

IF ~Global("RukrakiaMageCome","GLOBAL",11)~
  THEN BEGIN rukrap3 // from:
  SAY @5
  IF ~~ THEN REPLY @6 EXTERN ~rukmage1~ rukmage12
END

IF ~~
  THEN BEGIN rukrap4 // from:
  SAY @7
  IF ~~ THEN EXTERN ~rukadelb~ rukadelb2
END

//---------------

IF ~Global("RukrakiaMageCome","GLOBAL",14)~
  THEN BEGIN rukrap5 // from:
  SAY @8
  IF ~~ THEN EXTERN ~rukmage1~ rukmage14
END

IF ~~
  THEN BEGIN rukrap6 // from:
  SAY @9
  IF ~~ THEN EXTERN ~rukmage1~ rukmage15
END

IF ~Global("RukrakiaMageCome","GLOBAL",16)~
  THEN BEGIN rukrap7 // from:
  SAY @10 = @11 = @12 = @13
  IF ~InParty("jan")~ THEN REPLY @14 EXTERN ~JANJ~ ruk0
  IF ~!InParty("jan")~ THEN REPLY @14 GOTO rukrap9
  IF ~~ THEN REPLY @15 GOTO rukrap11
  IF ~~ THEN REPLY @16 GOTO rukrap11
END

IF ~~
  THEN BEGIN rukrap8 // from:
  SAY @19
  IF ~Global("RukrakiaMageCome","GLOBAL",16)~ THEN DO ~
                 SetGlobal("RukrakiaMageCome","GLOBAL",17)
                 SetGlobal("LoveTalk","LOCALS",22)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",5)
                 JoinParty()~ EXIT
  IF ~Global("RukrakiaMageCome","GLOBAL",15)~ THEN DO ~
                 SetGlobal("RukrakiaMageCome","GLOBAL",18)
                 SetGlobal("LoveTalk","LOCALS",22)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",5)
                 JoinParty()~ EXIT
END

IF ~~
  THEN BEGIN rukrap9 // from:
  SAY @20
  IF ~~ THEN REPLY @21 GOTO rukrap10
END

IF ~~
  THEN BEGIN rukrap10 // from:
  SAY @22
  IF ~Global("RukrakiaMageCome","GLOBAL",16)~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",17)
                 SetGlobal("LoveTalk","LOCALS",22)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",5)
                 JoinParty()~ EXIT
  IF ~Global("RukrakiaMageCome","GLOBAL",15)~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",18)
                 SetGlobal("LoveTalk","LOCALS",22)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",5)
                 JoinParty()~ EXIT
END

IF ~~
  THEN BEGIN rukrap11 // from:
  SAY @23 = @24
  IF ~~ THEN REPLY @25 GOTO rukrap12
  IF ~~ THEN REPLY @98 GOTO rukrap12
  IF ~~ THEN REPLY @99 GOTO rukrap12
END

IF ~~
  THEN BEGIN rukrap12 // from:
  SAY @26
  IF ~~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",17)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",1)
                 JoinParty()~ EXIT
END

//---------------

IF ~Global("RukrakiaMageCome","GLOBAL",15)~
  THEN BEGIN rukrap13 // from:
  SAY @27
  IF ~~ THEN REPLY @28 GOTO rukrap14
END

IF ~~
  THEN BEGIN rukrap14 // from:
  SAY @29 = @30 = @31
  IF ~~ THEN REPLY @32 GOTO rukrap15
END

IF ~~
  THEN BEGIN rukrap15 // from:
  SAY @33
  IF ~~ THEN REPLY @34 GOTO rukrap16
  IF ~~ THEN REPLY @35 GOTO rukrap17
  IF ~~ THEN REPLY @100 GOTO rukrap17
  IF ~~ THEN REPLY @101 GOTO rukrap16
END

IF ~~
  THEN BEGIN rukrap16 // from:
  SAY @36 = @37
  IF ~InParty("jan")~ THEN REPLY @14 EXTERN ~JANJ~ ruk0
  IF ~!InParty("jan")~ THEN REPLY @14 GOTO rukrap19
  IF ~~ THEN REPLY @15 GOTO rukrap18
  IF ~~ THEN REPLY @16 GOTO rukrap18
END

IF ~~
  THEN BEGIN rukrap17 // from:
  SAY @38 = @39
  IF ~~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",17)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",1)
                 JoinParty()~ EXIT
END

IF ~~
  THEN BEGIN rukrap18 // from:
  SAY @109
  IF ~Global("RukrakiaMageCome","GLOBAL",16)~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",17)
                 SetGlobal("LoveTalk","LOCALS",22)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",5)
                 JoinParty()~ EXIT
  IF ~Global("RukrakiaMageCome","GLOBAL",15)~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",18)
                 SetGlobal("LoveTalk","LOCALS",22)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",5)
                 JoinParty()~ EXIT
END

IF ~~
  THEN BEGIN rukrap19 // from:
  SAY @20
  IF ~~ THEN REPLY @21 GOTO rukrap18
END

//---------------

IF ~Global("RukrakiaKickedOut","GLOBAL",0)
    !Global("RukrakiaRomanceActive","GLOBAL",5)
    !Global("RukrakiaMageCome","GLOBAL",11)~ THEN BEGIN ruk0 // from:
  SAY @0
  IF ~~ THEN REPLY @1 GOTO ruk1
  IF ~~ THEN REPLY @2 GOTO ruk2
END


IF ~~ THEN BEGIN ruk1 // from:
  SAY @3
  IF ~~ THEN DO ~JoinParty()~ EXIT
END

IF ~~ THEN BEGIN ruk2 // from:
  SAY @4
  IF ~~ THEN DO ~SetGlobal("RukrakiaKickedOut","GLOBAL",1)
                 SetGlobal("RukrakiaRomanceActive","GLOBAL",1)
                 EscapeArea()~ EXIT
END

IF ~Global("RukrakiaKickedOut","GLOBAL",0)
    Global("RukrakiaRomanceActive","GLOBAL",5)
    !Global("RukrakiaMageCome","GLOBAL",11)~ THEN BEGIN ruk3 // from:
  SAY @40
  IF ~~ THEN REPLY @1 GOTO ruk4
  IF ~~ THEN REPLY @2 GOTO ruk5
END


IF ~~ THEN BEGIN ruk4 // from:
  SAY @41
  IF ~~ THEN DO ~JoinParty()~ EXIT
END

IF ~~ THEN BEGIN ruk5 // from:
  SAY @42
  IF ~~ THEN DO ~SetGlobal("RukrakiaKickedOut","GLOBAL",1)
                 EscapeArea()~ EXIT
END


//---------------

APPEND JANJ
  IF ~~ THEN BEGIN ruk0
     SAY @17 = @18
     IF ~~ THEN EXTERN ~rukrap~ rukrap8
  END
END

APPEND RUKMAGE1
IF ~Global("RukrakiaMageCome","GLOBAL",2)~ THEN BEGIN rukmage0 // from:
  SAY @44
  IF ~~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",3)~ EXIT
END

IF ~Global("RukrakiaMageCome","GLOBAL",5)~ THEN BEGIN rukmage1 // from:
  SAY @45
  IF ~~ THEN REPLY @46 GOTO rukmage2
  IF ~~ THEN REPLY @47 GOTO rukmage3
  IF ~~ THEN REPLY @48 GOTO rukmage4
END

IF ~~ THEN BEGIN rukmage2 // from:
  SAY @49 = @50
  IF ~~ THEN REPLY @53 GOTO rukmage5
  IF ~~ THEN REPLY @54 GOTO rukmage6
  IF ~~ THEN REPLY @55 GOTO rukmage7
END

IF ~~ THEN BEGIN rukmage3 // from:
  SAY @51 = @50
  IF ~~ THEN REPLY @53 GOTO rukmage5
  IF ~~ THEN REPLY @54 GOTO rukmage6
  IF ~~ THEN REPLY @55 GOTO rukmage7
END

IF ~~ THEN BEGIN rukmage4 // from:
  SAY @52 = @50
  IF ~~ THEN REPLY @53 GOTO rukmage5
  IF ~~ THEN REPLY @54 GOTO rukmage6
  IF ~~ THEN REPLY @55 GOTO rukmage7
END

IF ~~ THEN BEGIN rukmage5 // from:
  SAY @56 = @59
  IF ~~ THEN REPLY @60 DO ~GiveItem("rukscrol",Protagonist)~ GOTO rukmage8
END

IF ~~ THEN BEGIN rukmage6 // from:
  SAY @57 = @59
  IF ~~ THEN REPLY @60 DO ~GiveItem("rukscrol",Protagonist)~ GOTO rukmage8
END

IF ~~ THEN BEGIN rukmage7 // from:
  SAY @58 = @59
  IF ~~ THEN REPLY @60 DO ~GiveItem("rukscrol",Protagonist)~ GOTO rukmage8
END

IF ~~ THEN BEGIN rukmage8 // from:
  SAY @61 = @62
  IF ~~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",6)~ EXIT
END

IF ~Global("RukrakiaMageCome","GLOBAL",9)~ THEN BEGIN rukmage9
  SAY @63 = @64 = @102 = @65
  IF ~~ THEN REPLY @66 EXTERN ~rukamild~ rukamild1
  IF ~~ THEN REPLY @104 EXTERN ~rukamild~ rukamild1
  IF ~~ THEN REPLY @105 EXTERN ~rukamild~ rukamild1
END

IF ~~ THEN BEGIN rukmage10
  SAY @67 = @68
  IF ~~ THEN EXTERN ~rukamild~ rukamild2
END

IF ~~ THEN BEGIN rukmage11
  SAY @69
  IF ~~ THEN EXTERN ~rukamild~ rukamild3
END

IF ~~ THEN BEGIN rukmage12
  SAY @70
  IF ~~ THEN EXTERN ~rukadelb~ rukadelb0
END

IF ~~ THEN BEGIN rukmage13
  SAY @71 = @72
  IF ~~ THEN EXTERN ~rukadelb~ rukadelb1
END

IF ~~ THEN BEGIN rukmage14
  SAY @73
  IF ~~ THEN REPLY @74 EXTERN ~rukrap~ rukrap6
END

IF ~~ THEN BEGIN rukmage15 
  SAY @75 = @76
  IF ~~ THEN REPLY @77 GOTO rukmage16
  IF ~~ THEN REPLY @106 GOTO rukmage16f
END

IF ~~ THEN BEGIN rukmage16
  SAY @78 = @79 = @80
  IF ~~ THEN DO ~StartCutSceneMode()
                 CutSceneId("rukmage1")
                 ChangeAlignment(Myself,NEUTRAL)
                 ForceSpellRES("ruksnw2",Myself)
                 Wait(4)
                 SetGlobal("RukrakiaMageCome","GLOBAL",16)
                 EndCutSceneMode()
                 DestroySelf()~ EXIT
END

IF ~~ THEN BEGIN rukmage16f
  SAY @107 = @79 = @80
  IF ~~ THEN DO ~StartCutSceneMode()
                 CutSceneId("rukmage1")
                 ChangeAlignment(Myself,NEUTRAL)
                 ForceSpellRES("ruksnw2",Myself)
                 Wait(4)
                 SetGlobal("RukrakiaMageCome","GLOBAL",16)
                 EndCutSceneMode()
                 DestroySelf()~ EXIT
END
END

APPEND RUKAMILD
IF ~Global("RukrakiaMageCome","GLOBAL",9)~ THEN BEGIN rukamild0
  SAY @81
  IF ~~ THEN REPLY @82 EXTERN ~rukmage1~ rukmage9
  IF ~~ THEN REPLY @83 EXTERN ~rukmage1~ rukmage9
END

IF ~~ THEN BEGIN rukamild1
  SAY @84 = @85 = @103 = @86
  IF ~~ THEN REPLY @87 EXTERN ~rukmage1~ rukmage10
END

IF ~~ THEN BEGIN rukamild2
  SAY @88
  IF ~~ THEN EXTERN ~rukmage1~ rukmage11
END

IF ~~ THEN BEGIN rukamild3
  SAY @89 = @90 = @91
  IF ~~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",10)~ EXIT
END
END

APPEND RUKADELB
IF ~~ THEN BEGIN rukadelb0
  SAY @92 = @93
  IF ~~ THEN EXTERN ~rukmage1~ rukmage13
END

IF ~~ THEN BEGIN rukadelb1
  SAY @94
  IF ~~ THEN REPLY @95 EXTERN ~rukrap~ rukrap4
  IF ~~ THEN REPLY @108 EXTERN ~rukrap~ rukrap4
END

IF ~~ THEN BEGIN rukadelb2
  SAY @96 = @97
  IF ~~ THEN DO ~SetGlobal("RukrakiaMageCome","GLOBAL",13)
                 Shout(ALERT)
                 Enemy()~ EXIT
END
END