/
theHomingRingDX.lua
746 lines (707 loc) · 25.5 KB
/
theHomingRingDX.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
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
require 'adventure'
game = {
done = false,
stop = false,
filename = 'theHomingRing.save.txt',
defaultname = 'Tulkas',
introtext = '\nWelcome {name}, to the shortest adventure ever.\n\nWhen your mother passed away your father brought you to this sad little land.\n"For a better life", he said. But this backward place has exiled your father.\nYou were away on an errand and were not at home when it happened.\nWhat little knowledge you have of this awful event you received by reading\na very short note hurriedly scrawled.\n\n\t"Dearest {name},\n\t My homing ring is in dread cave.\n\tPutting it on you will come to me. Hurry...\n\n\t-- Your loving Dad"'
}
local goodclicks = {
'[You hear a crisp click that echoes throughout the cave.]\n\n',
'[You hear the sharp click of stone on stone.]\n\n',
'[A satisfying click is heard.]\n\n',
'[You hear a reassuring click off in the distance.]\n\n'
}
local badclicks = {
'[You hear a faint grating sound.]\n\n',
'[You hear a feeble rasping sound.]\n\n',
'[You hear a dull scraping sound.]\n\n',
'[You hear an awkward grinding sound.]\n\n'
}
local function atrium_south_intersection (event, state)
return function ()
gbl.description = 'It takes a moment for your eyes to adjust to the comparative darkness. You feel the coolness of the breeze upon your back.\n\nYou hear the sound of water to the East, the Southern opening is very dim, and to the North the largest opening whence comes the cool breeze.'
gbl.options = {
n = 'Go North; towards the natural atrium.',
e = 'Go East; following the sounds of water.',
w = 'Go West; back to the cleared cave-in.'
}
if not gbl.conditions.rockslide then
gbl.options['s'] = 'Go South; towards the darkest opening.'
end
deleteinventoryitem('the_empty_sconce')
return state
end
end
local function chamber_east_intersection (event, state)
return function ()
gbl.description = 'Finally able to stand you unfold yourself stretching out and looking around. This is a cavernous space with sparkling stalactites hanging from its roof. You can dimly see that you are at a sort of intersection; openings head off in all directions.\n\nYou hear the sound of water to the East, the Southern opening is very dim, and to the North the largest opening whence comes the cool breeze.'
gbl.options = {
n = 'Go North; towards the largest opening and the breeze.',
e = 'Go East; following the sounds of water.',
w = 'Go West; back to the cleared cave-in.'
}
gbl.conditions.enemies = true
if not gbl.conditions.rockslide then
gbl.options['s'] = 'Go South; towards the darkest opening.'
end
return state
end
end
local function chamber_west_crawlspace (event, state)
return function ()
gbl.description = 'Dusting yourself off you are back in the dark of the crawlspace. Your back hurts.'
gbl.options = {
w = 'Go West; back to the passage (where you can stand up).'
}
if gbl.conditions.cleared then
gbl.options['e'] = 'Go East; still not an easy path.'
elseif gbl.conditions.cavein then
gbl.options['e'] = 'Go East; to see the dead-end. (Why you would do that?)'
end
return state
end
end
local function crawlspace_east_chamber (event, state)
return function ()
gbl.options = {
w = 'Go West; backing out of the collapsed chamber.'
}
if gbl.conditions.cleared then
gbl.description = "It's an even tighter squeeze but with the cave-in cleared you shimmy by."
gbl.options['e'] = 'Go East; continue squeezing on through.'
elseif (gbl.conditions.cavein and not detectinventoryitem('the_pickax')) then
gbl.description = 'Looks just like it did a moment ago only caved-in.'
else
gbl.description = 'You crawl in to a tight chamber beyond the crawlspace. The ground begins to shake, a roaring fills your ears, dust obscures your vision. When the dust settles you see a cave-in that makes further progress impossible.'
gbl.conditions.cavein = true
end
if gbl.conditions.nsew > 1 and gbl.conditions.nsew < 6 then
gbl.conditions.nsew = 1
gbl.description = badclicks[math.random(#badclicks)] .. gbl.description
end
insertinventoryitem('the_rocks')
return state
end
end
local function crawlspace_west_passage (event, state)
return function ()
gbl.description = 'You are back in the entry passage. You feel much safer.'
gbl.options = {
n = 'Go North; continuing down the passage.',
e = 'Go East; entering the foreboding crawlspace.',
s = 'Go South; back to the entrance.',
}
if gbl.conditions.nsew == 5 then
gbl.conditions.nsew = 6
gbl.description = 'You hear the sound of gears meshing and turning ending in a resounding click.\n\nAn rock door swings open revealing an alcove.\n\n' .. gbl.description
elseif gbl.conditions.nsew > 0 and gbl.conditions.nsew < 6 then
gbl.conditions.nsew = gbl.conditions.nsew + 1
gbl.description = goodclicks[math.random(#goodclicks)] .. gbl.description
end
return state
end
end
local function entrance_north_passage (event, state)
return function ()
gbl.description = 'As you creep down the passage you feel the breeze coming from the East. There is a foreboding looking crawlspace from which the air is emanating.'
gbl.options = {
n = 'Go North; continuing down the passage.',
e = 'Go East; entering the foreboding crawlspace.',
s = 'Go South; back to the entrance.',
}
if gbl.conditions.nsew > 0 and gbl.conditions.nsew < 6 then
gbl.conditions.nsew = gbl.conditions.nsew + 1
gbl.description = goodclicks[math.random(#goodclicks)] .. gbl.description
end
return state
end
end
local function entrance_south_outside (event, state)
return function ()
gbl.description = 'You have left the cave; scared?'
gbl.options = {
n = 'Go North; return to the cave.'
}
return state
end
end
local function impasse_south_passage (event, state)
return function ()
gbl.description = 'You are back in the entry passage; and are not happy about going in the foreboding crawlspace.'
gbl.options = {
n = 'Go North; uselessly continuing down the dead-end passage.',
e = 'Go East; entering the foreboding crawlspace.',
s = 'Go South; back to the entrance.',
}
if gbl.conditions.nsew > 0 and gbl.conditions.nsew < 6 then
gbl.conditions.nsew = gbl.conditions.nsew + 1
gbl.description = goodclicks[math.random(#goodclicks)] .. gbl.description
end
return state
end
end
local function intersection_east_lake (event, state)
return function ()
gbl.description = 'A lazily lapping subterranean lake bars any further exploration in this direction.'
gbl.options = {
w = 'Go West; slipping and stumbling.'
}
if gbl.conditions.raft then gbl.options['n'] = 'Go North; on the raft.' end
if gbl.conditions.swim then
gbl.description = gbl.description .. '\n\nYou stand well away from the edge.'
if gbl.conditions.raft then gbl.description = gbl.description .. '\n\nBut there is that raft...' end
else
gbl.description = gbl.description .. "\n\nAs you walk closer to the edge of the water your foot slips. Suddenly you slide careening into the lake's slimy water. As it envelopes you panic starts to take hold. You start flailing thinking you will never come up for air again. You calm yourself and finally make it back to the edge. Clawing and scrabbling for a hold on the slippery bank you finally scramble up. Sopping wet but alive.\n\nAs you lie gasping you notice a raft."
gbl.conditions.swim = true
gbl.conditions.wet = true
end
return state
end
end
local function intersection_north_atrium (event, state)
return function ()
if gbl.conditions.atrium then
gbl.description = 'The cool breeze is a welcome change of pace. The empty sconce awaits in the center of the door.'
else
gbl.description = 'You have found the source of the cool breeze. The very center of the roof is open to the now evening sky. Dim light, bright as a noon day after the comparative darkness, streams in from above. You are immediately reminded of an atrium with stalactites and stalagmites meeting and forming the pillars of a natural colonnade going around the whole of the area.'
gbl.conditions.atrium = true
end
gbl.options = {
s = 'Go South; returning to the intersection.'
}
insertinventoryitem('the_empty_sconce')
return state
end
end
local function intersection_south_rockslide (event, state)
return function ()
gbl.description = "You go south scrambling over piles of rocks. It is obvious that there have been rock-slides in the past. You say to yourself that they were in the distant past; but you know better.\n\nSuddenly you hear a rumbling.\n\nCrash!\n\nROCKSLIDE!\n\nEven running you'll barely escape with your life."
gbl.options = {
n = 'Go North; RUN!'
}
gbl.conditions.rockslide = true
return state
end
end
local function intersection_west_chamber (event, state)
return function ()
gbl.description = 'You crawl in to a tight chamber beyond the crawlspace. you can see an intersection ahead.'
gbl.options = {
e = 'Go East; to the intersection.',
w = 'Go West; back to the crawlspace.'
}
return state
end
end
local function lake_north_river (event, state)
return function ()
gbl.description = 'You are riding on the raft in the center of a narrow, moving river.'
gbl.options = {
n = 'Go North; to the unknown and beyond!'
}
gbl.conditions.wet = false
return state
end
end
local function lake_west_intersection (event, state)
return function ()
gbl.description = 'Back in the intersection.'
gbl.options = {
n = 'Go North; towards the largest opening and the breeze.',
e = "Go East; following the sounds of water. (Fancy a swim?)",
w = 'Go West; back to the cleared cave-in.'
}
if gbl.conditions.wet then
gbl.description = gbl.description .. ' You are soaking wet and definitely regretting your fall in to the lake.'
gbl.conditions.wet = false
end
if not gbl.conditions.rockslide then
gbl.options['s'] = 'Go South; towards the darkest opening.'
end
return state
end
end
local function outside_north_entrance (event, state)
return function ()
gbl.description = 'You have bravely entered the cave. You are in the entry passage. A strange cool breeze is coming from the North.'
gbl.options = {
n = 'Go North; continuing down the passage.',
s = 'Go South; exiting the cave.',
}
return state
end
end
local function passage_east_crawlspace (event, state)
return function ()
if detectinventoryitem('the_lit_torch') then
gbl.description = 'Getting on your hands and knees you put the flaming torch in to your mouth and squeeze in to the crawlspace. Coughing from the oily flame you nearly singe off whatever facial hair you have.'
else
gbl.description = 'Getting on your hands and knees you squeeze in to the crawlspace. It is pitch black. As you crawl you cannot even see the backs of your hands on the ground in front of your face. You feel very unsafe.'
end
gbl.options = {
w = 'Go West; back to the passage.',
e = 'Go East; tight chamber.'
}
if gbl.conditions.nsew == 4 then
gbl.conditions.nsew = 5
gbl.description = goodclicks[math.random(#goodclicks)] .. gbl.description
elseif gbl.conditions.nsew < 4 and gbl.conditions.nsew > 0 then
gbl.conditions.nsew = 1
gbl.description = badclicks[math.random(#badclicks)] .. gbl.description
end
return state
end
end
local function passage_north_impasse (event, state)
return function ()
if (gbl.conditions.impasse or detectinventoryitem('the_pickax')) then
gbl.description = 'Still impassable...'
else
gbl.description = 'You have reached an impasse; solid rock. No amount of digging or climbing is going to buy passage.'
gbl.conditions.impasse = true
end
gbl.options = {
s = 'Go South; returning back to the passage.'
}
if gbl.conditions.nsew == 2 then
gbl.conditions.nsew = 3
gbl.description = goodclicks[math.random(#goodclicks)] .. gbl.description
end
return state
end
end
local function passage_south_entrance (event, state)
return function ()
gbl.description = 'You are back in the entry passage.'
gbl.options = {
n = 'Go North; back down the passage.',
s = 'Go South; exiting the cave.',
}
if (gbl.conditions.nsew > 0 and gbl.conditions.nsew < 6) then
gbl.conditions.nsew = 1
gbl.description = badclicks[math.random(#badclicks)] .. gbl.description
end
return state
end
end
local function rapids_north_waterfall (event, state)
return function ()
gbl.description = 'You plunge head over raft in to an abyss.\n\n\nTHE END'
game.done = true
return state
end
end
local function rapids_south_river (event, state)
return function ()
gbl.description = 'You paddle hard callousing both hands and winding yourself. With every muscle aching you manage to make landfall at the narrow edge. Exhausted you fall to the ground.'
gbl.options = {
s = 'Go South; ditching the raft to go back to the lake on foot.'
}
gbl.conditions.raft = false
return state
end
end
local function river_north_rapids (event, state)
return function ()
gbl.description = 'The water is getting dangerously fast. You are having second thoughts.'
gbl.options = {
s = 'Go South; returning to the slower flowing river.',
n = 'Go North; continue in to the unknown!'
}
return state
end
end
local function river_south_lake (event, state)
return function ()
gbl.description = "It's hard going but you slide and slip along the embankment back to the lake."
gbl.options = {
w = 'Go West; to the spacious and dry intersection.'
}
return state
end
end
local function rockslide_north_intersection (event, state)
return function ()
gbl.description = "Wow! You just made it by the skin of your teeth! The South passage is completely blocked. And no, the pickax is not going to help. In fact it is whimpering."
gbl.options = {
n = 'Go North; towards the largest opening and the cool air current.',
e = 'Go East; following the sounds of water.',
w = 'Go West; back to the cleared cave-in.'
}
return state
end
end
local function impasse_examine_impasse (event, state)
return function ()
if (gbl.conditions.impasse and gbl.conditions.cavein and not detectinventoryitem('the_pickax')) then
print(wrap('\n\nYou start to examine the area, but you sit down in despair. Will you ever find the one thing that can reunite you to your beloved father?\n\nPutting your head in your hands you lean forward and see something half covered in the dim floor of an alcove. Moving the dirt and debris you see a rusted discarded pickax on the floor.\n\n(Pickax taken.)\n\n'))
insertinventoryitem('the_pickax')
else
print('\nYour examination is fruitless.\n')
end
entertocontinue()
return state
end
end
local function passage_examine_passage (event, state)
return function ()
if gbl.conditions.nsew == 6 then
print(wrap('\n\nIn the alcove you see a flint and steel, tinder, and an oil imbued strip of cloth.\n\n(You take the components.)\n\n'))
insertinventoryitem({
'the_flint_and_steel',
'the_oil_imbued_cloth',
'the_tinder'
})
else
print('\nYour examination is fruitless.\n')
end
entertocontinue()
return state
end
end
local function atrium_examine_atrium (event, state)
return function ()
if not detectinventoryitem('the_unlit_torch') then
print(wrap('\n\nAt the center of the North wall is the outline of a door made of the rock face. There is no doorknob, no hinges, no obvious way to open the door. The only feature is an empty sconce in the center of the door.\n\nAn unlit torch lies upon the floor next to deeply scrawled letters, "NSEW".\n\n(You take the unlit torch.)\n\n'))
gbl.conditions.nsew = 1
insertinventoryitem('the_unlit_torch')
else
print(wrap('\n\nAt the center of the North wall is the outline of a door made of the rock face. There is no doorknob, no hinges, no obvious way to open the door. The only feature is an empty sconce in the center of the door.\n\nOn the floor are deeply scrawled letters, "NSEW".\n\n'))
end
entertocontinue()
return state
end
end
local function start_begin_outside (event, state)
return function ()
gbl.description = 'You stand at the south entrance of the dread cave.'
gbl.options = {
n = 'Go North; entering the cave.'
}
return state
end
end
locations = makeFSM({
{ 'atrium', 'examine', 'atrium', atrium_examine_atrium },
{ 'atrium', 'south', 'intersection', atrium_south_intersection },
{ 'chamber', 'east', 'intersection', chamber_east_intersection },
{ 'chamber', 'examine', 'chamber', fruitless_examination },
{ 'chamber', 'west', 'crawlspace', chamber_west_crawlspace },
{ 'crawlspace', 'east', 'chamber', crawlspace_east_chamber },
{ 'crawlspace', 'examine', 'crawlspace', fruitless_examination },
{ 'crawlspace', 'west', 'passage', crawlspace_west_passage },
{ 'entrance', 'examine', 'entrance', fruitless_examination },
{ 'entrance', 'north', 'passage', entrance_north_passage },
{ 'entrance', 'south', 'outside', entrance_south_outside },
{ 'impasse', 'examine', 'impasse', impasse_examine_impasse },
{ 'impasse', 'south', 'passage', impasse_south_passage },
{ 'intersection', 'east', 'lake', intersection_east_lake },
{ 'intersection', 'examine', 'intersection', fruitless_examination },
{ 'intersection', 'north', 'atrium', intersection_north_atrium },
{ 'intersection', 'south', 'rockslide', intersection_south_rockslide },
{ 'intersection', 'west', 'chamber', intersection_west_chamber },
{ 'lake', 'examine', 'lake', fruitless_examination },
{ 'lake', 'north', 'river', lake_north_river },
{ 'lake', 'west', 'intersection', lake_west_intersection },
{ 'outside', 'examine', 'outside', fruitless_examination },
{ 'outside', 'north', 'entrance', outside_north_entrance },
{ 'passage', 'east', 'crawlspace', passage_east_crawlspace },
{ 'passage', 'examine', 'passage', passage_examine_passage },
{ 'passage', 'north', 'impasse', passage_north_impasse },
{ 'passage', 'south', 'entrance', passage_south_entrance },
{ 'rapids', 'examine', 'rapids', fruitless_examination },
{ 'rapids', 'north', 'waterfall', rapids_north_waterfall },
{ 'rapids', 'south', 'river', rapids_south_river },
{ 'river', 'examine', 'river', fruitless_examination },
{ 'river', 'north', 'rapids', river_north_rapids },
{ 'river', 'south', 'lake', river_south_lake },
{ 'rockslide', 'examine', 'rockslide', fruitless_examination },
{ 'rockslide', 'north', 'intersection', rockslide_north_intersection },
{ 'start', 'begin', 'outside', start_begin_outside }
})
actions = {}
-- The start of creating an action: clearing the cave-in
local function clearcavein (effective)
local times = 1
return function (t)
return function ()
local r = stringifyaction(t)
if effective then
if times > 1 then
r = r .. '\n\nYou have cleared away the cave-in.'
gbl.conditions.cleared = true
gbl.description = "It's an even tighter squeeze but with the cave-in cleared you shimmy by."
gbl.options['e'] = 'Go East; continue squeezing on through.'
deleteinventoryitem('the_rocks')
else
r = r .. "\nIt's working. Some of the rocks are being cleared. It's going to take awhile, but with that pickax you could make it through."
end
times = times + 1
else
r = r .. ' Wow, is that all you got?\n\n(This is one of those rare times when more force is the answer.)'
end
return r
end
end
end
insertaction(
actions,
{
verbs = {
'drop',
'pull',
'push',
'put',
'throw',
'touch',
'use'
},
nouns = {
first = {
'the_rocks',
'the_pickax'
},
second = {
'the_rocks',
'the_pickax'
}
},
predicates = {
'at',
'in',
'on',
'to',
'with'
}
},
clearcavein(false)
)
insertaction(
actions,
{
verbs = {
'hit'
},
nouns = {
first = { 'the_rocks' },
second = { 'the_pickax' }
},
predicates = {
'with'
}
},
clearcavein(true)
)
insertaction(
actions,
{
verbs = {
'hit'
},
nouns = {
first = { 'the_pickax' },
second = { 'the_rocks' }
},
predicates = {
'at',
'on',
'to'
}
},
clearcavein(true)
)
-- The start of creating an action: lighting the unlit torch
local function lighttorch (step)
return function (t)
return function ()
local r = stringifyaction(t)
gbl.conditions[step] = true
if step == 'tinder_to_cloth' then
if not (gbl.conditions['flint_and_rock_over_tinder']
and gbl.conditions['cloth_on_torch'])
then
gbl.conditions.cloth_on_torch = false
gbl.conditions.flint_and_rock_over_tinder = false
gbl.conditions.tinder_to_cloth = false
r = failedaction(t)
end
elseif step == 'flint_and_rock_over_tinder' then
r = r .. '\n\n[The tinder is now smoldering.]'
deleteinventoryitem('the_tinder')
insertinventoryitem('the_smoldering_tinder')
elseif step == 'cloth_on_torch' then
r = r .. '\n\n[The unlit torch is now wrapped.]'
deleteinventoryitem({ 'the_oil_imbued_cloth', 'the_unlit_torch' })
insertinventoryitem('the_wrapped_torch')
end
local check = (
gbl.conditions.cloth_on_torch and
gbl.conditions.flint_and_rock_over_tinder and
gbl.conditions.tinder_to_cloth
)
if check then
r = r .. '\n\n[The torch is now lit. (Good job.)]'
deleteinventoryitem({ 'the_wrapped_torch', 'the_smoldering_tinder' })
insertinventoryitem({ 'the_lit_torch', 'the_tinder' })
end
return r
end
end
end
insertaction(
actions,
{
verbs = {
'put',
'use',
},
nouns = {
first = { 'the_oil_imbued_cloth' },
second = { 'the_unlit_torch' }
},
predicates = {
'on',
'over',
'with',
}
},
lighttorch('cloth_on_torch')
)
insertaction(
actions,
{
verbs = {
'hit'
},
nouns = {
first = { 'the_flint_and_steel' },
second = { 'the_tinder' }
},
predicates = {
'over'
}
},
lighttorch('flint_and_rock_over_tinder')
)
insertaction(
actions,
{
verbs = {
'drop',
'push',
'put',
'throw',
'touch',
'use',
},
nouns = {
first = { 'the_smoldering_tinder' },
second = { 'the_wrapped_torch' }
},
predicates = {
'on',
'over',
'to',
'with',
}
},
lighttorch('tinder_to_cloth')
)
-- The start of creating an action: putting the lit torch in the sconce
local function torchinsconce ()
return function (t)
return function ()
local r = ''
local s = '\n\n[The lit torch is now permanently affixed in the sconce.]\n\nYou place the lit torch in the empty sconce. The door noiselessly swings inward on hidden hinges revealing a courtyard ringed with rock. In the center is a glowing pedestal upon which resides the ring. Placing the ring upon your finger a blinding flame of light envelops you whisking you away to your waiting father.\n\n\nTHE END'
print('\n' .. wrap(s))
entertocontinue()
game.done = true
game.stop = true
return r
end
end
end
insertaction(
actions,
{
verbs = {
'drop',
'push',
'put',
'use',
},
nouns = {
first = { 'the_lit_torch' },
second = { 'the_empty_sconce' }
},
predicates = {
'in',
'on',
'to',
'with',
}
},
torchinsconce()
)
go({
name = nil,
roomswithenemies = {
'atrium',
'chamber',
'crawlspace',
'entrance',
'impasse',
'intersection',
'lake',
'passage',
'rockslide'
},
commands = {
n = 'north',
s = 'south',
e = 'east',
w = 'west',
i = 'inventory',
x = 'examine'
},
enemytypes = {
'mouse',
'squirrel',
'rat',
'badger'
},
inventory = {
},
conditions = {
impasse = false,
cavein = false,
cleared = false,
rockslide = false,
swim = false,
wet = false,
atrium = false,
nsew = 0,
raft = true,
cloth_on_torch = false,
flint_and_rock_over_tinder = false,
tinder_to_cloth = false
}
},
-- configuration for the fighting sub-engine
{
hero = {
hitmin = 3, -- where you start -- heroattack = math.random(cfg.hero.hitmin, cfg.hero.hitmax)
hitmax = 5, -- max bad-ass-ness -- heroattack = math.random(cfg.hero.hitmin, cfg.hero.hitmax)
tohit = 5 -- what the hero has to beat to hit the enemy -- heroattack > cfg.hero.tohit
},
enemy = {
hitmin = 2, -- enemyattack = math.random(cfg.enemy.hitmin, cfg.enemy.hitmax)
hitmax = 7, -- enemyattack = math.random(cfg.enemy.hitmin, cfg.enemy.hitmax)
mintohit = 4, -- the min of what an enemy has to beat to hit the hero (the enemy is savage)
maxtohit = 5, -- the max of what an enemy has to beat to hit the hero (the enemy is menacing)
minhp = 1, -- the min hit points for an enemy (this matches the enemytypes)
maxhp = 4, -- the max hit points for an enemy (this matches the enemytypes)
hitmod = 3 -- the diff between the maxtohit and the two types of enemies (menacing, savage)
}
})