(version 2)
(include "sci.sh")
(exports
    0 rm830
    1 reeshaTalker
    2 reeshaBTalker
)
(use "Main")
(use "TellerIcon")
(use "n026")
(use "GloryTalker")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Rev")
(use "Cycle")
(use "Game")
(use "View")
(use "Obj")
(script 830)


(local
    local0
    local1
    local2[5] = (0 -1 -2 -3 999 )
    local7[2]
    local9[9] = (0 -8 -7 -6 -5 -11 -12 -13 999 )
    local18[2]

)
(instance public rm830 of Rm
    (properties
        noun 9
        picture 830
    )

    (method (init)
        = local7[0] @local2
        = local18[0] @local9
        (egoTell:init(gOwner @local9 @local18))
        (send gOwner:
            setScale()
            scaleX(128)
            scaleY(128)
            init()
            noun(2)
            normalize()
        )
        (super:init())
        (send gMainIconBar:disable(1))
        (send global2:addObstacle((send ((Polygon:new())):
                type(3)
                init(39 189 319 189 259 138 287 138 309 138 309 130 270 130 245 130 163 90 61 90 38 189)
                yourself()
            )
))
        (sky:init())
        (if (proc0_6(57))
            = local0 1
        )
        proc0_4(57)
        (switch (local0)
            (case 0
                (send gLongSong:
                    number(830)
                    setLoop(-1)
                    play(127)
                )
                (reesha:init())
                (rubble:
                    init()
                    stopUpd()
                )
                (send global2:setScript(eventOne))
            )
            (case 1
                (if ((== gGClientModNum 550) and (== global155 0))
                    (send global2:setScript(egoIsDead))
                )(else
                    (if (== gGClientModNum 550)
                        (send gLongSong:
                            number(830)
                            setLoop(-1)
                            play(127)
                        )
                        (reesha:
                            noun(1)
                            init()
                        )
                        (rubble:
                            init()
                            stopUpd()
                        )
                        (send gOwner:changeGait(0))
                        (self:setScript(reeshaCollapses))
                    )(else
                        (send gLongSong:
                            number(832)
                            setLoop(-1)
                            play(127)
                        )
                        (reesha:
                            view(834)
                            loop(0)
                            setCel(5)
                            x(104)
                            y(181)
                            noun(1)
                            init()
                            addToPic()
                        )
                        (send (ScriptID(35 1)):
                            view(964)
                            setScale()
                            loop(0)
                            cel(3)
                            x(59)
                            y(180)
                            init()
                            addToPic()
                        )
                        (send (ScriptID(39 1)):
                            view(989)
                            setScale()
                            loop(2)
                            cel(0)
                            x(106)
                            y(110)
                            init()
                            addToPic()
                        )
                        (send (ScriptID(36 1)):
                            view(974)
                            setScale()
                            loop(2)
                            cel(0)
                            x(124)
                            y(113)
                            init()
                            addToPic()
                        )
                        (send (ScriptID(34 1)):
                            view(969)
                            setScale()
                            loop(2)
                            cel(0)
                            x(220)
                            y(127)
                            init()
                            addToPic()
                        )
                        (send (ScriptID(40 1)):
                            view(838)
                            x(61)
                            y(111)
                            setScale()
                            init()
                            addToPic()
                        )
                        (send global2:setScript(eventTwo))
                    )
                )
            )
        )
    )


    (method (dispose)
        proc958_0(0 991 34 35 36 39 40 41 939)
        (super:dispose())
    )

)
(instance egoIsDead of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (reesha:
                    view(837)
                    cel(9)
                    init()
                )
                = seconds 2
            )
            (case 1
                (send gOwner:
                    view(6)
                    cel(0)
                    loop(0)
                    setCycle(End self)
                )
            )
            (case 2
                proc26_0()
            )
        )
    )

)
(instance demonTaunts of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 5
            )
            (case 1
                (send global2:setScript(closeCombat))
            )
        )
    )

)
(instance eventTwo of Script
    (properties)

    (method (changeState newState)
        (var temp0, temp1)
        (switch (= state newState)
            (case 0
                proc0_2()
                proc0_5(6)
                (send gOwner:
                    x(298)
                    y(133)
                    solvePuzzle(338 25)
                    setMotion(MoveTo 168 145 self)
                )
            )
            (case 1
                (send (ScriptID(41 1)):
                    setScale()
                    init()
                    x(298)
                    y(133)
                    setCycle(Walk)
                    setMotion(MoveTo 198 161 self)
                )
            )
            (case 2
                (if (proc0_6(150))
                    (send gQg3Messager:say(4 6 10 0 self))
                )(else
                    (self:cue())
                )
            )
            (case 3
                (send gQg3Messager:say(6 6 17 0 self))
            )
            (case 4
                (send gQg3Messager:say(5 6 18 0 self))
            )
            (case 5
                (send gLongSong:changeTo(833))
                (send gOwner:
                    view(881)
                    setCycle(Fwd)
                )
                = seconds 5
            )
            (case 6
                (send gQg3Messager:say(5 6 19 0 self))
            )
            (case 7
                = temp0 Memory(1 50)
                = temp1 Message(0 830 5 6 3 1 temp0)
                (send gQg3Messager:sayFormat(temp1 temp0 @global157))
                Memory(3 temp0)
                = seconds 3
            )
            (case 8
                (send global2:newRoom(880))
                (self:dispose())
            )
        )
    )

)
(instance blastDoor of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (rubble:
                    loop(2)
                    setCycle(End self)
                )
                (send gLongSong2:
                    number(930)
                    play(127)
                )
            )
            (case 1
                (rubble:dispose())
                (self:dispose())
            )
        )
    )

)
(instance useDispell of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:
                    view(9)
                    setLoop(3)
                    setCycle(End self)
                )
            )
            (case 1
                (send gOwner:
                    view(5)
                    drop(16)
                    normalize()
                    addHonor(40)
                    solvePuzzle(337 10)
                )
                (reesha:setScript(reeshaCollapses))
                (self:dispose())
            )
        )
    )

)
(instance closeCombat of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(3 6 9 0 self))
            )
            (case 1
                = global365 845
                (send global2:newRoom(550))
            )
        )
    )

)
(instance reeshaCollapses of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                proc0_2()
                (reesha:
                    view(837)
                    loop(0)
                    cel(9)
                    setCycle(Beg self)
                )
                (send gLongSong2:
                    number(932)
                    setLoop(1)
                    play()
                )
            )
            (case 1
                (reesha:
                    view(833)
                    loop(0)
                    cel(5)
                    setCycle(Beg self)
                )
            )
            (case 2
                (demonCloud:
                    x(146)
                    y(125)
                    cel(0)
                    setLoop(1)
                    init()
                    setCycle(End self)
                )
            )
            (case 3
                (demonCloud:dispose())
                DrawPic((send global2:picture) dpCLOSEREOPEN_HCENTER)
                = seconds 3
            )
            (case 4
                proc0_3()
                (send global2:setScript(portalOpens))
                (self:dispose())
            )
        )
    )

)
(instance portalOpens of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gMainIconBar:disable())
                SetPort(0 0 190 200)
                = seconds 2
            )
            (case 1
                (send gLongSong2:
                    number(831)
                    setLoop(1)
                    play()
                )
                (portal:
                    loop(2)
                    x(40)
                    y(85)
                    init()
                    cycleSpeed(0)
                    setCycle(Fwd)
                )
                = seconds 4
            )
            (case 2
                (portal:
                    setLoop(3)
                    x(46)
                    y(11)
                    init()
                )
                DrawPic((send global2:picture) dpCLOSEREOPEN_HCENTER)
                SetPort(0 0 320 200)
                (send (ScriptID(34 1)):
                    setScale()
                    x(76)
                    y(94)
                    init()
                    setCycle(Walk)
                    setMotion(MoveTo 75 133 self)
                )
                (send gLongSong:
                    number(834)
                    setLoop(1)
                    play(self)
                )
            )
            (case 3
            )
            (case 4
                (portal:stopUpd())
                (send (ScriptID(34 1)):
                    view(969)
                    setScale()
                    stopUpd()
                    setCycle(0)
                    ignoreActors(1)
                )
                (send (ScriptID(36 1)):
                    view(975)
                    x(76)
                    y(94)
                    setScale()
                    init()
                    setCycle(Walk)
                    ignoreActors(1)
                    setMotion(MoveTo 154 113 self)
                )
                (send gLongSong:
                    number(835)
                    setLoop(1)
                    play(self)
                )
            )
            (case 5
                (send (ScriptID(36 1)):
                    setCycle(0)
                    setHeading(180)
                )
            )
            (case 6
                (send (ScriptID(39 1)):
                    x(76)
                    y(94)
                    setScale()
                    init()
                    setCycle(Walk)
                    ignoreActors(1)
                    setMotion(MoveTo 136 110 self)
                )
                (send gLongSong:
                    number(836)
                    setLoop(1)
                    play(self)
                )
            )
            (case 7
                (send (ScriptID(39 1)):
                    setCycle(0)
                    setHeading(180 self)
                )
            )
            (case 8
                (send (ScriptID(36 1)):
                    view(974)
                    ignoreActors(1)
                    stopUpd()
                )
            )
            (case 9
                (send (ScriptID(39 1)):
                    view(989)
                    ignoreActors(1)
                    stopUpd()
                )
                (send (ScriptID(40 1)):
                    x(76)
                    y(94)
                    init()
                    setCycle(Walk)
                    setMotion(MoveTo 38 169 self)
                )
                (send gLongSong:
                    number(837)
                    setLoop(1)
                    play(self)
                )
            )
            (case 10
            )
            (case 11
                (send (ScriptID(40 1)):
                    view(838)
                    setCycle(0)
                    ignoreActors(1)
                    stopUpd()
                )
                (send (ScriptID(35 1)):
                    setScale()
                    view(967)
                    setLoop(0)
                    x(76)
                    y(94)
                    init()
                    setCycle(Walk)
                    setMotion(MoveTo 115 135 self)
                )
                (send gLongSong:
                    number(280)
                    setLoop(-1)
                    play()
                )
            )
            (case 12
                (send gQg3Messager:say(5 6 8 0 self))
            )
            (case 13
                (portal:dispose())
                DrawPic((send global2:picture) dpCLOSEREOPEN_HCENTER)
                = seconds 2
            )
            (case 14
                (send (ScriptID(39 1)):addToPic())
                (send (ScriptID(36 1)):addToPic())
                (send (ScriptID(34 1)):addToPic())
                (send (ScriptID(40 1)):addToPic())
                (send (ScriptID(35 1)):
                    view(965)
                    loop(0)
                    cel(0)
                    setCycle(End self)
                )
                (send gLongSong2:
                    number(12)
                    setLoop(1)
                    play()
                )
            )
            (case 15
                (send gQg3Messager:say(5 6 14 0 self))
            )
            (case 16
                (if (not proc0_6(159))
                    (send gQg3Messager:say(5 6 22 0 self))
                )(else
                    (self:cue())
                )
            )
            (case 17
                (send (ScriptID(35 1)):setCycle(Beg self))
            )
            (case 18
                (reesha:setCycle(End self))
            )
            (case 19
                (send (ScriptID(35 1)):
                    setCycle(0)
                    addToPic()
                )
                (reesha:
                    ignoreActors(1)
                    addToPic()
                )
                (send gQg3Messager:say(5 6 15 0 self))
            )
            (case 20
                (send gLongSong:changeTo(720))
                (send (ScriptID(41 1)):
                    x(40)
                    y(-5)
                    view(985)
                    setLoop(5)
                    init()
                    ignoreHorizon(1)
                    setCycle(Rev)
                    setMotion(MoveTo 41 144 self)
                )
            )
            (case 21
                (send (ScriptID(41 1)):
                    setLoop(0)
                    setCycle(Walk)
                    setMotion(MoveTo 116 148 self)
                )
                (send gLongSong:changeTo(830))
            )
            (case 22
                (send gQg3Messager:say(6 6 8 0 self))
            )
            (case 23
                (send gQg3Messager:say(5 6 16 0 self))
            )
            (case 24
                (self:setScript(blastDoor self))
            )
            (case 25
                (if (== global125 0)
                    (send gOwner:get(45))
                    (send gQg3Messager:say(7 6 20 0 self))
                )(else
                    (self:cue())
                )
            )
            (case 26
                (send gQg3Messager:say(5 6 1 0 self))
            )
            (case 27
                (send gOwner:
                    ignoreActors(1)
                    setMotion(PolyPath 290 133 self)
                )
                (send (ScriptID(41 1)):
                    ignoreActors(1)
                    setMotion(MoveTo 294 133)
                )
            )
            (case 28
                (send gMainIconBar:enable())
                (send global2:newRoom(840))
                (self:dispose())
            )
        )
    )

)
(instance eventOne of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:
                    x(160)
                    y(190)
                    setScale()
                    solvePuzzle(336 3)
                    setMotion(MoveTo 160 180 self)
                )
            )
            (case 1
                (reesha:setCycle(End self))
            )
            (case 2
                (reesha:
                    loop(1)
                    setCycle(End self)
                )
            )
            (case 3
                (reesha:
                    loop(2)
                    setCycle(End self)
                )
            )
            (case 4
                (send gQg3Messager:say(1 6 8 0 self))
            )
            (case 5
                (if (== global125 3)
                    (send gQg3Messager:say(4 6 10))
                )
                (demonCloud:
                    x(146)
                    y(160)
                    init()
                    moveSpeed(0)
                    setCycle(End self)
                )
            )
            (case 6
                (demonCloud:
                    loop(1)
                    setCycle(End self)
                )
            )
            (case 7
                (demonCloud:dispose())
                = local1 1
                (reesha:
                    view(837)
                    loop(0)
                    cel(0)
                    setCycle(End self)
                )
                (send gLongSong2:
                    number(932)
                    setLoop(1)
                    play()
                )
            )
            (case 8
                (send gQg3Messager:say(3 6 8 0 self))
            )
            (case 9
                proc0_3()
                (send gMainIconBar:disable(1 4))
                = seconds 10
            )
            (case 10
                (send global2:setScript(closeCombat))
                (self:dispose())
            )
        )
    )

)
(instance rubble of Prop
    (properties
        x 209
        y 140
        view 830
    )
)
(instance reesha of Prop
    (properties
        x 145
        y 139
        noun 3
        view 833
        signal $4000
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 26
                (send global2:setScript(useDispell))
            )
            (case 2
                (send global2:setScript(closeCombat))
            )
            (case 65
                (send gQg3Messager:say(4 6 21))
            )
            (case 4
                (send global2:setScript(closeCombat))
            )
            (case 81
                (send global2:setScript(closeCombat))
            )
            (case 83
                (send global2:setScript(closeCombat))
            )
            (case 88
                (send global2:setScript(closeCombat))
            )
            (case 33
                (send global2:setScript(closeCombat))
            )
            (case 20
                (send global2:setScript(closeCombat))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance demonCloud of Actor
    (properties
        x 52
        y 189
        view 836
        loop 1
        signal $4000
    )
)
(instance portal of Prop
    (properties
        x 46
        y 11
        view 830
        loop 3
        signal $4000
    )
)
(instance sky of Feature
    (properties
        x 142
        y 13
        noun 8
        nsTop -2
        nsLeft 117
        nsBottom 28
        nsRight 167
        sightAngle 180
    )
)
(instance reeshaTell of Teller
    (properties)

    (method (doChild)
        (switch (query)
            (case -1
                (send global2:setScript(closeCombat))
            )
            (case -3
                (send global2:setScript(closeCombat))
            )
            (case -2
                (send global2:setScript(closeCombat))
            )
        )
        return 1
    )


    (method (doVerb theVerb)
        return 
            (switch (theVerb)
                (case 26
                    (send global2:setScript(useDispell))
                )
                (case 2
                    (send global2:setScript(closeCombat))
                    return 1
                )
                (default 
                    (super:doVerb(theVerb))
                )
            )
    )

)
(instance egoTell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-5 not local1 -8 not local1 -6 not local1 -7 not local1 -11 (== local1 1) -13 (== local1 1) -12 (== local1 1)))
    )


    (method (doChild)
        return 
            (switch (query)
                (case -11
                    (send gOwner:setScript(closeCombat))
                )
                (case -12
                    (send gOwner:setScript(closeCombat))
                )
                (case -13
                    (send global2:setScript(demonTaunts))
                )
                (default 
                    return query
                )
            )
    )

)
(instance public reeshaTalker of GloryTalker
    (properties
        x 205
        y 10
        view 832
        loop 1
        talkWidth 260
        back 57
        textX -180
        textY 100
        backColor 9
    )

    (method (init param1)
        (super:init(reeshaBust reeshaEyes reeshaMouth rest param1))
    )

)
(instance reeshaMouth of Prop
    (properties
        nsTop 49
        nsLeft 20
        view 832
    )
)
(instance reeshaEyes of Prop
    (properties
        nsTop 40
        nsLeft 19
        view 832
        loop 2
    )
)
(instance reeshaBust of View
    (properties
        nsTop 27
        nsLeft 19
        view 832
        loop 3
    )
)
(instance public reeshaBTalker of GloryTalker
    (properties
        x 10
        y 10
        view 822
        loop 1
        talkWidth 260
        back 57
        textX 15
        textY 100
        backColor 9
    )

    (method (init param1)
        (super:init(reeshaBBust reeshaBEyes reeshaBMouth rest param1))
    )

)
(instance reeshaBMouth of Prop
    (properties
        nsTop 31
        nsLeft 60
        view 822
    )
)
(instance reeshaBEyes of Prop
    (properties
        nsTop 24
        nsLeft 49
        view 822
        loop 2
    )
)
(instance reeshaBBust of View
    (properties
        nsTop 14
        nsLeft 53
        view 822
        loop 3
    )
)
