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



(instance public travrg of Rgn
    (properties)

    (method (init)
        Load(128 51)
        Load(132 33)
        (self:keep(0))
        (if (global594)
            = global175 6
        )
        (super:init())
    )


    (method (doit)
        (var temp0[50])
        (if (global219)
            --global220
            --global175
        )
        (if (== global175 15)
            proc255_0(701 0)
        )
        (if ((== global175 1) and (<> global11 18))
            = global175 0
            (if (== global11 14)
                (self:setScript(Attack1))
            )(else
                (self:setScript(Attack2))
            )
        )
        (if (((== global220 1) and global209) and not global178)
            (if (== global209 2)
                = global220 180
            )(else
                (if (== global209 3)
                    = global220 90
                )(else
                    = global220 4
                )
            )
            = global161 (+ global161 global165)
            = gGEgoY (+ gGEgoY global166)
            (if ((== global161 global163) and (== gGEgoY global164))
                = global220 0
                = global167 1
            )(else
                (if (== global161 12)
                    = global214 (* global161 gGEgoY)
                )(else
                    = global214 (+ (* (- gGEgoY 1) 12) global161)
                )
                (if (> global163 global161)
                    = global165 1
                )
                (if (< global163 global161)
                    = global165 -1
                )
                (if (== global163 global161)
                    = global165 0
                )
                (if (> global164 gGEgoY)
                    = global166 1
                )
                (if (< global164 gGEgoY)
                    = global166 -1
                )
                (if (== global164 gGEgoY)
                    = global166 0
                )
            )
        )
        (super:doit())
    )


    (method (handleEvent pEvent)
        (super:handleEvent(pEvent))
        (if ((send pEvent:claimed) or (<> (send pEvent:type) 128))
            return 
        )
    )

)
(instance Attack1 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (== global594 2)
                    (self:changeState(4))
                )(else
                    ShakeScreen(5 3)
                    = global594 1
                    (if ((not --global174 or (== global205 1)) or (== global205 0))
                        (send client:setScript(BlowUp))
                    )
                    (zipShip:
                        posn(128 69)
                        setLoop(2)
                        cel(0)
                        setPri(6)
                        illegalBits(0)
                        init()
                        cycleSpeed(0)
                        setCycle(End self)
                    )
                )
            )
            (case 1
                (zipShip:
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 2
                (zipShip:
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 3
                (zipShip:
                    cel(0)
                    setLoop(3)
                    posn(142 79)
                    setCycle(End self)
                )
            )
            (case 4
                = global594 2
                = seconds 4
            )
            (case 5
                (if ((== global594 2) or not (send global5:contains(zipShip)))
                    (zipShip:init())
                )
                (zipShip:
                    cel(0)
                    setLoop(0)
                    posn(185 72)
                    cycleSpeed(0)
                    setCycle(End self)
                )
            )
            (case 6
                (zipShip:
                    cel(0)
                    setLoop(1)
                    posn(195 80)
                    setCycle(End self)
                )
            )
            (case 7
                (zipShip:
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 8
                (zipShip:
                    setLoop(4)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 9
                (zipShip:dispose())
                proc0_10()
                ShakeScreen(5 3)
                (if ((not --global174 or (== global205 2)) or (== global205 0))
                    (send client:setScript(BlowUp))
                )
                = global594 0
                = global175 10
            )
        )
    )

)
(instance Attack2 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (== global594 2)
                    (self:changeState(1))
                )(else
                    ShakeScreen(5 3)
                    = global594 1
                    (if ((not --global174 or (== global205 1)) or (== global205 0))
                        (send global2:setScript(BlowUp))
                    )
                    = cycles 1
                )
            )
            (case 1
                = global594 2
                = seconds 6
            )
            (case 2
                ShakeScreen(5 3)
                (if ((not --global174 or (== global205 2)) or (== global205 0))
                    (send global2:setScript(BlowUp))
                )
                = global175 10
                = global594 0
                (send global2:setScript(0))
            )
        )
    )

)
(instance BlowUp of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ShakeScreen(20 3)
                (send global5:eachElementDo(91))
                proc0_12()
                (send global2:drawPic(121))
                (if (not global174)
                    proc255_0(701 1)
                )(else
                    proc255_0(701 2)
                )
                proc0_17(0 0 4 5)
            )
        )
    )

)
(instance zipShip of Act
    (properties)

    (method (init)
        (super:init())
        (self:
            view(51)
            ignoreActors(1)
            setPri(6)
            illegalBits(0)
        )
    )

)
(instance boom of Sound
    (properties
        number 33
        priority 2
    )
)
