(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "PV")
(use "Obj")
(script 9)


(local
    newProp
    newProp_2

)
(instance public Room9 of Rm
    (properties
        picture 9
    )

    (method (init)
        = north 3
        = south 15
        = east 10
        = west 8
        = horizon 75
        (send gEgo:
            view(2)
            init()
        )
        = global101 0
        (if (global100)
            = picture 109
        )
        (if (<= (send gEgo:y()) (+ horizon 1))
            (send gEgo:y((+ horizon 2)))
        )
        (if (< (send gEgo:x()) 93)
            (send gEgo:x(93))
        )
        (super:init())
        (self:setRegions(507 514))
        (if (not global100)
            (if (< Random(1 100) 50)
                = newProp (Prop:new())
                (send newProp:
                    view(342)
                    loop(5)
                    cel(2)
                    posn(283 18)
                    setPri(14)
                    setScript(bird1Actions)
                    init()
                )
            )
            (if (< Random(1 100) 50)
                = newProp_2 (Prop:new())
                (send newProp_2:
                    view(342)
                    loop(4)
                    cel(2)
                    posn(58 31)
                    setPri(14)
                    setScript(bird2Actions)
                    init()
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed()))
            return 1
        )
        return 
            (if (== (send pEvent:type()) 128)
                (if (Said('climb/boulder'))
                    Print(9 0)
                )(else
                    (if (Said('look>'))
                        (if (Said('/pool'))
                            Print(9 1)
                        )(else
                            (if (Said('/boulder'))
                                Print(9 2)
                            )(else
                                (if (Said('/blossom'))
                                    Print(9 3)
                                )(else
                                    (if (Said('[<around][/room]'))
                                        Print(9 4)
                                    )
                                )
                            )
                        )
                    )
                )
            )(else
                0
            )
    )


    (method (newRoom param1)
        (if ((send gCast:contains(gNewAct)))
            = global211 global160
            = global212 global159
        )
        (super:newRoom(param1))
    )

)
(instance bird1Actions of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send newProp:setCycle(Fwd)) = seconds Random(1 12)  )
            )
            (case 1
                ((send newProp:
                    setCycle(0)
                    cel(0)
                )
 = seconds Random(1 8)  )
            )
            (case 2
                ((self:changeState(0)) )
            )
        )
    )

)
(instance bird2Actions of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send newProp_2:setCycle(Fwd)) = seconds Random(1 12)  )
            )
            (case 1
                ((send newProp_2:
                    setCycle(0)
                    cel(0)
                )
 = seconds Random(1 8)  )
            )
            (case 2
                ((self:changeState(0)) )
            )
        )
    )

)
