(version 2)
(include "sci.sh")
(exports
    0 rm650
)
(use "Main")
(use "n026")
(use "JumpX")
(use "CueObj")
(use "n958")
(use "Timer")
(use "Cycle")
(use "Game")
(use "View")
(use "Obj")
(script 650)


(local
    local0
    local1
    local2 =     72
    local3
    local4
    local5
    local6
    local7
    local8
    local9
    local10
    local11
    local12
    local13
    local14
    local15
    local16
    local17 =     2
    local18
    local19
    local20
    newActor
    local22
    local23

)
(procedure (localproc_0ff0 param1 param2)
    (switch (global209)
        (case 1
            (send ((Timer:new())):setReal(param1 (* param2 10)))
        )
        (case 2
            (send ((Timer:new())):setReal(param1 (* param2 7)))
        )
        (case 3
            (send ((Timer:new())):setReal(param1 (* param2 4)))
        )
    )
)


(procedure (localproc_104a)
    DrawPic((send global2:picture) dpCLOSEREOPEN_HCENTER)
    Animate((send gGQg3KDHandler:elements) 0)
)


(class Fcycler of Cycle
    (properties
        client 0
        caller 0
        cycleDir 1
        cycleCnt 0
        completed 0
        head 0
        tail 10
    )

    (method (init param1 param2 param3)
        (super:init(param1))
        (self:head(param2))
        (if (> param3 (send client:lastCel()))
            (self:tail((send client:lastCel())))
        )(else
            (self:tail(param3))
        )
    )


    (method (doit)
        (var fcyclerNextCel)
        = fcyclerNextCel (self:nextCel())
        (if (> fcyclerNextCel (self:tail))
            (self:cycleDone())
        )(else
            (send client:cel(fcyclerNextCel))
        )
    )


    (method (cycleDone)
        (send client:cel(head))
    )

)
(class Sspell of Actor
    (properties
        x 0
        y 0
        z 0
        heading 0
        noun 0
        modNum -1
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        sightAngle 26505
        actions 0
        onMeCheck $6789
        approachX 0
        approachY 0
        approachDist 0
        _approachVerbs 0
        yStep 10
        view 21
        loop 0
        cel 0
        priority 15
        underBits 0
        signal $0010
        lsTop 0
        lsLeft 0
        lsBottom 0
        lsRight 0
        brTop 0
        brLeft 0
        brBottom 0
        brRight 0
        palette 0
        scaleSignal $0000
        scaleX 128
        scaleY 128
        maxScale 128
        cycleSpeed 0
        script 0
        cycler 0
        timer 0
        detailLevel 0
        scaler 0
        illegalBits $8000
        xLast 0
        yLast 0
        xStep 12
        origStep 770
        moveSpeed 0
        blocks 0
        baseSetter 0
        mover 0
        looper 0
        viewer 0
        avoider 0
        code 0
        tim 0
    )

    (method (init param1 param2)
        (super:init(rest param2))
        (self:
            x((send gOwner:x))
            y(- (send gOwner:y) 40)
            setLoop(param1)
            setCycle(Fwd)
            setMotion(MoveTo local15 local16 self)
        )
        (if (== param1 4)
            (self:
                scaleX(88)
                scaleY(88)
                origStep(6672)
            )
        )
        (send gLongSong2:
            number(
                (switch (param1)
                    (case 0
                        943
                    )
                    (case 2
                        13
                    )
                    (default 
                        11
                    )
                )
)
            play()
            setLoop(1)
        )
    )


    (method (cue)
        (if (tim)
            = tim 0
            (self:dispose())
        )(else
            (if (== loop 4)
                = loop 10
            )(else
                = loop 9
            )
            = tim 1
            (send gLongSong2:
                number(930)
                play()
                setLoop(1)
            )
            (self:setCycle(End self))
        )
    )

)
(class Fspell of Actor
    (properties
        x 0
        y 0
        z 0
        heading 0
        noun 0
        modNum -1
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        sightAngle 26505
        actions 0
        onMeCheck $6789
        approachX 0
        approachY 0
        approachDist 0
        _approachVerbs 0
        yStep 6
        view 21
        loop 0
        cel 0
        priority 15
        underBits 0
        signal $0010
        lsTop 0
        lsLeft 0
        lsBottom 0
        lsRight 0
        brTop 0
        brLeft 0
        brBottom 0
        brRight 0
        palette 0
        scaleSignal $0000
        scaleX 128
        scaleY 128
        maxScale 128
        cycleSpeed 0
        script 0
        cycler 0
        timer 0
        detailLevel 0
        scaler 0
        illegalBits $8000
        xLast 0
        yLast 0
        xStep 8
        origStep 770
        moveSpeed 0
        blocks 0
        baseSetter 0
        mover 0
        looper 0
        viewer 0
        avoider 0
        code 0
        rx 0
        ry 0
        qvalue 0
    )

    (method (init param1)
        = x (send gOwner:x)
        = y (- (send gOwner:y) 30)
        (super:init(rest param1))
        (self:
            rx((send gOwner:x))
            ry(- (send gOwner:y) 30)
            setLoop(7)
            setCycle(Fwd)
            setMotion(JumpX local15 local16 15 self)
        )
        (send gLongSong2:
            number(900)
            play()
            setLoop(1)
        )
    )


    (method (cue)
        (if (qvalue)
            (self:dispose())
        )(else
            = qvalue 1
            (if (local22)
                (send gQg3Messager:say(5 6 35))
                = local22 0
            )
            (self:
                setPri(- (send gOwner:priority) 1)
                setMotion(MoveTo rx ry self)
            )
            (send gLongSong2:
                number(900)
                play()
                setLoop(1)
            )
        )
    )

)
(instance public rm650 of Rm
    (properties
        noun 7
        picture 650
        vanishingY -180
    )

    (method (init param1)
        (send (ScriptID(36 0)):
            x(200)
            y(2)
            textX(-175)
            textY(150)
        )
        (send (ScriptID(43 0)):
            x(200)
            y(2)
            textX(-175)
            textY(150)
        )
        proc958_0(128 653 654 14)
        (if (== gGClientModNum 550)
            (send gOwner:
                view(5)
                init()
                setScale(0)
                setLoop(7)
                solvePuzzle(314 5 2)
                addHonor(20)
            )
            proc0_4(165)
            (judge:init())
            (super:init(rest param1))
            proc0_4(79)
            (switch (global155)
                (case 0
                    (send gOwner:
                        view(43)
                        cel(0)
                        loop(1)
                    )
                    (sHaman:
                        view(656)
                        loop(0)
                        x(102)
                        cel(9)
                        init()
                    )
                    (self:setScript(toDead))
                )
                (default 
                    (send gOwner:
                        view(5)
                        init()
                        setScale(0)
                        setLoop(7)
                    )
                    (sHaman:
                        view(656)
                        loop(0)
                        x(102)
                        cel(9)
                        init()
                    )
                    (send global2:setScript(leave))
                )
            )
        )(else
            (send gOwner:
                view(5)
                loop(6)
                cel(0)
                x(110)
                y(151)
                init()
                get(44)
                setScale(0)
            )
            (judge:
                init()
                stopUpd()
            )
            (judgeplat:init())
            (mainplatform:init())
            (sHaman:init())
            (juggleLight:
                init()
                setScale(0)
                stopUpd()
                hide()
            )
            (fire:
                init()
                stopUpd()
                hide()
            )
            (cage:
                init()
                stopUpd()
                hide()
            )
            (burst:
                init()
                stopUpd()
            )
            (spell:
                init()
                stopUpd()
            )
            proc0_2()
            proc0_4(69)
            (super:init(rest param1))
            (self:setScript(sayMessage))
        )
    )


    (method (doit param1)
        (super:doit(rest param1))
        Palette(palANIMATE 217 219 5)
    )


    (method (dispose)
        proc958_0(0 36 43 44 57)
        UnLoad(128 653)
        UnLoad(128 654)
        UnLoad(128 14)
        (send gTimers:
            eachElementDo(111)
            eachElementDo(81)
            release()
        )
        (super:dispose())
    )


    (method (doVerb theVerb)
        (var temp0)
        return 
            (if (((> 88 theVerb) and (> theVerb 74)) and (== local1 8))
                (send gQg3Messager:say(5 6 12))
            )(else
                (switch (theVerb)
                    (case 82
                        (if ((send gOwner:castSpell(26 local10)))
                            = local15 (send ((send gUser:curEvent)):x)
                            = local16 (send ((send gUser:curEvent)):y)
                            (if (& local0 $0080)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0080)
                                (send gOwner:setScript(castPersonalSpell 0 1))
                                (send ((Fspell:new())):init())
                            )
                        )
                    )
                    (case 78
                        (if ((send gOwner:castSpell(22 local10)))
                            (if (& local0 $0008)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0008)
                                (if (& local1 $0200)
                                    = local17 3
                                    (turnFacing:dispose())
                                    = local8 1
                                    (sHaman:setScript(buffScript 0 34))
                                    (judge:setScript(reactDazz combat))
                                )(else
                                    = local8 1
                                    (sHaman:setScript(reactDazz))
                                )
                                (send gOwner:setScript(castPersonalSpell 0 0))
                                (send gLongSong2:
                                    number(900)
                                    play()
                                    setLoop(1)
                                )
                            )
                        )
                    )
                    (case 85
                        (if ((send gOwner:castSpell(29 local10)))
                            (if (& local0 $0400)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local4 1
                                = local0 (| local0 $0400)
                                = local8 1
                                (send gOwner:setScript(castPersonalSpell 0 0))
                                (send gLongSong2:
                                    number(944)
                                    play()
                                    setLoop(1)
                                )
                                (switch (local1)
                                    (case 0
                                        (sHaman:setScript(buffScript 0 13))
                                    )
                                    (case 1
                                        (if (local3)
                                            (sHaman:setScript(buffScript 0 13))
                                        )(else
                                            (sHaman:setScript(buffScript 0 4))
                                        )
                                    )
                                    (case 4
                                        (sHaman:setScript(buffScript 0 10))
                                        (send gOwner:solvePuzzle(309 4 2))
                                    )
                                    (default 
                                        (sHaman:setScript(buffScript 0 30583))
                                    )
                                )
                            )
                        )
                    )
                    (case 80
                        (if ((send gOwner:castSpell(24 local10)))
                            (if (& local0 $0020)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0020)
                                (switch (local1)
                                    (case 64
                                        = temp0 0
                                        (judge:setScript(noFire 0 0))
                                        (sHaman:setScript(buffScript 0 23))
                                        (send gOwner:solvePuzzle(307 4 2))
                                    )
                                    (case 8
                                        = temp0 0
                                        (judge:setScript(noFire 0 0))
                                        (sHaman:setScript(buffScript 0 4))
                                    )
                                    (default 
                                        = temp0 1
                                    )
                                )
                                (send gOwner:setScript(castPersonalSpell 0 temp0))
                                (send gLongSong2:
                                    number(942)
                                    play()
                                    setLoop(1)
                                )
                            )
                        )
                    )
                    (case 84
                        (if ((send gOwner:castSpell(28 local10)))
                            (if (& local0 $0200)
                                (send global2:setScript(disQualify 0 ++local7))
                            )(else
                                = local0 (| local0 $0200)
                                (switch (local1)
                                    (case 64
                                        = temp0 0
                                        (judge:setScript(noFire 0 1))
                                        (send gOwner:setPri(11))
                                        (sHaman:setScript(buffScript 0 36))
                                    )
                                    (case 1024
                                        = temp0 0
                                        = local8 1
                                        (sHaman:setScript(buffScript 0 40))
                                        (send gOwner:solvePuzzle(312 4 2))
                                    )
                                    (default 
                                        = temp0 1
                                    )
                                )
                                (if (local10)
                                    (send gOwner:setScript(summonLeviSpell 0 temp0))
                                )(else
                                    (send gOwner:setScript(castLeviSpell 0 temp0))
                                )
                                (send gLongSong2:
                                    number(281)
                                    setLoop(1)
                                    play()
                                )
                            )
                        )
                    )
                    (case 86
                        (if ((send gOwner:castSpell(30 local10)))
                            (if (& local0 $0800)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0800)
                                = local8 1
                                (switch (local1)
                                    (case 256
                                        (if (IsObject((send ((send global2:script)):timer)))
                                            (send ((send ((send global2:script)):timer)):dispose())
                                        )
                                        (fire:setScript(waitLight 0 31))
                                        (juggleLight:setScript(lightUp 0 1))
                                        (send gOwner:solvePuzzle(308 4 2))
                                    )
                                    (default 
                                        (juggleLight:setScript(lightUp 0 0))
                                        (send gOwner:setScript(castJuggleLight 0 1))
                                    )
                                )
                            )
                        )
                    )
                    (case 77
                        (if ((send gOwner:castSpell(21 local10)))
                            (if (& local0 $0004)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0004)
                                = local8 1
                                (if (local13)
                                    (self:setScript(exPlode))
                                )(else
                                    (send gOwner:setScript(castPersonalSpell 0 1))
                                    (send gLongSong2:
                                        number(900)
                                        play()
                                        setLoop(1)
                                    )
                                )
                            )
                        )
                    )
                    (case 87
                        (if (local23)
                            (send gQg3Messager:say(13 6 37))
                        )(else
                            (if ((send gOwner:castSpell(31 local10)))
                                (if (& local0 $1000)
                                    (send global2:setScript(disQualify 0 2))
                                )(else
                                    = local8 1
                                    = local0 (| local0 $1000)
                                    (send gOwner:
                                        setScript(castGetSummonSpell 0 0)
                                        solvePuzzle(306 4 2)
                                    )
                                    (send gLongSong2:
                                        number(900)
                                        play()
                                        setLoop(1)
                                    )
                                    (switch (local1)
                                        (case 0
                                            (sHaman:setScript(buffScript 0 17))
                                        )
                                        (case 1
                                            (if (local3)
                                                (sHaman:setScript(buffScript 0 17))
                                            )(else
                                                (sHaman:setScript(buffScript 0 4))
                                            )
                                        )
                                        (case 2
                                            (sHaman:setScript(buffScript 0 10))
                                        )
                                        (default 
                                            (sHaman:setScript(buffScript 0 30583))
                                        )
                                    )
                                )
                            )
                        )
                    )
                    (case 75
                        (if ((send gOwner:castSpell(19 local10)))
                            (if (& local0 $0001)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0001)
                                = local8 1
                                (send gOwner:setScript(castPersonalSpell 0 1))
                                (send gLongSong2:
                                    number(900)
                                    play()
                                    setLoop(1)
                                )
                            )
                        )
                    )
                    (case 76
                        (if ((send gOwner:castSpell(20 local10)))
                            (if (& local0 $0002)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0002)
                                (send gOwner:setScript(castDectMagic))
                                (send gLongSong2:
                                    number(900)
                                    play()
                                    setLoop(1)
                                )
                                (switch (local1)
                                    (case 0
                                        (sHaman:setScript(buffScript 0 1))
                                    )
                                    (case 1
                                        (sHaman:setScript(buffScript 0 4))
                                    )
                                    (default 
                                        (sHaman:setScript(buffScript 0 30583))
                                    )
                                )
                            )
                        )
                    )
                    (case 79
                        (if ((send gOwner:castSpell(23 local10)))
                            (if (& local0 $0010)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0010)
                                = local8 1
                                (send gOwner:setScript(castPersonalSpell 0 1))
                                (send gLongSong2:
                                    number(900)
                                    play()
                                    setLoop(1)
                                )
                            )
                        )
                    )
                    (case 81
                        (if ((send gOwner:castSpell(25 local10)))
                            = local15 (send ((send gUser:curEvent)):x)
                            = local16 (send ((send gUser:curEvent)):y)
                            (if (& local0 $0040)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0040)
                                (if ((& local1 $0200) and not local11)
                                    (send gOwner:setScript(shootIt))
                                    return 1
                                )(else
                                    (send gOwner:setScript(castPersonalSpell 0 1))
                                    (send ((Sspell:new())):init(2))
                                )
                            )
                        )
                    )
                    (case 83
                        (if ((send gOwner:castSpell(27 local10)))
                            = local15 (send ((send gUser:curEvent)):x)
                            = local16 (send ((send gUser:curEvent)):y)
                            (if (& local0 $0100)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $0100)
                                (if ((& local1 $0200) and not local11)
                                    (send gOwner:setScript(shootIt))
                                    return 1
                                )(else
                                    (send gOwner:setScript(castPersonalSpell 0 1))
                                    (send ((Sspell:new())):init(0))
                                )
                            )
                        )
                    )
                    (case 88
                        (if ((send gOwner:castSpell(32 local10)))
                            = local15 (send ((send gUser:curEvent)):x)
                            = local16 (send ((send gUser:curEvent)):y)
                            (if (& local0 $2000)
                                (send global2:setScript(disQualify 0 local7))
                            )(else
                                = local0 (| local0 $2000)
                                (if ((& local1 $0200) and not local11)
                                    (send gOwner:setScript(shootIt))
                                    return 1
                                )(else
                                    (send gOwner:setScript(castPersonalSpell 0 1))
                                    (send ((Sspell:new())):init(4))
                                )
                            )
                        )
                    )
                    (case 33
                        (send gOwner:drop(23 1))
                        (super:doVerb(theVerb))
                    )
                    (case 20
                        (send gOwner:drop(10 1))
                    )
                    (case 16
                        (send gOwner:drop(6 1))
                    )
                    (default 
                        (super:doVerb(theVerb))
                    )
                )
            )
    )

)
(instance exPlode of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (local10)
                    (send gOwner:
                        x(
                            (if (<> (send gOwner:view) 18)
                                + (send gOwner:x) 12
                            )(else
                                (send gOwner:x)
                            )
)
                        y(
                            (if (<> (send gOwner:view) 18)
                                + (send gOwner:y) 1
                            )(else
                                (send gOwner:y)
                            )
)
                        view(18)
                        setLoop(local17)
                        cel(0)
                        setCycle(Beg self)
                    )
                )(else
                    (send gOwner:
                        view(14)
                        loop(local17)
                        setCycle(Beg self)
                    )
                )
                (send gLongSong2:
                    number(900)
                    setLoop(1)
                    play()
                )
            )
            (case 1
                Palette(palSET_INTENSITY 0 255 800)
                (send gLongSong2:
                    number(930)
                    play()
                    setLoop(1)
                )
                = cycles 5
            )
            (case 2
                (send gGQg3KDHandler:eachElementDo(102))
                = seconds 2
            )
            (case 3
                proc26_0(34)
            )
        )
    )

)
(instance buffScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                0
            )
            (case 1
                (if (local3)
                    = local3 0
                    (if (== register 30583)
                        localproc_0ff0(combat 1)
                    )(else
                        (combat:changeState(register))
                    )
                )(else
                    (if (== register 30583)
                        (combat:cue())
                    )(else
                        (combat:changeState(register))
                    )
                )
                (self:dispose())
            )
        )
    )

)
(instance waitLight of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                0
            )
            (case 1
                (combat:changeState(register))
                (self:dispose())
            )
        )
    )

)
(instance noFire of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
            )
            (case 1
                (fire:
                    setLoop(0)
                    setCycle(CT 0 -1 self)
                )
                (cage:
                    setLoop(2)
                    setCycle(CT 0 -1 self)
                )
            )
            (case 2
                0
            )
            (case 3
                (cage:
                    hide()
                    setPri(-1)
                )
                (fire:
                    hide()
                    setPri(-1)
                )
                = cycles 5
            )
            (case 4
                (if (register)
                    0
                )(else
                    (self:cue())
                )
            )
            (case 5
                (send gQg3Messager:say(3 6 9 0 self))
            )
            (case 6
                (if ((sHaman:script))
                    (sHaman:cue())
                )
                ++local5
                (self:dispose())
            )
        )
    )

)
(instance shootIt of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    view(14)
                    setLoop(3)
                    setCycle(End self)
                )
                (cage:
                    view(651)
                    x((send gOwner:x))
                    y(- (send gOwner:y) 50)
                    setLoop(0)
                    origStep(6671)
                    moveSpeed(0)
                    cycleSpeed(0)
                    setCycle(Fwd)
                    setStep(15 10)
                )
                (send gLongSong2:
                    number(13)
                    play()
                    setLoop(1)
                )
            )
            (case 1
                (cage:
                    show()
                    setMotion(MoveTo local15 local16 self)
                )
            )
            (case 2
                (send gOwner:cel(0))
                (cage:
                    setCycle(0)
                    hide()
                )
                (burst:
                    x(local15)
                    y(local16)
                    show()
                    setCycle(End self)
                )
            )
            (case 3
                (send gLongSong2:
                    number(930)
                    play()
                    setLoop(1)
                )
                (if ((((>= local15 (- (juggleLight:x) 10)) and (<= local15 (+ (juggleLight:x) 10))) and (>= local16 (- (juggleLight:y) 18))) and (<= local16 (+ (juggleLight:y) 18)))
                    (juggleLight:dispose())
                    (turnFacing:dispose())
                    (send gOwner:solvePuzzle(311 4 2))
                    = register 1
                )(else
                    (self:dispose())
                )
                (burst:hide())
                = cycles 5
            )
            (case 4
                (combat:changeState(35))
                (burst:hide())
                (self:dispose())
            )
        )
    )

)
(instance castJuggleLight of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (IsObject((send ((send global2:script)):timer)))
                    (send ((send ((send global2:script)):timer)):dispose())
                )
                (if (local10)
                    (send gOwner:
                        view(19)
                        setLoop(local17)
                        cel(0)
                        setCycle(CT 2 1 self)
                    )
                )(else
                    (send gOwner:
                        view(15)
                        loop(local17)
                        setCycle(CT 4 1 self)
                    )
                )
            )
            (case 1
                (juggleLight:
                    view(111)
                    loop(0)
                    cel(0)
                    x((send gOwner:x))
                    y((send gOwner:nsTop))
                    priority(+ (send gOwner:priority) 1)
                    signal(16)
                    show()
                    setCycle(Fwd)
                )
                = seconds 2
            )
            (case 2
                (if (local10)
                    (send gOwner:
                        view(18)
                        setLoop(local17)
                        cel(0)
                    )
                )(else
                    (send gOwner:cel(0))
                )
                (juggleLight:hide())
                (if ((juggleLight:script))
                    = cycles 70
                )(else
                    (self:cue())
                )
            )
            (case 3
                proc0_3(5 1 3 8 7)
                = cycles 5
            )
            (case 4
                (if ((sHaman:script) and local8)
                    = local8 0
                    (sHaman:cue())
                )
                (if ((judge:script))
                    (judge:cue())
                )
                (if (register)
                    (if (local3)
                        = local3 0
                        localproc_0ff0(combat 1)
                    )(else
                        (if (& local1 $1000)
                            0
                        )(else
                            (combat:cue())
                        )
                    )
                )
                (self:dispose())
            )
        )
    )

)
(instance castPersonalSpell of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (IsObject((send ((send global2:script)):timer)))
                    (send ((send ((send global2:script)):timer)):dispose())
                )
                (if (local10)
                    (send gOwner:
                        x(
                            (if (<> (send gOwner:view) 18)
                                - (send gOwner:x) 5
                            )(else
                                (send gOwner:x)
                            )
)
                        y(
                            (if (<> (send gOwner:view) 18)
                                - (send gOwner:y) 2
                            )(else
                                (send gOwner:y)
                            )
)
                        view(18)
                        setLoop(local17)
                        cel(0)
                        setCycle(Beg self)
                    )
                )(else
                    (send gOwner:
                        view(14)
                        loop(local17)
                        setCycle(Beg self)
                    )
                )
            )
            (case 1
                (if ((juggleLight:script))
                    = cycles 70
                )(else
                    (self:cue())
                )
            )
            (case 2
                proc0_3(5 1 3 8 7)
                = cycles 5
            )
            (case 3
                (if ((sHaman:script) and local8)
                    = local8 0
                    (sHaman:cue())
                )
                (if ((judge:script))
                    (judge:cue())
                )
                (if (register)
                    (if (local3)
                        = local3 0
                        localproc_0ff0(combat 1)
                    )(else
                        (if (& local1 $1000)
                            0
                        )(else
                            (combat:cue())
                        )
                    )
                )
                (self:dispose())
            )
        )
    )

)
(instance summonLeviSpell of Script
    (properties)

    (method (doit param1)
        (super:doit(rest param1))
        (if (IsObject(newActor) and (& local1 $fdff))
            (send newActor:y((send gOwner:y)))
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (IsObject((send ((send global2:script)):timer)))
                    (send ((send ((send global2:script)):timer)):dispose())
                )
                (send gOwner:
                    view(19)
                    setLoop(local17)
                    setCycle(CT 2 1 self)
                )
            )
            (case 1
                = newActor (Actor:new())
                (send newActor:
                    view(17)
                    loop(4)
                    cel(0)
                    x((send gOwner:x))
                    y((send gOwner:y))
                    priority((send gOwner:priority))
                    signal(16400)
                    init()
                    setCycle(Fwd)
                )
                = cycles 3
            )
            (case 2
                (send gOwner:setMotion(MoveTo (send gOwner:x) (- (send gOwner:y) local2) self))
            )
            (case 3
                (if ((judge:script))
                    (judge:cue())
                )
                (if (& local1 $0400)
                    (self:cue())
                )(else
                    (send gOwner:setMotion(MoveTo (send gOwner:x) (+ (send gOwner:y) local2) self))
                )
            )
            (case 4
                (send gOwner:
                    view(18)
                    cel(0)
                    loop(local17)
                )
                (if (IsObject(newActor))
                    (send newActor:dispose())
                )
                (if ((sHaman:script) and local8)
                    = local8 0
                    (sHaman:cue())
                )
                (if ((judge:script))
                    (judge:cue())
                )
                (if (register)
                    (if (local3)
                        = local3 0
                        localproc_0ff0(combat 1)
                    )(else
                        (combat:cue())
                    )
                )
                (send gOwner:setPri(-1))
                (self:dispose())
            )
        )
    )

)
(instance castLeviSpell of Script
    (properties)

    (method (doit param1)
        (super:doit(rest param1))
        (if (IsObject(newActor) and (& local1 $fdff))
            (send newActor:y((send gOwner:y)))
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (IsObject((send ((send global2:script)):timer)))
                    (send ((send ((send global2:script)):timer)):dispose())
                )
                (send gOwner:
                    view(17)
                    setLoop(local17)
                    cel(0)
                    cycleSpeed(10)
                    setStep(5 3)
                    setCycle(End self)
                )
            )
            (case 1
                = newActor (Actor:new())
                (send newActor:
                    view(17)
                    loop(4)
                    cel(0)
                    x((send gOwner:x))
                    y((send gOwner:y))
                    priority((send gOwner:priority))
                    signal(16400)
                    init()
                    setCycle(Fwd)
                )
                = cycles 3
            )
            (case 2
                (send gOwner:setMotion(MoveTo (send gOwner:x) (- (send gOwner:y) local2) self))
            )
            (case 3
                (if ((judge:script))
                    (judge:cue())
                )
                (if (& local1 $0400)
                    (cage:hide())
                    (send gOwner:setMotion(MoveTo (send gOwner:x) (+ (send gOwner:y) 1) self))
                )(else
                    (send gOwner:setMotion(MoveTo (send gOwner:x) (+ (send gOwner:y) local2) self))
                )
            )
            (case 4
                (if (IsObject(newActor))
                    (send newActor:dispose())
                )
                (send gOwner:setCycle(CT 0 -1 self))
            )
            (case 5
                (if ((judge:script))
                    (judge:cue())
                )
                (if ((sHaman:script) and local8)
                    = local8 0
                    (sHaman:cue())
                )
                (if (register)
                    (if (local3)
                        = local3 0
                        localproc_0ff0(combat 1)
                    )(else
                        (combat:cue())
                    )
                )
                (send gOwner:
                    setPri(-1)
                    cycleSpeed(6)
                )
                (self:dispose())
            )
        )
    )

)
(instance castGetSummonSpell of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (IsObject((send ((send global2:script)):timer)))
                    (send ((send ((send global2:script)):timer)):dispose())
                )
                (send gOwner:
                    view(20)
                    x(123)
                    setLoop(4)
                    setCycle(End self)
                )
            )
            (case 1
                (send gOwner:
                    x(116)
                    setLoop(6)
                    setCycle(End self)
                )
            )
            (case 2
                (if ((sHaman:script) and local8)
                    = local8 0
                    (sHaman:cue())
                )
                = local7 (+ local7 3)
                (if (register)
                    (if (local3)
                        = local3 0
                        localproc_0ff0(combat 1)
                    )(else
                        (combat:cue())
                    )
                )
                = local10 1
                = local20 12
                (self:dispose())
            )
        )
    )

)
(instance castSummonSpell of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (IsObject((send ((send global2:script)):timer)))
                    (send ((send ((send global2:script)):timer)):dispose())
                )
                (send gOwner:
                    view(19)
                    loop(2)
                    setCycle(Beg self)
                )
            )
            (case 1
                (if ((sHaman:script) and local8)
                    = local8 0
                    (sHaman:cue())
                )
                (if (register)
                    (if (local3)
                        = local3 0
                        localproc_0ff0(combat 1)
                    )(else
                        (combat:cue())
                    )
                )
                (self:dispose())
            )
        )
    )

)
(instance castDectMagic of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (self:setScript(castPersonalSpell self 0))
            )
            (case 1
                (send gQg3Messager:say(5 6 6 0 self))
            )
            (case 2
                (if ((sHaman:script))
                    (sHaman:cue())
                )
                (self:dispose())
            )
        )
    )

)
(instance lightUp of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (juggleLight:
                    view(111)
                    x((send gOwner:x))
                    y((send gOwner:nsTop))
                    show()
                    setLoop(0)
                    setPri(- (send gOwner:priority) 1)
                    setCycle(Fwd)
                )
                (if (register)
                    (send gOwner:show())
                    (sHaman:show())
                    (judge:
                        show()
                        stopUpd()
                    )
                    PalVary(pvREVERSE 4)
                    = seconds 5
                )(else
                    (self:cue())
                )
            )
            (case 1
                (if (register)
                    (send gOwner:setCycle(CT 0 -1 self))
                )(else
                    (self:cue())
                )
            )
            (case 2
                (if (register)
                    PalVary(pvINIT 650 1)
                    (waitLight:cue())
                )
                (juggleLight:hide())
                proc0_3(5 1 3 8 7)
                (self:dispose())
            )
        )
    )

)
(instance openCage of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = local8 0
                (self:setScript(castPersonalSpell self 0))
            )
            (case 1
                (cage:
                    hide()
                    setPri(-1)
                )
                (if (IsObject(newActor))
                    (send newActor:dispose())
                )
                localproc_104a()
                (send gLongSong2:
                    number(916)
                    play()
                    setLoop(1)
                )
                = cycles 5
            )
            (case 2
                (send gQg3Messager:say(3 6 14 0 self))
            )
            (case 3
                (send gOwner:solvePuzzle(310 4 2))
                (combat:changeState(27))
                (self:dispose())
            )
        )
    )

)
(instance reactDazz of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (== local1 0)
                    = local18 8
                )(else
                    (if (& local1 $0f00)
                        = local18 7
                    )(else
                        = local18 0
                    )
                )
            )
            (case 1
                proc0_2()
                = cycles 5
            )
            (case 2
                Palette(palSET_INTENSITY 0 255 1000)
                Palette(palSET_INTENSITY 0 255 100)
                (sHaman:
                    view(654)
                    loop(local18)
                    setCycle(End self)
                )
                (if (== local1 512)
                    (juggleLight:dispose())
                )
            )
            (case 3
                (sHaman:cel(0))
                (if (<> (send gOwner:trySkill(22 150)) -1)
                    = local3 1
                    localproc_0ff0(combat 2)
                )(else
                    localproc_0ff0(combat 1)
                )
                proc0_3(5 1 3 8 7)
                (self:dispose())
            )
        )
    )

)
(instance disQualify of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (switch (register)
                    (case 0
                        (self:setScript(castPersonalSpell self 0))
                    )
                    (case 1
                        (self:setScript(castLeviSpell self 0))
                    )
                    (case 2
                        (self:setScript(castSummonSpell self 0))
                    )
                    (case 3
                        (self:setScript(castPersonalSpell self 0))
                    )
                    (case 4
                        (self:setScript(summonLeviSpell self 0))
                    )
                )
            )
            (case 1
                (send gQg3Messager:say(3 6 4 0 self))
            )
            (case 2
                (send global2:newRoom(600))
                (self:dispose())
            )
        )
    )

)
(instance sayMessage of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 5
            )
            (case 1
                (send gQg3Messager:say(1 6 1 0 self))
            )
            (case 2
                (send gQg3Messager:say(2 6 2 0 self))
            )
            (case 3
                (send gQg3Messager:say(3 6 3 0 self))
            )
            (case 4
                proc0_3(5 1 3 8 7)
                (send global2:setScript(combat))
            )
        )
    )

)
(instance castSummonStaff of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (sHaman:
                    view(653)
                    cycleSpeed(10)
                    setLoop(0)
                    setCycle(End self)
                )
                (send gLongSong2:
                    number(944)
                    play()
                    setLoop(1)
                )
                = local13 1
            )
            (case 1
                proc0_3(5 1 3 8 7)
                (self:dispose())
            )
        )
    )

)
(instance castWallFlame of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (not local9)
                    = local9 1
                    (fire:
                        x(189)
                        y(58)
                        show()
                        setLoop(0)
                        moveSpeed(0)
                        setCycle(Fwd)
                    )
                )
                (sHaman:
                    setLoop(2)
                    cel(0)
                )
                = cycles 30
            )
            (case 1
                (sHaman:setCycle(End))
                (send gLongSong2:
                    number(913)
                    setLoop(1)
                    play()
                )
                (fire:
                    view(650)
                    x(69)
                    y(146)
                    noun(9)
                    setLoop(0)
                    setPri(14)
                    setCycle(End self)
                    show()
                )
                (cage:
                    view(650)
                    x(68)
                    y(144)
                    noun(9)
                    setLoop(2)
                    setPri(- (send gOwner:priority) 1)
                    show()
                    setCycle(End self)
                )
            )
            (case 2
                0
            )
            (case 3
                (fire:
                    setLoop(1)
                    setCycle(Fwd)
                )
                (cage:
                    setLoop(3)
                    setCycle(Fwd)
                )
                = cycles 5
            )
            (case 4
                proc0_3(5 1 3 8 7)
                (self:dispose())
            )
        )
    )

)
(instance castFlameDart of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (sHaman:
                    view(653)
                    setLoop(1)
                    setCycle(CT 2 1 self)
                )
                (fire:
                    view(651)
                    setLoop(0)
                    x(182)
                    y(60)
                    setStep(10 3)
                    moveSpeed(0)
                    show()
                )
            )
            (case 1
                (send gLongSong2:
                    number(13)
                    play()
                    setLoop(1)
                )
                (fire:
                    setCycle(Fwd)
                    setMotion(MoveTo + (fire:x) 5 (fire:y))
                )
                (sHaman:
                    view(653)
                    setLoop(1)
                    setCycle(CT 5 1 self)
                )
            )
            (case 2
                (fire:setMotion(MoveTo (send gOwner:x) 101 self))
            )
            (case 3
                (fire:hide())
                (burst:
                    x(118)
                    y(101)
                    setCycle(End self)
                    show()
                )
            )
            (case 4
                (send gLongSong2:
                    number(11)
                    play()
                    setLoop(1)
                )
                (fire:show())
                (burst:hide())
                (if (register)
                    = local9 1
                    (fire:setMotion(MoveTo 189 58 self))
                )(else
                    (send gQg3Messager:say(13 6 36 0 self))
                )
            )
            (case 5
                (fire:
                    view(340)
                    setLoop(0)
                    setCycle(Fwd)
                )
                (if (register)
                    (sHaman:
                        setLoop(2)
                        cel(0)
                    )
                )
                = cycles 2
            )
            (case 6
                = local9 1
                proc0_3(5 1 3 8 7)
                (self:dispose())
            )
        )
    )

)
(instance castCage of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (sHaman:
                    view(653)
                    setLoop(2)
                    setCycle(Beg self)
                )
            )
            (case 1
                (send gLongSong2:
                    number(7)
                    play()
                    setLoop(1)
                )
                (cage:
                    view(651)
                    setLoop(1)
                    show()
                    x(+ 112 local20)
                    y(78)
                    noun(10)
                    setPri(13)
                    setCycle(End self)
                )
                = newActor (Prop:new())
                (send newActor:
                    view(651)
                    loop(4)
                    cel(0)
                    x(+ 113 local20)
                    y(48)
                    z(-30)
                    noun(10)
                    signal(16384)
                    init()
                    setCycle(End self)
                )
            )
            (case 2
                0
            )
            (case 3
                proc0_3(5 1 3 8 7)
                (self:dispose())
            )
        )
    )

)
(instance castSmoke of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (sHaman:
                    view(654)
                    setLoop(2)
                    setCycle(Beg self)
                )
                (if (PalVary(pvGET_CURRENT_STEP))
                    PalVary(pvREVERSE 0)
                )
            )
            (case 1
                = seconds 1
            )
            (case 2
                PalVary(pvINIT 651 2)
                = seconds 3
            )
            (case 3
                (send gLongSong2:
                    number(939)
                    play()
                    setLoop(1)
                )
                = local10 0
                = local17 3
                (send gOwner:
                    view(15)
                    setLoop(3)
                    cel(2)
                    x(201)
                    y(134)
                )
                (sHaman:
                    view(654)
                    setLoop(4)
                    x(102)
                    y(122)
                )
                (send gGQg3KDHandler:eachElementDo(102))
                = cycles 5
            )
            (case 4
                = local12 1
                = local13 0
                = local23 1
                (send gQg3Messager:say(5 6 27 0 self))
            )
            (case 5
                proc0_3(5 1 3 8 7)
                (self:dispose())
            )
        )
    )

)
(instance turnFacing of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = seconds 2
            )
            (case 1
                (judge:
                    setLoop(1)
                    setCycle(CT 2 1 self)
                )
            )
            (case 2
                (send gQg3Messager:say(3 6 17 0 self))
                proc0_3(5 1 3 8 7)
                ++local5
            )
            (case 3
                proc0_2()
                = local1 512
                (sHaman:
                    view(654)
                    setLoop(4)
                    setCycle(End self)
                )
            )
            (case 4
                proc0_3(5 1 3 8 7)
                (juggleLight:
                    view(651)
                    cel(0)
                    x(+ (sHaman:x) 35)
                    y(- (sHaman:y) 40)
                    xStep(20)
                    noun(11)
                    cycleSpeed(3)
                    show()
                    setLoop(2)
                    setCycle(Fcycler 0 6)
                )
                localproc_0ff0(self 1)
            )
            (case 5
                (juggleLight:setCycle(CT 10 1 self))
            )
            (case 6
                (juggleLight:
                    setCycle(0)
                    moveSpeed(0)
                    setMotion(MoveTo - (send gOwner:x) 10 - (send gOwner:y) 30 self)
                )
            )
            (case 7
                = local11 1
                (juggleLight:setMotion(MoveTo (send gOwner:x) (- (send gOwner:y) 30) self))
            )
            (case 8
                (juggleLight:
                    cycleSpeed(6)
                    setCycle(Fcycler 0 6)
                )
                localproc_0ff0(self 2)
            )
            (case 9
                (combat:cue())
                (self:dispose())
            )
        )
    )

)
(instance castPit of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (& local1 $0200)
                    (sHaman:
                        view(654)
                        setLoop(5)
                    )
                )(else
                    (sHaman:
                        view(653)
                        setLoop(2)
                    )
                )
                (sHaman:setCycle(Beg self))
            )
            (case 1
                (if (< (send gOwner:x) 140)
                    (cage:
                        view(651)
                        loop(3)
                        cel(0)
                        noun(12)
                        x(- (send gOwner:x) 24)
                        y(- (send gOwner:y) 8)
                        show()
                    )
                )(else
                    (cage:
                        view(651)
                        loop(3)
                        cel(1)
                        x(- (send gOwner:x) 24)
                        y(- (send gOwner:y) 5)
                        noun(12)
                        show()
                    )
                )
                = cycles 5
            )
            (case 2
                (if (local10)
                    (self:changeState(4))
                )(else
                    (send gOwner:
                        view(5)
                        setLoop(0)
                    )
                    = cycles 10
                )
            )
            (case 3
                (send gOwner:setLoop(4))
                = cycles 10
            )
            (case 4
                (send gOwner:setLoop(2))
                = cycles 10
            )
            (case 5
                (cage:setPri(1))
                (send gOwner:
                    setPri(2)
                    moveSpeed(0)
                    yStep(6)
                    setCycle(0)
                    setMotion(MoveTo (send gOwner:x) + (send gOwner:y) 70 self)
                )
            )
            (case 6
                proc0_3(5 1 3 8 7)
                (send gOwner:moveSpeed(6))
                (self:dispose())
            )
        )
    )

)
(instance finalScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = gGMonsterMonHP 180
                (send gQg3Messager:say(2 6 22 0 self))
            )
            (case 1
                (sHaman:
                    view(656)
                    cel(0)
                    setLoop(0)
                    setCycle(End self)
                )
                (judge:
                    setLoop(2)
                    setCycle(Fwd)
                )
                (burst:cue())
            )
            (case 2
                = cycles 35
            )
            (case 3
                (send gQg3Messager:say(1 6 23 0 self))
            )
            (case 4
                proc0_3(5 1 3)
                (switch (global209)
                    (case 3
                        = seconds 5
                    )
                    (default 
                        = seconds 9
                    )
                )
            )
            (case 5
                proc0_2()
                = global365 595
                (send global2:newRoom(550))
            )
        )
    )

)
(instance combat of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gLongSong:
                    number(157)
                    setLoop(-1)
                    play()
                )
                = local1 0
                localproc_0ff0(self 1)
            )
            (case 1
                (self:setScript(castSummonStaff self))
            )
            (case 2
                (send gQg3Messager:say(3 6 5 0 self))
                ++local6
            )
            (case 3
                = local1 1
                localproc_0ff0(self 1)
            )
            (case 4
                (sHaman:setScript(castWallFlame self))
            )
            (case 5
                = local1 64
                localproc_0ff0(self 1)
            )
            (case 6
                = local1 16
                (if (local9)
                    (fire:dispose())
                )
                = cycles 1
            )
            (case 7
                = cycles 0
                (send gOwner:
                    view(43)
                    setLoop(2)
                    setCel(0)
                    setCycle(End self)
                )
                (juggleLight:dispose())
            )
            (case 8
                (send gQg3Messager:say(3 6 7 0 self))
            )
            (case 9
                (if ((send gOwner:takeDamage(25)))
                    (send global2:newRoom(600))
                )(else
                    proc26_0(24)
                )
            )
            (case 13
                (if (local3)
                    = local3 0
                    = cycles 1
                )(else
                    (self:setScript(castSummonStaff self))
                )
            )
            (case 14
                (if (local3)
                    (self:cue())
                )(else
                    (send gQg3Messager:say(3 6 5 0 self))
                    ++local6
                )
            )
            (case 15
                = local1 2
                localproc_0ff0(self 1)
            )
            (case 16
                (self:changeState(4))
            )
            (case 10
                (self:setScript(castFlameDart self 1))
            )
            (case 11
                = local1 32
                ++local5
                (send gQg3Messager:say(3 6 13 0 self))
            )
            (case 12
                (self:changeState(4))
            )
            (case 17
                (self:setScript(castSummonStaff self))
            )
            (case 18
                (send gQg3Messager:say(3 6 11 0 self))
            )
            (case 19
                = local1 4
                localproc_0ff0(self 1)
            )
            (case 20
                (self:setScript(castFlameDart self 0))
            )
            (case 21
                = local1 8
                localproc_0ff0(self 1)
            )
            (case 22
                (self:changeState(6))
            )
            (case 23
                (sHaman:setScript(castCage self))
            )
            (case 24
                = local1 128
                = local2 5
                localproc_0ff0(self 1)
            )
            (case 25
                (send gQg3Messager:say(3 6 15 0 self))
            )
            (case 26
                (send global2:newRoom(600))
            )
            (case 27
                (juggleLight:hide())
                (sHaman:setScript(castSmoke self))
            )
            (case 28
                = local1 256
                localproc_0ff0(self 1)
            )
            (case 29
                proc0_2()
                (send gQg3Messager:say(3 6 16 0 self))
            )
            (case 30
                (send global2:newRoom(600))
            )
            (case 31
                (fire:dispose())
                (self:setScript(turnFacing))
            )
            (case 32
                (send gQg3Messager:say(3 6 18 0 self))
            )
            (case 33
                (self:changeState(6))
            )
            (case 34
                0
            )
            (case 35
                = local2 72
                ++local5
                = cycles 0
                (send gQg3Messager:say(3 6 19 0 self))
            )
            (case 36
                (self:setScript(castPit self))
            )
            (case 37
                = local1 1024
                localproc_0ff0(self 1)
            )
            (case 38
                (send gQg3Messager:say(3 6 20 0 self))
            )
            (case 39
                (send global2:newRoom(600))
            )
            (case 40
                = local1 2048
                (send gQg3Messager:say(3 6 21 0 self))
            )
            (case 41
                = local1 4096
                (self:setScript(finalScript self))
            )
            (case 42
                (send global2:setScript(doneRoom))
            )
        )
    )

)
(instance judgeKill of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setScript(castPersonalSpell))
                (send gLongSong2:
                    number(13)
                    setLoop(1)
                    play()
                )
                (juggleLight:
                    view(
                        (if (== register 20)
                            46
                        )(else
                            21
                        )
)
                    setLoop(
                        (switch (register)
                            (case 20
                                2
                            )
                            (case 81
                                2
                            )
                            (case 83
                                0
                            )
                            (case 88
                                4
                            )
                        )
)
                    x((send gOwner:x))
                    y(- (send gOwner:y) 35)
                    moveSpeed(0)
                    cycleSpeed(0)
                    setStep(12 10)
                    setPri(15)
                    show()
                    setCycle(Fwd)
                    setMotion(MoveTo (judge:x) - (judge:y) 20)
                )
                = cycles 20
            )
            (case 1
                proc0_2()
                (spell:
                    view(651)
                    x(64)
                    y(66)
                    moveSpeed(0)
                    cycleSpeed(0)
                    setLoop(0)
                    setPri(15)
                    setStep(12 10)
                    setCycle(Fwd)
                    setMotion(MoveTo - (send gOwner:x) 10 - (send gOwner:y) 30 self)
                    show()
                )
                (send gLongSong2:
                    number(13)
                    setLoop(1)
                    play()
                )
                (juggleLight:
                    setMotion(0)
                    view(21)
                    setLoop(9)
                    setCycle(End juggleLight)
                )
            )
            (case 2
                (spell:hide())
                (if (<> register 20)
                    (burst:
                        x(- (send gOwner:x) 5)
                        y(- (send gOwner:y) 20)
                        show()
                        setCycle(End self)
                    )
                )(else
                    (burst:dispose())
                    = cycles 5
                )
                (send gLongSong2:
                    number(930)
                    setLoop(1)
                    play()
                )
            )
            (case 3
                (burst:dispose())
                = local14 5
                (send global2:setScript(egoDead))
            )
        )
    )

)
(instance judgeShow of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setScript(castPersonalSpell))
                (send gLongSong2:
                    number(13)
                    setLoop(1)
                    play()
                )
                (sHaman:
                    view(653)
                    cel(0)
                    setLoop(
                        (if (local12)
                            3
                        )(else
                            0
                        )
)
                    setCycle(End)
                )
                (juggleLight:
                    view(
                        (if (== register 20)
                            46
                        )(else
                            21
                        )
)
                    setLoop(
                        (switch (register)
                            (case 20
                                2
                            )
                            (case 81
                                2
                            )
                            (case 83
                                0
                            )
                            (case 88
                                4
                            )
                        )
)
                    x((send gOwner:x))
                    y(- (send gOwner:y) 35)
                    moveSpeed(0)
                    cycleSpeed(0)
                    setStep(12 10)
                    setPri(15)
                    show()
                    setCycle(Fwd)
                    setMotion(MoveTo (sHaman:x) - (sHaman:y) 30)
                )
                = cycles 20
            )
            (case 1
                proc0_2()
                (spell:
                    view(651)
                    x(64)
                    y(66)
                    moveSpeed(0)
                    cycleSpeed(0)
                    setLoop(0)
                    setPri(14)
                    setStep(12 10)
                    setCycle(Fwd)
                    setMotion(MoveTo - (send gOwner:x) 10 - (send gOwner:y) 30 self)
                    show()
                )
                (send gLongSong2:
                    number(13)
                    setLoop(1)
                    play()
                )
                (juggleLight:
                    setMotion(0)
                    view(21)
                    setLoop(9)
                    setCycle(End juggleLight)
                )
            )
            (case 2
                (spell:hide())
                (if (<> register 20)
                    (burst:
                        x(- (send gOwner:x) 5)
                        y(- (send gOwner:y) 20)
                        show()
                        setCycle(End self)
                    )
                )(else
                    (burst:dispose())
                    = cycles 5
                )
                (send gLongSong2:
                    number(930)
                    setLoop(1)
                    play()
                )
            )
            (case 3
                (burst:dispose())
                (send global2:setScript(egoDead))
            )
        )
    )

)
(instance egoDead of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    view(43)
                    setLoop(2)
                    setCycle(End self)
                )
            )
            (case 1
                (switch (local14)
                    (case 1
                        proc26_0(25)
                    )
                    (case 5
                        proc26_0(31)
                    )
                    (default 
                        proc26_0(24)
                    )
                )
            )
        )
    )

)
(instance leave of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gLongSong:
                    number(159)
                    setLoop(1)
                    play(self)
                )
            )
            (case 1
                (sHaman:setCycle(CT 0 -1 self))
            )
            (case 2
                (sHaman:
                    view(592)
                    loop(0)
                    scaleX(110)
                    scaleY(110)
                    setCycle(End self)
                )
            )
            (case 3
                (send gOwner:solvePuzzle(305 10 2))
                (send global2:newRoom(620))
            )
        )
    )

)
(instance toDead of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setCycle(End self))
            )
            (case 1
                proc26_0(28)
            )
        )
    )

)
(instance doneRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (judge:setCycle(0))
                (spell:dispose())
                (burst:dispose())
                = cycles 5
            )
            (case 1
                (sHaman:
                    cycleSpeed(12)
                    setCycle(CT 0 -1 self)
                )
            )
            (case 2
                = cycles 10
            )
            (case 3
                (send gQg3Messager:say(2 6 30 0 self))
            )
            (case 4
                (send gOwner:solvePuzzle(305 10 2))
                (send global2:newRoom(620))
            )
        )
    )

)
(instance sHaman of Actor
    (properties
        x 198
        y 110
        noun 2
        view 653
        signal $4000
    )

    (method (doVerb theVerb)
        (var temp0[30])
        (if (((> 88 theVerb) and (> theVerb 74)) and (== local1 8))
            (send gQg3Messager:say(5 6 12))
        )(else
            (switch (theVerb)
                (case 26
                    (if (& local1 $1000)
                        (send gOwner:drop(16 1))
                        (send gLongSong2:
                            number(932)
                            play()
                            setLoop(1)
                        )
                        (send gOwner:
                            solvePuzzle(313 8 2)
                            addHonor(50)
                        )
                        (if (IsObject((send ((send global2:script)):timer)))
                            (send ((send ((send global2:script)):timer)):dispose())
                        )
                        (finalScript:dispose())
                    )(else
                        (super:doVerb(theVerb))
                    )
                )
                (case 82
                    = local22 1
                    (send global2:doVerb(theVerb))
                )
                (case 20
                    (if (& local1 $1000)
                        = gGMonsterMonHP (- gGMonsterMonHP 8)
                        (send global2:doVerb(theVerb))
                    )(else
                        (send global2:setScript(judgeShow 0 20))
                    )
                )
                (case 81
                    (if ((send gOwner:castSpell(25 local10)))
                        (if (& local1 $1000)
                            = gGMonsterMonHP (- gGMonsterMonHP 10)
                            = local0 (& local0 $ffaf)
                            (send global2:doVerb(theVerb))
                        )(else
                            (send global2:setScript(judgeShow 0 81))
                        )
                    )
                )
                (case 83
                    (if ((send gOwner:castSpell(27 local10)))
                        (if (& local1 $1000)
                            = gGMonsterMonHP (- gGMonsterMonHP 8)
                            = local0 (& local0 $feff)
                            (send global2:doVerb(theVerb))
                        )(else
                            (send global2:setScript(judgeShow 0 83))
                        )
                    )
                )
                (case 88
                    (if ((send gOwner:castSpell(32 local10)))
                        (if (& local1 $1000)
                            = gGMonsterMonHP (- gGMonsterMonHP 12)
                            = local0 (& local0 $dfff)
                            (send global2:doVerb(theVerb))
                        )(else
                            (send global2:setScript(judgeShow 0 88))
                        )
                    )
                )
                (default 
                    (super:doVerb(theVerb))
                )
            )
        )
    )

)
(instance judge of Prop
    (properties
        x 64
        y 80
        noun 8
        view 652
        signal $4000
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 20
                (send global2:setScript(judgeKill 0 20))
            )
            (case 81
                (send global2:setScript(judgeKill 0 81))
            )
            (case 83
                (send global2:setScript(judgeKill 0 83))
            )
            (case 88
                (send global2:setScript(judgeKill 0 88))
            )
            (case 82
                = local22 1
                (send global2:doVerb(theVerb))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance juggleLight of Actor
    (properties
        x 116
        y 88
        view 21
        loop 4
        signal $4000
        xStep 5
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 81
                (send global2:doVerb(theVerb))
            )
            (case 83
                (send global2:doVerb(theVerb))
            )
            (case 88
                (send global2:doVerb(theVerb))
            )
            (case 20
                (send global2:doVerb(theVerb))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )


    (method (cue)
        (self:dispose())
    )

)
(instance fire of Actor
    (properties
        x 184
        y 59
        sightAngle 90
        view 340
        signal $4000
    )
)
(instance cage of Actor
    (properties
        x 123
        y 76
        sightAngle 90
        view 651
        loop 2
        signal $4000
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 75
                (send gOwner:castSpell(19 local10))
                (if (& local0 $0001)
                    (send global2:setScript(disQualify 0 local7))
                )(else
                    (if (& local1 $0080)
                        = local0 (| local0 $0001)
                        (send gOwner:setScript(openCage))
                        (send gLongSong2:
                            number(900)
                            play()
                            setLoop(1)
                        )
                    )(else
                        (send global2:doVerb(theVerb))
                    )
                )
            )
            (case 1
                (super:doVerb(theVerb))
            )
            (case 83
                (send gOwner:castSpell(27 local10))
                (if (& local1 $0080)
                    (send gOwner:setScript(openCage))
                )(else
                    (send global2:doVerb(theVerb))
                )
            )
            (default 
                (send global2:doVerb(theVerb))
            )
        )
    )

)
(instance judgeplat of Feature
    (properties
        x 54
        y 71
        noun 4
        nsTop 59
        nsLeft 1
        nsBottom 84
        nsRight 108
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 82
                (send global2:doVerb(theVerb))
            )
            (case 81
                (send global2:doVerb(theVerb))
            )
            (case 83
                (send global2:doVerb(theVerb))
            )
            (case 88
                (send global2:doVerb(theVerb))
            )
            (case 20
                (send global2:doVerb(theVerb))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance mainplatform of Feature
    (properties
        x 150
        y 75
        noun 6
        nsTop 88
        nsLeft 31
        nsBottom 170
        nsRight 270
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 82
                (send global2:doVerb(theVerb))
            )
            (case 81
                (send global2:doVerb(theVerb))
            )
            (case 83
                (send global2:doVerb(theVerb))
            )
            (case 88
                (send global2:doVerb(theVerb))
            )
            (case 20
                (send global2:doVerb(theVerb))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance burst of Prop
    (properties
        view 21
        loop 9
        priority 15
        signal $4010
        cycleSpeed 1
    )

    (method (init param1)
        (super:init(rest param1))
        (self:hide())
    )


    (method (cue)
        (send gLongSong2:
            number(13)
            setLoop(1)
            play()
        )
        (spell:
            x(64)
            y(66)
            show()
            setStep(12 10)
            setMotion(MoveTo 101 92 spell)
        )
        (self:hide())
    )

)
(instance spell of Actor
    (properties
        x 184
        y 59
        view 21
        loop 9
        signal $4000
    )

    (method (init param1)
        (super:init(rest param1))
        (self:hide())
    )


    (method (cue)
        (send gLongSong2:
            number(930)
            setLoop(1)
            play()
        )
        (self:
            view(21)
            loop(9)
            cel(0)
            show()
            setCycle(End burst)
        )
    )

)
