(version 2)
(include "sci.sh")
(exports
    0 rm700
)
(use "Main")
(use "TargFeature")
(use "n026")
(use "MChase")
(use "DIcon")
(use "PAvoider")
(use "Blink")
(use "Scaler")
(use "PolyPath")
(use "Polygon")
(use "Timer")
(use "Sound")
(use "Cycle")
(use "Game")
(use "User")
(use "View")
(use "Obj")
(script 700)


(local
    local0
    local1
    local2
    local3
    local4
    local5
    local6
    newProp
    local8
    local9
    local10
    local11
    local12
    local13
    newProp_2
    local15
    local16
    local17
    local18[2]
    newActor
    local21
    local22
    local23
    local24
    local25
    local26
    local27
    local28 =     1
    local29
    local30
    local31
    local32
    local33
    local34 =     340
    local35
    local36
    local37
    local38
    local39[2] = (8 )
    local41
    gOwnerX
    gOwnerY
    local44
    local45
    local46[2] = (700 705 )
    local48
    local49[4] = (-20 170 160 340 )
    local53[4] = (165 -10 260 165 )
    local57
    local58[2]
    local60
    local61
    local62
    local63
    local64[2]
    local66[4] = (20 -20 10 -10 )
    local70[48] = (-23 -23 -38 -38 10 -10 -20 20 -34 -34 -22 22 0 1 2 3 0 1 0 1 4 5 4 4 4 5 4 5 )

)
(procedure (localproc_3a24)
    (var temp0[2], temp2, temp3)
    = local45 (+ (+ local41 (* (+ gOwnerX 15) 3)) (* (+ gOwnerY 30) 2))
    = local48 (+ (<< (^ local45 local41) $0001) (& $0001 (+ gOwnerX gOwnerY)))
    = local44 (% (+ (+ local41 gOwnerX) gOwnerY) 2)
    (switch (% (+ local41 (* gOwnerX gOwnerY)) 4)
        (case 0
            = local60 1
        )
        (case 1
            = local60 0
        )
        (case 2
            = local60 1
        )
        (case 3
            = local60 0
        )
    )
    (if (gGQg3KDHandler)
        (send gGQg3KDHandler:
            eachElementDo(111)
            eachElementDo(81)
            release()
        )
    )
    (if (gOldATPs)
        (send gOldATPs:
            eachElementDo(111)
            eachElementDo(81)
            release()
        )
    )
    Animate((send gGQg3KDHandler:elements) 0)
    (if ((send global2:obstacles))
        (send ((send global2:obstacles)):
            eachElementDo(111)
            release()
        )
    )
    (if (local44)
        (send global2:
            picture(700)
            curPic(700)
        )
        (if (local60)
            (send global2:
                style(16393)
                addObstacle((send ((Polygon:new())):
                        type(2)
                        init(-15 220 -15 151 121 151 151 167 151 220)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(190 220 190 167 218 152 330 152 330 220)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(330 115 243 114 164 79 154 43 154 -15 330 -15)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(-15 -15 122 -15 122 43 116 74 59 120 -15 117)
                        yourself()
                    )
)
            )
        )(else
            (send global2:
                style(9)
                addObstacle((send ((Polygon:new())):
                        type(2)
                        init(-15 -15 168 -15 168 43 159 78 66 119 -15 119)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(190 -15 330 -15 330 119 255 119 200 76 190 41)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(-15 220 -15 158 121 158 128 220)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(172 220 176 155 330 154 330 220)
                        yourself()
                    )
)
            )
        )
    )(else
        (send global2:
            picture(705)
            curPic(705)
        )
        (if (local60)
            (send global2:
                style(16393)
                addObstacle((send ((Polygon:new())):
                        type(2)
                        init(-15 220 -15 169 136 170 155 220)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(-15 -15 188 -15 188 27 178 93 136 139 -15 138)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(330 158 223 147 207 27 207 -15 330 -15)
                        yourself()
                    )
)
            )
        )(else
            (send global2:
                style(9)
                addObstacle((send ((Polygon:new())):
                        type(2)
                        init(-15 -15 113 -15 113 26 91 146 -15 156)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(330 142 182 142 146 98 129 28 129 -15 330 -15)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(2)
                        init(161 220 188 172 330 172 330 220)
                        yourself()
                    )
)
            )
        )
    )
    DrawPic((send global2:picture) (send global2:style) dpCLEAR)
    = temp2 0
    = temp3 1
    (while (< temp2 6)
        (if (& local48 temp3)
            (send (ScriptID(703 0)):init(temp2 local45 local60 gOwnerX gOwnerY local44))
        )
        ++temp2
        = temp3 (<< temp3 $0001)
    )
    DisposeScript(703)
    (if (local37)
        (fireWood:
            view(700)
            approachVerbs(19 4)
            approachX(176)
            approachY(170)
            loop(7)
            cel(0)
            x(146)
            y(160)
            init()
        )
    )
)


(procedure (localproc_3e94 param1)
    (var temp0, temp1[2], temp3, temp4)
    = temp3 -100
    = temp0 0
    (while (<> temp3 30583)
        = temp3 proc999_6(param1 (* 2 temp0))
        ++temp0
    )
    return --temp0
)


(procedure (localproc_3ebe param1)
    return 
        (if (((< (send param1:x) -80) or (> (send param1:x) 399)) or (< (send param1:y) -80))
        )(else
            > (send param1:y) 269
        )
)


(procedure (localproc_3ef2 param1 param2 param3)
    (var temp0)
    = temp0 1
    (while (Message(0 gClientModNum param1 param2 param3 temp0))
        ++temp0
    )
    return --temp0
)


(instance controls of Controls
    (properties)
)
(instance sFx of Sound
    (properties)
)
(instance leopardProject of Actor
    (properties
        signal $1000
    )

    (method (init)
        (var temp0, temp1)
        (switch (= temp0 Random(0 2))
            (case 0
                (send gLongSong2:
                    number(13)
                    setLoop(1)
                    play()
                )
                = temp1 2
            )
            (case 1
                (send gLongSong2:
                    number(943)
                    setLoop(1)
                    play()
                )
                = temp1 13
            )
            (case 2
                (send gLongSong2:
                    number(11)
                    setLoop(1)
                    play()
                )
                = temp1 4
            )
        )
        (self:
            view(21)
            loop(temp1)
            x(+ (it:x) (/ (* (it:scaleY) local66[(it:loop)]) 128))
            y(+ (it:y) (/ (* (it:scaleY) local70[(it:loop)]) 128))
            setStep(8 5)
            moveSpeed(0)
            cycleSpeed(0)
            z(15)
            signal(6160)
            priority(proc999_3((it:priority) (send gOwner:priority)))
            ignoreActors(1)
            ignoreHorizon(1)
            illegalBits(0)
            setScale(-1 it)
            setCycle(Fwd)
            setMotion(MoveTo / (+ (send gOwner:nsLeft) (send gOwner:nsRight)) 2 + (send gOwner:nsTop) 25 self)
        )
        (switch (temp0)
            (case 0
                = global432 (- global432 global373)
            )
            (case 1
                = global432 (- global432 global375)
            )
            (case 2
                = global432 (- global432 global380)
            )
        )
        (super:init())
        SetNowSeen(self)
    )


    (method (doit)
        (super:doit())
        (if (== global125 0)
            (if (== (send gMainIconBar:curInvIcon) (send gInv:at(5)))
                = local11 1
                = local10 0
            )(else
                = local11 0
            )
        )(else
            (if (== global125 3)
                (if ((== (send gMainIconBar:curInvIcon) (send gInv:at(1))) and (send ((send gInv:at(1))):state))
                    = local10 1
                    = local11 0
                )(else
                    = local10 0
                )
            )
        )
        (if ((send gOwner:onMe((/ (+ nsRight nsLeft) 2) (+ nsTop 4))) and not noun)
            = noun 1
            (self:cue(0))
        )(else
            (if (noun and (it:onMe((/ (+ nsRight nsLeft) 2) (+ nsTop 4))))
                (self:cue(0))
            )
        )
    )


    (method (dispose)
        (if (IsObject(script))
            DisposeClone(script)
            = script 0
        )
        (super:dispose())
    )


    (method (setScript theScript)
        (if (IsObject(script))
            DisposeClone(script)
            = script 0
        )
        (super:setScript(rest theScript))
    )


    (method (cue param1)
        (var temp0)
        (if (not script)
            = temp0 0
            (if (((send gOwner:onMe((/ (+ nsRight nsLeft) 2) (+ nsTop 4))) and not gGGOwnerMaxStamina) and not local11)
                (if (not local10)
                    = local28 0
                    (send gLongSong2:
                        number(901)
                        setLoop(1)
                        play()
                    )
                    (if (not (send gOwner:takeDamage(20)))
                        (send global2:setScript(egoIsDead))
                    )
                )(else
                    (if (not local9)
                        = local9 1
                        (send gQg3Messager:say(4 6 91))
                    )
                )
                = temp0 1
            )(else
                (if ((send gOwner:onMe((/ (+ nsRight nsLeft) 2) (+ nsTop 4))) and (gGGOwnerMaxStamina or local11))
                    (self:setMotion(MoveTo (it:x) (it:y) self))
                    (sFx:
                        number(10)
                        setLoop(1)
                        play()
                    )
                    (if (local11 and not local8)
                        = local8 1
                        (send gQg3Messager:say(4 6 92))
                    )
                )(else
                    (if ((it:onMe((/ (+ nsRight nsLeft) 2) (+ nsTop 4))))
                        (it:getHurt(-1 0))
                        = temp0 1
                    )(else
                        = temp0 1
                    )
                )
            )
            (if (not cycleSpeed and temp0)
                (self:
                    cycleSpeed(1)
                    setMotion(0)
                    setScript((explode:new()) self)
                )
            )
        )(else
            (if (paramTotal and param1)
                DisposeClone(script)
                = script 0
                (self:dispose())
            )
        )
    )

)
(instance explode of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (== (send client:loop) 2)
                    (send client:
                        loop(9)
                        cel(0)
                        setCycle(End self)
                    )
                )(else
                    (if (== (send client:loop) 4)
                        (send client:
                            loop(10)
                            cel(0)
                            setCycle(End self)
                        )
                    )(else
                        (send client:
                            loop(14)
                            cel(0)
                            setCycle(End self)
                        )
                    )
                )
                (send gLongSong2:
                    number(930)
                    setLoop(1)
                    play()
                )
            )
            (case 1
                (send client:cue(1))
            )
        )
    )

)
(instance public rm700 of Rm
    (properties
        noun 79
        picture 700
        horizon 41
        vanishingY 37
    )

    (method (init)
        (var temp0)
        = number gClientModNum
        = controls controls
        = gPicAngle picAngle
        = curPic picture
        = gPicNumber -1
        (if (== gGClientModNum 550)
            = local1 1
            = local41 global430
            = gOwnerX gGOwnerX_4
            = gOwnerY gGOwnerY_4
            = gGClientModNum gGGClientModNum_2
            = local44 (& global431 $0001)
            = local28 (& global431 $0002)
            localproc_3a24()
            (send gOwner:
                init()
                normalize()
                setScale(Scaler 120 59 189 47)
                posn(150 156)
                signal(2)
                noun(2)
            )
            (switch (global155)
                (case 0
                    (self:setScript(egoIsDead))
                )
                (case 1
                    (send gLongSong:
                        setLoop(-1)
                        changeTo(400)
                    )
                    = local30 1
                    (it:
                        x(210)
                        y(150)
                        init()
                    )
                    (if (== global365 590)
                        (it:
                            loop(1)
                            cel(7)
                        )
                    )
                    (switch (global365)
                        (case 590
                            (send gOwner:solvePuzzle(295 2 9))
                        )
                        (case 595
                            (send gOwner:solvePuzzle(290 2 9))
                        )
                        (case 580
                            (send gOwner:solvePuzzle(291 2 9))
                        )
                        (case 575
                            (send gOwner:solvePuzzle(296 2 9))
                        )
                        (case 565
                            (send gOwner:solvePuzzle(293 2 9))
                        )
                        (case 585
                            (send gOwner:solvePuzzle(292 2 9))
                        )
                    )
                    (self:setScript(monsterIsDead))
                )
                (case 2
                    = local3 1
                    (send gOwner:changeGait(1))
                    (self:setScript(encounterScript))
                    (send gLongSong:
                        setLoop(-1)
                        changeTo(700)
                    )
                )
            )
        )(else
            (send gLongSong:
                setLoop(-1)
                changeTo(400)
            )
            = global432 230
            = gGMonsterMonHP 0
            = global426 0
            = local41 Random(64 256)
            = gOwnerY Random(5 127)
            = gOwnerX gOwnerY
            (switch (global365)
                (case 74
                    (send (ScriptID(705 0)):init(4 6 95))
                    (switch (gCursor)
                        (case 1
                            = local37 1
                        )
                        (case 2
                            0
                        )
                    )
                    = gOwnerY 128
                    = gOwnerX gOwnerY
                    = local41 192
                    = local38 0
                    = local30 1
                    localproc_3a24()
                    (send gOwner:
                        x(
                            (if (local44)
                                245
                            )(else
                                182
                            )
)
                        y(
                            (if (local44)
                                80
                            )(else
                                125
                            )
)
                        init()
                        signal(2)
                        normalize()
                        setScale(Scaler 120 59 189 47)
                        posn(240 156)
                        noun(2)
                    )
                )
                (case 590
                    localproc_3a24()
                    (send gOwner:
                        init()
                        normalize()
                        signal(2)
                        setScale(Scaler 120 59 189 47)
                        posn(160 156)
                        noun(2)
                    )
                    (if (proc0_6(96))
                        (self:setScript(monkeysWithEgo))
                        (send gGame:save(1))
                    )(else
                        (self:setScript(encounterScript))
                    )
                )
                (case 6
                    = local38 1
                    localproc_3a24()
                    proc0_3()
                    (send gOwner:
                        init()
                        normalize()
                        signal(2)
                        setScale(Scaler 120 59 189 47)
                        posn(160 156)
                        noun(2)
                    )
                    proc0_5(105)
                    (if (& global431 $4000)
                        = global431 (& global431 $bfff)
                        = global431 (| global431 $2000)
                    )(else
                        (if (proc0_6(102) and (& global431 $8000))
                            = global431 (& global431 $7fff)
                            = global431 (| global431 $4000)
                        )(else
                            (if (not proc0_6(102) and not (& global431 $8000))
                                = global431 (| global431 $8000)
                            )
                        )
                    )
                    (self:setScript(ScriptID(702 1)))
                    (send (ScriptID(702 0)):init())
                )
                (case 8
                    = local41 88
                    = gOwnerY 77
                    = gOwnerX gOwnerY
                    localproc_3a24()
                    (send gOwner:
                        init()
                        normalize()
                        setScale(Scaler 120 59 189 47)
                        signal(2)
                        posn(160 156)
                        noun(2)
                    )
                    (self:setScript(ScriptID(701 2)))
                )
                (case 9
                    proc0_4(105)
                    = local41 88
                    = gOwnerY 77
                    = gOwnerX gOwnerY
                    localproc_3a24()
                    (send gOwner:
                        init()
                        normalize()
                        signal(2)
                        setScale(Scaler 120 59 189 47)
                        posn(160 156)
                        noun(2)
                    )
                    (self:setScript(ScriptID(701 5)))
                )
                (case 7
                    = local41 88
                    = gOwnerY 77
                    = gOwnerX gOwnerY
                    localproc_3a24()
                    (send gOwner:
                        init()
                        normalize()
                        signal(2)
                        setScale(Scaler 120 59 189 47)
                        posn(160 156)
                        noun(2)
                    )
                    = local38 0
                    (self:setScript(ScriptID(704 0)))
                    proc0_3()
                )
                (case 10
                    = local41 88
                    = gOwnerY 77
                    = gOwnerX gOwnerY
                    localproc_3a24()
                    (send gOwner:
                        init()
                        normalize()
                        signal(2)
                        setScale(Scaler 120 59 189 47)
                        posn(160 156)
                        noun(2)
                    )
                    (if (not proc0_6(116))
                        = newActor (Actor:new())
                        (send newActor:
                            view(700)
                            loop(5)
                            cel(0)
                            x(77)
                            y(12)
                            priority(15)
                            signal(20496)
                            actions(genericProp)
                            noun(81)
                            init()
                        )
                    )
                    (send ((View:new())):
                        view(700)
                        loop(4)
                        cel(0)
                        x(90)
                        y(12)
                        priority(15)
                        signal(20496)
                        actions(genericProp)
                        noun(81)
                        init()
                    )
                    (send ((View:new())):
                        view(700)
                        loop(4)
                        cel(1)
                        x(85)
                        y(18)
                        priority(15)
                        signal(20496)
                        actions(genericProp)
                        noun(81)
                        init()
                    )
                    (send ((View:new())):
                        view(700)
                        loop(5)
                        cel(1)
                        x(83)
                        y(17)
                        priority(15)
                        signal(20496)
                        actions(genericProp)
                        noun(81)
                        init()
                    )
                    (genericProp:
                        nsLeft(63)
                        nsTop(5)
                        nsRight(100)
                        nsBottom(22)
                        noun(81)
                    )
                    proc0_3()
                )
                (case 4
                    = local30 1
                    = local36 localproc_3ef2(6 1 80)
                    = local38 0
                    = gOwnerY 128
                    = gOwnerX gOwnerY
                    = local41 192
                    localproc_3a24()
                    (send gOwner:
                        x(160)
                        y(156)
                        init()
                        setAvoider(PAvoider)
                        normalize()
                        signal(2)
                        setScale(Scaler 120 59 189 47)
                        noun(2)
                    )
                    (genericProp:init())
                    proc0_3()
                )
                (case 5
                    = local30 1
                    = local38 0
                    = gOwnerY 128
                    = gOwnerX gOwnerY
                    = local41 192
                    localproc_3a24()
                    (send gOwner:
                        x(160)
                        y(156)
                        init()
                        normalize()
                        signal(2)
                        setAvoider(PAvoider)
                        setScale(Scaler 120 59 189 47)
                        noun(2)
                    )
                    (genericProp:
                        approachVerbs(4)
                        init()
                    )
                    proc0_3()
                )
                (default 
                    localproc_3a24()
                    (send gOwner:
                        init()
                        normalize()
                        signal(2)
                        setScale(Scaler 120 59 189 47)
                        posn(160 156)
                        noun(2)
                    )
                    (if (<> global365 999)
                        (self:setScript(encounterScript))
                        = local38 1
                    )
                )
            )
        )
        Animate((send gGQg3KDHandler:elements) 1)
    )


    (method (doit param1)
        (if ((local38 and proc0_6(102)) and (== global365 6))
            = local38 0
        )
        (if (script)
            (if (== global365 10)
                (if (> (send gOwner:z) 70)
                    (send gMainIconBar:enable(3))
                )(else
                    (send gMainIconBar:disable(3))
                )
            )
        )(else
            (if (local57)
                (if ((((<= 4 (send gOwner:x)) and (<= (send gOwner:x) 316)) and (<= 48 (send gOwner:y))) and (<= (send gOwner:y) 185))
                    = local57 0
                    proc0_3()
                )
            )(else
                (if (<= (send gOwner:x) 3)
                    (if (((== global365 6) and proc0_6(102)) and not proc0_6(105))
                        = local57 1
                        (send gQg3Messager:say(3 6 20))
                        (send gOwner:setMotion(PolyPath 20 (send gOwner:y)))
                    )(else
                        (if ((== global365 9) and proc0_6(105))
                            = local57 1
                            (send gQg3Messager:say(5 6 101))
                            (send gOwner:setMotion(PolyPath 20 (send gOwner:y)))
                        )(else
                            = local24 1
                            (if (not local38)
                                = gOwnerX -20
                                = gOwnerY (send gOwner:y)
                                (self:setScript(sExit))
                            )(else
                                (self:setScript(showNewRoom self 4))
                            )
                        )
                    )
                )(else
                    (if (>= (send gOwner:y) 187)
                        (if (((== global365 6) and proc0_6(102)) and not proc0_6(105))
                            = local57 1
                            (send gQg3Messager:say(3 6 20))
                            (send gOwner:setMotion(PolyPath (send gOwner:x) 170))
                        )(else
                            (if ((== global365 9) and proc0_6(105))
                                = local57 1
                                (send gQg3Messager:say(5 6 101))
                                (send gOwner:setMotion(PolyPath (send gOwner:x) 170))
                            )(else
                                = local24 1
                                (if (not local38)
                                    = gOwnerX (send gOwner:x)
                                    = gOwnerY 250
                                    (self:setScript(sExit))
                                )(else
                                    (self:setScript(showNewRoom self 3))
                                )
                            )
                        )
                    )(else
                        (if (>= (send gOwner:x) 317)
                            (if (((== global365 6) and proc0_6(102)) and not proc0_6(105))
                                = local57 1
                                (send gQg3Messager:say(3 6 20))
                                (send gOwner:setMotion(PolyPath 300 (send gOwner:y)))
                            )(else
                                (if ((== global365 9) and proc0_6(105))
                                    = local57 1
                                    (send gQg3Messager:say(5 6 101))
                                    (send gOwner:setMotion(PolyPath 300 (send gOwner:y)))
                                )(else
                                    = local24 1
                                    (if (not local38)
                                        = gOwnerX 330
                                        = gOwnerY (send gOwner:y)
                                        (self:setScript(sExit))
                                    )(else
                                        (self:setScript(showNewRoom self 2))
                                    )
                                )
                            )
                        )(else
                            (if (<= (send gOwner:y) 45)
                                (if (((== global365 6) and proc0_6(102)) and not proc0_6(105))
                                    = local57 1
                                    (send gQg3Messager:say(3 6 20))
                                    (send gOwner:setMotion(PolyPath (send gOwner:x) (+ (send gOwner:y) 10)))
                                )(else
                                    (if ((== global365 9) and proc0_6(105))
                                        = local57 1
                                        (send gQg3Messager:say(5 6 101))
                                        (send gOwner:setMotion(PolyPath (send gOwner:x) (+ (send gOwner:y) 10)))
                                    )(else
                                        = local24 1
                                        (if (not local38)
                                            = gOwnerX (send gOwner:x)
                                            = gOwnerY vanishingY
                                            (self:setScript(sExit))
                                        )(else
                                            (self:setScript(showNewRoom self 1))
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
        (super:doit(rest param1))
    )


    (method (dispose)
        (if (timer)
            (send timer:
                dispose()
                delete()
            )
        )
        = global461 0
        = global462 0
        (super:dispose())
    )


    (method (doVerb theVerb param2)
        return 
            (switch (theVerb)
                (case 65
                    (if (local38)
                        (send gQg3Messager:say(0 0 93))
                    )(else
                        (send (ScriptID(7 5)):init(global455))
                    )
                )
                (case 74
                    (if (local30 and not local38)
                        = global365 74
                        = local17 1
                        (self:setScript(sleepScript 0 0))
                    )(else
                        (send gQg3Messager:say(4 6 16))
                    )
                )
                (case 20
                    ++global426
                    (if (proc999_5(global365 580 8 9))
                        (send gOwner:setScale())
                    )
                    (send gOwner:setScript(ScriptID(32 0) self 20))
                )
                (case 81
                    (if ((send gOwner:castSpell(25)))
                        (if (proc999_5(global365 580 8 9))
                            (send gOwner:setScale())
                        )
                        (send gOwner:setScript(ScriptID(32 0) self 81))
                    )
                )
                (case -77
                    (send gQg3Messager:say(0 0 2 1 0 12))
                )
                (case -76
                    (send gQg3Messager:say(0 0 1 1 0 12))
                )
                (case -80
                    (send gQg3Messager:say(0 0 4 1 0 12))
                )
                (case 83
                    (if ((send gOwner:castSpell(27)))
                        (if (proc999_5(global365 580 8 9))
                            (send gOwner:setScale())
                        )
                        (send gOwner:setScript(ScriptID(32 0) self 83))
                    )
                )
                (case 88
                    (if ((send gOwner:castSpell(32)))
                        (if (proc999_5(global365 580 8 9))
                            (send gOwner:setScale())
                        )
                        (send gOwner:setScript(ScriptID(32 0) self 88))
                    )
                )
                (case 80
                    (if ((send gOwner:castSpell(24)))
                        = local2 1
                        (send ((Timer:new())):setReal(self (/ gGOwnerMaxStamina[24] 10)))
                        (send gOwner:setScript(ScriptID(12 0) self 80))
                    )
                )
                (case 75
                    (if ((send gOwner:castSpell(19)))
                        proc0_14((send ((User:curEvent)):x) (send ((User:curEvent)):y))
                        (if ((== global365 8) and not proc0_6(109))
                            (send gOwner:setScript(ScriptID(13) 0 ScriptID(701 6)))
                        )(else
                            (send gOwner:setScript(ScriptID(13)))
                        )
                    )
                )
                (case 77
                    (if ((send gOwner:castSpell(21)))
                        (if (== (genericProp:noun) 7)
                            (send gOwner:setScript(ScriptID(12 0) genericProp))
                        )(else
                            (super:doVerb(theVerb rest param2))
                        )
                    )
                )
                (case 84
                    (if ((send gOwner:castSpell(28)))
                        (send (ScriptID(31 0)):init((send gOwner:x) (+ (send gOwner:y) 1) 80))
                    )
                )
                (case 82
                    (if ((send gOwner:castSpell(26)))
                        (if (== global365 10)
                            (if (not script)
                                (self:setScript(ScriptID(37 0) 0 genericProp))
                            )
                        )(else
                            (if (not script)
                                (self:setScript(ScriptID(37 0)))
                            )
                        )
                    )
                    return 1
                )
                (case 86
                    (if (local38)
                        (send gQg3Messager:say(4 6 99))
                    )(else
                        (if ((send gOwner:castSpell(30)))
                            (send gOwner:setScript(ScriptID(62 0)))
                        )
                    )
                )
                (case 87
                    (if ((send gOwner:castSpell(31)))
                        (send gOwner:setScript(ScriptID(46 0)))
                    )
                )
                (case 78
                    (if ((send gOwner:castSpell(22)))
                        (send ((Timer:new())):setReal(self (/ gGOwnerMaxStamina[22] 10)))
                        (send gOwner:setScript(ScriptID(12 0) self 78))
                    )
                )
                (case 33
                    (if (proc999_5(global365 580 8 9))
                        (send gOwner:setScale())
                    )
                    (send gOwner:setScript(ScriptID(32 0) self 33))
                )
                (case 85
                    (if ((send gOwner:castSpell(29)))
                        = gGGOwnerMaxStamina gGOwnerMaxStamina[29]
                        (sFx:
                            number(943)
                            setLoop(1)
                            play()
                        )
                        (send gOwner:setScript(ScriptID(12 0) self 85))
                    )
                )
                (case 4
                    (if (> (send ((User:curEvent)):y) 100)
                        (send gOwner:setScript(getRocks))
                    )(else
                        (super:doVerb(theVerb))
                    )
                )
                (default 
                    (super:doVerb(theVerb))
                )
            )
    )


    (method (cue)
        (var temp0)
        (if (== global365 580)
            (send gOwner:setScale(Scaler 120 59 189 47))
        )(else
            (super:cue())
        )
    )

)
(instance monkeysWithEgo of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                (self:setScript(ScriptID(701 0) self))
            )
            (case 1
                (send global2:setScript(encounterScript))
            )
        )
    )

)
(instance paladinHearsMonster of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    setLoop(3)
                    cel(0)
                    setCycle(End self)
                )
                = register (Narrator:y)
            )
            (case 1
                (Narrator:y(20))
                (send gQg3Messager:say(4 6 96))
                (send gOwner:
                    setLoop(5)
                    cel(3)
                    setCycle(End self)
                )
            )
            (case 2
                (Narrator:y(register))
                (send gOwner:
                    x(+ (send gOwner:x) 25)
                    normalize()
                )
                = cycles 10
            )
            (case 3
                (self:dispose())
            )
        )
    )

)
(instance doBattle of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = seconds 2
                (if (IsObject((send gOwner:looper)))
                    (send ((send gOwner:looper)):dispose())
                )
                (send gOwner:
                    looper(0)
                    setMotion(0)
                )
            )
            (case 1
                (send gQg3Messager:say(4 6 51))
                = cycles 2
            )
            (case 2
                (if (< gGMonsterMonHP 2)
                    = gGMonsterMonHP 2
                )
                (send global2:newRoom(550))
            )
        )
    )

)
(instance getRocks of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:
                    setMotion(0)
                    view(4)
                    loop(% (send gOwner:loop) 2)
                    setCycle(End self)
                )
                = register (Narrator:y)
            )
            (case 1
                (Narrator:y(20))
                (send gQg3Messager:say(4 6 89 0 self))
                (send gOwner:get(23 Random(2 5)))
            )
            (case 2
                (Narrator:y(register))
                (send gOwner:setCycle(Beg self))
            )
            (case 3
                (send gOwner:normalize())
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance encounterScript of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                = cycles 2
            )
            (case 1
                (send gOwner:normalize())
                proc0_3()
                (switch (global365)
                    (case 595
                        = local63 100
                        (if (not gGMonsterMonHP)
                            = gGMonsterMonHP 180
                        )
                        = global462 800
                    )
                    (case 565
                        = local63 40
                        (if (not gGMonsterMonHP)
                            = gGMonsterMonHP 150
                        )
                        = global462 600
                    )
                    (case 585
                        = local63 30
                        (if (not gGMonsterMonHP)
                            = gGMonsterMonHP 200
                        )
                        = global462 700
                    )
                    (case 580
                        = local63 30
                        (if (not gGMonsterMonHP)
                            = gGMonsterMonHP 150
                        )
                        = global462 700
                    )
                    (case 575
                        = local63 30
                        (if (not gGMonsterMonHP)
                            = gGMonsterMonHP 180
                        )
                        = global462 700
                    )
                    (case 590
                        = local63 50
                        (if (not gGMonsterMonHP)
                            = gGMonsterMonHP 200
                        )
                        = global462 700
                    )
                )
                (self:cue())
            )
            (case 2
                = local30 0
                (if (local3)
                    (if (== global102 0)
                        (it:signal((& (it:signal) $bfff)))
                        = local6 200
                    )
                    (it:
                        x(300)
                        y(150)
                        init()
                    )
                    (send gOwner:setMotion(PolyPath -10 (send gOwner:y)))
                )(else
                    = local6 50
                    (if (proc0_6(150) and not local0)
                        (send gQg3Messager:say(4 6 96))
                    )
                    = temp0 Random(0 3)
                    (it:
                        x(local49[temp0])
                        y(local53[temp0])
                        init()
                    )
                )
                = local38 1
                (send gLongSong:
                    setLoop(-1)
                    number(700)
                    play()
                )
                (self:dispose())
            )
        )
    )

)
(instance genericProp of Prop
    (properties)

    (method (init)
        = signal (| signal $1000)
        (if (== global365 5)
            = view 700
            = cel 0
            = loop Random(9 10)
            = x 180
            = y 147
            = noun 7
            = approachX x
            = approachY 155
        )(else
            = view 700
            = loop 8
            = cel Random(0 3)
            = x 181
            = y 166
            = noun 6
            = local35 Random(1 local36)
        )
        (super:init())
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global365 10)
                    (if ((>= (send gOwner:z) 75) and (send gOwner:inRect(70 170 110 190)))
                        (if (IsObject(newActor))
                            (send newActor:dispose())
                            proc0_5(132)
                            (send gOwner:
                                get(39)
                                solvePuzzle(317 3 2)
                            )
                            (send gQg3Messager:say(4 6 12))
                            proc0_4(116)
                        )(else
                            (send gQg3Messager:say(4 6 13))
                        )
                    )(else
                        (send gQg3Messager:say(4 6 14))
                    )
                )(else
                    (if (== noun 6)
                        (send gQg3Messager:say(6 4 79))
                    )(else
                        (if (== cel 0)
                            (self:setCycle(End self))
                            = local4 1
                            (send gLongSong2:
                                number(401)
                                setLoop(1)
                                play()
                            )
                            (send gOwner:addHonor(10))
                        )(else
                            (send gQg3Messager:say(7 6 81))
                        )
                    )
                )
            )
            (case 1
                (if (== global365 10)
                    (super:doVerb(theVerb rest param2))
                )(else
                    (if (== global365 4)
                        (send gQg3Messager:say(6 1 80 local35))
                    )(else
                        (if (== cel 0)
                            (send gQg3Messager:say(7 6 82))
                        )(else
                            (send gQg3Messager:say(7 1 81))
                        )
                    )
                )
            )
            (case -82
                (if (== global365 10)
                    (if (IsObject(newActor))
                        (send newActor:dispose())
                        (send gOwner:
                            solvePuzzle(317 3)
                            get(39)
                        )
                        (send gQg3Messager:say(4 6 15))
                        proc0_4(116)
                    )(else
                        (send gQg3Messager:say(4 6 13))
                    )
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (cue)
        (if (== global365 5)
            (if (not local4 or local5)
                (self:doVerb(4))
            )(else
                = local5 1
                (send gQg3Messager:say(7 6 83))
            )
        )(else
            (super:cue())
        )
    )

)
(instance egoIsDead of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (send gOwner:
                    view(43)
                    loop(Random(0 3))
                    cel(0)
                    cycleSpeed(10)
                    setMotion(0)
                    setCycle(End self)
                )
            )
            (case 1
                (switch (global365)
                    (case 595
                        proc26_0(1 700 633 End 158)
                    )
                    (case 590
                        (if (proc0_6(96))
                            proc26_0(2 700 707 End 158)
                        )(else
                            proc26_0(84 700 707 End 158)
                        )
                    )
                    (case 565
                        proc26_0(3 700 707 End 152)
                    )
                    (case 580
                        proc26_0(5 700 937 End 152)
                    )
                    (case 585
                        proc26_0(6 700 455 End 155)
                    )
                    (case 575
                        proc26_0(4 700 937 End 152)
                    )
                )
                (self:dispose())
            )
        )
    )

)
(instance monsterIsDead of Script
    (properties)

    (method (doit)
        (if ((it:z))
            (it:z((- (it:z) 1)))
        )
        (super:doit())
    )


    (method (changeState newState)
        (var temp0, temp1[13], temp14)
        (switch (= state newState)
            (case 0
                proc0_2()
                (it:
                    approachVerbs(4)
                    approachX(/ (+ (it:nsLeft) (it:nsRight)) 2)
                    approachY(+ (/ (+ (it:nsTop) (it:nsBottom)) 2) 5)
                )
                = local30 1
                (it:
                    setMotion(0)
                    init()
                )
                = local38 0
                (if (== global365 590)
                    = cycles 5
                )(else
                    = temp0 
                        (if (Random(0 1))
                            -10
                        )(else
                            10
                        )
                    proc0_12(it (it:x) + (it:y) temp0 self)
                )
            )
            (case 1
                (if (<> global365 590)
                    (it:
                        loop(
                            (if (< temp0 0)
                                1
                            )(else
                                0
                            )
)
                        cel(0)
                        setMotion(0)
                        init()
                        setCycle(End)
                    )
                )(else
                    (it:setCycle(Beg))
                )
                (send gLongSong2:
                    setLoop(1)
                    number(931)
                    play()
                )
                (switch (global365)
                    (case 565
                        (send gLongSong:
                            setLoop(1)
                            changeTo(153 self)
                        )
                    )
                    (case 580
                        (send gLongSong:
                            setLoop(1)
                            changeTo(153 self)
                        )
                    )
                    (case 575
                        (send gLongSong:
                            setLoop(1)
                            changeTo(153 self)
                        )
                    )
                    (case 590
                        (send gLongSong:
                            setLoop(1)
                            changeTo(156 self)
                        )
                    )
                    (case 595
                        (send gLongSong:
                            setLoop(1)
                            changeTo(159 self)
                        )
                    )
                    (case 585
                        (send gLongSong:
                            setLoop(1)
                            changeTo(156 self)
                        )
                    )
                )
            )
            (case 2
                (if (proc0_6(96))
                    proc0_5(96)
                    (send client:setScript(ScriptID(701 1) 0 0 1))
                )(else
                    (if (== global365 590)
                        proc0_3()
                        (it:dispose())
                    )
                )
                = cycles 6
            )
            (case 3
                (it:
                    approachVerbs(4)
                    approachX(/ (+ (it:nsLeft) (it:nsRight)) 2)
                    approachY(+ (/ (+ (it:nsTop) (it:nsBottom)) 2) 5)
                )
                = temp1[0] (- (it:nsLeft) 3)
                = temp1[1] (/ (+ (it:nsTop) (it:nsBottom)) 2)
                = temp1[2] (+ 3 (it:nsRight))
                = temp1[3] (/ (+ (it:nsTop) (it:nsBottom)) 2)
                = temp1[4] (+ 3 (it:nsRight))
                = temp1[5] (+ 3 (it:nsBottom))
                = temp1[6] (- (it:nsLeft) 3)
                = temp1[7] (+ 3 (it:nsBottom))
                = temp1[8] 30583
                = temp1[9] 0
                = temp14 MergePoly(@temp1 (send ((send global2:obstacles)):elements) (send ((send global2:obstacles)):size))
                (if (temp14)
                    (send ((send global2:obstacles)):add((send ((Polygon:new())):
                            points((= temp14 MergePoly(@temp1 (send ((send global2:obstacles)):elements) (send ((send global2:obstacles)):size))))
                            size(localproc_3e94((= temp14 MergePoly(@temp1 (send ((send global2:obstacles)):elements) (send ((send global2:obstacles)):size)))))
                            type(2)
                            dynamic(1)
                            yourself()
                        )
))
                )(else
                    (send ((send global2:obstacles)):add((send ((Polygon:new())):
                            points(@temp1)
                            size(4)
                            type(2)
                            dynamic(1)
                            yourself()
                        )
))
                )
                = local13 1
                proc0_3()
                (send gLongSong:
                    number(400)
                    setLoop(-1)
                    play()
                )
                (self:dispose())
            )
        )
    )

)
(instance searchMonster of Script
    (properties)

    (method (changeState newState)
        (var temp0[50])
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (Random(0 1))
                    proc0_12(gOwner + (send gOwner:x) 10 (send gOwner:y) self)
                )(else
                    proc0_12(gOwner - (send gOwner:x) 10 (send gOwner:y) self)
                )
                (if (register)
                    (send gOwner:get(0 register))
                )
            )
            (case 1
                (send gOwner:
                    view(4)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 2
                = cycles 10
            )
            (case 3
                (if (register)
                    Message(0 700 4 6 18 1 @temp0)
                    (send gQg3Messager:sayFormat(99 @temp0 register))
                    = cycles 1
                )(else
                    (send gQg3Messager:say(4 6 19 0 self))
                )
            )
            (case 4
                (send gOwner:setCycle(Beg self))
            )
            (case 5
                (send gOwner:normalize())
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance sleepScript of Script
    (properties)

    (method (changeState newState)
        (var temp0, temp1, temp2, temp3)
        (switch (= state newState)
            (case 0
                proc0_2()
                = cycles 2
                = local0 0
            )
            (case 1
                (send gOwner:setMotion(PolyPath 165 135 self))
            )
            (case 2
                (send gOwner:
                    x(- (send gOwner:x) 25)
                    view(35)
                    loop(1)
                    cel(0)
                    setCycle(End self)
                )
                (send gLongSong:
                    setLoop(-1)
                    fade(127 1 30 0)
                    changeTo(927)
                )
            )
            (case 3
                = temp2 PalVary(pvGET_CURRENT_STEP)
                (if (temp2)
                    (if (< (= temp2 PalVary(pvGET_CURRENT_STEP)) 64)
                        PalVary(pvCHANGE_TICKS 3)
                    )
                )(else
                    PalVary(pvINIT 700 3)
                )
                = seconds 5
            )
            (case 4
                (if (not local13)
                    (if (local15)
                        = temp3 Random(0 3)
                    )(else
                        = temp3 0
                    )
                    (if (not temp3)
                        (if ((<= 4 global123) and (<= global123 6))
                            (if (< Random(1 10) 5)
                                = global365 585
                            )
                        )(else
                            (if (not Random(0 2))
                                = global365 585
                            )
                        )
                        (if ((<> global365 74) and (<> global123 7))
                            = temp1 global120
                            (send (ScriptID(7 4)):init(3))
                            = temp0 (/ (% (- (+ global120 3600) temp1) 3600) 150)
                            (send gOwner:useStamina(neg (* temp0 2)))
                            (send gOwner:takeDamage(neg (* temp0 2)))
                            (send gOwner:useMana(neg (* temp0 2)))
                        )
                    )
                )
                (self:cue())
            )
            (case 5
                (switch (global365)
                    (case 74
                        = seconds 10
                    )
                    (default 
                        = local15 0
                        = local37 0
                        (if (proc0_6(150))
                            = local0 1
                            (self:setScript(paladinHearsMonster self))
                        )(else
                            = seconds 2
                        )
                    )
                )
            )
            (case 6
                (if (== global365 74)
                    PalVary(pvREVERSE 3)
                    = seconds 4
                )(else
                    (if (local0)
                        = seconds 3
                    )(else
                        (send gOwner:setCycle(Beg self))
                    )
                )
            )
            (case 7
                (if (<> global365 74)
                    (if (local0)
                        = local13 1
                        (send client:setScript(encounterScript))
                        (self:dispose())
                    )(else
                        = local13 1
                        (send gOwner:
                            x(165)
                            y(135)
                        )
                        (send client:setScript(encounterScript))
                        (self:dispose())
                    )
                )(else
                    (self:cue())
                )
            )
            (case 8
                (send (ScriptID(7 7)):init(5 40))
                = cycles 10
            )
            (case 9
                (send gOwner:setCycle(Beg self))
            )
            (case 10
                (send gOwner:
                    x(165)
                    y(135)
                    normalize()
                )
                = cycles 10
            )
            (case 11
                (send gLongSong:
                    setLoop(-1)
                    number(400)
                    play()
                )
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance castFire of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send ((User:curEvent)):
                    x(146)
                    y(160)
                )
                (self:setScript(ScriptID(32 0) self 81))
            )
            (case 1
                proc0_3()
                (send gOwner:normalize())
                = local15 1
                = newProp (Prop:new())
                (send newProp:
                    signal(20496)
                    view(700)
                    loop(6)
                    cel(0)
                    x(144)
                    y(149)
                    priority(13)
                    setScript(loopSound)
                    init()
                    setCycle(Fwd)
                )
                (self:dispose())
            )
        )
    )

)
(instance justLayDown of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(PolyPath 165 135 self))
            )
            (case 1
                (send gOwner:
                    x(140)
                    y(135)
                    view(35)
                    loop(1)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 2
                (self:dispose())
            )
        )
    )

)
(instance loopSound of Script
    (properties)

    (method (doit)
        (if ((<> (send gLongSong2:number) 913) and (== state 1))
            (self:cue())
        )(else
            (super:doit())
        )
    )


    (method (dispose)
        (send gLongSong2:
            client(0)
            stop()
        )
        (super:dispose())
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = ticks 120
            )
            (case 1
                (send gLongSong2:
                    number(913)
                    setLoop(10000)
                    play(self)
                )
            )
            (case 2
                (self:init())
            )
        )
    )

)
(instance kindleFire of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:
                    view(4)
                    loop(1)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 1
                (if (local15)
                    (self:cue())
                )(else
                    = seconds 5
                )
            )
            (case 2
                (if (local15)
                    = local15 0
                    (send newProp:
                        setScript(0)
                        dispose()
                    )
                    (send gQg3Messager:say(93 48 0))
                    = newProp 0
                )(else
                    = local15 1
                    = newProp (Prop:new())
                    (send newProp:
                        view(700)
                        loop(6)
                        cel(0)
                        x(144)
                        y(149)
                        priority(13)
                        signal(20496)
                        setScript(loopSound)
                        init()
                        setCycle(Fwd)
                    )
                )
                (send gOwner:setCycle(Beg self))
            )
            (case 3
                (send gOwner:normalize())
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance throwSpell of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                (if (((< global432 global373) and (< global432 global380)) and (< global432 global375))
                    = local27 1
                    = local63 15
                    (it:setMotion(MChase gOwner local63 it))
                    (self:dispose())
                )(else
                    (if (local28 and (< global432 115))
                        (it:
                            setMotion(PolyPath -50 -50 it)
                            setAvoider(PAvoider)
                        )
                        = local38 0
                        (self:dispose())
                    )(else
                        (it:setMotion(0))
                        proc0_12(it gOwner self)
                    )
                )
            )
            (case 1
                = register (it:loop)
                (it:
                    view(706)
                    cel(0)
                    loop(
                        (if (< (send gOwner:x) (it:x))
                            (if (< (send gOwner:y) (it:y))
                                3
                            )(else
                                1
                            )
                        )(else
                            (if (< (send gOwner:y) (it:y))
                                2
                            )(else
                                0
                            )
                        )
)
                    setCycle(End self)
                )
            )
            (case 2
                (send ((leopardProject:new())):init())
                = cycles 5
            )
            (case 3
                (it:setCycle(Beg self))
            )
            (case 4
                (it:
                    view(590)
                    loop(register)
                    setCycle(Walk)
                )
                = temp0 
                    (switch (global209)
                        (case 1
                            240
                        )
                        (case 2
                            120
                        )
                        (case 3
                            70
                        )
                    )
                = cycles Random(20 temp0)
            )
            (case 5
                (it:setMotion(MChase gOwner local63 it))
                (self:dispose())
            )
        )
    )

)
(instance sExit of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:signal(8194))
                (if ((== global365 8) and not proc0_6(109))
                    (if (proc0_6(110))
                        (if (proc0_6(111))
                            proc26_0(8)
                        )(else
                            proc0_4(111)
                            (send gOwner:addHonor(-100))
                        )
                    )(else
                        proc0_4(110)
                        (send gOwner:addHonor(-100))
                    )
                )
                (self:cue())
            )
            (case 1
                (if (global426 and not local33)
                    (send gQg3Messager:say(0 20 86 0 self))
                    (send gOwner:get(10 global426))
                )(else
                    (self:cue())
                )
            )
            (case 2
                (if (local15)
                    (send gQg3Messager:say(4 6 98))
                )
                (send gOwner:setMotion(PolyPath gOwnerX gOwnerY self))
            )
            (case 3
                (send global2:newRoom(gGClientModNum))
            )
        )
    )

)
(instance it of TargActor
    (properties
        view 0
        signal $7000
    )

    (method (init)
        (if (not (send gGQg3KDHandler:contains(self)))
            (super:init())
        )
        (if (local30)
            (self:approachVerbs(4))
        )
        (switch (global365)
            (case 595
                (if (local30)
                    (self:
                        view(592)
                        setScale(-1 gOwner)
                        cycleSpeed(6)
                        noun(82)
                    )
                )(else
                    (self:
                        origStep(1542)
                        view(590)
                        setScale(-1 gOwner)
                        moveSpeed(+ (send gOwner:moveSpeed) 4)
                        cycleSpeed(+ (send gOwner:cycleSpeed) 4)
                        setCycle(Walk)
                        noun(83)
                        setMotion(MChase gOwner local63 self)
                    )
                )
            )
            (case 590
                (if (local30)
                    (self:
                        view(585)
                        setScale(-1 gOwner)
                        cycleSpeed(+ (send gOwner:cycleSpeed) 4)
                    )
                )(else
                    (self:
                        origStep(1540)
                        view(585)
                        setScale(-1 gOwner)
                        moveSpeed(+ (send gOwner:moveSpeed) 3)
                        cycleSpeed(+ (send gOwner:cycleSpeed) 5)
                        setCycle(Fwd)
                        setCel(0)
                        setLoop(2)
                        noun(84)
                        setMotion(MChase gOwner local63 self)
                    )
                )
            )
            (case 565
                (if (local30)
                    (self:
                        view(563)
                        setScale(-1 gOwner)
                        cycleSpeed(6)
                        noun(85)
                    )
                )(else
                    (self:
                        origStep(1542)
                        view(561)
                        setScale(-1 gOwner)
                        moveSpeed(+ (send gOwner:moveSpeed) 6)
                        cycleSpeed(+ (send gOwner:cycleSpeed) 7)
                        setCycle(Walk)
                        noun(86)
                        setMotion(MChase gOwner local63 self)
                    )
                )
            )
            (case 580
                (if (local30)
                    (self:
                        view(577)
                        z(20)
                        setScale(-1 gOwner)
                        cycleSpeed(6)
                        noun(87)
                    )
                )(else
                    (self:
                        origStep(1542)
                        view(575)
                        setScale(-1 gOwner)
                        moveSpeed(+ (send gOwner:moveSpeed) 3)
                        cycleSpeed((send gOwner:cycleSpeed))
                        setCycle(Walk)
                        z(20)
                        noun(88)
                        setMotion(MChase gOwner local63 self)
                    )
                )
            )
            (case 585
                (if (local30)
                    (self:
                        view(582)
                        setScale(-1 gOwner)
                        cycleSpeed(6)
                        noun(89)
                    )
                )(else
                    (self:
                        origStep(1542)
                        view(580)
                        setScale(-1 gOwner)
                        moveSpeed(+ (send gOwner:moveSpeed) 4)
                        cycleSpeed(+ (send gOwner:cycleSpeed) 5)
                        setCycle(Walk)
                        noun(90)
                        setMotion(MChase gOwner local63 self)
                    )
                )
            )
            (case 575
                (if (local30)
                    (self:
                        view(572)
                        setScale(-1 gOwner)
                        cycleSpeed(6)
                        noun(91)
                    )
                )(else
                    (self:
                        origStep(1542)
                        view(570)
                        setScale(-1 gOwner)
                        moveSpeed(+ (send gOwner:moveSpeed) 4)
                        cycleSpeed(+ (send gOwner:cycleSpeed) 5)
                        setCycle(Walk)
                        noun(92)
                        setMotion(MChase gOwner local63 self)
                    )
                )
            )
            (default 
                (self:dispose())
            )
        )
    )


    (method (doit)
        (var temp0, theBrLeft, theBrRight, temp3, temp4, temp5, temp6)
        (if (((local2 and local1) and (send global2:timer)) and not (send gOwner:script))
            = local2 0
            (send ((send global2:timer)):dispose())
            (send global2:timer(0))
            (send gQg3Messager:say(0 6 87))
        )
        (if (script)
            (send script:doit())
        )
        return 
            (if (not local6)
                = signal (| signal $4000)
                (if (== global365 590)
                    (if (mover)
                        (if (not & signal $0008)
                            (if (== local62 7)
                                = local62 0
                                = signal (| signal $0030)
                                = priority 0
                            )(else
                                ++local62
                                = signal (& signal $ffdf)
                            )
                        )
                        (if (not Random(0 50))
                            ShakeScreen(1)
                        )
                    )(else
                        (if (((== loop 1) or (== loop 0)) and cycler)
                            = signal (& signal $ffcf)
                            ShakeScreen(1)
                        )
                    )
                )
                (if (not % global120 10)
                    (if ((localproc_3ebe(self) and not local25) and (== global100 2))
                        = local25 1
                        (if (>= Random(0 gGOwnerMaxStamina[8]) 100)
                            = global461 10000
                            (self:cue())
                        )
                    )
                )(else
                    = local25 0
                )
                (if (mover and (send global2:timer))
                    (if (== global365 590)
                        (send ((send global2:timer)):
                            dispose()
                            delete()
                        )
                    )(else
                        (self:setMotion(0))
                        = local31 (send ((Polygon:new())):
                                type(2)
                                init((- nsLeft 6) (- nsBottom 5) (+ 6 nsRight) (- nsBottom 5) (+ 6 nsRight) (+ 3 nsBottom) (- nsLeft 6) (+ 3 nsBottom))
                                yourself()
                            )
                        (send global2:addObstacle(local31))
                    )
                )(else
                    (if (((== global365 590) and cycler) and (send global2:timer))
                        (self:setCycle(0))
                        (if (IsObject(newProp_2))
                            (send newProp_2:setCycle(0))
                        )
                        = local31 (send ((Polygon:new())):
                                type(2)
                                init((- nsLeft 6) (- nsBottom 5) (+ 6 nsRight) (- nsBottom 5) (+ 6 nsRight) (+ 3 nsBottom) (- nsLeft 6) (+ 3 nsBottom))
                                yourself()
                            )
                        (send global2:addObstacle(local31))
                    )(else
                        (if (((((== global365 590) and not local30) and not mover) and not (send global2:timer)) and not cycler)
                            (if (not local12 and not local26)
                                (if (<= GetDistance(x y (send gOwner:x) (send gOwner:y)) local63)
                                    (self:setCycle(End self))
                                    (if (IsObject(newProp_2))
                                        (send newProp_2:setCycle(End))
                                    )
                                )(else
                                    (if (<> cel 0)
                                        (self:setCycle(Beg self))
                                        (if (IsObject(newProp_2))
                                            (send newProp_2:setCycle(Beg))
                                        )
                                    )
                                )
                            )
                        )(else
                            (if ((not local30 and not mover) and not (send global2:timer))
                                (if ((send ((send global2:obstacles)):contains(local31)))
                                    (send ((send global2:obstacles)):delete(local31))
                                    (send local31:dispose())
                                )
                                (if (not script and (<> global365 590))
                                    (self:setMotion(MChase gOwner local63 self))
                                )
                            )
                        )
                    )
                )
                (if ((((not local30 and (== global365 595)) and not (send global2:timer)) and not local26) and (<= GetDistance(x y (send gOwner:x) (send gOwner:y)) 15))
                    = global461 0
                    (self:cue())
                )
                (if (<= y 45)
                    = signal (| signal $0008)
                )(else
                    = signal (& signal $fff7)
                )
                (if (& signal $8000)
                    return & signal $8000
                )
                (if ((& signal $0004) and not (& signal $0002))
                    return not & signal $0002
                )
                (if (scaler)
                    (send scaler:doit())
                )
                (if (& scaleSignal $0001)
                    = temp5 (>> origStep $0008)
                    = temp6 (& origStep $00ff)
                    (if (< y (send global2:vanishingY))
                        = temp3 (/ (- (send global2:vanishingY) y) temp5)
                        = temp4 (/ (- (send global2:vanishingY) y) temp6)
                    )(else
                        = temp3 (/ (* temp5 scaleX) 128)
                        = temp4 (/ (* temp6 scaleY) 128)
                    )
                    (if (> temp3 temp5)
                        = temp3 temp5
                    )(else
                        (if (< temp3 1)
                            = temp3 1
                        )
                    )
                    (if (> temp4 temp6)
                        = temp4 temp6
                    )(else
                        (if (< temp4 1)
                            = temp4 1
                        )
                    )
                    (if ((<> temp3 xStep) or (<> temp4 yStep))
                        (self:setStep(temp3 temp4 1))
                    )
                )
                (if (avoider)
                    (send avoider:doit())
                )(else
                    (if (mover)
                        (send mover:doit())
                    )
                )
                (if (cycler)
                    = theBrLeft brLeft
                    = theBrRight brRight
                    (send cycler:doit())
                )
                = brTop (- y 1)
                = brLeft (- x 1)
                = brRight (+ x 1)
                = brBottom (+ y 1)
                = xLast x
                = yLast y
            )(else
                (if (== local6 1)
                    (switch (global365)
                        (case 565
                            (sFx:
                                number(904)
                                setLoop(1)
                                play()
                            )
                        )
                        (case 585
                            (sFx:
                                number(907)
                                setLoop(1)
                                play()
                            )
                        )
                        (case 595
                            (sFx:
                                number(909)
                                setLoop(1)
                                play()
                            )
                        )
                        (case 580
                            (sFx:
                                number(909)
                                setLoop(1)
                                play()
                            )
                        )
                    )
                )
                --local6
            )
    )


    (method (doVerb theVerb param2)
        return 
            (switch (theVerb)
                (case 4
                    (if (local38)
                        (super:doVerb(theVerb rest param2))
                    )(else
                        (switch (global365)
                            (case 595
                                (self:setScript(searchMonster 0 
                                    (if (local32)
                                        0
                                    )(else
                                        Random(2 10)
                                    )
))
                            )
                            (case 565
                                (self:setScript(searchMonster 0 0))
                            )
                            (case 580
                                (self:setScript(searchMonster 0 0))
                            )
                            (case 585
                                (self:setScript(searchMonster 0 
                                    (if (local32)
                                        0
                                    )(else
                                        Random(2 10)
                                    )
))
                            )
                            (case 575
                                (self:setScript(searchMonster 0 
                                    (if (local32)
                                        0
                                    )(else
                                        Random(2 10)
                                    )
))
                            )
                        )
                        = local32 1
                        return 1
                    )
                )
                (default 
                    (super:doVerb(theVerb rest param2))
                )
            )
    )


    (method (delete)
        = signal (& signal $ffdf)
        (super:delete())
    )


    (method (cue)
        (var temp0)
        (if (< global461 global462)
            (if (((>= global461 15) and (== global365 595)) and not local27)
                (if (not (send global2:timer))
                    (self:setScript(throwSpell))
                )
            )(else
                (if (((== global365 590) and (== loop 2)) and not local12)
                    (self:
                        setCel()
                        setLoop(
                            (if (> x (send gOwner:x))
                                0
                            )(else
                                1
                            )
)
                        setCycle(End self)
                        setMotion(0)
                    )
                    = newProp_2 (Prop:new())
                    (send newProp_2:
                        view(585)
                        loop(3)
                        cel(0)
                        setScale(-1 self)
                        x(x)
                        y(y)
                        signal(16400)
                        priority(priority)
                        cycleSpeed(cycleSpeed)
                        setCycle(End)
                        init()
                    )
                )(else
                    (if (((== global365 590) and (== cel 0)) and not local12)
                        (self:
                            setCel(0)
                            setLoop(2)
                            setCycle(Fwd)
                            setMotion(MChase gOwner local63 self)
                        )
                        (if (IsObject(newProp_2))
                            (send newProp_2:dispose())
                            = newProp_2 0
                        )
                    )(else
                        (if (((== global365 590) and (> GetDistance(x y (send gOwner:x) (send gOwner:y)) local63)) and not local12)
                            (self:setCycle(Beg self))
                            (if (IsObject(newProp_2))
                                (send newProp_2:setCycle(Beg))
                            )
                        )(else
                            (if (<= (send gOwner:z) local63)
                                = local38 0
                                (send gOwner:setMotion(0))
                                (self:setMotion(0))
                                = global430 local41
                                = gGOwnerX_4 gOwnerX
                                = gGOwnerY_4 gOwnerY
                                = gGGClientModNum_2 gGClientModNum
                                (if (local44)
                                    = global431 (& global431 $fffe)
                                )(else
                                    = global431 (^ global431 $0001)
                                )
                                (if (local28)
                                    = global431 (& global431 $fffd)
                                )(else
                                    = global431 (^ global431 $0002)
                                )
                                (if (not local26)
                                    = local26 1
                                    = local6 10000
                                    (self:setScript(doBattle))
                                )
                            )(else
                                (if (not local12)
                                    = local12 1
                                    (self:
                                        setCycle(0)
                                        setMotion(MChase gOwner local63 self)
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )(else
            (self:setMotion(0))
            = local15 0
            (send gQg3Messager:say(4 6 90))
            (send gOwner:setMotion(0))
            = local38 0
            = local30 1
            = local13 1
            = local33 1
            (if (proc0_6(96))
                proc0_5(96)
                (send global2:setScript(ScriptID(701 1) 0 0 0))
            )(else
                (send global2:setScript(0))
                proc0_3()
            )
            (send gLongSong:
                setLoop(-1)
                changeTo(400)
            )
            (self:dispose())
        )
    )


    (method (cantBeHere)
        return 0
    )


    (method (getHurt param1 param2)
        = local1 1
        (if ((send global2:timer))
            (send ((send global2:timer)):
                dispose()
                delete()
            )
        )
        (if (not local30)
            (switch (global365)
                (case 595
                    (if (== param1 -1)
                        (if (local29)
                            0
                        )(else
                            = local29 1
                            (send gQg3Messager:say(4 6 94))
                        )
                    )(else
                        = local6 10
                        = gGMonsterMonHP (- gGMonsterMonHP param2)
                    )
                )
                (case 590
                    (if (<> cel 0)
                        = local6 10
                        = gGMonsterMonHP (- gGMonsterMonHP param2)
                    )
                )
                (case 565
                    = local6 10
                    = gGMonsterMonHP (- gGMonsterMonHP param2)
                )
                (case 580
                    = local6 10
                    = gGMonsterMonHP (- gGMonsterMonHP param2)
                )
                (case 585
                    = local6 10
                    = gGMonsterMonHP (- gGMonsterMonHP param2)
                )
                (case 575
                    = local6 10
                    = gGMonsterMonHP (- gGMonsterMonHP param2)
                )
            )
            (if ((< gGMonsterMonHP 1) and (<> script doBattle))
                = local26 0
                (self:setMotion(0))
                (self:setScript(monsterIsDead))
            )
        )
    )

)
(instance fireWood of View
    (properties
        x 146
        y 160
        noun 80
        view 700
        loop 7
        signal $4000
    )

    (method (init param1)
        (super:init(rest param1))
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(129 155 163 155 163 171 129 171)
                yourself()
            )
))
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 81
                (if (not local15)
                    = noun 93
                    (send global2:setScript(castFire))
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (case 19
                (if (not local15)
                    = noun 93
                    (send global2:setScript(kindleFire))
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (case 48
                (if (local15)
                    = noun 80
                    (send gOwner:drop(37 1))
                    (send gOwner:get(15 1))
                    (send global2:setScript(kindleFire))
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (case 4
                (if (local15)
                    = noun 80
                    (send global2:setScript(kindleFire))
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance showNewRoom of Script
    (properties)

    (method (changeState newState)
        (var gOwnerX, gOwnerY)
        (switch (= state newState)
            (case 0
                proc0_2()
                (self:cue())
            )
            (case 1
                (switch (register)
                    (case 4
                        = gOwnerX -15
                        = gOwnerY (send gOwner:y)
                        (send gOwner:setMotion(PolyPath gOwnerX gOwnerY self))
                    )
                    (case 3
                        = gOwnerY 230
                        = gOwnerX (send gOwner:x)
                        (send gOwner:setMotion(PolyPath gOwnerX gOwnerY self))
                    )
                    (case 2
                        = gOwnerX 330
                        = gOwnerY (send gOwner:y)
                        (send gOwner:setMotion(PolyPath gOwnerX gOwnerY self))
                    )
                    (case 1
                        (self:cue())
                    )
                )
            )
            (case 2
                = local57 1
                (it:setMotion(0))
                (send gOwner:setMotion(0))
                = cycles 2
            )
            (case 3
                proc0_2()
                (switch (register)
                    (case 4
                        --gOwnerX
                        = gOwnerX 0
                        (it:x((+ 330 (- (it:x) (send gOwner:x)))))
                        (send gOwner:
                            x(325)
                            y(155)
                        )
                        = gOwnerY (send gOwner:y)
                    )
                    (case 1
                        --gOwnerY
                        = gOwnerX (send gOwner:x)
                        = gOwnerY 0
                        (it:y((+ 230 (- (it:y) (send gOwner:y)))))
                        (send gOwner:
                            y(205)
                            x(160)
                        )
                    )
                    (case 3
                        ++gOwnerY
                        = gOwnerY 190
                        (it:y((+ 45 (- (it:y) (send gOwner:y)))))
                        (send gOwner:
                            y(45)
                            x(160)
                        )
                        = gOwnerX (send gOwner:x)
                    )
                    (case 2
                        ++gOwnerX
                        = gOwnerX 320
                        = gOwnerY (send gOwner:y)
                        (it:x((+ -15 (- (it:x) (send gOwner:x)))))
                        (send gOwner:
                            x(-5)
                            y(155)
                        )
                    )
                )
                localproc_3a24()
                (send gOwner:
                    init()
                    normalize()
                    signal(2)
                    setScale(Scaler 120 59 189 47)
                    setMotion(PolyPath gOwnerX gOwnerY)
                )
                = cycles 2
            )
            (case 4
                (if (<> global365 6)
                    (it:init())
                )
                proc0_3()
                = cycles 2
            )
            (case 5
                (if (== global365 6)
                    (send (ScriptID(702 0)):init())
                    ++local22
                    = seconds (+ (send gOwner:moveSpeed) 1)
                )(else
                    = local24 0
                    (self:dispose())
                )
            )
            (case 6
                (switch (local22)
                    (case 1
                        (if (& global431 $4000)
                            (send gQg3Messager:say(4 6 58))
                        )(else
                            (send gQg3Messager:say(4 6 62))
                        )
                    )
                    (case 2
                        (if (& global431 $4000)
                            (send gQg3Messager:say(4 6 61))
                            = local38 0
                        )(else
                            (send gQg3Messager:say(4 6 57))
                        )
                    )
                    (case 3
                        (send gQg3Messager:say(4 6 59))
                        = local38 0
                    )
                )
                (self:dispose())
            )
        )
    )

)
