(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "SQRoom")
(use "Polygon")
(use "Class_950_0")
(use "ForwardCounter")
(use "Sound")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 30)


(local
    tehlocal0[28] = (0 172 22 177 36 174 64 174 80 181 120 173 149 179 168 174 205 180 232 180 256 185 319 184 319 189 0 189 )

)
(instance public rm030 of SQRoom
    (properties
        picture 30
        style 30
        east 35
        south 45
        west 25
    )

    (method (init)
        Load(rsSOUND 148)
        Load(rsSCRIPT 956)
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(0 0 319 0 319 185 293 185 251 187 220 181 156 182 120 176 81 183 59 176 32 180 0 175)
                yourself()
            )
))
        (switch (gWest)
            (case east
                (send gEgo:
                    y(186)
                    setHeading(270)
                )
            )
            (case west
                (send gEgo:
                    y(179)
                    setHeading(90)
                )
            )
            (case south
                0
            )
            (default 
                (send gEgo:posn(160 185))
            )
        )
        (send gEgo:init())
        (lightningScript:start(1))
        (lightning1:
            init()
            hide()
            setScript(lightningScript)
        )
        (thunder:init())
        (theRubble:init())
        (theBackBldgs:init())
        (streetPoly:
            points(@local0)
            size(14)
        )
        (theStreet:init())
        (opening:init())
        (superComputer:init())
        (theArea:init())
        (if (not Btest(0))
            (self:setRegions(701))
        )
        (super:init())
        (self:setRegions(705))
    )

)
(instance lightningScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds Random(10 20)
            )
            (case 1
                (self:start(0))
                = seconds Random(3 6)
            )
            (case 2
                (send client:
                    show()
                    setCel(0)
                    setCycle(Fwd)
                )
                = cycles 1
            )
            (case 3
                (thunder:play())
                (send client:setCycle(ForwardCounter Random(1 3) self))
            )
            (case 4
                (send client:hide())
                (self:init())
            )
        )
    )

)
(instance thunder of Sound
    (properties
        number 148
        priority 15
    )
)
(instance lightning1 of Prop
    (properties
        x 240
        y 38
        description "lightning"
        view 32
    )
)
(instance theRubble of Feature
    (properties
        x 160
        y 5
        nsBottom 200
        nsRight 320
        description "rubble"
        onMeCheck 8192
        lookStr "The clearing ends here. Jagged chunks of debris clog the north."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                Print("The rubble is rough and jagged. No sense in risking injury this early in the adventure. There will be plenty of time for that later.")
            )
            (case 11
                Print("It smells like the remains of a flourishing civilization blasted to smithereens by an evil entity of immense power.")
            )
            (case 10
                Print("It doesn't taste half bad, considering what it smells like.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance theBackBldgs of Feature
    (properties
        x 160
        y 5
        nsBottom 200
        nsRight 320
        description "back buildings"
        onMeCheck 64
        lookStr "In the distance the skeletal remains of once proud structures continue to defy, as they jut weakly into the chemical-laden atmosphere."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 10
                Print("If your tongue were that long... well, you know the rest (and if you don't you probably shouldn't).")
            )
            (case 11
                Print("The ruined buildings smell of death and destruction.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance theStreet of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "street"
        lookStr "Creases from tank treads, craters from incoming ordnance, and gouges from fallen debris are the only deviations in an otherwise-smooth surface."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(streetPoly))
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 11
                Print("It has that unmistakably tangy aroma of petrochemicals melted down and pressure-treated.")
            )
            (case 10
                Print("The taste of the street brings to mind all those wonderful times as a child that the local bully ground your face into the asphalt.")
            )
            (case 3
                (send (ScriptID(705 4)):doVerb(param1 param2))
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance streetPoly of Polygon
    (properties)
)
(instance superComputer of Feature
    (properties
        x 160
        y 20
        nsBottom 200
        nsRight 320
        description "structure"
        sightAngle 45
        onMeCheck 1024
        lookStr "The large structure in the background captures your curiosity."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 10
                Print("Nobody can reach that building from here with their tongue unless they're a member of KISS.")
            )
            (case 11
                Print("It smells like trouble. What's going on in there?")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance opening of Feature
    (properties
        x 160
        y 22
        nsBottom 200
        nsRight 320
        description "structure"
        sightAngle 45
        onMeCheck 2048
        lookStr "There seems to be some light pouring through a row of three openings high up in the face of the distant structure."
    )
)
(instance theArea of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "area"
        lookStr "You are at the northern boundary of a clearing in the midst of a battle-scarred city. Standing so large and ominous, the monstrous building is the only thing in sight which might contain some life."
    )
)
