File: code.lua

package info (click to toggle)
fillets-ng-data 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180,924 kB
  • sloc: makefile: 2
file content (308 lines) | stat: -rw-r--r-- 10,382 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308

-- -----------------------------------------------------------------
-- Init
-- -----------------------------------------------------------------
local function prog_init()
    initModels()
    sound_playMusic("music/rybky06.ogg")
    local pokus = getRestartCount()


    -- -------------------------------------------------------------
    local function prog_init_room()
        local pom1, pom2, pomb1, pomb2 = 0, 0, false, false

        room.odjel = 0
        room.qopatrne = 0
        room.hulakat = random(30) + 10 * pokus
        room.oci = 0
        room.reklopatrne = 0

        return function()
            if small:isTalking() or big:isTalking() then
                room.hulakat = -1
            end
            if room.odjel == 0 and big:isOut() and isReady(small) then
                room.odjel = 1
                switch(random(3)){
                    [0] = function()
                        addm(10, "zr-m-takfajn")
                    end,
                    [1] = function()
                        addm(10, "zr-m-tojeon")
                    end,
                    [2] = function()
                        addm(10, "zr-m-pockej")
                    end,
                }
            elseif room.qopatrne < 2 and room.reklopatrne == 1 and not small:isAlive() and small.X == 8 and isReady(big) then
                addv(3, "zr-v-vzdyt")
                room.qopatrne = 2
            end
            if room.qopatrne < 2 then
                if isReady(small) and small.X == 9 and isReady(big) and lahev.X == 8 and small:isLeft() and room.qopatrne == 0 then
                    if no_dialog() then
                        addv(1, "zr-v-opatrne")
                        room.reklopatrne = 1
                    else
                        room.reklopatrne = 0
                    end
                    room.qopatrne = 1
                end
            end
            if room.qopatrne == 1 and not small:isLeft() then
                room.qopatrne = 0
            end
            if isReady(small) and isReady(big) and no_dialog() then
                if room.hulakat > 0 then
                    room.hulakat = room.hulakat - 1
                elseif room.hulakat == 0 then
                    room.hulakat = -1
                    switch(random(3)){
                        [0] = function()
                            addv(3, "zr-v-hej")
                        end,
                        [1] = function()
                            addv(3, "zr-v-halo")
                        end,
                        [2] = function()
                            addv(3, "zr-v-jetunekdo")
                        end,
                    }
                    switch(random(3)){
                        [0] = function()
                            addm(9, "zr-m-nervi")
                        end,
                        [1] = function()
                            addm(9, "zr-m-nepovykuj")
                        end,
                        [2] = function()
                            addm(9, "zr-m-tadyjsem")
                        end,
                    }
                end
                if no_dialog() and small.trpelivost == 0 then
                    switch(random(2)){
                        [0] = function()
                            addm(0, "zr-m-obliceje")
                        end,
                        [1] = function()
                            addm(0, "zr-m-prestan")
                        end,
                    }
                    small.trpelivost = random(600) + 100
                end
                if no_dialog() and peri.cinnost == 7 and room.oci == 0 and random(100) < 50 then
                    addm(5, "zr-m-komu")
                    addv(10, "zr-v-nevim")
                    room.oci = 1
                end
            end
        end
    end

    -- -------------------------------------------------------------
    local function prog_init_peri()
        local pom1, pom2, pomb1, pomb2 = 0, 0, false, false

        peri.cinnost = 0

        return function()
            local anim_table = {
                [0] = function()
                    peri.delay = random(100) + 50
                    peri.cinnost = 1
                    peri.afaze = 0
                end,
                [1] = function()
                    if peri.delay == 0 then
                        peri.cinnost = peri.cinnost + 1
                    else
                        peri.delay = peri.delay - 1
                    end
                end,
                [2] = function()
                    peri.afaze = peri.cinnost - 1
                    peri.cinnost = peri.cinnost + 1
                end,
                [8] = function()
                    peri.delay = random(30) + 15
                    peri.cinnost = peri.cinnost + 1
                end,
                [9] = function()
                    if math.mod(game_getCycles(), 3) == 0 then
                        peri.afaze = 6 + random(2)
                    end
                    if peri.delay == 0 then
                        peri.cinnost = peri.cinnost + 1
                    else
                        peri.delay = peri.delay - 1
                    end
                end,
                [10] = function()
                    if random(100) < 30 then
                        peri.cinnost = 20
                    else
                        peri.cinnost = peri.cinnost + 1
                    end
                end,
                [11] = function()
                    peri.delay = random(5) + 2
                    peri.cinnost = peri.cinnost + 1
                end,
                [12] = function()
                    if random(100) < 20 then
                        peri.cinnost = peri.cinnost + 1
                    end
                end,
                [13] = function()
                    peri.afaze = 18 - peri.cinnost
                    peri.cinnost = peri.cinnost + 1
                end,
                [16] = function()
                    peri.afaze = peri.cinnost - 12
                    peri.cinnost = peri.cinnost + 1
                end,
                [19] = function()
                    if peri.delay == 0 then
                        peri.cinnost = 8
                    else
                        peri.delay = peri.delay - 1
                        peri.cinnost = 12
                    end
                end,
                [20] = function()
                    peri.afaze = 25 - peri.cinnost
                    peri.cinnost = peri.cinnost + 1
                end,
                [26] = function()
                    peri.cinnost = 0
                end,
            }

            anim_table[3] = anim_table[2]
            anim_table[4] = anim_table[2]
            anim_table[5] = anim_table[2]
            anim_table[6] = anim_table[2]
            anim_table[7] = anim_table[2]

            anim_table[14] = anim_table[13]
            anim_table[15] = anim_table[13]

            anim_table[17] = anim_table[16]
            anim_table[18] = anim_table[16]

            anim_table[21] = anim_table[20]
            anim_table[22] = anim_table[20]
            anim_table[23] = anim_table[20]
            anim_table[24] = anim_table[20]
            anim_table[25] = anim_table[20]

            switch(peri.cinnost)(anim_table)
            peri:updateAnim()
        end
    end

    -- -------------------------------------------------------------
    local function prog_init_zrcadlo()
        local pom1, pom2, pomb1, pomb2 = 0, 0, false, false

        zrcadlo:setEffect("mirror")
    end

    -- -------------------------------------------------------------
    local function prog_init_naboj()
        local pom1, pom2, pomb1, pomb2 = 0, 0, false, false

        naboj.nabita = 0

        return function()
            if naboj.nabita == 0 and naboj.X == 12 and naboj.Y == 8 then
                naboj.nabita = 1
                room:talk("zr-x-nabito")
            end
        end
    end

    -- -------------------------------------------------------------
    local function prog_init_small()
        local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
        local xicht = 0

        small.trpelivost = random(50) + 30

        return function()
            if not small:isLeft() and (xdist(small, zrcadlo) == -1 or xdist(small, zrcadlo) == -2) and ydist(small, zrcadlo) == 0 then
                if random(100) < 30 then
                    xicht = random(9)
                end
            else
                xicht = 0
            end
            if xicht ~= 0 then
                small:useSpecialAnim("head_all", xicht)
            end
        end
    end

    -- -------------------------------------------------------------
    local function prog_init_big()
        local xicht = 0
        return function()
            if not big:isLeft() and (xdist(big, zrcadlo) == -1 or xdist(big, zrcadlo) == -2) and (zrcadlo.Y == big.Y or zrcadlo.Y == big.Y - 1) then
                if random(100) < 30 then
                    xicht = random(8)
                end
                if small.trpelivost > 0 then
                    small.trpelivost = small.trpelivost - 1
                end
            else
                xicht = 0
            end
            if xicht ~= 0 then
                big:useSpecialAnim("head_all", xicht)
            end
        end
    end

    -- --------------------
    local update_table = {}
    local subinit
    subinit = prog_init_room()
    if subinit then
        table.insert(update_table, subinit)
    end
    subinit = prog_init_peri()
    if subinit then
        table.insert(update_table, subinit)
    end
    subinit = prog_init_zrcadlo()
    if subinit then
        table.insert(update_table, subinit)
    end
    subinit = prog_init_naboj()
    if subinit then
        table.insert(update_table, subinit)
    end
    subinit = prog_init_small()
    if subinit then
        table.insert(update_table, subinit)
    end
    subinit = prog_init_big()
    if subinit then
        table.insert(update_table, subinit)
    end
    return update_table
end
local update_table = prog_init()


-- -----------------------------------------------------------------
-- Update
-- -----------------------------------------------------------------
function prog_update()
    for key, subupdate in pairs(update_table) do
        subupdate()
    end
end