(version 2)
(include "sci.sh")
(exports
    0 endGame
    1 deWizTalker
    2 deWiz
    3 gargoyle
    4 orb
    5 portal
    6 deMaster
    7 knockGarg
    8 castSpells
    9 zap
    10 deWizTimer
    11 walkOnGarg
    12 blastWiz
    13 touchPortal
    14 touchOrb
    15 blastOrb
    16 egoHit
    17 sFx
    18 pedestal
    19 noticeEgo
)
(use "Main")
(use "TargFeature")
(use "n026")
(use "OccasionalCycle")
(use "Blink")
(use "Scaler")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Sound")
(use "Cycle")
(use "Game")
(use "User")
(use "View")
(use "Obj")
(script 850)


(local
    local0
    local1
    local2

)
(instance public endGame of Rgn
    (properties
        modNum 850
        noun 18
    )

    (method (init)
        (egoActions:init(gOwner))
        (send gLongSong:
            number(851)
            setLoop(-1)
            play(127)
        )
        (send gOwner:
            x(-10)
            y(183)
            actions(egoActions)
            init()
            setScale(Scaler 92 63 189 130)
            normalize()
            ignoreHorizon(1)
        )
        proc0_3()
        (if (not == global125 1)
            (send gMainIconBar:disable(6 5 4))
        )
        (super:init())
        (switch (global125)
            (case 2
                (send global2:addObstacle((send ((Polygon:new())):
                        type(3)
                        init(270 67 266 76 243 76 238 66 227 66 206 90 180 90 172 74 147 76 147 87 139 92 118 92 112 85 112 80 81 85 104 101 166 94 181 105 128 114 142 121 153 120 162 127 161 139 148 145 162 165 205 167 227 189 301 189 264 167 319 152 319 56 292 59)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(3)
                        init(0 100 0 189 112 189 104 178 116 176 108 166 88 156 77 158 69 148 52 148 48 144 55 134 45 124 28 121 45 115 35 105)
                        yourself()
                    )
))
            )
            (case 1
                (send global2:addObstacle((send ((Polygon:new())):
                        type(3)
                        init(270 67 266 76 243 76 238 66 227 66 206 90 180 90 172 74 147 76 147 87 139 92 118 92 112 85 112 80 81 85 104 101 166 94 181 105 128 114 142 121 153 120 162 127 161 139 148 145 162 165 205 167 227 189 301 189 264 167 319 152 319 56 292 59)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(3)
                        init(0 144 0 189 112 189 104 178 116 176 110 171 84 173 72 162 69 148 52 148 48 144)
                        yourself()
                    )
))
            )
            (default 
                (send global2:addObstacle((send ((Polygon:new())):
                        type(3)
                        init(206 90 177 90 170 76 151 76 151 92 110 92 108 81 84 85 104 100 166 94 183 104 128 114 142 121 153 120 162 127 161 139 148 145 162 165 205 167 227 189 301 189 264 167 319 152 319 56 282 56 282 135 277 142 253 140 239 107)
                        yourself()
                    )
 (send ((Polygon:new())):
                        type(3)
                        init(0 144 0 189 112 189 104 178 116 176 108 166 88 156 77 158 69 148 52 148 48 144)
                        yourself()
                    )
))
            )
        )
        (if (not == global125 2)
            (gargoyle:
                x(93)
                y(174)
                loop(0)
                cel(0)
                init()
            )
        )
        (if (== global125 1)
            (gargoyle:
                view(853)
                loop(1)
                cel(0)
            )
        )
        (portal:
            init()
            stopUpd()
        )
        (deWiz:
            init()
            setPri(12)
            stopUpd()
        )
        (orb:
            init()
            stopUpd()
        )
        (if (== global125 2)
            (pedestal:
                view(853)
                x(217)
                y(124)
            )
        )
        (pedestal:
            init()
            stopUpd()
        )
        (ledge:init())
    )


    (method (doit)
        proc0_15(72 86 -1)
        (super:doit())
    )


    (method (dispose)
        (send gOwner:changeGait(0))
        (if (gNewList)
            (send gNewList:dispose())
        )
        proc958_0(0 851 852 853 854 33)
        (super:dispose())
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 56
                (if (not (send global2:script))
                    proc0_4(84)
                    (self:setScript(ScriptID(32 0) 0 theVerb))
                )
            )
            (case 20
                (if (not (send global2:script))
                    (self:setScript(ScriptID(32 0) 0 theVerb))
                )
            )
            (case 33
                (if (not (send global2:script))
                    (self:setScript(ScriptID(32 0) 0 theVerb))
                )
            )
            (case 81
                (if (not (self:script))
                    (self:setScript(ScriptID(32 0) 0 theVerb))
                )
            )
            (case 88
                (if (not (self:script))
                    (self:setScript(ScriptID(32 0) 0 theVerb))
                )
            )
            (case 83
                (if (not (self:script))
                    (self:setScript(ScriptID(32 0) 0 theVerb))
                )
            )
            (case 80
                (send gQg3Messager:say(2 6 66 0 0 850))
            )
            (case 86
                (send gQg3Messager:say(2 6 66 0 0 850))
            )
            (case 78
                (send gQg3Messager:say(2 6 66 0 0 850))
            )
            (case 82
                (send gQg3Messager:say(2 6 67 0 0 850))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )


    (method (cue)
        (if (== (send gOwner:script) walkOnGarg)
            (send gMainIconBar:disable(1 5 4))
        )
        (super:cue())
    )

)
(instance public knockGarg of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (== (send (ScriptID(851 2)):state) 0)
                    (self:cue())
                )(else
                    (if (== (send (ScriptID(852 2)):state) 0)
                        (self:cue())
                    )(else
                        (if ((not (== (egoHit:state) -1) or not (== (send (ScriptID(851 2)):state) -1)) or not (== (send (ScriptID(852 2)):state) -1))
                            0
                        )(else
                            (self:cue())
                        )
                    )
                )
            )
            (case 1
                proc0_2()
                = local0 1
                (castSpells:dispose())
                (if (not (send gGQg3KDHandler:contains(ScriptID(852 5))))
                    (deWiz:stopUpd())
                )
                (send gOwner:
                    changeGait(1)
                    setMotion(MoveTo 52 180 self)
                )
            )
            (case 2
                (send gOwner:
                    view(36)
                    cel(0)
                    setLoop(0)
                    setCycle(CT 3 1 self)
                )
            )
            (case 3
                (sFx:
                    number(850)
                    play()
                )
                (gargoyle:
                    view(871)
                    cel(0)
                    setCycle(End self)
                )
                (send gOwner:setCycle(End))
            )
            (case 4
                (sFx:
                    number(920)
                    play()
                )
                ShakeScreen(10)
                (send gQg3Walkers:addToFront(gargoyle))
                (gargoyle:stopUpd())
                (send gOwner:
                    view(0)
                    changeGait(0)
                    normalize()
                )
                (if ((not proc0_6(91) and (send gGQg3KDHandler:contains(deWiz))) and (not (== (send (ScriptID(852 3)):state) -1) or not (== (send (ScriptID(851 3)):state) -1)))
                    (deWiz:setScript(castSpells))
                )
                proc0_3()
                (send gMainIconBar:disable(6 4 5))
                (self:dispose())
            )
        )
    )

)
(instance public castSpells of Script
    (properties)

    (method (dispose)
        (if ((send gGQg3KDHandler:contains(zap)))
            (zap:dispose())
        )
        (super:dispose())
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gMainIconBar:disable(1 4 5))
                (if (not == global125 1)
                    (send gMainIconBar:disable(6))
                )
                (deWiz:
                    view(863)
                    cel(0)
                    loop(Random(0 6))
                    setCycle(End self)
                )
            )
            (case 1
                (deWiz:
                    view(863)
                    loop(0)
                    setCycle(CT 6 1 self)
                )
            )
            (case 2
                (sFx:
                    number(13)
                    play()
                )
                (zap:
                    setLoop(Random(0 4))
                    x(186)
                    y(60)
                    setStep(8 7)
                    cycleSpeed(0)
                    moveSpeed(0)
                    setScale()
                    init()
                    setMotion(MoveTo (send gOwner:x) - (send gOwner:y) 35 self)
                )
                (deWiz:setCycle(End))
            )
            (case 3
                (if (> (zap:loop) 3)
                    (zap:
                        loop(10)
                        setCycle(End self)
                    )
                )(else
                    (zap:
                        loop(9)
                        setCycle(End self)
                    )
                )
            )
            (case 4
                (zap:dispose())
                (send gMainIconBar:enable(1))
                (if (proc0_6(91) or proc0_6(84))
                    proc26_0(47 850)
                )
                = state -1
                (switch (global209)
                    (case 1
                        = seconds 10
                    )
                    (case 2
                        = seconds 7
                    )
                    (case 3
                        = seconds 5
                    )
                )
            )
        )
    )

)
(instance public egoHit of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (not 
                (if ((== (blastWiz:state) -1) and (== (send (ScriptID(852 3)):state) -1))
                    == (send (ScriptID(851 3)):state) -1
                )
)
                    0
                )(else
                    (self:cue())
                )
            )
            (case 1
                proc0_2()
                (sFx:
                    number(930)
                    play()
                )
                (if ((send gOwner:takeDamage(Random(5 15))))
                    (send gOwner:
                        view(29)
                        loop(0)
                        cel(0)
                        setMotion(0)
                        setCycle(CT 6 1 self)
                    )
                )(else
                    proc26_0(47 850)
                )
            )
            (case 2
                (send gOwner:setCycle(Beg self))
            )
            (case 3
                (send gOwner:
                    view(0)
                    normalize()
                )
                proc0_3()
                (if (not == global125 1)
                    (send gMainIconBar:disable(6 5 4))
                )
                (if (== (blastWiz:state) 0)
                    (blastWiz:cue())
                )
                (if (== (send (ScriptID(851 3)):state) 0)
                    (send (ScriptID(851 3)):cue())
                )
                (if (== (knockGarg:state) 0)
                    (knockGarg:cue())
                )
                (if (== (send (ScriptID(852 3)):state) 1)
                    (send (ScriptID(852 3)):cue())
                )
                = state -1
                (self:dispose())
            )
        )
    )

)
(instance public blastWiz of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if ((not (== (egoHit:state) -1) or (== (self:client) ScriptID(851 2))) or (== (self:client) ScriptID(852 2)))
                    0
                )(else
                    (self:cue())
                )
            )
            (case 1
                proc0_2()
                proc0_4(15)
                (self:setScript(ScriptID(32 0) self register))
            )
            (case 2
                proc0_5(15)
                (if (not 
                (if ((> (send gOwner:view) 17) and (< (send gOwner:view) 21))
                )
)
                    (send gOwner:normalize())
                )(else
                    proc0_2()
                )
                (if (== (egoHit:state) 0)
                    (egoHit:cue())
                )
                (if (== (send (ScriptID(853 1)):state) 3)
                    (send (ScriptID(853 1)):seconds(3))
                )
                (if (not 
                (if ((> (send gOwner:view) 17) and (< (send gOwner:view) 21))
                )
 and (== global125 1))
                    (send gMainIconBar:enable(6 8))
                )
                (if (not == global125 1)
                    (send gMainIconBar:enable(8))
                )
                (User:
                    controls(1)
                    input(1)
                )
                (if (== (send gOwner:script) walkOnGarg)
                    (send gMainIconBar:disable(1 5 4 6))
                )
                = state -1
                (self:dispose())
            )
        )
    )

)
(instance public deWizTimer of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (not (send gGQg3KDHandler:contains(ScriptID(852 5))))
                    (deWiz:setCycle(OccasionalCycle 1 10 1550))
                )
                (switch (global209)
                    (case 1
                        = seconds 90
                    )
                    (case 2
                        = seconds 60
                    )
                    (case 3
                        = seconds 30
                    )
                )
            )
            (case 1
                (if (== (self:script) ScriptID(852 6))
                    (send (ScriptID(852 6)):dispose())
                )
                (deMaster:
                    view(856)
                    loop(1)
                    setPri(6)
                    init()
                )
                DrawPic((send global2:picture) dpCLOSEREOPEN_HCENTER)
                = seconds 1
            )
            (case 2
                proc26_0(2 850)
            )
        )
    )

)
(instance public walkOnGarg of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (castSpells:dispose())
                (send gQg3Walkers:delete(gargoyle))
                (send gOwner:setMotion(MoveTo 128 169 self))
            )
            (case 1
                (if (proc0_6(91) or not (send gGQg3KDHandler:contains(deWiz)))
                    (self:cue())
                )(else
                    (send gQg3Messager:say(3 6 8 0 self 850))
                )
            )
            (case 2
                (if (proc0_6(91) or not (send gGQg3KDHandler:contains(deWiz)))
                    (self:cue())
                )(else
                    (gargArm:
                        init()
                        setCycle(End self)
                    )
                )
            )
            (case 3
                (if (proc0_6(91) or not (send gGQg3KDHandler:contains(deWiz)))
                    (self:cue())
                )(else
                    (send gQg3Messager:say(2 6 9 0 self 850))
                    (deWiz:setScript(castSpells))
                    (send gMainIconBar:advanceCurIcon())
                    (send gGame:setCursor(941))
                )
            )
            (case 4
                (if (proc0_6(91) or not (send gGQg3KDHandler:contains(deWiz)))
                    (self:cue())
                )(else
                    (if (== global125 3)
                        (send gQg3Messager:say(3 6 14 0 0 850))
                    )
                    (deWiz:setScript(deWizTimer))
                    (send gMainIconBar:enable(3 9 8 2))
                    (send gUser:canInput(1))
                )
            )
            (case 5
                (if (proc0_6(91) or not (send gGQg3KDHandler:contains(deWiz)))
                    (self:cue())
                )(else
                    proc0_2()
                    (gargArm:setCycle(Beg self))
                )
            )
            (case 6
                (gargArm:dispose())
                (send gOwner:setMotion(MoveTo 183 147 self))
            )
            (case 7
                = local1 1
                proc0_3()
                (send gMainIconBar:disable(6 5 4))
                (self:dispose())
            )
        )
    )

)
(instance public touchPortal of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(MoveTo 225 120 self))
            )
            (case 1
                (send gOwner:
                    view(31)
                    loop(0)
                    setCycle(End self)
                )
            )
            (case 2
                (send gOwner:dispose())
                DrawPic(850 dpCLOSEREOPEN_HCENTER)
                = seconds 2
            )
            (case 3
                proc26_0(11 850)
                (self:dispose())
            )
        )
    )

)
(instance public touchOrb of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(MoveTo 243 141 self))
            )
            (case 1
                (send gOwner:
                    view(31)
                    loop(0)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 2
                (send gOwner:dispose())
                DrawPic(850 dpCLOSEREOPEN_HCENTER)
                = seconds 2
            )
            (case 3
                proc26_0(12 850)
                (self:dispose())
            )
        )
    )

)
(instance knockOrb of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (deWizTimer:dispose())
                (if (< (send gOwner:x) 100)
                    (send gOwner:
                        changeGait(1)
                        setMotion(MoveTo (send gOwner:x) 141 self)
                    )
                )(else
                    (self:cue())
                )
            )
            (case 1
                (send gOwner:
                    changeGait(1)
                    setMotion(MoveTo 243 141 self)
                )
            )
            (case 2
                (send gOwner:
                    view(36)
                    loop(0)
                    cel(0)
                    setCycle(CT 4 1 self)
                )
            )
            (case 3
                (sFx:
                    number(850)
                    play()
                )
                (orb:
                    moveSpeed(0)
                    setStep(7 6)
                    setMotion(MoveTo 247 80)
                )
                (send gOwner:setCycle(End self))
            )
            (case 4
                (sFx:
                    number(101)
                    play()
                )
                (orb:dispose())
                (send gOwner:solvePuzzle(341 20))
                DrawPic(850 dpCLOSEREOPEN_HCENTER)
                = seconds 2
            )
            (case 5
                (if ((send gGQg3KDHandler:contains(ScriptID(852 5))))
                    (send (ScriptID(852 4)):dispose())
                    (send (ScriptID(852 5)):dispose())
                )
                (if ((send gGQg3KDHandler:contains(deWiz)))
                    (deWiz:
                        setCycle(Walk)
                        setStep(6 5)
                        moveSpeed(0)
                        setPri(14)
                        setMotion(MoveTo 243 89 self)
                    )
                )(else
                    (self:cue())
                )
            )
            (case 6
                (if ((send gGQg3KDHandler:contains(deWiz)))
                    (deWiz:hide())
                    DrawPic(850 dpCLOSEREOPEN_HCENTER)
                    (send gOwner:solvePuzzle(340 10))
                    = seconds 2
                )(else
                    (self:cue())
                )
            )
            (case 7
                (portal:setCycle(End self))
                (sFx:
                    number(831)
                    play()
                )
            )
            (case 8
                (portal:
                    loop(1)
                    setCycle(Fwd)
                )
                = seconds 3
            )
            (case 9
                (portal:dispose())
                (send gOwner:normalize())
                (switch (global125)
                    (case 0
                        (send gQg3Messager:say(2 6 57 0 self 850))
                    )
                    (case 3
                        (send gQg3Messager:say(2 6 58 0 self 850))
                    )
                    (default 
                        (send gQg3Messager:say(2 6 3 0 self 850))
                    )
                )
            )
            (case 10
                = cycles 3
            )
            (case 11
                proc0_4(117)
                (send global2:newRoom(830))
            )
        )
    )

)
(instance public blastOrb of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (deWizTimer:dispose())
                (self:setScript(ScriptID(32 0) self register))
            )
            (case 1
            )
            (case 2
                (sFx:
                    number(520)
                    play()
                )
                (if ((send gGQg3KDHandler:contains(ScriptID(852 4))))
                    (send (ScriptID(852 5)):dispose())
                    (send (ScriptID(852 4)):dispose())
                )
                (orb:
                    moveSpeed(0)
                    setStep(7 6)
                    setMotion(MoveTo 247 80 self)
                )
            )
            (case 3
                (orb:dispose())
                (send gOwner:solvePuzzle(341 20))
                DrawPic(850 dpCLOSEREOPEN_HCENTER)
                = seconds 2
            )
            (case 4
                (if ((send gGQg3KDHandler:contains(deWiz)))
                    (deWiz:
                        setCycle(Walk)
                        setStep(6 5)
                        moveSpeed(0)
                        setPri(14)
                        setMotion(MoveTo 243 89 self)
                    )
                )(else
                    (self:cue())
                )
            )
            (case 5
                (if ((send gGQg3KDHandler:contains(deWiz)))
                    (deWiz:hide())
                    DrawPic(850 dpCLOSEREOPEN_HCENTER)
                    (send gOwner:solvePuzzle(340 10))
                    = seconds 2
                )(else
                    (self:cue())
                )
            )
            (case 6
                (portal:setCycle(End self))
                (sFx:
                    number(831)
                    play()
                )
            )
            (case 7
                (portal:
                    loop(1)
                    setCycle(Fwd)
                )
                = seconds 3
            )
            (case 8
                (portal:dispose())
                (send gQg3Messager:say(2 6 3 0 self 850))
            )
            (case 9
                proc0_4(117)
                (send global2:newRoom(830))
            )
        )
    )

)
(instance deSummons of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(3 6 14 0 self 850))
            )
            (case 1
                (deWiz:
                    view(861)
                    loop(1)
                    cel(5)
                    setCycle(Beg self)
                )
            )
            (case 2
                (deWiz:
                    loop(0)
                    setCycle(OccasionalCycle self 1 1 20)
                )
                (send global2:setScript(deWizTimer))
            )
        )
    )

)
(instance public noticeEgo of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                proc0_4(124)
                (send gOwner:code(0))
                (send gQg3Messager:say(1 6 5 0 self 850))
            )
            (case 1
                (deMaster:dispose())
                DrawPic(850 dpCLOSEREOPEN_HCENTER)
                = seconds 1
            )
            (case 2
                (deWiz:
                    view(861)
                    loop(1)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 3
                (send gQg3Messager:say(3 6 6 0 self 850))
            )
            (case 4
                (deWiz:
                    view(863)
                    cel(0)
                    setCycle(End)
                )
                (send gLongSong2:
                    setLoop(1)
                    number(13)
                    play()
                )
                (zap:
                    setLoop(Random(0 4))
                    x(186)
                    y(60)
                    setStep(8 7)
                    cycleSpeed(0)
                    moveSpeed(0)
                    setScale()
                    init()
                    setMotion(MoveTo (send gOwner:x) - (send gOwner:y) 35 self)
                )
            )
            (case 5
                (if (> (zap:loop) 3)
                    (zap:
                        loop(10)
                        setCycle(End self)
                    )
                )(else
                    (zap:
                        loop(9)
                        setCycle(End self)
                    )
                )
            )
            (case 6
                (zap:dispose())
                (if (== global125 2)
                    proc26_0(47 850 857 End)
                )
                (self:dispose())
            )
        )
    )

)
(instance public zap of Actor
    (properties
        yStep 7
        view 21
        signal $4000
        xStep 8
    )

    (method (init)
        (super:init())
        SetNowSeen(self)
    )


    (method (doit)
        (super:doit())
        (if (((send gOwner:onMe(zap)) and not proc0_6(82)) and not proc0_6(89))
            (if (not 
            (if ((> (send gOwner:view) 17) and (< (send gOwner:view) 21))
            )
 and not (castSpells:script))
                (castSpells:setScript(egoHit))
            )
        )
    )

)
(instance public gargoyle of Prop
    (properties
        x 93
        y 174
        noun 6
        modNum 850
        view 852
        priority 8
        signal $4010
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (if ((send gOwner:has(5)) and not local0)
                    (self:setScript(knockGarg))
                )(else
                    (if (local0 and (== (walkOnGarg:state) -1))
                        (send gOwner:setScript(walkOnGarg))
                    )(else
                        (super:doVerb(theVerb))
                    )
                )
            )
            (case 15
                (if ((send gOwner:has(5)) and not local0)
                    (self:setScript(knockGarg))
                )
            )
            (case 3
                (if (local0 and (== (walkOnGarg:state) -1))
                    (send gOwner:setScript(walkOnGarg))
                )
            )
            (case 26
                (if (local0)
                    (walkOnGarg:cue())
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance public deWiz of TargActor
    (properties
        x 187
        y 115
        noun 3
        modNum 850
        view 861
        signal $4000
    )

    (method (dispose)
        (send gOwner:addHonor(50))
        (super:dispose())
    )


    (method (doVerb theVerb)
        (if (proc999_5(theVerb 81 83 88 20 11 33))
            (if (== (send (ScriptID(853 2)):state) 11)
                proc26_0(18 850 857 End)
            )(else
                (if ((== theVerb 11) and not (== global125 3))
                    0
                )(else
                    (if (not (send global2:script) and (== theVerb 11))
                        (send global2:setScript(ScriptID(852 3)))
                        (if (== (deWiz:script) castSpells)
                            (castSpells:dispose())
                        )
                    )(else
                        (if (== (send gOwner:script) ScriptID(851 2))
                            (send (ScriptID(851 2)):setScript(blastWiz 0 theVerb))
                        )(else
                            (if (== (send gOwner:script) ScriptID(852 2))
                                (send (ScriptID(852 2)):setScript(ScriptID(852 3) 0 theVerb))
                            )(else
                                (if (not (send gOwner:script))
                                    proc0_14((send ((User:curEvent)):x) (send ((User:curEvent)):y))
                                    (send gOwner:setScript(blastWiz 0 theVerb))
                                )(else
                                    (if ((== (send gOwner:script) egoHit) or (== (send gOwner:script) walkOnGarg))
                                        proc0_14((send ((User:curEvent)):x) (send ((User:curEvent)):y))
                                        (send global2:setScript(blastWiz 0 theVerb))
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )(else
            (if (== theVerb 56)
                proc0_4(84)
                (if (== (send gOwner:script) walkOnGarg)
                    (walkOnGarg:setScript(ScriptID(851 3) walkOnGarg theVerb))
                )(else
                    (if (not (send gOwner:script))
                        (send gOwner:setScript(ScriptID(851 3) 0 theVerb))
                    )(else
                        (send global2:setScript(ScriptID(851 3) 0 theVerb))
                    )
                )
            )(else
                (if ((== global125 3) and (== theVerb 11))
                    (if (== (send gOwner:script) walkOnGarg)
                        (walkOnGarg:setScript(ScriptID(852 3) walkOnGarg theVerb))
                    )(else
                        (if (not (send gOwner:script))
                            (send gOwner:setScript(ScriptID(852 3) walkOnGarg theVerb))
                        )
                    )
                )(else
                    (if ((((== global125 3) and (== theVerb 4)) and local0) and not (== (send (ScriptID(852 3)):state) -1))
                        (send (ScriptID(852 3)):cue())
                    )(else
                        (if (== theVerb 26)
                            (send gQg3Messager:say(3 26 10 0 0 850))
                        )(else
                            (if (== theVerb 16)
                                (if (not > (send gOwner:x) 290)
                                    (send gQg3Messager:say(2 6 37 0 0 850))
                                )(else
                                    (send gOwner:setScript(ScriptID(854 2)))
                                )
                            )(else
                                (if ((== theVerb 4) and (send gGQg3KDHandler:contains(ScriptID(852 5))))
                                    proc26_0(2 850)
                                )(else
                                    (super:doVerb(theVerb))
                                )
                            )
                        )
                    )
                )
            )
        )
    )


    (method (getHurt)
        (if (not proc0_6(124))
            (send global2:setScript(noticeEgo))
        )(else
            (if (proc0_6(84))
                (if (not == (send (ScriptID(851 3)):state) -1)
                    (send (ScriptID(851 3)):cue())
                )(else
                    (send gOwner:drop(45))
                    (send (ScriptID(851 3)):start(2))
                    (if (== (send gOwner:script) walkOnGarg)
                        (walkOnGarg:setScript(ScriptID(851 3)))
                    )(else
                        (send gOwner:setScript(ScriptID(851 3)))
                    )
                )
            )(else
                (if (proc0_6(91))
                    (send (ScriptID(852 3)):cue())
                )(else
                    (if (== 
                    (if ((> (send gOwner:view) 17) and (< (send gOwner:view) 21))
                    )
 1)
                        (send ((send global2:script)):setScript(ScriptID(853 3)))
                    )(else
                        (if (== global125 1)
                            (send gQg3Messager:say(3 6 43 0 0 850))
                        )(else
                            (send gQg3Messager:say(3 6 29 0 0 850))
                        )
                    )
                )
            )
        )
    )

)
(instance public portal of Prop
    (properties
        x 246
        y 106
        noun 19
        modNum 850
        view 856
        priority 1
        signal $4015
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (if (local0 and not (send gGQg3KDHandler:contains(deWiz)))
                    (send global2:setScript(touchPortal))
                )(else
                    (super:doVerb(theVerb))
                )
            )
            (case 33
                (send global2:doVerb(theVerb))
            )
            (case 81
                (send global2:doVerb(theVerb))
            )
            (case 83
                (send global2:doVerb(theVerb))
            )
            (case 88
                (send global2:doVerb(theVerb))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance public orb of TargActor
    (properties
        x 267
        y 115
        z 20
        noun 15
        modNum 850
        view 860
        loop 1
        signal $4000
    )

    (method (dispose)
        (send gOwner:addHonor(100))
        (super:dispose())
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (if (local0 and local1)
                    (send global2:setScript(touchOrb))
                )(else
                    (super:doVerb(theVerb))
                )
            )
            (case 15
                (if (== (send gOwner:script) ScriptID(851 2))
                    (send (ScriptID(851 2)):dispose())
                )
                (if ((not local1 and (== local0 1)) and not (== (send gOwner:script) walkOnGarg))
                    (send gOwner:setScript(walkOnGarg))
                )
                (if ((== local0 1) and not (== (send gOwner:script) walkOnGarg))
                    (send global2:setScript(knockOrb))
                )(else
                    (super:doVerb(theVerb))
                )
            )
            (case 83
                (if (== (send (ScriptID(853 2)):state) 11)
                    proc26_0(18 850 857 End)
                )(else
                    (send global2:setScript(blastOrb 0 theVerb))
                )
            )
            (case 88
                (if (== (send (ScriptID(853 2)):state) 11)
                    proc26_0(18 850 857 End)
                )(else
                    (send global2:setScript(blastOrb 0 theVerb))
                )
            )
            (case 56
                (send global2:setScript(ScriptID(32 0) 0 theVerb))
            )
            (case 16
                (send gQg3Messager:say(2 6 49 0 0 850))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )


    (method (getHurt)
        (if ((send gGQg3KDHandler:contains(deWiz)))
            (send gQg3Messager:say(2 6 42 0 0 850))
        )(else
            (if (== (send global2:script) blastOrb)
                (blastOrb:cue())
            )(else
                (deWizTimer:dispose())
                (blastOrb:start(2))
                (send global2:setScript(blastOrb))
            )
        )
    )

)
(instance public deMaster of View
    (properties
        x 210
        y 17
        modNum 850
        view 873
        loop 1
        priority 14
        signal $4015
    )
)
(instance public pedestal of TargProp
    (properties
        x 266
        y 139
        noun 16
        modNum 850
        view 860
        signal $5000
    )

    (method (doVerb theVerb)
        (orb:doVerb(theVerb))
    )


    (method (getHurt)
        (orb:getHurt())
    )

)
(instance public deWizTalker of Talker
    (properties
        x 10
        y 10
        view 862
        loop 1
        talkWidth 260
        back 57
        textX 15
        textY 100
    )

    (method (init param1)
        (super:init(deWizBust deWizEyes deWizMouth rest param1))
    )


    (method (doit param1)
        (self:
            cycle(brows)
            cycle(bubbles)
        )
        (super:doit(rest param1))
    )


    (method (dispose)
        (brows:
            setCycle(0)
            dispose()
        )
        (bubbles:
            setCycle(0)
            dispose()
        )
        (super:dispose())
    )


    (method (startText)
        (send eyes:setCycle(Fwd))
        (brows:setCycle(Fwd))
        (bubbles:setCycle(Fwd))
        (super:startText())
    )

)
(instance brows of Prop
    (properties
        nsTop 32
        nsLeft 28
        view 862
        loop 3
        cycleSpeed 96
    )
)
(instance bubbles of Prop
    (properties
        nsTop 12
        nsLeft 42
        view 862
        loop 4
        cycleSpeed 24
    )
)
(instance deWizMouth of Prop
    (properties
        nsTop 51
        nsLeft 32
        view 862
    )
)
(instance deWizEyes of Prop
    (properties
        nsTop 42
        nsLeft 37
        view 862
        loop 2
    )
)
(instance deWizBust of View
    (properties
        view 862
        loop 1
    )
)
(instance gargArm of Prop
    (properties
        x 122
        y 182
        view 858
        priority 13
        signal $4010
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 26
                (send gQg3Messager:say(4 26 10 0 0 850))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance ledge of Feature
    (properties
        x 98
        y 165
        noun 17
        nsTop 150
        nsLeft 74
        nsBottom 181
        nsRight 123
        sightAngle 180
    )
)
(instance egoActions of Actions
    (properties)

    (method (doVerb theVerb)
        (if (((not local0 and (== theVerb 15)) and (send gGQg3KDHandler:contains(deWiz))) and not (== (castSpells:script) egoHit))
            (send gOwner:setScript(ScriptID(851 2)))
        )(else
            (if ((((not local0 and (== theVerb 11)) and (== global125 3)) and (send gGQg3KDHandler:contains(deWiz))) and not (== (castSpells:script) egoHit))
                (send gOwner:setScript(ScriptID(852 2)))
            )(else
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance public sFx of Sound
    (properties)
)
