(version 2)
(include "sci.sh")
(exports
    0 Room54
)
(use "Main")
(use "Class_255_0")
(use "Sound")
(use "Cycle")
(use "Game")
(use "Feature")
(use "Obj")
(script 54)



(instance lightning of Prop
    (properties)
)
(instance thunder of Sound
    (properties)
)
(instance explosion of Sound
    (properties)
)
(instance public Room54 of Rm
    (properties
        picture 54
    )

    (method (init)
        = south gNorth
        Load(129 540)
        Load(128 79)
        Load(132 31)
        Load(132 32)
        Load(132 33)
        (super:init())
        proc0_1()
        (send gEgo:init())
        (lightning:
            view(69)
            loop(8)
            cel(0)
            posn(99 75)
            setScript(flash)
            init()
        )
        = global104 0
        (send gEgo:
            posn(157 188)
            view(0)
            loop(3)
        )
        (send global2:setScript(Actions))
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 1
        )
        return 
            (if ((== (send pEvent:type) 128) and Said('look>'))
                (if ((Said('/area') or Said('/around')) or Said('[<around][/!*]'))
                    proc255_0(54 0)
                )(else
                    (if (Said('/butte,toe'))
                        proc255_0(54 1)
                    )(else
                        (if (Said('/cloud,air') or Said('<up'))
                            proc255_0(54 2)
                        )(else
                            (if (Said('/desert'))
                                proc255_0(54 3)
                            )(else
                                (if (Said('/dirt,dirt'))
                                    proc255_0(54 4)
                                )(else
                                    (if (Said('/lightning'))
                                        proc255_0(54 5)
                                    )
                                )
                            )
                        )
                    )
                )
            )(else
                0
            )
    )


    (method (newRoom newRoomNumber)
        DisposeScript(988)
        (if (not global155)
            (super:newRoom(newRoomNumber))
        )
    )

)
(instance Actions of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (<> global11 global13)
            return 
        )
        (if ((== state 0) and ((<> (send gEgo:x) 157) or (<= (send gEgo:y) 185)))
            = seconds 0
            (self:changeState(1))
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 8
            )
            (case 1
                proc0_2()
                (explosion:
                    number(33)
                    priority(34)
                    play()
                )
                (send global2:overlay(540 5))
                (send gEgo:
                    view(79)
                    loop(1)
                    cel(255)
                    cycleSpeed(1)
                    setCycle(End self)
                )
                = cycles 1
            )
            (case 2
                ShakeScreen(8)
                (send global2:drawPic(54 4))
            )
            (case 3
                = seconds 7
            )
            (case 4
                proc0_17(901 0 11 18)
            )
        )
    )

)
(instance flash of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds Random(5 15)
            )
            (case 1
                (lightning:
                    cel(255)
                    setCycle(End self)
                )
            )
            (case 2
                (lightning:cel(0))
                = seconds Random(2 5)
            )
            (case 3
                (thunder:
                    priority(2)
                    number(Random(31 32))
                    play(self)
                )
            )
            (case 4
                = state -1
            )
        )
    )

)
