File: code.lua

package info (click to toggle)
fillets-ng-data 0.6.1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 73,664 kB
  • ctags: 2,328
  • sloc: makefile: 46
file content (292 lines) | stat: -rw-r--r-- 10,849 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

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


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

        room.uvod = 0
        room.olosech = 0
        room.poslhlaska = 0
        room.dalsihlaska = random(300) + 50
        room.pochlasek = 0

        return function()
            if no_dialog() and isReady(small) and isReady(big) then
                if room.uvod == 0 then
                    room.uvod = 1
                    switch(pokus){
                        [1] = function()
                            pom1 = 2
                        end,
                        [2] = function()
                            pom1 = 1
                        end,
                        default = function()
                            pom1 = random(3)
                        end,
                    }
                    adddel(10 + random(20))
                    if pom1 >= 1 then
                        addm(0, "deu-m-valka")
                        addv(10, "deu-v-nepratelstvi")
                    end
                    if pom1 >= 2 then
                        addm(random(20) + 5, "deu-m-bojovat")
                        addv(3, "deu-v-losa")
                    end
                elseif room.olosech == 0 and dist(small, loos) <= 2 and random(100) < 3 then
                    room.olosech = 1
                    switch(pokus){
                        [1] = function()
                            pom1 = 1
                        end,
                        [2] = function()
                            pom1 = 2
                        end,
                        default = function()
                            pom1 = random(3)
                        end,
                    }
                    switch(pom1){
                        [1] = function()
                            addv(10, "deu-v-radsi")
                            planDialogSet(random(10) + 5, "deu-l-pozalsta", 101, loos, "cinnost")
                            planDialogSet(0, "deu-p-schnell", 111, papouch, "cinnost")
                        end,
                        [2] = function()
                            addm(10, "deu-m-zvlastni")
                            addv(8, "deu-v-slysel")
                            planDialogSet(10, "deu-l-los", 101, loos, "cinnost")
                            planSet(loos, "cinnost", 30)
                        end,
                    }
                end
            end
            if no_dialog() then
                if room.dalsihlaska > 0 then
                    room.dalsihlaska = room.dalsihlaska - 1
                end
                if room.dalsihlaska == 0 then
                    room.pochlasek = room.pochlasek + 1
                    room.dalsihlaska = random(300) + room.pochlasek * 30
                    pom1 = random(2)
                    if pom1 == room.poslhlaska then
                        pom1 = 2
                    end
                    room.poslhlaska = pom1
                    switch(pom1){
                        [0] = function()
                            if random(2) == 0 then
                                planDialogSet(20, "deu-p-trinken"..random(2), 111, papouch, "cinnost")
                            else
                                planDialogSet(20, "deu-p-los", 111, papouch, "cinnost")
                                planDialogSet(random(20) + 5, "deu-l-los"..random(2), 101, loos, "cinnost")
                            end
                        end,
                        [1] = function()
                            switch(random(6)){
                                [0] = function()
                                    planDialogSet(20, "deu-p-schnell", 111, papouch, "cinnost")
                                end,
                                [1] = function()
                                    planDialogSet(20, "deu-p-jawohl", 111, papouch, "cinnost")
                                end,
                                [2] = function()
                                    planDialogSet(20, "deu-p-stimmt", 111, papouch, "cinnost")
                                end,
                                [3] = function()
                                    planDialogSet(20, "deu-p-streng", 111, papouch, "cinnost")
                                end,
                                [4] = function()
                                    planDialogSet(20, "deu-p-ordnung", 111, papouch, "cinnost")
                                end,
                                [5] = function()
                                    planDialogSet(20, "deu-p-skoll", 111, papouch, "cinnost")
                                end,
                            }
                        end,
                        [2] = function()
                            switch(random(6)){
                                [0] = function()
                                    planDialogSet(20, "deu-l-ja", 101, loos, "cinnost")
                                end,
                                [1] = function()
                                    planDialogSet(20, "deu-l-neznaju", 101, loos, "cinnost")
                                end,
                                [2] = function()
                                    planDialogSet(20, "deu-l-nesmotrel", 101, loos, "cinnost")
                                end,
                                [3] = function()
                                    planDialogSet(20, "deu-l-zivjot", 101, loos, "cinnost")
                                    planSet(loos, "cinnost", 30)
                                end,
                                [4] = function()
                                    planDialogSet(20, "deu-l-necital", 101, loos, "cinnost")
                                end,
                                [5] = function()
                                    planDialogSet(20, "deu-l-tovarisci", 101, loos, "cinnost")
                                    planSet(loos, "cinnost", 30)
                                end,
                            }
                        end,
                    }
                end
            end
        end
    end

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

        papouch.cinnost = 0

        return function()
            switch(papouch.cinnost){
                [111] = function()
                    papouch.afaze = random(2)
                end,
            }

            papouch:updateAnim()
        end
    end

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

        snecik.kouka = 0

        return function()
            if snecik.dir ~= dir_no then
                snecik.kouka = random(100) + 10
            elseif snecik.kouka > 0 then
                snecik.kouka = snecik.kouka - 1
            end
            if snecik.kouka > 0 then
                if snecik.afaze < 2 then
                    snecik.afaze = snecik.afaze + 1
                end
            elseif snecik.afaze > 0 then
                snecik.afaze = snecik.afaze - 1
            end

            snecik:updateAnim()
        end
    end

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

        loos.cinnost = 0

        return function()
            pomb1 = math.mod(game_getCycles(), 3) == 0
            switch(loos.cinnost){
                [0] = function()
                    loos.afaze = 3
                    if random(1000) < 3 then
                        loos.cinnost = 1
                    end
                end,
                [1] = function()
                    if pomb1 then
                        if random(100) < 5 then
                            loos.afaze = 3
                        else
                            loos.afaze = 0
                        end
                    end
                    if random(1000) < 2 then
                        loos.cinnost = 0
                    end
                end,
                [10] = function()
                    setanim(loos, "a3d3a4a5a6a7d2a6a5a4a3")
                    loos.cinnost = 11
                end,
                [11] = function()
                    goanim(loos)
                    if anim == "" then
                        if random(100) < 30 then
                            loos.cinnost = 10
                        else
                            loos.cinnost = 0
                        end
                    end
                end,
                [20] = function()
                    setanim(loos, "a3d5a4d1a5d1a6d1a7d12a6d1a5d1a4d1a3")
                    loos.cinnost = 21
                end,
                [21] = function()
                    goanim(loos)
                    if anim == "" then
                        loos.cinnost = 0
                    end
                end,
                [30] = function()
                    loos.cinnost = random(2) * 10 + 10
                end,
                [101] = function()
                    if pomb1 then
                        pom1 = random(2)
                        if pom1 == loos.afaze then
                            pom1 = 2
                        end
                        if pom1 == 0 and random(100) < 8 then
                            loos.afaze = 3
                        else
                            loos.afaze = pom1
                        end
                    end
                end,
            }

            loos:updateAnim()
        end
    end

    -- --------------------
    local update_table = {}
    local subinit
    subinit = prog_init_room()
    if subinit then
        table.insert(update_table, subinit)
    end
    subinit = prog_init_papouch()
    if subinit then
        table.insert(update_table, subinit)
    end
    subinit = prog_init_snecik()
    if subinit then
        table.insert(update_table, subinit)
    end
    subinit = prog_init_loos()
    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