(version 2)
(include "sci.sh")
(exports
    0 dinosaurMonster
)
(use "Main")
(use "CombatIcon")
(use "Cycle")
(use "Obj")
(script 560)



(instance public dinosaurMonster of Monster
    (properties
        x 152
        y 44
        view 559
        loop 3
        priority 4
        roar 903
        primDamage 15
        secDamage 8
        tertDamage 15
        armorValue 8
        monHP 320
        spellHitX 152
        spellHitY 69
    )

    (method (init param1)
        (send global2:picture(555))
        (armLeft:init())
        (armRight:init())
        (theTail:
            init()
            setPri(0)
            stopUpd()
        )
        (super:init(rest param1))
        (self:restart())
        (send gLongSong:
            setLoop(-1)
            changeTo(157)
        )
    )


    (method (getHurt)
        (self:setScript(sReact))
        (super:getHurt())
    )


    (method (defenseLevel)
        return 200
    )


    (method (restart)
        (self:setScript(sFight))
    )

)
(instance armLeft of MonsterProp
    (properties
        x 164
        y 55
        view 559
        loop 2
        priority 6
    )

    (method (cue)
        (self:
            setCel(0)
            stopUpd()
        )
    )

)
(instance armRight of MonsterProp
    (properties
        x 158
        y 63
        view 559
        priority 2
    )

    (method (cue)
        (self:
            setCel(0)
            stopUpd()
        )
    )

)
(instance theTail of MonsterProp
    (properties
        x 218
        y 86
        view 559
        loop 5
    )

    (method (cue)
        (if (cel)
            (send gWarriorObj:autoDodge())
            (if (not 
            (if ((== (send gWarriorObj:view) 26) or (== (send gWarriorObj:view) 27))
            )(else
                == (send gWarriorObj:view) 555
            )
)
                (send gWarriorObj:getHurt((send gMonster:tertDamage)))
            )(else
                (send gLongSong2:
                    number(940)
                    play()
                )
            )
            (self:setCycle(Beg self))
        )(else
            (self:setPri(0))
            (super:cue())
        )
    )

)
(instance sFight of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = ticks (/ 180 global209)
                (send gMonster:
                    x(152)
                    y(44)
                )
            )
            (case 1
                (send gMonster:
                    setCel(0)
                    setCycle(CT 2 1 self)
                )
            )
            (case 2
                (send gMonster:setCycle(End gMonster))
                (send gWarriorObj:autoDodge())
                (if (not 
                (if ((== (send gWarriorObj:view) 26) or (== (send gWarriorObj:view) 27))
                )(else
                    == (send gWarriorObj:view) 555
                )
)
                    (send gWarriorObj:getHurt((send gMonster:primDamage)))
                )
                = ticks (/ Random(180 270) global209)
            )
            (case 3
                (armLeft:setCycle(CT 3 1 self))
                (armRight:setCycle(CT 3 1 self))
            )
            (case 4
                (armLeft:setCycle(End armLeft))
                (armRight:setCycle(End armRight))
                (send gWarriorObj:autoDodge())
                (if (not 
                (if ((== (send gWarriorObj:view) 26) or (== (send gWarriorObj:view) 27))
                )(else
                    == (send gWarriorObj:view) 555
                )
)
                    (send gWarriorObj:getHurt((send gMonster:secDamage)))
                )(else
                    (send gLongSong2:
                        number(940)
                        play()
                    )
                )
                = ticks (/ Random(270 360) global209)
            )
            (case 5
                (theTail:
                    setPri(6)
                    setCycle(End theTail)
                )
                (send gMonster:setCycle(End self))
            )
            (case 6
                (send gMonster:cue())
                = ticks (/ Random(180 270) global209)
            )
            (case 7
                (armRight:setCycle(CT 3 1 self))
                (armLeft:setCycle(CT 3 1 self))
            )
            (case 8
                (armLeft:setCycle(End self))
                (armRight:setCycle(End self))
                (send gWarriorObj:autoDodge())
                (if (not 
                (if ((== (send gWarriorObj:view) 26) or (== (send gWarriorObj:view) 27))
                )(else
                    == (send gWarriorObj:view) 555
                )
)
                    (send gWarriorObj:getHurt((send gMonster:secDamage)))
                )(else
                    (send gLongSong2:
                        number(940)
                        play()
                    )
                )
            )
            (case 9
                (armLeft:cue())
                (armRight:cue())
                = ticks (/ Random(180 270) global209)
            )
            (case 10
                (self:init())
            )
        )
    )

)
(instance sReact of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gMonster:
                    whimper()
                    setCel(1)
                    x(172)
                    y(39)
                )
                (armLeft:setCel(4))
                (armRight:setCel(4))
                = ticks 30
            )
            (case 1
                (armLeft:setCel(1))
                (armRight:setCel(1))
                = ticks 30
            )
            (case 2
                (send gMonster:whimper())
                (armLeft:setCel(5))
                (armRight:setCel(5))
                = ticks (/ 30 global209)
            )
            (case 3
                (armLeft:setCel(0))
                (armRight:setCel(0))
                (send gMonster:
                    x(152)
                    y(44)
                    setCel(0)
                    setScript(sFight)
                )
            )
        )
    )

)
