(version 2)
(include "sci.sh")
(exports
    0 rm50
)
(use "Main")
(use "Class_255_0")
(use "Blk")
(use "n958")
(use "RFeature")
(use "Cycle")
(use "Game")
(use "User")
(use "PicView")
(use "Obj")
(script 50)



(instance public rm50 of Rm
    (properties
        picture 50
        horizon 48
        north 22
        east 51
    )

    (method (init)
        proc958_0(128 251 274 701)
        (self:style(
            (switch (gGNumber)
                (case north
                    6
                )
                (case east
                    2
                )
            )
))
        (super:init())
        proc0_1()
        (switch (gGNumber)
            (case north
                (send gEgo:
                    posn(58 51)
                    loop(0)
                )
            )
            (case east
                (send gEgo:posn(289 143))
            )
            (default 
                (send gEgo:posn(289 143))
            )
        )
        (send gEgo:init())
        (if (not proc0_12(82))
            (send gAddToPics:
                add(rock)
                eachElementDo(#init)
                doit()
            )
            (send gEgo:observeBlocks(rockBlock))
        )
        (if (proc0_12(2))
            proc255_0(50 0)
            proc0_11(2)
        )
        (drip1:
            init()
            setScript(doDrip1)
        )
        (puddle1:init())
        (drip2:
            init()
            setScript(doDrip2)
        )
        (puddle2:init())
    )


    (method (doit)
        (var temp0)
        (if (script)
            (send script:doit())
        )(else
            = temp0 
                (switch ((send ((User:alterEgo)):edgeHit))
                    (case 1
                        north
                    )
                    (case 2
                        east
                    )
                )
            (if (temp0)
                (if (((== (= temp0 
                    (switch ((send ((User:alterEgo)):edgeHit))
                        (case 1
                            north
                        )
                        (case 2
                            east
                        )
                    )
) north) and (== gGNumber 51)) and proc0_12(82))
                    proc0_19(99 2)
                )
                (send global2:newRoom(temp0))
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look/boulder,granite'))
                    (if (proc0_12(82))
                        proc255_0(50 1)
                    )(else
                        proc255_0(50 2)
                    )
                )(else
                    (if (Said('look,look>'))
                        (if (Said('[<at,around][/cave,room]'))
                            (if (proc0_12(82))
                                proc255_0(50 3)
                            )(else
                                proc255_0(50 4)
                            )
                        )(else
                            (if (Said('/stalactite,grass,wall'))
                                proc255_0(50 5)
                            )(else
                                (if (Said('/hole'))
                                    (if ((send gEgo:inRect(0 0 169 82)))
                                        proc255_0(50 6)
                                    )(else
                                        (if ((send gEgo:inRect(200 105 321 191)))
                                            (if (proc0_12(82))
                                                proc255_0(50 7)
                                            )(else
                                                proc255_0(50 8)
                                            )
                                        )(else
                                            proc255_0(50 9)
                                        )
                                    )
                                )
                            )
                        )
                    )(else
                        (if (Said('get,get/boulder'))
                            proc255_0(50 10)
                        )(else
                            (if (Said('move,move/boulder'))
                                (if (> (send gEgo:distanceTo(rock)) 50)
                                    proc255_0(50 11)
                                )(else
                                    proc255_0(50 12)
                                )
                            )(else
                                (if (Said('get,(pick<up)/slime'))
                                    proc255_0(50 13)
                                )(else
                                    (if (Said('climb,climb/boulder'))
                                        proc255_0(50 14)
                                    )(else
                                        (if (Said('get,get,drink/water,puddle'))
                                            proc255_0(50 15)
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance rock of RPicView
    (properties
        x 311
        y 146
        view 251
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                (if (proc0_12(82))
                    proc255_0(50 1)
                )(else
                    proc255_0(50 2)
                )
            )
        )
    )

)
(instance rockBlock of Blk
    (properties
        top 132
        left 276
        bottom 146
        right 346
    )
)
(instance drip1 of Prop
    (properties
        x 176
        y 51
        view 274
        loop 2
        priority 12
        signal $4010
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look/drip'))
                    (self:doVerb(1))
                )
            )
        )
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 1
                proc255_0(50 16)
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance drip2 of Prop
    (properties
        x 252
        y 65
        view 274
        loop 2
        priority 13
        signal $4010
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 1
                proc255_0(50 16)
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance puddle1 of Prop
    (properties
        x 178
        y 165
        view 701
        signal $4000
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look/puddle,water'))
                    (self:doVerb(1))
                )
            )
        )
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 1
                proc255_0(50 17)
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance puddle2 of Prop
    (properties
        x 252
        y 179
        view 701
        loop 1
        signal $4000
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 1
                proc255_0(50 17)
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance doDrip1 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles Random((* global101 10) (* global101 30))
            )
            (case 1
                (drip1:setCycle(End self))
            )
            (case 2
                (drip1:stopUpd())
                (puddle1:setCycle(End self))
            )
            (case 3
                (puddle1:stopUpd())
                (self:changeState(0))
            )
        )
    )

)
(instance doDrip2 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles Random((* global101 10) (* global101 30))
            )
            (case 1
                (drip2:setCycle(End self))
            )
            (case 2
                (drip2:stopUpd())
                (puddle2:setCycle(End self))
            )
            (case 3
                (puddle2:stopUpd())
                (self:changeState(0))
            )
        )
    )

)
