-
Notifications
You must be signed in to change notification settings - Fork 0
/
leftcontrol.lua
571 lines (409 loc) · 17.4 KB
/
leftcontrol.lua
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
function moveLeft()
info[file].meta.left = info[file].meta.left + 1
if info[file].battle.on then
return
end
if info[file].shop then
return
end
if info[file].text then
return
end
if not(you == nil) then
replaceYou("Left")
local thisSpace = currentMap[info[file].posx][info[file].posy]
if info[file].posx > 1 and
not (currentMap[info[file].posx - 1][info[file].posy] == "Void") then
local specialMove = true
local nextSpace = currentMap[info[file].posx - 1][info[file].posy] -- not at edge, then make variable
if info[file].map.name == "Cave" then
--[[if (info[file].map.subname == "Spawn Path")
and (info[file].meta.left % 20 == 0) then
startBattle(info[file].battle.you.hp, info[file].battle.you.endur, info[file].battle.you.hit,
"Golem", 30, 5, 5, 1.01, 15, 2)
else]]--
if info[file].prog.cave.tutorial then
if nextSpace == "Push Rock" then -- cannot go through rock
oneText("Capstone Tiles/Cave - Push Rock.png", "A seemingly immovable rock. What would happen if an unstoppable force hits it?")
elseif nextSpace == "Monster" then -- cannot go through monster
oneText("Capstone Tiles/Cave - Monster.png", "You sighed. Those stationary monsters seem to be a ploy to lead you to a linear gameplay path.")
elseif nextSpace == "Rolling Rock" then -- cannot go through rolling rock
oneText("Capstone Tiles/Cave - Rolling Rock.png", "Perhaps if you push it from the other side, it might roll downhill and crash the rock blocking your path...")
elseif nextSpace == "Small Rock" then
oneText("Capstone Textbox/You - Normal.png", "You aren't supposed to be reading this text.")
else
specialMove = false
end
else
if nextSpace == "Hole" then
if not(currentMap[info[file].posx - 2] == nil) then
local afterHole = currentMap[info[file].posx - 2][info[file].posy]
end
if currentMap[info[file].posx - 2] == nil -- edge of map
or afterHole == "Void"
or afterHole == "Hole"
or afterHole == "Push Rock"
or afterHole == "Pull Rock"
or afterHole == "Fake Pull Rock"
or afterHole == "Stacked Rock" then
return
else
replaceYou("Left")
you.x = you.x - 60
info[file].posx = info[file].posx - 2
end
elseif nextSpace == "Ladder" then
info[file].prog.cave.secondfloor = true
makeMap()
updateMap()
specialMove = false
elseif nextSpace == "Push Rock"
or nextSpace == "Pull Rock"
or nextSpace == "Fake Pull Rock"
or nextSpace == "Stacked Rock"
or nextSpace == "Second Floor Rock"
or nextSpace == "Monster" then
return
else
specialMove = false
end
end
elseif info[file].map.name == "Town" then
if collidedWithNPCLeft() then
return
elseif nextSpace == "Warp 2"
or nextSpace == "Warp 4"
or nextSpace == "Compass 3"
or nextSpace == "Compass 6"
or nextSpace == "Compass 9"
or nextSpace == "Cave 3"
or nextSpace == "Cave 6"
or nextSpace == "Old Compass 3"
or nextSpace == "Old Compass 6"
or nextSpace == "Old Compass 9"
or nextSpace == "Cave 3"
or nextSpace == "Cave 6"
or nextSpace == "Rubble"
or nextSpace == "Warp Void"
or nextSpace == "Warp Post"
or nextSpace == "Bar Void"
or nextSpace == "Bar Chair"
or nextSpace == "Bar Table"
or nextSpace == "Bar Counter"
or nextSpace == "Bar Counter 2"
then
return
else
specialMove = false
end
elseif info[file].map.name == "Plains" then
if nextSpace == "Fence Up"
or nextSpace == "Fence Left"
or nextSpace == "Fence Down"
or nextSpace == "Fence Right"
or nextSpace == "Item"
or nextSpace == "Post"
or nextSpace == "Temple 3"
or nextSpace == "Temple 6"
or nextSpace == "Temple 9" then
return
else
specialMove = false
end
elseif info[file].map.name == "Temple" then
local m = text[info[file].map.id][info[file].map.subid][info[file].posy]:sub(info[file].posx, info[file].posx)
if m == "C" or m == "F" or m == "H" or m == "J" or m == "K" or m == "M" or m == "P" or m == "Q" or m == "Z" then
templeWallLeft()
elseif nextSpace == "Ladder" then
if info[file].map.subname == "First Floor" then
redoMap("Temple", "Fane Temple", "Second Floor", 4, 6, 5, 5, 5, 5, "Left")
elseif info[file].map.subname == "Second Floor" then
redoMap("Temple", "Fane Temple", "First Floor", 4, 1, 5, 5, 5, 5, "Left")
end
elseif info[file].map.subname == "Second Floor" then
if collidedWithInteractiblesLeft("Lock") then
return
else
specialMove = false
end
elseif info[file].map.subname == "Boss Room" then
if collidedWithNPCLeft() then
return
elseif nextSpace == "Book"
or nextSpace == "Item"
or nextSpace == "Item 2" then
return
end
specialMove = false
else
specialMove = false
end
elseif info[file].map.name == "Volcano" then
if collidedWithInteractiblesLeft("Lock") then
return
elseif nextSpace == "Wall"
or nextSpace == "Wall 2"
or nextSpace == "Way Out Up"
or nextSpace == "Way Out Down"
or nextSpace == "Right"
or nextSpace == "Rock"
or nextSpace == "Lava" then
return
elseif thisSpace == "Crack" then
currentMap[info[file].posx][info[file].posy] = "Lava"
updateMap()
specialMove = false
else
specialMove = false
end
elseif info[file].map.name == "Desert" then
if collidedWithLaser() then
return
elseif collidedWithInteractiblesLeft("Statue") then
return
elseif thisSpace == "Right"
or thisSpace == "Slide"
or nextSpace == "Right"
or nextSpace == "Fence Corner"
or nextSpace == "Fence End"
or nextSpace == "Fence Right"
or nextSpace == "Fence Up"
or nextSpace == "Switch"
or nextSpace == "Water"
or nextSpace == "Post"
or nextSpace == "Dessert" then
return
else
changeLaserLeftRight()
updateMap()
specialMove = false
end
elseif info[file].map.name == "Metropolis" then
if info[file].map.subname == "Main Area" then
specialMove = false
elseif info[file].map.subname == "Sewers" then
if nextSpace == "Push Rock" then
return
else
specialMove = false
end
end
elseif info[file].map.name == "Snow" then
if info[file].prog.alp.dir == "" then
if nextSpace == "Rock"
or nextSpace == "Wall"
or nextSpace == "Way Out Up"
or nextSpace == "Way Out Down"
or nextSpace == "Hole" then
return
elseif nextSpace == "Ice" then
snowSlipLeft()
specialMove = false
elseif nextSpace == "Snowball" then
snowMoveBallLeft()
else
specialMove = false
end
elseif info[file].prog.alp.dir == "Left" then
snowUnslipLeft()
specialMove = false
end
elseif info[file].map.name == "Ruins" then
if info[file].prog.ruins.dir == "" then
if thisSpace == "Up"
or thisSpace == "Right"
or thisSpace == "Down"
or thisSpace == "Very Up"
or thisSpace == "Very Right"
or thisSpace == "Very Down" then
return
elseif thisSpace == "Very Left" then
ruinsSlipLeft()
specialMove = false
elseif nextSpace == "Right"
or nextSpace == "Rock"
or nextSpace == "Post"
or nextSpace == "Switch"
or nextSpace == "Track" then
return
elseif nextSpace == "Hole" then
redoMap("Ruins", "Relic Ruins", tostring(tonumber(info[file].map.subname:sub(1, 1)) - 1).."F, "..info[file].map.subname:sub(5, 9).." Sector", 9, info[file].map.subid - 2, info[file].posx - 1, info[file].posy, 5, 5, "Left")
elseif nextSpace == "Stair Up" then
redoMap("Ruins", "Relic Ruins", tostring(tonumber(info[file].map.subname:sub(1, 1)) + 1).."F, "..info[file].map.subname:sub(5, 9).." Sector", 9, info[file].map.subid + 2, info[file].posx - 1, info[file].posy, 5, 5, "Left")
elseif nextSpace == "Stair Down" then
redoMap("Ruins", "Relic Ruins", tostring(tonumber(info[file].map.subname:sub(1, 1)) - 1).."F, "..info[file].map.subname:sub(5, 9).." Sector", 9, info[file].map.subid - 2, info[file].posx - 1, info[file].posy, 5, 5, "Left")
else
specialMove = false
end
elseif info[file].prog.ruins.dir == "Left" then
ruinsUnslip()
specialMove = false
end
elseif info[file].map.name == "Void" then
if info[file].map.subname == "Cave Room" then
if nextSpace == "Spawn"
or nextSpace == "Stacked Rock"
or nextSpace == "Stair Down" then
return
else
specialMove = false
end
elseif info[file].map.subname == "Plains Room" then
local m = text[info[file].map.id][info[file].map.subid][info[file].posy + 9]:sub(info[file].posx, info[file].posx)
if m == "C" or m == "F" or m == "H" or m == "J" or m == "K" or m == "M" or m == "P" or m == "Q" or m == "Z" then
return
else
specialMove = false
end
elseif info[file].map.subname == "Volcano Room" then
if nextSpace == "Crack"
or nextSpace == "Lava" then
return
elseif thisSpace == "Cave"
or thisSpace == "Climb"
or thisSpace == "Ledge"
or thisSpace == "Stair"
or thisSpace == "Wall 2" then
currentMap[info[file].posx][info[file].posy] = "Lava"
updateMap()
specialMove = false
else
specialMove = false
end
elseif info[file].map.subname == "Alp Room" then
if info[file].prog.void.snowdir == "" then
if nextSpace == "Ledge" then
return
elseif nextSpace == "Bridge"
or nextSpace == "Cave"
or nextSpace == "Climb"
or nextSpace == "Wall"
or nextSpace == "Way Out Down" then
voidSnowSlipLeft()
specialMove = false
else
specialMove = false
end
elseif info[file].prog.void.snowdir == "Left" then
voidSnowUnslipLeft()
specialMove = false
end
elseif info[file].map.subname == "Ruins Room" then
if info[file].prog.void.ruinsdir == "" then
if thisSpace == "Left"
or thisSpace == "Down"
or thisSpace == "Up"
or thisSpace == "Very Left"
or thisSpace == "Very Down"
or thisSpace == "Very Up" then
return
elseif thisSpace == "Very Right" then
voidRuinsSlipLeft()
specialMove = false
else
specialMove = false
end
elseif info[file].prog.void.ruinsdir == "Left" then
voidRuinsUnslip()
specialMove = false
end
elseif info[file].map.subname == "Temple Room" then
if (not(thisSpace == "Book"
or thisSpace == "Item"
or thisSpace == "Item 2"
or thisSpace == "Ladder"
or thisSpace == "1"
or thisSpace == "3")-- in a warp zone
and not info[file].prog.void.templestep) -- and can't step forward
or nextSpace == "Post" then -- or next step is a wall
return
else
info[file].prog.void.templestep = false -- can't step forward in a warp zone
specialMove = false
end
elseif info[file].map.subname == "Void Room" then
if nextSpace == "Rock"
or nextSpace == "Right"
or nextSpace == "Lava"
or thisSpace == "Up"
or thisSpace == "Right"
or thisSpace == "Down"
or thisSpace == "Very Up"
or (thisSpace == "Warp A" and not info[file].prog.void.templestep)
or (thisSpace == "Warp B" and not info[file].prog.void.templestep)
or (thisSpace == "Warp C" and not info[file].prog.void.templestep) then
return
end
info[file].prog.void.templestep = false
if thisSpace == "Crack" then
currentMap[info[file].posx][info[file].posy] = "Lava"
addLava()
updateMap()
specialMove = false
end
if nextSpace == "Ice" then
voidFuncIceLeft()
elseif thisSpace == "Very Left" then
redoMap("Void", "Void", "Void Room", 10, 7, 1, 1, 5, 5, "Left")
else
specialMove = false
end
elseif info[file].map.subname == "Boss Room" then
if nextSpace == "Rock" then
return
else
specialMove = false
end
end
end
if not specialMove then
if info[file].posx - 5 > 0 and info[file].posx == info[file].centerx then
info[file].centerx = info[file].centerx - 1
updateMap()
replaceYou("Left") -- move NPC to front
else
you.x = you.x - 30
end
info[file].posx = info[file].posx - 1
end
elseif info[file].posx == 1 then
if info[file].map.name == "Cave" then
elseif info[file].map.name == "Town" then
elseif info[file].map.name == "Plains" then
if info[file].map.subname == "Steppe Path" then
redoMap("Town", "Municipality Town", "Town Square", 2, 1, 9, 5, 5, 5, "Left")
elseif info[file].map.subname == "Steppe Land" then
--redoMap("Metropolis", "Metropolitan City", "Main Area", 7, 1, 31, 20, 27, 18, "Left")
end
elseif info[file].map.name == "Temple" then
if info[file].map.subname == "First Floor" then
if info[file].prog.temple == 1 then
redoMap("Temple", "Fane Temple", "Room 2", 4, 3, 9, 5, 5, 5, "Left")
end
elseif info[file].map.subname == "Second Floor" then
redoMap("Temple", "Fane Temple", "Room 7", 4, 9, 9, 5, 5, 5, "Left")
elseif info[file].map.subname == "Room 3" then
redoMap("Temple", "Fane Temple", "First Floor", 4, 1, 9, 5, 5, 5, "Left")
elseif info[file].map.subname == "Room 8" and info[file].posy == 5 then
redoMap("Temple", "Fane Temple", "Second Floor", 4, 6, 9, 5, 5, 5, "Left")
end
elseif info[file].map.name == "Volcano" then
if info[file].map.subname == "Master Cave" then
redoMap("Volcano", "Mesa Volcano", "Exterior", 5, 1, 19, 8, 19, 8, "Down")
end
elseif info[file].map.name == "Desert" then
elseif info[file].map.name == "Metropolis" then
if info[file].map.subname == "Sewers" then
info[file].cave = makeCaveMap()
info[file].prog.cave.power = true -- can move rocks
redoMap("Cave", "Crypt Cave", "Spawn Path", 1, 1, 28, info[file].posy - 5, 24, 5, "Left")
end
elseif info[file].map.name == "Snow" then
if info[file].map.subname == "Master Cave" then
redoMap("Snow", "Mesa Alp", "Exterior", 5, 1, 19, 8, 19, 8, "Down")
end
elseif info[file].map.name == "Ruins" then
end
end
end
end