(version 2)
(include "sci.sh")
(exports
    0 rm460
    1 target
)
(use "Main")
(use "TellerIcon")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "Track")
(use "n958")
(use "StopWalk")
(use "Jump")
(use "Cycle")
(use "Game")
(use "User")
(use "View")
(use "Obj")
(script 460)


(local
    local0
    local1
    local2
    local3
    local4
    local5
    targetX
    targetY
    local8
    newSpear[6]
    local15
    newDagger[10]
    newRackSpear[6]
    local32[12] = (92 128 88 131 84 134 250 131 258 135 260 138 )
    local44
    local45[5] = (0 -26 -27 -21 999 )
    local50[4]
    local54
    local55[4] = (0 20 -37 999 )
    local59[7] = (0 -18 -23 24 25 -28 999 )
    local66[3] = (0 -23 999 )
    local69[3] = (0 22 999 )
    local72[4]
    local76
    local77
    local78
    local79
    local80
    local81
    local82
    local83
    local84
    local85
    local86
    local87
    local88
    local89
    local90
    local91
    local92
    local93
    local94
    local95
    local96
    local97

)
(procedure (localproc_1c78)
    (var temp0, temp1, temp2, temp3, temp4)
    = temp2 0
    = temp0 
        (switch (local81)
            (case 1
                150
            )
            (case 2
                175
            )
            (case 3
                200
            )
        )
    (send gOwner:trySkill(10 (- temp0 1)))
    (if ((< gGOwnerMaxStamina[10] temp0) or (< gGOwnerMaxStamina[0] temp0))
        = temp1 (- 100 (/ (+ (- temp0 gGOwnerMaxStamina[10]) (- temp0 gGOwnerMaxStamina[0])) 2))
        (if (< temp1 10)
            = temp1 10
        )
        (if (> temp1 90)
            = temp1 90
        )
        (if (>= temp1 Random(1 100))
            (if (< targetX 171)
                = targetX Random((+ (target:nsLeft) 4) (+ (target:nsLeft) 6))
            )(else
                = targetX Random((- (target:nsRight) 7) (- (target:nsRight) 5))
            )
            = targetY Random((+ (target:nsTop) 3) (- (target:nsBottom) 8))
        )(else
            (if ((< targetX 171) or (== local92 -1))
                = targetX Random((targArea:nsLeft) (- (target:nsLeft) 1))
            )(else
                = targetX Random((+ (target:nsRight) 1) (targArea:nsRight))
            )
        )
    )(else
        (if (local91 and (= temp2 (- (= temp2 local91) (/ (- gGOwnerMaxStamina[0] temp0) 10))))
            = targetX (+ targetX (* local92 (= temp2 (- (= temp2 local91) (/ (- gGOwnerMaxStamina[0] temp0) 10)))))
        )
        = temp4 (/ (- (+ temp0 100) gGOwnerMaxStamina[10]) 10)
        (if (<= temp4 2)
            = temp4 2
        )
        = targetX (+ targetX (- temp4 Random(0 (+ temp4 temp4))))
        = targetY (+ targetY (- temp4 Random(0 (+ temp4 temp4))))
    )
    localproc_1e43()
)


(procedure (localproc_1e2e)
    (var temp0)
    (while (1)
        = temp0 localproc_20a3()
        (if (temp0)
            break
        )
    )
)


(procedure (localproc_1e43)
    (if (< targetX 110)
        = targetX 110
    )(else
        (if (> targetX 226)
            = targetY 226
        )
    )
    (if (< targetY 44)
        = local5 0
        = targetY 65
    )(else
        (if ((< 64 targetY) and (< targetY 80))
            = local5 0
        )(else
            (if (>= targetY 80)
                = local5 0
                = targetY 80
            )(else
                = local5 1
            )
        )
    )
)


(procedure (localproc_1ea1)
    (if (local0)
        proc0_2()
        localproc_1f3a()
        (if (<> local1 3)
            (send gQg3Messager:say(26 61 61))
        )
        proc0_3()
    )
    = local44 0
    (if ((competeVSUhura:script))
        (send ((competeVSUhura:script)):dispose())
    )
    (if ((send (ScriptID(34 1)):script))
        (send ((send (ScriptID(34 1)):script)):dispose())
        (send (ScriptID(34 1)):
            view(971)
            setCycle(StopWalk 969)
            setHeading(270)
        )
    )
    (send ((send gMainIconBar:at(3))):cursor(942))
)


(procedure (localproc_1f3a)
    (var temp0)
    = temp0 0
    (while (< temp0 local0)
        (if (IsObject(newSpear[temp0]))
            (send newSpear[temp0]:dispose())
        )
        (send (= newRackSpear[temp0] (rackSpear:new())):
            loop(
                (if (< temp0 3)
                    4
                )(else
                    3
                )
)
            cel(Random(0 3))
            x(local32[* temp0 2])
            y(local32[+ (* temp0 2) 1])
            init()
            stopUpd()
        )
        ++temp0
    )
    = local0 0
)


(procedure (localproc_1faf)
    (var temp0, temp1)
    (switch (local81)
        (case 1
            = temp0 150
            = temp1 150
        )
        (case 2
            = temp0 175
            = temp1 175
        )
        (case 3
            = temp0 200
            = temp1 200
        )
    )
    return 
        (if ((>= gGOwnerMaxStamina[10] temp0) and (>= gGOwnerMaxStamina[0] temp1))
            return 1
        )(else
            return 0
        )
)


(procedure (localproc_200b)
    (var temp0)
    = temp0 3
    (while (<= temp0 local76)
        (if (IsObject(newSpear[temp0]))
            (send newSpear[temp0]:dispose())
        )
        (send (= newRackSpear[temp0] (rackSpear:new())):
            loop(3)
            cel(Random(0 3))
            x(local32[* temp0 2])
            y(local32[+ (* temp0 2) 1])
            init()
        )
        ++temp0
    )
)


(procedure (localproc_206a)
    (send gMainIconBar:
        enable(3)
        curIcon((send gMainIconBar:at(3)))
    )
    (User:canInput(1))
    (send gGame:setCursor((send ((send gMainIconBar:curIcon)):cursor) 1))
)


(procedure (localproc_20a3)
    return - Random(0 2) 1
)


(procedure (localproc_2111)
    (if (not (& local88 $0001) and (< gGOwnerMaxStamina[0] 150))
        (send gQg3Messager:say(2 6 6))
        = local88 (| local88 $0001)
    )(else
        (if (not (& local88 $0002) and (< gGOwnerMaxStamina[10] 150))
            (send gQg3Messager:say(2 6 1))
            = local88 (| local88 $0002)
        )(else
            (if (not (& local88 $0004) and (< gGOwnerMaxStamina[0] 150))
                (send gQg3Messager:say(2 6 7))
                = local88 (| local88 $0004)
            )(else
                (if (not (& local88 $0008) and (< gGOwnerMaxStamina[10] 150))
                    (send gQg3Messager:say(2 6 2))
                    = local88 (| local88 $0008)
                )(else
                    (if ((not (& local88 $0010) and (< gGOwnerMaxStamina[0] 175)) and (== local81 3))
                        (send gQg3Messager:say(2 6 8))
                        = local88 (| local88 $0010)
                    )(else
                        (if ((not (& local88 $0020) and (< gGOwnerMaxStamina[10] 150)) and (<> local81 1))
                            (send gQg3Messager:say(2 6 3))
                            = local88 (| local88 $0020)
                        )(else
                            (if ((not (& local88 $0040) and (< gGOwnerMaxStamina[10] 170)) and (<> local81 1))
                                (send gQg3Messager:say(2 6 4))
                                = local88 (| local88 $0040)
                            )(else
                                (if ((not (& local88 $0080) and (< gGOwnerMaxStamina[10] 200)) and (== local81 3))
                                    (send gQg3Messager:say(2 6 5))
                                    = local88 (| local88 $0080)
                                )(else
                                    (if ((not (& local88 $0100) and (< gGOwnerMaxStamina[10] 200)) and (== local81 3))
                                        (send gQg3Messager:say(2 6 31))
                                        = local88 (| local88 $0100)
                                    )(else
                                        (if (not (& local88 $0200) and (== local81 3))
                                            (send gQg3Messager:say(2 6 34))
                                            = local88 (| local88 $0200)
                                        )(else
                                            (if (not (& local88 $0400) and (<> local81 1))
                                                (send gQg3Messager:say(2 6 33))
                                                = local88 (| local88 $0400)
                                            )(else
                                                (if (not local94)
                                                    = local94 1
                                                    (send gQg3Messager:say(2 6 30))
                                                )(else
                                                    (if (not Random(0 5))
                                                        (send gQg3Messager:say(2 6 30))
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )
)


(procedure (localproc_2351)
    (if (not (& local88 $0001) and (< gGOwnerMaxStamina[0] 125))
        (send gQg3Messager:say(1 6 6))
        = local88 (| local88 $0001)
    )(else
        (if ((not (& local88 $0002) and (< gGOwnerMaxStamina[0] 150)) and (<> local81 1))
            (send gQg3Messager:say(1 6 7))
            = local88 (| local88 $0002)
        )(else
            (if ((not (& local88 $0004) and (< gGOwnerMaxStamina[0] 175)) and (== local81 3))
                (send gQg3Messager:say(1 6 8))
                = local88 (| local88 $0004)
            )(else
                (if (not (& local88 $0008) and (< gGOwnerMaxStamina[10] 100))
                    (send gQg3Messager:say(1 6 1))
                    = local88 (| local88 $0008)
                )(else
                    (if (not (& local88 $0010) and (< gGOwnerMaxStamina[10] 150))
                        (send gQg3Messager:say(1 6 2))
                        = local88 (| local88 $0010)
                    )(else
                        (if ((not (& local88 $0020) and (< gGOwnerMaxStamina[10] 145)) and (<> local81 1))
                            (send gQg3Messager:say(1 6 3))
                            = local88 (| local88 $0020)
                        )(else
                            (if ((not (& local88 $0040) and (< gGOwnerMaxStamina[10] 170)) and (<> local81 1))
                                (send gQg3Messager:say(1 6 4))
                                = local88 (| local88 $0040)
                            )(else
                                (if ((not (& local88 $0080) and (< gGOwnerMaxStamina[10] 195)) and (== local81 3))
                                    (send gQg3Messager:say(1 6 5))
                                    = local88 (| local88 $0080)
                                )
                            )
                        )
                    )
                )
            )
        )
    )
)


(procedure (localproc_2535 param1)
    (if (not (& local90 $0001) and (< gGOwnerMaxStamina[0] 100))
        (send gQg3Messager:say(1 6 14 0 param1))
        = local90 (| local90 $0001)
    )(else
        (if ((not (& local90 $0002) and (< gGOwnerMaxStamina[0] 125)) and (<> local81 1))
            (send gQg3Messager:say(1 6 15 0 param1))
            = local90 (| local90 $0002)
        )(else
            (if ((not (& local90 $0004) and (< gGOwnerMaxStamina[0] 150)) and (== local81 3))
                (send gQg3Messager:say(1 6 16 0 param1))
                = local90 (| local90 $0004)
            )(else
                (if (not (& local90 $0008) and (< gGOwnerMaxStamina[10] 100))
                    (send gQg3Messager:say(1 6 9 0 param1))
                    = local90 (| local90 $0008)
                )(else
                    (if (not (& local90 $0010) and (< gGOwnerMaxStamina[10] 125))
                        (send gQg3Messager:say(1 6 10 0 param1))
                        = local90 (| local90 $0010)
                    )(else
                        (if ((not (& local90 $0020) and (< gGOwnerMaxStamina[10] 150)) and (<> local81 1))
                            (send gQg3Messager:say(1 6 11 0 param1))
                            = local90 (| local90 $0020)
                        )(else
                            (if ((not (& local90 $0040) and (< gGOwnerMaxStamina[10] 175)) and (<> local81 1))
                                (send gQg3Messager:say(1 6 12 0 param1))
                                = local90 (| local90 $0040)
                            )(else
                                (if ((not (& local90 $0080) and (< gGOwnerMaxStamina[10] 185)) and (== local81 3))
                                    (send gQg3Messager:say(1 6 13 0 param1))
                                    = local90 (| local90 $0080)
                                )(else
                                    (send param1:cue())
                                )
                            )
                        )
                    )
                )
            )
        )
    )
)


(instance public rm460 of Rm
    (properties
        noun 5
        picture 460
    )

    (method (init)
        (var temp0, temp1)
        = local97 0
        = local3 1
        = local50[0] @local45
        = local50[1] 999
        (egoActions:init(gOwner @local45 @local50))
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(0 189 0 0 319 0 319 164 278 160 260 146 232 146 232 126 101 126 39 188)
                yourself()
            )
))
        proc0_2()
        (target:
            setLoop(0)
            ignoreActors(1)
            init()
        )
        (barrier:init())
        (leftBush:init())
        (leftRocks:init())
        (rightRocks:init())
        (leftTreeTop:init())
        (leftTreeBot:init())
        (rightTrees:init())
        (plant1:init())
        (plant2:init())
        (plant3:init())
        (plant4:init())
        (plant5:init())
        (plant6:init())
        (targArea:init())
        = local95 0
        = local96 0
        = local94 0
        = temp1 0
        (while (< temp1 6)
            (send (= newRackSpear[temp1] (rackSpear:new())):
                loop(
                    (if (< temp1 3)
                        4
                    )(else
                        3
                    )
)
                cel(Random(0 3))
                x(local32[* temp1 2])
                y(local32[+ (* temp1 2) 1])
                init()
            )
            ++temp1
        )
        (spearRack:
            approachVerbs(4)
            init()
        )
        (flag:init())
        (if (proc0_6(56))
            proc958_0(128 980 981 989)
        )(else
            proc958_0(128 46 971 972 969)
        )
        (super:init())
        (send gOwner:
            normalize()
            setScale()
            scaleX(128)
            scaleY(128)
            actions(egoActions)
            noun(3)
            init()
            hide()
        )
        (if ((proc0_6(56) and not global121) and not proc0_6(16))
            = local1 3
            (send gOwner:
                x(103)
                y(148)
                setHeading(15)
                show()
            )
            (send (ScriptID(39 1)):
                view(984)
                x(242)
                y(144)
                loop(4)
                cel(0)
                setScale()
                scaleX(128)
                scaleY(128)
                init()
            )
            (send gOwner:setScript(startContest))
        )(else
            (if (== gGClientModNum 480)
                (send gOwner:setScript(enterFromEast))
            )(else
                (send global2:setScript(enterRoom))
            )
        )
    )


    (method (doit param1)
        (if (script)
            0
        )(else
            (if ((send gOwner:script))
                0
            )(else
                (if ((send gOwner:mover) and local44)
                    localproc_1ea1()
                )(else
                    (if (>= (send gOwner:y) 183)
                        (send global2:setScript(walkEgoOut))
                    )(else
                        (if (>= (send gOwner:x) 315)
                            (send global2:setScript(exitTo480))
                        )
                    )
                )
            )
        )
        (super:doit(rest param1))
    )


    (method (dispose)
        (if (<> (send gLongSong:number) 160)
            (send gLongSong:changeTo(160))
        )
        (send ((send gMainIconBar:at(3))):cursor(942))
        UnLoad(128 46)
        UnLoad(128 9)
        UnLoad(128 10)
        UnLoad(128 971)
        UnLoad(128 972)
        UnLoad(128 969)
        UnLoad(128 980)
        UnLoad(128 981)
        UnLoad(128 989)
        proc958_0(0 34 39 991 955 53)
        (super:dispose())
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 65
                (send gQg3Messager:say(27 6 66))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance egoActions of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-26 (send gGQg3KDHandler:contains(ScriptID(34 1))) -27 (send gGQg3KDHandler:contains(ScriptID(34 1))) -21 
            (if ((send gGQg3KDHandler:contains(ScriptID(34 1))) and (== local1 2))
                not local78
            )(else
                0
            )
))
    )


    (method (doChild)
        return 
            (switch (query)
                (case -26
                    (if (not proc0_6(155))
                        proc0_4(155)
                        (send gOwner:addHonor(4))
                    )
                    return 1
                )
                (case -27
                    (send gOwner:addHonor(2))
                    localproc_1ea1()
                    (send global2:setScript(uhuraLeave))
                    return 0
                )
                (case -21
                    (uhuraActions:query(-37))
                    (uhuraActions:doChild())
                )
            )
    )


    (method (doVerb theVerb)
        (var temp0)
        (switch (theVerb)
            (case 2
                (super:doVerb(theVerb))
            )
            (default 
                (send gOwner:doVerb(theVerb))
            )
        )
    )

)
(instance uhuraActions of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-18 
            (if (== local1 1)
                not local54
            )(else
                0
            )
 20 (<> local1 1) -37 not local78 -28 gGOwnerMaxStamina[10]))
    )


    (method (doChild param1)
        return 
            (switch (query)
                (case -37
                    = local78 1
                    = local77 0
                    localproc_1f3a()
                    (send (ScriptID(34 1)):setScript(competeVSUhura))
                    return 0
                )
                (case -18
                    (send gQg3Messager:say(2 5 18))
                    (send global2:setScript(uhuraThrow))
                    return 0
                )
                (case -23
                    (super:doChild(rest param1))
                )
                (case -28
                    = local2 1
                    return 1
                )
            )
    )


    (method (doVerb theVerb)
        (var temp0)
        (switch (theVerb)
            (case 2
                (super:doVerb(theVerb))
            )
            (default 
                (send (ScriptID(34 1)):doVerb(theVerb))
            )
        )
    )

)
(instance enterFromEast of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:
                    x(330)
                    y(170)
                    show()
                    setMotion(PolyPath 300 170 self)
                )
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance yesufuThrows of Script
    (properties)

    (method (doit param1)
        (if (not (target:script))
            0
        )(else
            (if (<> state 0)
                0
            )(else
                (if ((== (target:x) 202) and (== local4 -1))
                    = targetX 155
                    = targetY (+ (target:y) Random(0 2))
                    (self:cue())
                )(else
                    (if ((== (target:x) 140) and (== local4 1))
                        = targetX 158
                        = targetY (+ (target:y) Random(0 2))
                        (self:cue())
                    )
                )
            )
        )
        (super:doit(rest param1))
    )


    (method (changeState newState)
        (var temp0, temp1, temp2)
        (switch (= state newState)
            (case 0
                = local97 0
                (if (not (target:script))
                    = targetX (target:x)
                    = targetY (target:y)
                    = targetX (+ targetX (- 7 Random(0 14)))
                    = targetY (+ targetY (- 6 Random(0 12)))
                    = cycles 1
                )
            )
            (case 1
                = local85 (+ local84 3)
                (switch (local81)
                    (case 1
                        = temp2 150
                    )
                    (case 2
                        = temp2 175
                    )
                    (case 3
                        = temp2 200
                    )
                )
                = local86 0
                (send newRackSpear[local85]:dispose())
                (send (ScriptID(39 1)):
                    setCel(0)
                    loop(2)
                    setScale()
                    scaleX(128)
                    scaleY(128)
                    setCycle(End self)
                )
            )
            (case 2
                (send (ScriptID(39 1)):
                    loop(3)
                    cel(0)
                    setCycle(CT 3 1 self)
                )
                = local97 0
            )
            (case 3
                (send (ScriptID(39 1)):setCycle(End self))
                = local95 (+ local95 (+ Abs((- (target:x) targetX)) Abs((- (target:y) targetY))))
                = local97 (= newSpear[local85] (spear:new()))
                (send local97:
                    x(200)
                    y(79)
                    setLoop(1)
                    setScale()
                    scaleX(128)
                    scaleY(128)
                    setCycle(CT 4 1 self)
                    setPri(
                        (if (< targetX (+ (target:nsLeft) 2))
                            3
                        )(else
                            5
                        )
)
                    init()
                    setMotion(JumpTo targetX targetY self)
                )
            )
            (case 4
                1
            )
            (case 5
                (if (> (send local97:x) (+ (target:x) 4))
                    (send local97:x((- (send local97:x) 3)))
                )
                (if (< (send local97:x) (- (target:x) 4))
                    (send local97:x((+ (send local97:x) 3)))
                )
                = cycles 1
            )
            (case 6
                (send gLongSong2:
                    number(461)
                    setLoop(1)
                    play(127)
                )
                (send (ScriptID(39 1)):
                    loop(4)
                    setCel(0)
                    setScale()
                    scaleX(128)
                    scaleY(128)
                )
                = temp0 (- (send newSpear[local85]:x) (target:x))
                = temp1 (- (send newSpear[local85]:y) (target:y))
                (if ((target:script))
                    (if ((target:onMe(newSpear[local85])))
                        (send newSpear[local85]:
                            setMotion((trackSpear:new()) target temp0 temp1)
                            setPri(
                                (if (local5)
                                    5
                                )(else
                                    2
                                )
)
                        )
                    )(else
                        (send newSpear[local85]:setPri(2))
                    )
                )
                (send newSpear[local85]:setCycle(0))
                = cycles 2
            )
            (case 7
                (self:dispose())
            )
        )
    )

)
(instance startContest of Script
    (properties)

    (method (doit)
        (if (local83)
            = local83 0
            (self:cue())
        )
        (super:doit())
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (User:canControl(0))
                = ticks 1
            )
            (case 1
                (send gLongSong:changeTo(490))
                = ticks 30
            )
            (case 2
                (send gQg3Messager:say(4 6 39 0 self))
            )
            (case 3
                (send gQg3Messager:say(4 6 46 0 self))
            )
            (case 4
                = local81 global209
                (self:setScript(throwMode self))
            )
            (case 5
                localproc_206a()
                (User:canControl(0))
            )
            (case 6
                = cycles 1
            )
            (case 7
                (self:setScript(yesufuThrows self))
            )
            (case 8
                (if (< ++local84 3)
                    (self:changeState((- state 3)))
                )(else
                    = local84 0
                    = cycles 1
                )
            )
            (case 9
                = local0 6
                localproc_1f3a()
                (if (> local96 local95)
                    (send gQg3Messager:say(4 6 50 0 self))
                )(else
                    (send gQg3Messager:say(4 6 51 0 self))
                )
                (target:setScript(moveTarget))
                = local0 0
                = local80 local0
                = local87 local80
                = local79 local87
            )
            (case 10
                localproc_206a()
                (User:canControl(0))
            )
            (case 11
                = cycles 1
            )
            (case 12
                (self:setScript(yesufuThrows self))
            )
            (case 13
                (if (< ++local84 3)
                    (self:changeState((- state 3)))
                )(else
                    = cycles 1
                )
            )
            (case 14
                (if (< local96 local95)
                    proc0_4(78)
                    (send gQg3Messager:say(4 6 55 0 self))
                )(else
                    (send gQg3Messager:say(4 6 54 0 self))
                )
            )
            (case 15
                (if (< local96 local95)
                    (send gOwner:
                        view(32)
                        loop(0)
                        cel(0)
                        setCycle(End self)
                    )
                    (send gLongSong:
                        setLoop(1)
                        number(462)
                        play()
                    )
                    (send gOwner:solvePuzzle(278 5 9))
                )(else
                    = cycles 1
                )
            )
            (case 16
                localproc_1ea1()
                (send global2:newRoom(470))
            )
        )
    )

)
(instance competeVSUhura of Script
    (properties)

    (method (doit)
        (if (local77)
            = local77 0
            (self:cue())
        )
        (super:doit())
    )


    (method (changeState newState)
        (var temp0, temp1)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(2 6 39 0 self))
            )
            (case 1
                (send gQg3Messager:say(2 6 40 0 self))
            )
            (case 2
                localproc_1f3a()
                (switch (local81)
                    (case 1
                        = temp1 180
                    )
                    (case 2
                        = temp1 215
                    )
                    (case 3
                        = temp1 240
                    )
                )
                = local80 0
                = local79 local80
                = local96 local79
            )
            (case 3
                = local3 0
                proc0_2()
                = local76 3
                (if (not local82 and (>= local79 5))
                    = temp0 1
                )(else
                    = temp0 2
                )
                (self:setScript(uhuraThrowSp self temp0))
            )
            (case 4
                = cycles 3
            )
            (case 5
                ++local76
                (if (not local82 and (>= local79 4))
                    = temp0 1
                )(else
                    = temp0 2
                )
                (self:setScript(uhuraThrowSp self temp0))
            )
            (case 6
                = cycles 3
            )
            (case 7
                ++local76
                (if (not local82 and (>= local79 3))
                    = temp0 1
                )(else
                    = temp0 2
                )
                (self:setScript(uhuraThrowSp self temp0))
            )
            (case 8
                = cycles 1
            )
            (case 9
                proc0_3()
                = local3 1
                localproc_200b()
                (if (< local95 local96)
                    = local95 0
                    (send gQg3Messager:say(2 6 43 0 self))
                )(else
                    = local95 0
                    (send gQg3Messager:say(2 6 44 0 self))
                )
                proc0_4(64)
            )
            (case 10
                (send gQg3Messager:say(2 6 45 0 self))
            )
            (case 11
                (send (ScriptID(34 1)):
                    view(971)
                    setCycle(StopWalk 969)
                    setHeading(270)
                )
            )
            (case 12
                (send gOwner:solvePuzzle(277 3 9))
                (send global2:setScript(uhuraLeave))
                (self:dispose())
            )
        )
    )

)
(instance uhuraLeave of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                localproc_200b()
                (send gQg3Messager:say(3 5 27 0 self))
            )
            (case 1
                (send (ScriptID(34 1)):
                    view(971)
                    setCycle(StopWalk 969)
                    setMotion(PolyPath (send (ScriptID(34 1)):x) 235 self)
                    setCycle(StopWalk 969)
                )
            )
            (case 2
                (send gLongSong:changeTo(160))
                = local88 0
                = local1 0
                (send (ScriptID(34 1)):dispose())
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance uhuraEnterAgain of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gLongSong:changeTo(460))
                = local1 2
                = local88 0
                (if (not register)
                    (send gQg3Messager:say(2 6 35 0 self))
                )(else
                    (send gQg3Messager:say(2 6 56 0 self))
                )
            )
            (case 1
                (self:setScript(uhuraEnter self))
            )
            (case 2
                (send gQg3Messager:say(2 6 36 0 self))
            )
            (case 3
                (self:dispose())
            )
        )
    )

)
(instance uhuraThrowSp of Script
    (properties)

    (method (changeState newState)
        (var targetX, targetY)
        (switch (= state newState)
            (case 0
                (send newRackSpear[local76]:dispose())
                (send (ScriptID(34 1)):
                    view(973)
                    setCel(0)
                    loop(0)
                    setCycle(End self)
                )
            )
            (case 1
                (send (ScriptID(34 1)):
                    loop(2)
                    cel(0)
                    setCycle(CT 3 1 self)
                )
            )
            (case 2
                (send (ScriptID(34 1)):setCycle(End self))
                = targetX (target:x)
                = targetY (target:y)
                = targetX (+ targetX (- 9 Random(0 18)))
                = targetY (+ targetY (- 9 Random(0 18)))
                = local95 (+ local95 (+ Abs((- (target:x) targetX)) Abs((- (target:y) targetY))))
                (send (= newSpear[local76] (spear:new())):
                    x(200)
                    y(79)
                    setLoop(1)
                    setScale()
                    scaleX(128)
                    scaleY(128)
                    setCycle(CT 4 1)
                    setPri(
                        (if (< targetX (+ (target:nsLeft) 2))
                            3
                        )(else
                            5
                        )
)
                    setMotion(JumpTo targetX targetY self)
                    init()
                )
            )
            (case 3
                Animate((send gGQg3KDHandler:elements) 1)
                = cycles 5
            )
            (case 4
                (if ((((< 168 (send newSpear[local76]:x)) and (< (send newSpear[local76]:x) 174)) and (< 52 (send newSpear[local76]:y))) and (< (send newSpear[local76]:y) 58))
                    = local80 (+ local80 2)
                )(else
                    = local80 (+ local80 1)
                )
                (send gLongSong2:
                    number(461)
                    setLoop(1)
                    play(127)
                )
            )
            (case 5
                (self:dispose())
            )
        )
    )

)
(instance uhuraThrow of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = local54 1
                = local76 4
                (self:setScript(uhuraThrowSp self))
            )
            (case 1
                (if (== global209 1)
                    (send (ScriptID(34 1)):
                        view(971)
                        setCycle(StopWalk 969)
                    )
                    (self:dispose())
                )(else
                    (send gQg3Messager:say(2 6 38 0 self))
                )
            )
            (case 2
                = local76 5
                (self:setScript(uhuraThrowSp self))
            )
            (case 3
                (send (ScriptID(34 1)):
                    view(971)
                    setCycle(StopWalk 969)
                )
                (self:dispose())
            )
        )
    )

)
(instance throwMode of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send ((send gMainIconBar:at(3))):cursor(947))
                = local44 1
                = local81 global209
                (send gOwner:setHeading(15))
                = cycles 1
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance uhuraEnter of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gLongSong:changeTo(460))
                proc0_2()
                (send gOwner:setHeading(90))
                proc0_4(53)
                (send (ScriptID(34 1)):
                    x(230)
                    y(200)
                    setCycle(StopWalk 969)
                    setScale()
                    scaleX(128)
                    scaleY(128)
                    noun(2)
                    init()
                    setMotion(MoveTo 242 144 self)
                )
            )
            (case 1
                (send (ScriptID(34 1)):setHeading(270))
                = cycles 18
            )
            (case 2
                (if (== local1 1)
                    = local72[0] @local59
                    = local72[1] @local69
                    (uhuraActions:init(ScriptID(34 1) @local59 @local72 @local66))
                    (send gQg3Messager:say(2 6 17 0 self))
                )(else
                    = local72[0] @local55
                    (uhuraActions:init(ScriptID(34 1) @local55 @local72))
                    = cycles 1
                )
            )
            (case 3
                (if ((== local1 1) and (== global362 0))
                    (send gQg3Messager:say(2 6 19 0 self))
                )(else
                    = cycles 1
                )
            )
            (case 4
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance throwSpear of Script
    (properties)

    (method (changeState newState)
        (var temp0, temp1, temp2)
        (switch (= state newState)
            (case 0
                Load(rsVIEW 10)
                = local89 1
                = local93 0
                (if (<> local1 3)
                    proc0_2()
                )(else
                    (send gMainIconBar:disable(3))
                    (send gGame:setCursor(global21 1))
                )
                (if (== gGOwnerMaxStamina[10] 0)
                    (send gQg3Messager:say(26 61 57))
                    localproc_1ea1()
                    proc0_3()
                    (self:dispose())
                )(else
                    (send newRackSpear[local0]:dispose())
                    (send gOwner:
                        view(10)
                        loop(0)
                        cel(0)
                        setCycle(CT 4 1 self)
                    )
                )
            )
            (case 1
                (send gOwner:setCycle(End))
                (switch (local81)
                    (case 1
                        = temp0 150
                    )
                    (case 2
                        = temp0 175
                    )
                    (case 3
                        = temp0 200
                    )
                )
                localproc_1c78()
                (send (= newSpear[local0] (spear:new())):
                    init()
                    ignoreActors(1)
                    illegalBits(0)
                    setLoop(5)
                    setPri(
                        (if (< targetX (+ (target:nsLeft) 2))
                            3
                        )(else
                            5
                        )
)
                    setCycle(CT 2 1)
                    cycleSpeed(6)
                    setScale()
                    scaleX(128)
                    scaleY(128)
                    setStep(30 20)
                    setMotion(MoveTo targetX targetY self)
                )
            )
            (case 2
                (if ((((< (+ (target:nsLeft) 2) targetX) and (< targetX (- (target:nsRight) 2))) and (< (target:nsTop) targetY)) and (< targetY (- (target:nsBottom) 5)))
                    (if ((target:mover))
                        = temp1 (- targetX (target:x))
                        = temp2 (- targetY (target:y))
                        (send newSpear[local0]:
                            setMotion((trackSpear:new()) target temp1 temp2)
                            setPri(5)
                        )
                    )
                    = register 0
                    (send gLongSong2:
                        number(461)
                        setLoop(1)
                        play(127)
                    )
                )(else
                    = register 1
                )
                (send newSpear[local0]:setCycle(End self))
            )
            (case 3
                = local96 (+ local96 (+ Abs((- (target:x) targetX)) Abs((- (target:y) targetY))))
                (if (register)
                    (if ((((send gGQg3KDHandler:contains(ScriptID(34 1))) and local2) and (== local1 1)) and gGOwnerMaxStamina[10])
                        = local89 1
                        localproc_2111()
                    )(else
                        (if ((== local1 0) and gGOwnerMaxStamina[10])
                            = local89 1
                            localproc_2351()
                        )
                    )
                    (send newSpear[local0]:setPri(3))
                )(else
                    (if (((== local1 1) and local2) and (send gGQg3KDHandler:contains(ScriptID(34 1))))
                        (send gQg3Messager:say(2 6 29))
                    )
                )
                = local89 0
                (if (== ++local0 3)
                    = ticks 120
                )(else
                    = ticks 60
                )
            )
            (case 4
                (if ((<> local1 3) and (== local0 3))
                    = local77 1
                    (send gQg3Messager:say(26 61 58))
                    localproc_1f3a()
                )
                (send gOwner:
                    normalize(3)
                    setHeading(15)
                )
                (if ((((proc0_6(53) and (== global362 0)) and not proc0_6(64)) and not (send gGQg3KDHandler:contains(ScriptID(34 1)))) and localproc_1faf())
                    (self:setScript(uhuraEnterAgain self register))
                )(else
                    = cycles 1
                )
            )
            (case 5
                = local83 1
                (if (not local3 or (== local1 3))
                    0
                )(else
                    proc0_3()
                )
                UnLoad(128 10)
                (self:dispose())
            )
        )
    )

)
(instance moveTarget of Script
    (properties)

    (method (changeState newState param2)
        (switch (= state newState)
            (case 0
                = local4 1
                (target:setMotion(MoveTo 215 55 self))
            )
            (case 1
                = local4 -1
                (target:setMotion(MoveTo 120 55 self))
            )
            (case 2
                (self:changeState((- state 2) rest param2))
            )
        )
    )

)
(instance exitTo480 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath (+ (send gOwner:x) 30) (send gOwner:y) self))
            )
            (case 1
                (send global2:newRoom(480))
            )
        )
    )

)
(instance walkEgoOut of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath (send gOwner:x) (+ (send gOwner:y) 65) self))
            )
            (case 1
                (send global2:newRoom(420))
            )
        )
    )

)
(instance enterRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    x(160)
                    y(200)
                    show()
                    setMotion(PolyPath 160 180 self)
                )
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance throwDagger of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                Load(rsVIEW 9)
                = local81 global209
                (if (== gGOwnerMaxStamina[10] 0)
                    (send gQg3Messager:say(26 61 57))
                    (self:dispose())
                )(else
                    proc0_2()
                    (send gOwner:setMotion(PolyPath 103 148 self))
                )
            )
            (case 1
                (send gOwner:
                    view(9)
                    loop(2)
                    cel(0)
                    setCycle(CT 3 1 self)
                )
            )
            (case 2
                (send gOwner:setCycle(End))
                localproc_1c78()
                (send (= newDagger[local15] (dagger:new())):
                    setCycle(Fwd)
                    cycleSpeed(2)
                    moveSpeed(2)
                    setScale(115)
                    origStep(2570)
                    setMotion(MoveTo targetX targetY self)
                    init()
                )
                (send gOwner:drop(10 1))
            )
            (case 3
                (if (not 
                (if (local5 and (< 157 targetX))
                    < targetX 185
                )
)
                    (send newDagger[local15]:hide())
                    localproc_2535(self)
                )(else
                    (send gLongSong2:
                        number(461)
                        setLoop(1)
                        play(127)
                    )
                    = cycles 1
                )
            )
            (case 4
                (if (not & (send newDagger[local15]:signal) $0080)
                    (send newDagger[local15]:
                        setCycle(0)
                        cel(3)
                    )
                )
                ++local15
                proc0_3()
                (if (== local15 10)
                    = local15 0
                    (while (< local15 10)
                        (send newDagger[local15]:dispose())
                        ++local15
                    )
                    (send gOwner:get(10 10))
                    = local15 0
                    (send gQg3Messager:say(26 61 59))
                )
                (send gOwner:normalize(6))
                UnLoad(128 9)
                (self:dispose())
            )
        )
    )

)
(instance spearRack of Feature
    (properties
        x 90
        y 120
        nsTop 85
        nsLeft 50
        nsBottom 152
        nsRight 100
        sightAngle 40
        approachX 103
        approachY 148
    )

    (method (doVerb theVerb param2)
        return 
            (switch (theVerb)
                (case 4
                    (if (not proc0_6(53) and not global121)
                        = local1 1
                        (send global2:setScript(uhuraEnter))
                    )(else
                        (send global2:setScript(throwMode))
                    )
                    return 1
                )
                (case 1
                    (send global2:doVerb(1 rest param2))
                )
                (default 
                    (super:doVerb(theVerb))
                )
            )
    )

)
(instance targArea of Feature
    (properties
        x 159
        y 40
        nsTop 34
        nsLeft 73
        nsBottom 88
        nsRight 246
        sightAngle 40
    )

    (method (doVerb theVerb param2)
        return 
            (switch (theVerb)
                (case 4
                    (if ((send global2:script))
                        0
                    )(else
                        (if (local44)
                            = targetX gTargetX
                            = targetY (- gPEventY 10)
                            (send global2:setScript(throwSpear))
                            return 1
                        )
                    )
                )
                (case 20
                    (if ((send global2:script))
                        0
                    )(else
                        (if (not local44)
                            = targetX gTargetX
                            = targetY (- gPEventY 10)
                            (send global2:setScript(throwDagger))
                        )(else
                            (send gQg3Messager:say(26 61 60))
                        )
                    )
                )
                (case 1
                    (send global2:doVerb(1))
                )
                (default 
                    (super:doVerb(theVerb rest param2))
                )
            )
    )

)
(instance rackSpear of View
    (properties
        noun 10
        approachX 103
        approachY 148
        view 460
        cel 1
        signal $6800
    )

    (method (init)
        (self:approachVerbs(4))
        (super:init())
    )


    (method (doVerb theVerb param2)
        (if (== theVerb 1)
            (super:doVerb(1 rest param2))
        )(else
            (spearRack:doVerb(theVerb rest param2))
        )
    )

)
(instance barrier of Feature
    (properties
        x 169
        y 108
        noun 12
        nsTop 106
        nsLeft 82
        nsBottom 110
        nsRight 256
        sightAngle 180
    )
)
(instance leftBush of Feature
    (properties
        x 14
        y 169
        noun 13
        nsTop 158
        nsBottom 181
        nsRight 29
        sightAngle 180
    )
)
(instance leftRocks of Feature
    (properties
        x 35
        y 145
        noun 14
        nsTop 129
        nsBottom 162
        nsRight 70
        sightAngle 180
    )
)
(instance rightRocks of Feature
    (properties
        x 294
        y 135
        noun 15
        nsTop 117
        nsLeft 270
        nsBottom 154
        nsRight 319
        sightAngle 180
    )
)
(instance leftTreeTop of Feature
    (properties
        x 65
        y 20
        noun 16
        nsBottom 41
        nsRight 130
        sightAngle 180
    )
)
(instance leftTreeBot of Feature
    (properties
        x 58
        y 67
        noun 17
        nsTop 48
        nsLeft 14
        nsBottom 87
        nsRight 103
        sightAngle 180
    )
)
(instance rightTrees of Feature
    (properties
        x 273
        y 40
        noun 18
        nsLeft 228
        nsBottom 80
        nsRight 319
        sightAngle 180
    )
)
(instance plant1 of Feature
    (properties
        x 78
        y 173
        noun 19
        nsTop 165
        nsLeft 62
        nsBottom 181
        nsRight 95
        sightAngle 180
    )
)
(instance plant2 of Feature
    (properties
        x 183
        y 135
        noun 20
        nsTop 127
        nsLeft 167
        nsBottom 144
        nsRight 200
        sightAngle 180
    )
)
(instance plant3 of Feature
    (properties
        x 224
        y 130
        noun 21
        nsTop 124
        nsLeft 201
        nsBottom 136
        nsRight 247
        sightAngle 180
    )
)
(instance plant4 of Feature
    (properties
        x 213
        y 172
        noun 22
        nsTop 166
        nsLeft 202
        nsBottom 178
        nsRight 225
        sightAngle 180
    )
)
(instance plant5 of Feature
    (properties
        x 123
        y 95
        noun 23
        nsTop 89
        nsLeft 111
        nsBottom 101
        nsRight 135
        sightAngle 180
    )
)
(instance plant6 of Feature
    (properties
        x 235
        y 88
        noun 24
        nsTop 81
        nsLeft 219
        nsBottom 95
        nsRight 252
        sightAngle 180
    )
)
(instance flag of Prop
    (properties
        x 33
        y 98
        noun 8
        view 460
        loop 5
    )

    (method (doit param1)
        (var temp0)
        (if (<> global209 1)
            (if (not (self:cycler) and (== loop 5))
                = local91 10
                (if (Random(0 1))
                    = local92 1
                )(else
                    = local92 -1
                )
                (self:
                    loop(
                        (if (> local92 0)
                            1
                        )(else
                            2
                        )
)
                    setCycle(Fwd)
                )
            )
            = temp0 Random(0 3600)
            (if (< temp0 10)
                = local92 1
                = loop 1
            )
            (if (> temp0 3590)
                = local92 -1
                = loop 2
            )
        )(else
            (if (local91)
                = local91 0
                = local92 local91
            )
            (if (<> loop 5)
                (self:
                    setCycle(0)
                    loop(5)
                )
            )
        )
        (super:doit(rest param1))
    )

)
(instance public target of Actor
    (properties
        x 171
        y 55
        noun 9
        view 460
        priority 4
        signal $6010
        xStep 1
        moveSpeed 0
    )

    (method (doVerb theVerb param2)
        (var temp0)
        (switch (theVerb)
            (case 4
                (if ((<> (send ((send gMainIconBar:at(3))):cursor) 3) and IsObject(newDagger[0]))
                    = temp0 0
                    (while (< temp0 local15)
                        (send newDagger[temp0]:dispose())
                        (send gOwner:get(10))
                        ++temp0
                    )
                    (send gQg3Messager:say(26 61 59))
                    = local15 0
                )(else
                    (targArea:doVerb(theVerb rest param2))
                )
            )
            (case 20
                (targArea:doVerb(theVerb rest param2))
            )
            (case 13
                (send gQg3Messager:say(27 4 62))
            )
            (case 33
                (send gQg3Messager:say(27 4 63))
            )
            (case 12
                (send gQg3Messager:say(27 4 64))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance spear of Actor
    (properties
        x 128
        y 92
        noun 10
        view 46
        loop 5
        signal $6000
    )

    (method (doVerb theVerb param2)
        (if (== theVerb 1)
            (super:doVerb(theVerb rest param2))
        )(else
            (targArea:doVerb(theVerb rest param2))
        )
    )

)
(instance dagger of Actor
    (properties
        x 95
        y 110
        noun 11
        view 46
        loop 2
        priority 5
        signal $6810
    )
)
(instance spearPath of JumpTo
    (properties
        waitApogeeX 0
        waitApogeeY 0
    )
)
(instance trackSpear of Track
    (properties)

    (method (doit)
        (send client:
            x(+ (send who:x) xOffset)
            y(+ (send who:y) yOffset)
            z(+ (send who:z) zOffset)
        )
    )

)
