bequestdecendres 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4733 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "bequestdecendres/version"
4
+
5
+ module BequestCalender
6
+ class Error < StandardError; end
7
+
8
+ class LunarSeason
9
+ ######################################################################################
10
+ # Lunar Calender #
11
+ ######################################################################################
12
+ # This establishes the basic mechanics of the Lunar Calender system that modifies #
13
+ # the player's base metrics on what the current lunar phase, with it being more #
14
+ # advised to switch to Bequest mechanics during the time they are weakest, then #
15
+ # using the Gribatomaton for when the lunar phase when Bear Men and Kumabatto poses #
16
+ # the least challenge to them. #
17
+ # #
18
+ # It remains to be seen whether this will continue to be relevant as I refine this #
19
+ # this Bequest RPG framework. #
20
+ ######################################################################################
21
+
22
+ def self.global_stats
23
+ # Standard Operations
24
+ $stalemates = 0 # Keeps track of how many stalemates
25
+ $player_struck = 0 # Keeps track of how many times player hit the enemy.
26
+ $enemy_struck = 0 # Keeps track of how many times enemy hit the player.
27
+
28
+ # Amount of days in a year.
29
+ $current_day = 0
30
+ $lunar_ticks = 30
31
+
32
+ ## Current Lunar Phase
33
+ $current_phase = 0
34
+
35
+ $player_level = 1
36
+ $enemy_level = 1
37
+
38
+ # Yes or no spider
39
+ $has_pet_spider = false
40
+ end
41
+
42
+ def self.enemy_name
43
+ # ~~~
44
+ # 10 => 20 => 30 New Moon
45
+ # 9 => 18 => 27 Waxing Crescent
46
+ # 7 => 14 => 21 First Quarter
47
+ # 6 => 12 => 18 Waxing Gibbous
48
+ # 4 => 8 => 12 Full Moon
49
+ # 6 => 12 => 18 Waning Gibbous
50
+ # 7 => 14 => 21 Last Quarter
51
+ # 8 => 16 => 24 Waning Crescent
52
+ # ~~
53
+
54
+ # Lunar Phases In French
55
+ nl = "nouvelle lune"; clc = "croissant A La cire";
56
+ pt = "premier trimestre"; cdg = "cire de Gibbous";
57
+ pl = "Pleine Lune"; eg = "evetement gibbous";
58
+ dt = "dernier trimestre"; af = "aurfeur";
59
+
60
+ # Fauna Names In Nihongo
61
+ attc = "Anos Tsuchi Tesutosujettos de les corrompue"
62
+ aduc = "Anos Denki Ursinehomme de le carbonise"
63
+ asur = "Ana Shi Ursinehomme de le recupere"
64
+ atun = "Ana Tsuchi Ursinehomme de la noyee"
65
+ aeun = "Anos Ea Ursinehomme de le noye"
66
+ adts = "Anos Denki Tesutosujettos de le souffle"
67
+ attn = "Ana Tsuchi Tesutosujettos de la noyee"
68
+ athn = "Anos Tenchi Homard Au Cochon de la noyee"
69
+ adtc = "Anos Denki Tesutosujettos de les corrompue"
70
+ adua = "Anos Danki Usinehomme de les abandonnes"
71
+ atuc = "Anos Tenchi Ursinehomme de les corrompue"
72
+ adha = "Anos Denki Homard Au Cochon de les abandonnes"
73
+
74
+ lunar_fauna = [
75
+ [[attc, attc], [attc, aduc], [attc, asur], [attc, atun], [attc, aeun], [attc, adts], [attc, attn], [attc, athn], [attc, adtc], [attc, adua], [attc, atuc], [attc, adha]],
76
+ [[aduc, attc], [aduc, aduc], [aduc, asur], [aduc, atun], [aduc, aeun], [aduc, adts], [aduc, attn], [aduc, athn], [aduc, adtc], [aduc, adua], [aduc, atuc], [aduc, adha]],
77
+ [[asur, attc], [asur, aduc], [asur, asur], [asur, atun], [asur, aeun], [asur, adts], [asur, attn], [asur, athn], [asur, adtc], [asur, adua], [asur, atuc], [asur, adha]],
78
+ [[atun, attc], [atun, aduc], [atun, asur], [atun, atun], [atun, aeun], [atun, adts], [atun, attn], [atun, athn], [atun, adtc], [atun, adua], [atun, atuc], [atun, adha]],
79
+ [[aeun, attc], [aeun, aduc], [aeun, asur], [aeun, atun], [aeun, aeun], [aeun, adts], [aeun, attn], [aeun, athn], [aeun, adtc], [aeun, adua], [aeun, atuc], [aeun, adha]],
80
+ [[adts, attc], [adts, aduc], [adts, asur], [adts, atun], [adts, aeun], [adts, adts], [adts, attn], [adts, athn], [adts, adtc], [adts, adua], [adts, atuc], [adts, adha]],
81
+ [[attn, attc], [attn, aduc], [attn, asur], [attn, atun], [attn, aeun], [attn, adts], [attn, attn], [attn, athn], [attn, adtc], [attn, adua], [attn, atuc], [attn, adha]],
82
+ [[athn, attc], [athn, aduc], [athn, asur], [athn, atun], [athn, aeun], [athn, adts], [athn, attn], [athn, athn], [athn, adtc], [athn, adua], [athn, atuc], [athn, adha]],
83
+ [[adtc, attc], [adtc, aduc], [adtc, asur], [adtc, atun], [adtc, aeun], [adtc, adts], [adtc, attn], [adtc, athn], [adtc, adtc], [adtc, adua], [adtc, atuc], [adtc, adha]],
84
+ [[adua, attc], [adua, aduc], [adua, asur], [adua, atun], [adua, aeun], [adua, adts], [adua, attn], [adua, athn], [adua, adtc], [adua, adua], [adua, atuc], [adua, adha]],
85
+ [[atuc, attc], [atuc, aduc], [atuc, asur], [atuc, atun], [atuc, aeun], [atuc, adts], [atuc, attn], [atuc, athn], [atuc, adtc], [atuc, adua], [atuc, atuc], [atuc, adha]],
86
+ [[adha, attc], [adha, aduc], [adha, asur], [adha, atun], [adha, aeun], [adha, adts], [adha, attn], [adha, athn], [adha, adtc], [adha, adua], [adha, atuc], [adha, adha]],
87
+ ]
88
+
89
+ # Fauna Type
90
+ row_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
91
+ col_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
92
+ arr_options = [0, 1]
93
+
94
+ cur_row = row_options.sample
95
+ cur_col = col_options.sample
96
+ cur_arr = arr_options.sample
97
+
98
+ $fauna_type = lunar_fauna[cur_row][cur_col][cur_arr]
99
+ end
100
+
101
+ def self.new_moon
102
+ $player_sanity = 10 * $player_level
103
+ $player_hp = 10 * $player_level
104
+ $player_atk = 2 * $player_level
105
+ $player_heal = 2 * $player_level
106
+
107
+ $enemy_sanity = 2 * $enemy_level
108
+ $enemy_hp = 2 * $enemy_level
109
+ $enemy_atk = 10 * $enemy_level # player gets 5 damage when factoring in healing rate.
110
+
111
+ $lunar_phase = "Le phase lunaire es Nouvelle Luna."
112
+ $enemy_name = "#{$lunar_phase} #{$fauna_type}"
113
+ end
114
+
115
+ def self.waxing_crescent
116
+ $player_sanity = 9 * $player_level
117
+ $player_atk = 2 * $player_level
118
+ $player_heal = 2 * $player_level
119
+
120
+ $enemy_sanity = 4 * $enemy_level
121
+ $enemy_hp = 4 * $enemy_level
122
+ $enemy_atk = 8 * $enemy_level # Player gets exactly 4 damage when factoring in healing rate as defence.
123
+
124
+ $lunar_phase = "Le phase lunaire es Croissant A La Cire."
125
+ $enemy_name = "#{$lunar_phase} #{$fauna_type}"
126
+ end
127
+
128
+ def self.first_quarter
129
+ $player_sanity = 7 * $player_level
130
+ $player_atk = 2 * $player_level
131
+ $player_heal = 2 * $player_level
132
+
133
+ $enemy_sanity = 6 * $enemy_level
134
+ $enemy_hp = 6 * $enemy_level
135
+ $enemy_atk = 6 * $enemy_level # player gets 3 damage when factoring in healing rate.
136
+
137
+ $lunar_phase = "Le phase lunaire es Premier Trimestre."
138
+ $enemy_name = "#{$lunar_phase} #{$fauna_type}"
139
+ end
140
+
141
+ def self.waxing_gibbous
142
+ $player_sanity = 6 * $player_level
143
+ $player_atk = 2 * $player_level
144
+ $player_heal = 2 * $player_level
145
+
146
+ $enemy_sanity = 8 * $enemy_level
147
+ $enemy_hp = 8 * $enemy_level
148
+ $enemy_atk = 4 * $enemy_level # Player gets exactly 2 Damage when factoring in healing as defence.
149
+
150
+ $lunar_phase = "Le phase lunaire es Cire De Gibbous."
151
+ $enemy_name = "#{$lunar_phase} #{$fauna_type}"
152
+ end
153
+
154
+ def self.full_moon
155
+ $player_sanity = 4 * $player_level
156
+ $player_atk = 2 * $player_level
157
+ $player_heal = 2 * $player_level
158
+
159
+ $enemy_sanity = 10 * $enemy_level
160
+ $enemy_hp = 10 * $enemy_level
161
+ $enemy_atk = 2 * $enemy_level # Player gets exactly 1 damage when factoring in healing rate as defence.
162
+
163
+ $lunar_phase = "Le phase lunaire es Pleine Lune."
164
+ $enemy_name = "#{$lunar_phase} #{$fauna_type}"
165
+ end
166
+
167
+ def self.waning_gibbous
168
+ $player_sanity = 6 * $player_level
169
+ $player_atk = 2 * $player_level
170
+ $player_heal = 2 * $player_level
171
+
172
+ $enemy_sanity = 8 * $enemy_level
173
+ $enemy_hp = 8 * $enemy_level
174
+ $enemy_atk = 4 * $enemy_level # Player gets exactly 2 damage when factoring in healing as defence.
175
+
176
+ $lunar_phase = "Le phase lunaire es Evetement Gibbous."
177
+ $enemy_name = "#{$lunar_phase} #{$fauna_type}"
178
+ end
179
+
180
+ def self.last_quarter
181
+ $player_sanity = 7 * $player_level
182
+ $player_atk = 2 * $player_level
183
+
184
+ $enemy_sanity = 4 * $enemy_level
185
+ $enemy_hp = 4 * $enemy_level
186
+ $enemy_atk = 6 * $enemy_level # Player gets exactly 3 damage when factoring in healing as defence.
187
+
188
+ $lunar_phase = "Le phase lunaire es Dernier trimestre."
189
+ $enemy_name = "#{$lunar_phase} #{$fauna_type}"
190
+ end
191
+
192
+ def self.waning_crescent
193
+ $player_sanity = 8 * $player_level
194
+ $player_atk = 2 * $player_level
195
+ $player_heal = 2 * $player_level # player gets exactly 4 damage when factoring in healing as defence.
196
+
197
+ $enemy_sanity = 2 * $enemy_level
198
+ $enemy_hp = 2 * $enemy_level
199
+ $enemy_atk = 8 * $enemy_level
200
+
201
+ $lunar_phase = "Le phase lunaire es Aurfeur."
202
+ $enemy_name = "#{$lunar_phase} #{$fauna_type}"
203
+ end
204
+
205
+ def self.lunar_cycle
206
+ lunar_phases = [0, 1, 2, 3, 4, 5, 6, 7]
207
+
208
+ # The current lunar phase mod 7
209
+ current_phase = $current_phase % 7
210
+ #$current_phase = $current_phase + 1 % 7
211
+
212
+ if current_phase == lunar_phases[0]
213
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: New Moon. Réinitialisation des statistiques du joueur...\e[0m"
214
+
215
+ sleep(1)
216
+
217
+ BequestCalender::LunarCalender.new_moon
218
+ elsif current_phase == lunar_phases[1]
219
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waxing Gibbous. Réinitialisation des statistiques du joueur...\e[0m"
220
+
221
+ sleep(1)
222
+
223
+ BequestCalender::LunarCalender.waxing_crescent
224
+ elsif current_phase == lunar_phases[2]
225
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: First Quarter. Réinitialisation des statistiques du joueur...\e[0m"
226
+
227
+ sleep(1)
228
+
229
+ BequestCalender::LunarCalender.first_quarter
230
+ elsif current_phase == lunar_phases[3]
231
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waxing Gibbous. Réinitialisation des statistiques du joueur...\e[0m"
232
+
233
+ sleep(1)
234
+
235
+ BequestCalender::LunarCalender.waxing_gibbous
236
+ elsif current_phase == lunar_phases[4]
237
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Full_moon. Réinitialisation des statistiques du joueur...\e[0m"
238
+
239
+ sleep(1)
240
+
241
+ BequestCalender::LunarCalender.full_moon
242
+ elsif current_phase == lunar_phases[5]
243
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waning Gibbous. Réinitialisation des statistiques du joueur...\e[0m"
244
+
245
+ sleep(1)
246
+
247
+ BequestCalender::LunarCalender.waning_gibbous
248
+ elsif current_phase == lunar_phases[6]
249
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Last Quarter. Réinitialisation des statistiques du joueur...\e[0m"
250
+
251
+ sleep(1)
252
+
253
+ BequestCalender::LunarCalender.last_quarter
254
+ elsif current_phase == lunar_phases[7]
255
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waning Crescent. Réinitialisation des statistiques du joueur...\e[0m"
256
+
257
+ sleep(1)
258
+
259
+ BequestCalender::LunarCalender.waning_crescent
260
+ end
261
+
262
+ sleep(1.5)
263
+ end
264
+
265
+ def self.player_gui
266
+ puts "Player Stats"
267
+ puts "Sanity: #{$player_sanity} HP: #{$player_hp} ATK: #{$player_atk} HEAL: #{$player_heal}"
268
+ puts " "
269
+ puts "#{$enemy_name}"
270
+ puts "Sanity: #{$enemy_sanity} HP: #{$enemy_hp} ATK: #{$enemy_atk}"
271
+ end
272
+ end
273
+ end
274
+
275
+ module BequestGame
276
+ class Player
277
+ ######################################################################################
278
+ # Changes From Yumemoire #
279
+ ######################################################################################
280
+ # This game framework establishes the base player stats, and tracks how many times #
281
+ # a player has lured, stunned, or trapped a monster whose name is procedurally #
282
+ # generated from random magical element based on the fantasy language that I am #
283
+ # developing. In the graphical edition that will be also include the traditional #
284
+ # color palette that diverges from traditional Japanese colors, with more of a focus #
285
+ # on colors you're likely to encounter on pirate ships. #
286
+ # #
287
+ # The elemental weakness chart keeps track of elemental names, the immunity label #
288
+ # and a ranged probability metric that tracks how immune or susceptible a monster #
289
+ # is to a specific element. The eventual aims is more nuanced range between immunity #
290
+ # and susceptibility to different magical elements you will run across. #
291
+ # #
292
+ # This text adventure operates on a text parser based system that splits parser #
293
+ # functionality into three sections: lure, stun, and trap. Eventually I will also #
294
+ # include parser mechanics for things like applying first aid. #
295
+ ######################################################################################
296
+
297
+ def self.initialize
298
+ $lures = 0 # How many times you've lured a monster.
299
+ $stuns = 0 # How many times you've stunned a monster.
300
+ $traps = 0 # How many times a monster was lured into a trap.
301
+ end
302
+
303
+ # The main text parser the presents enemy weakness statistics and battle mechanics.
304
+ def self.parser
305
+ ## Element Immunity Probability
306
+ elemental_weakness = [
307
+ [ "Ea", "Immune", 0.330 ],
308
+ [ "Ea", "Almost Immune", 0.405 ],
309
+ [ "Ea", "Less Susceptible", 0.480 ],
310
+ [ "Ea", "More Susceptible", 0.575 ],
311
+ [ "Ea", "Weak", 0.670 ],
312
+ ], [
313
+ [ "Denki", "Immune", 0.330 ],
314
+ [ "Denki", "Almost Immune", 0.405 ],
315
+ [ "Denki", "Less Susceptible", 0.480 ],
316
+ [ "Denki", "More Susceptible", 0.575 ],
317
+ [ "Denki", "Weak", 0.670 ],
318
+ ], [
319
+ [ "Kaiyo", "Immune", 0.330 ],
320
+ [ "Kaiyo", "Almost Immune", 0.405 ],
321
+ [ "Kaiyo", "Less Susceptible", 0.480 ],
322
+ [ "Kaiyo", "More Susceptible", 0.575 ],
323
+ [ "Kaiyo", "Weak", 0.670 ],
324
+ ], [
325
+ [ "Tsuchi", "Immune", 0.330 ],
326
+ [ "Tsuchi", "Almost Immune", 0.405 ],
327
+ [ "Tsuchi", "Less Susceptible", 0.480 ],
328
+ [ "Tsuchi", "More Susceptible", 0.575 ],
329
+ [ "Tsuchi", "Weak", 0.670 ],
330
+ ], [
331
+ [ "Tenchi", "Immune", 0.330 ],
332
+ [ "Tenchi", "Almost Immune", 0.405 ],
333
+ [ "Tenchi", "Less Susceptible", 0.480 ],
334
+ [ "Tenchi", "More Susceptible", 0.575 ],
335
+ [ "Tenchi", "Weak", 0.670 ],
336
+ ], [
337
+ [ "Shi", "Immune", 0.330 ],
338
+ [ "Shi", "Almost Immune", 0.405 ],
339
+ [ "Shi", "Less Susceptible", 0.480 ],
340
+ [ "Shi", "More Susceptible", 0.575 ],
341
+ [ "Shi", "Weak", 0.670 ],
342
+ ]
343
+
344
+ monster_name_elements = $current_monster_name.split(" ")
345
+
346
+ loop do
347
+ #Bequest::LunarCalender.lunar_cycle
348
+
349
+ #if $player_hp < 1
350
+ #sleep(1.5)
351
+
352
+ #puts "You became to exhausted to continue."
353
+ #abort
354
+ #end
355
+
356
+ airborn = elemental_weakness[0] # Air
357
+ electric = elemental_weakness[1] # Fire / Electricity
358
+ heavenly = elemental_weakness[3] # Heaven
359
+ earthen = elemental_weakness[4] # Earth
360
+ recovery = elemental_weakness[2] # Recovery
361
+ corruption = elemental_weakness[5] # Corruption
362
+
363
+ #Bequest::Enemy.familiarity
364
+
365
+ # Get monster element name, immunity factor, immunity probability, and elemental weakness its strength in number.
366
+ if monster_name_elements[1] == "Ea"; puts "\n#{airborn[0][0]}: #{airborn[0][1]} #{airborn[0][2]} #{earthen[0][0]}: #{earthen[4][1]} #{earthen[4][2]}"
367
+ elsif monster_name_elements[1] == "Denki"; puts "\n#{electric[0][0]}: #{electric[0][1]} #{electric[0][2]} #{airborn[0][0]}: #{airborn[4][1]} #{airborn[4][2]}"
368
+ elsif monster_name_elements[1] == "Kaiyo"; puts "\n#{recovery[0][0]}: #{recovery[0][1]} #{covery[0][2]} #{corruption[0][0]}: #{corruption[4][1]} #{corruption[4][2]}"
369
+ elsif monster_name_elements[1] == "Tsuchi"; puts "\n#{heavenly[0][0]}: #{heavenly[0][1]} #{heavenly[0][2]} #{airborn[0][0]}: #{airborn[4][1]} #{airborn[4][2]}"
370
+ elsif monster_name_elements[1] == "Tenchi"; puts "\n#{earthen[0][0]}: #{earthen[0][1]} #{earthen[0][2]} #{electric[0][0]}: #{electric[4][1]} #{electric[4][2]}"
371
+ elsif monster_name_elements[1] == "Shi"; puts "\n#{corruption[0][0]}: #{corruption[0][1]} #{corruption[0][2]} #{heavenly[0][0]}: #{heavenly[4][1]} #{heavenly[4][2]}"
372
+ else
373
+ puts "Unrecognized entity."
374
+ end
375
+
376
+ parsers = {
377
+ "Ereil" => "#{$current_monster_name}",
378
+ "#{$current_monster_name}" => "es ereil a toi.",
379
+ }, {
380
+ "Eblouir" => "#{$current_monster_name}",
381
+ "#{$current_monster_name}" => "es eblouir par toi.",
382
+ }, {
383
+ "Plege" => "#{$current_monster_name}",
384
+ "#{$current_monster_name}" => "es plege par toi.",
385
+ }
386
+
387
+ puts "\n[ Ereil #{$lures} ][ Eblouir #{$stuns} ][ Plege #{$traps} ]"
388
+
389
+ print "Regarder par: #{$current_monster_name}, bokette? << "
390
+
391
+ @action = gets.chomp
392
+
393
+ if @action == "Ereil"
394
+ print parsers[0]["Ereil"]
395
+ print " "
396
+ print parsers[0][$current_monster_name]
397
+
398
+ $lures = $lures + 1
399
+
400
+ print $current_monster_name
401
+ print " "
402
+ BequestGame::Enemy.lure_enemy
403
+ elsif @action == "Eblouir"
404
+ print parsers[1]["Eblouir"]
405
+ print " "
406
+ print parsers[1][$current_monster_name]
407
+
408
+ $stuns = $stuns + 1
409
+
410
+ print $current_monster_name
411
+ print " "
412
+ BequestGame::Enemy.stun_enemy
413
+ elsif @action == "Plege"
414
+ print parsers[2]["Plege"]
415
+ print " "
416
+ print parsers[2][$current_monster_name]
417
+
418
+ $traps = $traps + 1
419
+
420
+ print $current_monster_name
421
+ print " "
422
+ BequestGame::Enemy.trap_enemy
423
+ else
424
+ puts ">> Your action is not recognized."
425
+ end
426
+ end
427
+
428
+ # def self.quip_contrastive
429
+ # BequestGame::Language.contrastive
430
+ # end
431
+ #
432
+ # def self.quip_standard
433
+ # Bequest::Language.standard
434
+ # end
435
+
436
+ # def self.quip
437
+ # # standard contrastive
438
+ # # standard s,s s,c
439
+ # # contrastive c,s c,c
440
+ #
441
+ # formats = [
442
+ # [["standard", "standard"], ["standard", "contrastive"]],
443
+ # [["contrastive", "standard"], ["contrastive", "contrastive"]],
444
+ # ]
445
+ #
446
+ # row_options = [0, 1]
447
+ # col_options = [0, 1]
448
+ # arr_options = [0, 1]
449
+ #
450
+ # cur_row = row_options.sample
451
+ # cur_col = col_options.sample
452
+ # cur_arr = arr_options.sample
453
+ #
454
+ # current_format = formats[cur_row][cur_col][cur_arr]
455
+ #
456
+ # if current_format == "standard"; Bequest::Language.contrastive
457
+ # elsif current_format == "contrastive"; Bequest::Language.standard
458
+ # else
459
+ # Bequest::Language.standard
460
+ # end
461
+ # end
462
+ end
463
+ end
464
+
465
+ class Enemy
466
+ def self.monster_name
467
+ #def self.five_elements
468
+ possible_elements = File.readlines("lib/beastiary/monsternames/elements.txt")
469
+
470
+ $chosen_element = possible_elements.sample.strip.to_s
471
+ #end
472
+
473
+ #def self.adjectives
474
+ possible_adjectives = File.readlines("lib/beastiary/monsternames/gendered_adverb.txt")
475
+
476
+ $chosen_adjective = possible_adjectives.sample.strip.to_s
477
+ #end
478
+
479
+ #Bequest::Enemy.monster_name.five_elements
480
+ #Bequest::Enemy.monster_name.adjectives
481
+
482
+ $current_monster_name = "#{$chosen_element} #{$chosen_adjective}"
483
+
484
+ File.open("lib/previous/enemy.txt", "w") { |f|
485
+ f.puts $current_monster_name
486
+ }
487
+ end
488
+
489
+ # If the previous enemy encountered matches one you've dueled before, it quips about not continuing to run into them.
490
+ def self.familiarity
491
+ previous_enemy = File.read("lib/previous/enemy.txt")
492
+
493
+ name_list = File.readlines("lib/rendered/enemies.txt")
494
+ size_limit = name_list.size.to_i
495
+ index = 0
496
+
497
+ size_limit.times do
498
+ current_enemy = name_list[index]
499
+
500
+ if current_enemy == previous_enemy
501
+ puts "<< We have to stop running into each other."
502
+ else
503
+ puts "<< I don't believe we've met."
504
+ end
505
+
506
+ index = index + 1
507
+
508
+ sleep(0.5)
509
+ end
510
+ end
511
+
512
+ def self.lure_enemy
513
+ # true false
514
+ # true t,t t,f
515
+ # false f,t f,f
516
+
517
+ active_state = [
518
+ [[true, true], [true, false]],
519
+ [[false, true], [false, false]],
520
+ ]
521
+
522
+ row_options = [0, 1]
523
+ col_options = [0, 1]
524
+ arr_options = [0, 1]
525
+
526
+ cur_row = row_options.sample
527
+ cur_col = col_options.sample
528
+ cur_arr = arr_options.sample
529
+
530
+ lure_status = active_state[cur_row][cur_col][cur_arr]
531
+
532
+ if false == lure_status
533
+ puts "did not manage to spot you."
534
+ elsif true == lure_status
535
+ puts "managed to spot you."
536
+
537
+ enemy_hit = ["hit", "miss"]
538
+
539
+ current_strike = enemy_hit.sample
540
+
541
+ if current_strike == "hit"
542
+ puts ">> You were struck by the aggressor."
543
+ $player_hp = $player_hp - 2
544
+ elsif current_strike == "miss"
545
+ puts ">> You managed to avoid being struck."
546
+ end
547
+ end
548
+ end
549
+
550
+ def self.stun_enemy
551
+ # true false
552
+ # true t,t t,f
553
+ # false f,t f,f
554
+
555
+ active_state = [
556
+ [[true, true], [true, false]],
557
+ [[false, true], [false, false]],
558
+ ]
559
+
560
+ row_options = [0, 1]
561
+ col_options = [0, 1]
562
+ arr_options = [0, 1]
563
+
564
+ cur_row = row_options.sample
565
+ cur_col = col_options.sample
566
+ cur_arr = arr_options.sample
567
+
568
+ stun_status = active_state[cur_row][cur_col][cur_arr]
569
+
570
+ if false == stun_status
571
+ puts "was not paralyzed by your strike."
572
+ elsif true == stun_status
573
+ puts "managed to be stunned by your strike."
574
+ end
575
+ end
576
+
577
+ def self.trap_enemy
578
+ # true false
579
+ # true t,t t,f
580
+ # false f,t f,f
581
+
582
+ active_state = [
583
+ [[true, true], [true, false]],
584
+ [[false, true], [false, false]],
585
+ ]
586
+
587
+ row_options = [0, 1]
588
+ col_options = [0, 1]
589
+ arr_options = [0, 1]
590
+
591
+ cur_row = row_options.sample
592
+ cur_col = col_options.sample
593
+ cur_arr = arr_options.sample
594
+
595
+ trap_status = active_state[cur_row][cur_col][cur_arr]
596
+
597
+ if false == trap_status
598
+ puts "was not tricked into a trap."
599
+ elsif true == trap_status
600
+ puts "managed to be trapped while you lured it in your direction."
601
+
602
+ sleep(1.5)
603
+
604
+ puts "YON WIN"
605
+
606
+ gets.chomp
607
+ abort
608
+ end
609
+ end
610
+ end
611
+
612
+ class MoveHistory
613
+ # Similar approaches to variable additions.
614
+ # Except instead of move_x or move_y: it adds move x or y history to history of move_x or move_y
615
+ def self.move_left_x
616
+ $x = $x - 1
617
+ end
618
+
619
+ def self.move_right_x
620
+ $x = $x + 1
621
+ end
622
+
623
+ def self.move_down_y
624
+ $y = $y + 1
625
+ end
626
+
627
+ def self.move_up_y
628
+ $y = $y - 1
629
+ end
630
+
631
+ # Records and recalls previous moves in x coordinates.
632
+ $previous_x = "You had moved #{$x} in the x coordinate."
633
+ $previous_y = "You had moved #{$y} in the y coordinate."
634
+
635
+ def self.move_x_record
636
+ move_x = $previous_x
637
+
638
+ File.open("_history/move_x/move_history.txt", "a") { |f|
639
+ f.puts move_x
640
+ }
641
+ end
642
+
643
+ def self.move_x_recall
644
+ previous_moves = File.readlines("_history/move_x/move_history.txt")
645
+ search_limit = previous_move.size.to_i
646
+
647
+ index = 0
648
+
649
+ search_limit.times do
650
+ puts "PREVIOUS MOVE X"
651
+ puts previous_move[index]
652
+
653
+ index = index + 1
654
+ end
655
+ end
656
+
657
+ # Records and recalls previous moves in y coordinates.
658
+ def self.move_y_record
659
+ move_y = $previous_y
660
+
661
+ File.open("_history/move_y/move_history.txt", "a") { |f|
662
+ f.puts move_y
663
+ }
664
+ end
665
+
666
+ def self.move_y_recall
667
+ previous_moves = File.readlines("_history/move_y/move_history.txt")
668
+ search_limit = previous_move.size.to_i
669
+
670
+ index = 0
671
+
672
+ search_limit.times do
673
+ puts "PREVIOUS MOVE Y"
674
+ puts previous_move[index]
675
+
676
+ index = index + 1
677
+ end
678
+ end
679
+ end
680
+ end
681
+
682
+ module BequestColorMixer
683
+ class Error < StandardError; end
684
+
685
+ class ColorSynthesis
686
+ def self.create_palette
687
+ color_set = File.readlines("Colors/mycolors.txt")
688
+
689
+ first_color = color_set.sample.strip
690
+ second_color = color_set.sample.strip
691
+ third_color = color_set.sample.strip
692
+ fourth_color = color_set.sample.strip
693
+
694
+ puts "Inputting colors into mixer vectors..."
695
+
696
+ puts first_color
697
+
698
+ open("_input/first_color.txt", "w") { |f|
699
+ f.puts first_color
700
+ }
701
+
702
+ puts second_color
703
+
704
+ open("_input/second_color.txt", "w") { |f|
705
+ f.puts second_color
706
+ }
707
+
708
+ puts third_color
709
+
710
+ open("_input/third_color.txt", "w") { |f|
711
+ f.puts third_color
712
+ }
713
+
714
+ puts fourth_color
715
+
716
+ open("_input/fourth_color.txt", "w") { |f|
717
+ f.puts fourth_color
718
+ }
719
+
720
+ sleep(1.5)
721
+ end
722
+
723
+ def self.first_mixer
724
+ require "digest"
725
+
726
+ first_hex = File.read("_input/first_color.txt").strip.to_s
727
+ second_hex = File.read("_input/second_color.txt").strip.to_s
728
+ md5 = Digest::MD5.new
729
+
730
+ combined_hexes = first_hex + second_hex
731
+
732
+ new_mixture = md5.update combined_hexes
733
+
734
+ @f_first_hex = "#" + new_mixture[0] + new_mixture[1] + new_mixture[2] + new_mixture[3] + new_mixture[4] + new_mixture[5]
735
+ @f_second_hex = "#" + new_mixture[6] + new_mixture[7] + new_mixture[8] + new_mixture[9] + new_mixture[10] + new_mixture[11]
736
+ @f_third_hex = "#" + new_mixture[12] + new_mixture[13] + new_mixture[14] + new_mixture[15] + new_mixture[16] + new_mixture[17]
737
+ @f_fourth_hex = "#" + new_mixture[18] + new_mixture[19] + new_mixture[20] + new_mixture[21] + new_mixture[22] + new_mixture[23]
738
+ @f_fifth_hex = "#" + new_mixture[24] + new_mixture[25] + new_mixture[26] + new_mixture[27] + new_mixture[28] + new_mixture[29]
739
+
740
+ File.open("_results/first_mix.txt", "w") { |f|
741
+ f.puts @f_first_hex
742
+ f.puts @f_second_hex
743
+ f.puts @f_third_hex
744
+ f.puts @f_fourth_hex
745
+ f.puts @f_fifth_hex
746
+ }
747
+
748
+ puts "##{@f_first_hex} ##{@f_second_hex} ##{@f_third_hex} ##{@f_fourth_hex} ##{@f_fifth_hex}"
749
+ end
750
+
751
+ def self.second_mixer
752
+ require "digest"
753
+
754
+ md5 = Digest::MD5.new
755
+
756
+ @second_mixture = @s_first_hex + @s_second_hex + @s_third_hex + @s_fourth_hex + @s_fifth_hex
757
+
758
+ new_mixture = md5.update new_mixture
759
+
760
+ @s_first_hex = "#" + new_mixture[0] + new_mixture[1] + new_mixture[2] + new_mixture[3] + new_mixture[4] + new_mixture[5]
761
+ @s_second_hex = "#" + new_mixture[6] + new_mixture[7] + new_mixture[8] + new_mixture[9] + new_mixture[10] + new_mixture[11]
762
+ @s_third_hex = "#" + new_mixture[12] + new_mixture[13] + new_mixture[14] + new_mixture[15] + new_mixture[16] + new_mixture[17]
763
+ @s_fourth_hex = "#" + new_mixture[18] + new_mixture[19] + new_mixture[20] + new_mixture[21] + new_mixture[22] + new_mixture[23]
764
+ @s_fifth_hex = "#" + new_mixture[24] + new_mixture[25] + new_mixture[26] + new_mixture[27] + new_mixture[28] + new_mixture[29]
765
+
766
+ File.open("_results/second_mix.txt", "w") { |f|
767
+ f.puts @s_first_hex
768
+ f.puts @s_second_hex
769
+ f.puts @s_third_hex
770
+ f.puts @s_fourth_hex
771
+ f.puts @s_fifth_hex
772
+ }
773
+
774
+ puts "##{@s_first_hex} ##{@s_second_hex} ##{@s_third_hex} ##{@s_fourth_hex} ##{@s_fifth_hex}"
775
+ end
776
+
777
+ def self.final_mixer
778
+ require "digest"
779
+
780
+ md5 = Digest::MD5.new
781
+
782
+ @final_mixture = @s_first_hex + @s_second_hex + @s_third_hex + @s_fourth_hex + @s_fifth_hex
783
+
784
+ new_mixture = md5.update new_mixture
785
+
786
+ @t_first_hex = "#" + new_mixture[0] + new_mixture[1] + new_mixture[2] + new_mixture[3] + new_mixture[4] + new_mixture[5]
787
+ @t_second_hex = "#" + new_mixture[6] + new_mixture[7] + new_mixture[8] + new_mixture[9] + new_mixture[10] + new_mixture[11]
788
+ @t_third_hex = "#" + new_mixture[12] + new_mixture[13] + new_mixture[14] + new_mixture[15] + new_mixture[16] + new_mixture[17]
789
+ @t_fourth_hex = "#" + new_mixture[18] + new_mixture[19] + new_mixture[20] + new_mixture[21] + new_mixture[22] + new_mixture[23]
790
+ @t_fifth_hex = "#" + new_mixture[24] + new_mixture[25] + new_mixture[26] + new_mixture[27] + new_mixture[28] + new_mixture[29]
791
+
792
+ File.open("_results/third_mix.txt", "w") { |f|
793
+ f.puts @t_first_hex
794
+ f.puts @t_second_hex
795
+ f.puts @t_third_hex
796
+ f.puts @t_fourth_hex
797
+ f.puts @t_fifth_hex
798
+ }
799
+
800
+ puts "##{@t_first_hex} ##{@t_second_hex} ##{@t_third_hex} ##{@t_fourth_hex} ##{@t_fifth_hex}"
801
+ end
802
+
803
+ def self.first_result_confidence
804
+ first_result = File.readlines("_results/first_mix.txt")
805
+ first_result_counter = first_result / 1
806
+ first_size_limit = first_result.size.to_i
807
+ first_index = 0
808
+
809
+ second_result = File.readlines("_results/second_mix.txt")
810
+ second_result_counter = second_result / 1
811
+ second_size_limit = first_result.size.to_i
812
+ second_index = 0
813
+
814
+ third_result = File.readlines("_results/third_mix.txt")
815
+ third_result_counter = third_result / 1
816
+ third_size_limit = first_result.size.to_i
817
+ third_index = 0
818
+
819
+ puts "\nFirst Color Mix Stack"
820
+ first_result_size_limit.times do
821
+ puts "#{first_result[first_index]} #{first_result_counter}"
822
+
823
+ first_index = first_index + 1
824
+ end
825
+
826
+ puts "\nSecond Color Mix Stack"
827
+ second_result_size_limit.times do
828
+ puts "#{second_result[second_index]} #{second_result_counter}"
829
+
830
+ second_index = second_index + 1
831
+ end
832
+
833
+ puts "\nThird Color Mix Stack"
834
+ third_result_size_limit.times do
835
+ puts "#{third_result[third_index]} #{third_result_counter}"
836
+
837
+ first_index = first_index + 1
838
+ end
839
+
840
+ case first_result_count
841
+ when 0.001..0.033; puts "The confidence for this color is low."
842
+ when 0.034..0.050; puts "The confidence for this color is mild."
843
+ when 0.051..0.075; puts "The confidence for this color is medium."
844
+ when 0.076..1.000; puts "The confidence for this color is high."
845
+ else
846
+ puts "The strength of first result is off the charts."
847
+ end
848
+
849
+ case second_result_count
850
+ when 0.001..0.033; puts "The confidence for this color is low."
851
+ when 0.034..0.050; puts "The confidence for this color is mild."
852
+ when 0.051..0.075; puts "The confidence for this color is medium."
853
+ when 0.076..1.000; puts "The confidence for this color is high."
854
+ else
855
+ puts "The strength of second result is off the charts."
856
+ end
857
+
858
+ case third_result_count
859
+ when 0.001..0.033; puts "The confidence for this color is low."
860
+ when 0.034..0.050; puts "The confidence for this color is mild."
861
+ when 0.051..0.075; puts "The confidence for this color is medium."
862
+ when 0.076..1.000; puts "The confidence for this color is high."
863
+ else
864
+ puts "The strength of third result is off the charts."
865
+ end
866
+ end
867
+ end
868
+ end
869
+
870
+ module BequestDialogue
871
+ class EachWord
872
+ def self.standard_francophonic
873
+ word_classes = [
874
+ [
875
+ [["Le", "Le"], ["Le", "La"], ["Le", "Les"]],
876
+ [["La", "Le"], ["La", "La"], ["La", "Les"]],
877
+ [["Les", "Le"], ["Les", "La"], ["Les", "Les"]],
878
+ ], [
879
+ [["Anu", "Anu"], ["Anu", "Ana"], ["Anu", "Anos"]],
880
+ [["Ana", "Anu"], ["Ana", "Ana"], ["Ana", "Anos"]],
881
+ [["Anos", "Anu"], ["Anos", "Ana"], ["Anos", "Anus"]],
882
+ ], [
883
+ [["Lanu", "Lanu"], ["Lanu", "Lana"], ["Lanu", "Lanos"]],
884
+ [["Lana", "Lanu"], ["Lana", "Lana"], ["Lana", "Lanos"]],
885
+ [["Lanos", "Lanu"], ["Lanos", "Lana"], ["Lanos", "Lanos"]],
886
+ ],
887
+ ]
888
+
889
+ context_window = [0, 1, 2]
890
+ row_options = [0, 1, 2]
891
+ col_options = [0, 1, 2]
892
+ arr_options = [0, 1]
893
+
894
+ cur_con = context_window.sample
895
+ cur_row = row_options.sample
896
+ cur_col = col_options.sample
897
+ cur_arr = arr_options.sample
898
+
899
+ @current_word_class = word_classes[cur_con][cur_row][cur_col][cur_arr]
900
+ #print current_word_class; print " "
901
+
902
+ ho = "homme"
903
+ fe = "femme"
904
+ fi = "fille"
905
+ ga = "garcon"
906
+ ta = "tante"
907
+ oj = "oncle"
908
+ cofi = "cousinfille"
909
+ coga = "cousingarcon"
910
+ grm = "grandmere"
911
+ grp = "grandpere"
912
+
913
+ ct = "chat"
914
+ ch = "chien"
915
+ oi = "oiseau"
916
+ gr = "souris"
917
+ ou = "ours"
918
+ wo = "orgueil"
919
+ pr = "ostritch"
920
+ po = "jiraff"
921
+ pi = "écureuil"
922
+
923
+ m = "maison"
924
+ c = "cabin"
925
+ e = "ecole"
926
+
927
+ oju = "ojijaku"
928
+ neo = "ne ojijaku"
929
+
930
+ # [context window][row][col][arr]
931
+
932
+ nouns = [
933
+ [[ho, ho], [ho, fe], [ho, fi], [ho, ga], [ho, ta], [ho, oj], [ho, cofi], [ho, coga], [ho, grm], [ho, grp]],
934
+ [[fe, ho], [fe, fe], [fe, fi], [fe, ga], [fe, ta], [fe, oj], [fe, cofi], [fe, coga], [fe, grm], [fe, grp]],
935
+ [[fi, ho], [fi, fe], [fi, fi], [fi, ga], [fi, ta], [fi, oj], [fi, cofi], [fi, coga], [fi, grm], [fi, grp]],
936
+ [[ga, ho], [ga, fe], [ga, fi], [ga, ga], [ga, ta], [ga, oj], [ga, cofi], [ga, coga], [ga, grm], [ga, grp]],
937
+ [[ta, ho], [ta, fe], [ta, fi], [ta, ga], [ta, ta], [ta, oj], [ta, cofi], [ta, coga], [ta, grm], [ta, grp]],
938
+ [[oj, ho], [oj, fe], [oj, fi], [oj, ga], [oj, ta], [oj, oj], [oj, cofi], [oj, coga], [oj, grm], [oj, grp]],
939
+ [[cofi, ho], [cofi, fe], [cofi, fi], [cofi, ga], [cofi, ta], [cofi, oj], [cofi, cofi], [cofi, coga], [cofi, grm], [cofi, grp]],
940
+ [[coga, ho], [coga, fe], [coga, fi], [coga, ga], [coga, ta], [coga, oj], [coga, cofi], [coga, coga], [coga, grm], [coga, grp]],
941
+ [[grm, ho], [grm, fe], [grm, fi], [grm, ga], [grm, ta], [grm, oj], [grm, cofi], [grm, coga], [grm, grm], [grm, grp]],
942
+ [[grp, ho], [grp, fe], [grp, fi], [grp, ga], [grp, ta], [grp, oj], [grp, cofi], [grp, coga], [grp, grm], [grp, grp]],
943
+ ], [
944
+ [[ct, ct], [ct, ch], [ct, oi], [ct, gr], [ct, wo], [ct, ou], [ct, pr], [ct, po]],
945
+ [[ch, ct], [ch, ch], [ch, oi], [ch, gr], [ch, wo], [ch, ou], [ch, pr], [ch, po]],
946
+ [[oi, ct], [oi, ch], [oi, oi], [pi, gr], [oi, wo], [oi, ou], [oi, pr], [oi, po]],
947
+ [[gr, ct], [gr, ch], [gr, oi], [gr, gr], [gr, wo], [gr, ou], [gr, pr], [gr, po]],
948
+ ], [
949
+ [[m, m], [m, c], [m, e]],
950
+ [[c, m], [c, c], [c, e]],
951
+ [[e, m], [e, c], [e, e]],
952
+ ], [
953
+ [[oju, oju], [oju, neo]],
954
+ [[neo, oju], [neo, neo]],
955
+ ]
956
+
957
+ context_window = [0, 1, 2, 3]
958
+ cur_con = context_window.sample
959
+
960
+ if cur_con == 0
961
+ row_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
962
+ col_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
963
+ arr_options = [0, 1]
964
+
965
+ #cur_con = context_window.sample
966
+ cur_row = row_options.sample
967
+ cur_col = col_options.sample
968
+ cur_arr = arr_options.sample
969
+
970
+ @current_noun = nouns[cur_con][cur_row][cur_col][cur_arr]
971
+ #print current_noun; print " "
972
+
973
+ elsif cur_con == 1
974
+ row_options = [0, 1, 2, 3]
975
+ col_options = [0, 1, 2, 3]
976
+ arr_options = [0, 1]
977
+
978
+ #cur_con = context_window.sample
979
+ cur_row = row_options.sample
980
+ cur_col = col_options.sample
981
+ cur_arr = arr_options.sample
982
+
983
+ @current_noun = nouns[cur_con][cur_row][cur_col][cur_arr]
984
+ #print current_noun; print " "
985
+
986
+ elsif cur_con == 2
987
+ row_options = [0, 1, 2]
988
+ col_options = [0, 1, 2]
989
+ arr_options = [0, 1]
990
+
991
+ #cur_con = context_window.sample
992
+ cur_row = row_options.sample
993
+ cur_col = col_options.sample
994
+ cur_arr = arr_options.sample
995
+
996
+ @current_noun = nouns[cur_con][cur_row][cur_col][cur_arr]
997
+ #print current_noun; print " "
998
+
999
+ elsif cur_con == 3
1000
+ row_options = [0, 1]
1001
+ col_options = [0, 1]
1002
+ arr_options = [0, 1]
1003
+
1004
+ #cur_con = context_window.sample
1005
+ cur_row = row_options.sample
1006
+ cur_col = col_options.sample
1007
+ cur_arr = arr_options.sample
1008
+
1009
+ @current_noun = nouns[cur_con][cur_row][cur_col][cur_arr]
1010
+ #print current_noun; print " "
1011
+
1012
+ end
1013
+
1014
+ subjects = [
1015
+ [["es", "es"], ["es", "es ne"]],
1016
+ [["es ne", "es"], ["es ne", "es ne"]],
1017
+ ], [
1018
+ [["es", "es"], ["es", "es ne"]],
1019
+ [["es ne", "es"], ["es ne", "es ne"]],
1020
+ ]
1021
+
1022
+ context_window = [0, 1]
1023
+
1024
+ row_options = [0, 1]
1025
+ col_options = [0, 1]
1026
+ arr_options = [0, 1]
1027
+
1028
+ cur_con = context_window.sample
1029
+ cur_row = row_options.sample
1030
+ cur_col = col_options.sample
1031
+ cur_arr = arr_options.sample
1032
+
1033
+ @current_subject = subjects[cur_con][cur_row][cur_col][cur_arr]
1034
+ #print current_subject; print " "
1035
+
1036
+ avo = "avoir"
1037
+ cou = "coupe"
1038
+ ser = "serrure"
1039
+ dev = "déverrouillage"
1040
+
1041
+ verbs = [[
1042
+ [[avo, avo], [avo, cou], [avo, ser], [avo, dev]],
1043
+ [[cou, avo], [cou, cou], [cou, ser], [cou, dev]],
1044
+ [[ser, avo], [ser, cou], [ser, ser], [ser, dev]],
1045
+ [[dev, avo], [dev, cou], [dev, ser], [dev, dev]],
1046
+ ], [
1047
+ [[cou, avo], [cou, cou], [cou, ser], [cou, dev]],
1048
+ [[ser, avo], [ser, cou], [ser, ser], [ser, dev]],
1049
+ [[dev, avo], [dev, cou], [dev, ser], [dev, dev]],
1050
+ [[avo, avo], [avo, cou], [avo, ser], [avo, dev]],
1051
+ ], [
1052
+ [[ser, avo], [ser, cou], [ser, ser], [ser, dev]],
1053
+ [[dev, avo], [dev, cou], [dev, ser], [dev, dev]],
1054
+ [[avo, avo], [avo, cou], [avo, ser], [avo, dev]],
1055
+ [[cou, avo], [cou, cou], [cou, ser], [cou, dev]],
1056
+ ], [
1057
+ [[dev, avo], [dev, cou], [dev, ser], [dev, dev]],
1058
+ [[avo, avo], [avo, cou], [avo, ser], [avo, dev]],
1059
+ [[cou, avo], [cou, cou], [cou, ser], [cou, dev]],
1060
+ [[ser, avo], [ser, cou], [ser, ser], [ser, dev]],
1061
+ ]]
1062
+
1063
+ context_window = [0, 1, 2, 3]
1064
+ row_options = [0, 1, 2, 3]
1065
+ col_options = [0, 1, 2, 3]
1066
+ arr_options = [0, 1]
1067
+
1068
+ cur_con = context_window.sample
1069
+ cur_row = row_options.sample
1070
+ cur_col = col_options.sample
1071
+ cur_arr = arr_options.sample
1072
+
1073
+ current_verb = verbs[cur_con][cur_row][cur_col][cur_arr]
1074
+
1075
+ #print current_verb; print "."
1076
+
1077
+ File.open("lib/dialogue/lines/generated_dialogue.txt", "a") { |f|
1078
+ f.puts @phrase
1079
+ }
1080
+ end
1081
+
1082
+ def self.grammar_one
1083
+ @grammar_one = {
1084
+ word_class: "#{@current_word_class}",
1085
+ noun: "#{@current_noun}",
1086
+ subject: "#{@current_subject}",
1087
+ verb: "#{@current_verb}",
1088
+ }
1089
+ end
1090
+
1091
+ def self.grammar_two
1092
+ @grammar_two = {
1093
+ word_class: "#{@current_word_class}",
1094
+ noun: "#{@current_noun}",
1095
+ subject: "#{@current_subject}",
1096
+ verb: "#{@current_verb}",
1097
+ }
1098
+ end
1099
+
1100
+ def self.grammar_three
1101
+ @grammar_three = {
1102
+ word_class: "#{@current_word_class}",
1103
+ noun: "#{@current_noun}",
1104
+ subject: "#{@current_subject}",
1105
+ verb: "#{@current_verb}",
1106
+ }
1107
+ end
1108
+
1109
+ def self.map_grammars
1110
+ my_grammars = [
1111
+ [[@grammar_one, @grammar_one], [@grammar_one, @grammar_two], [@grammar_one, @grammar_three]],
1112
+ [[@grammar_two, @grammar_one], [@grammar_two, @grammar_two], [@grammar_two, @grammar_three]],
1113
+ [[@grammar_three, @grammar_one], [@grammar_three, @grammar_two], [@grammar_three, @grammar_three]],
1114
+ ]
1115
+
1116
+ row_options = [0, 1, 2]
1117
+ col_options = [0, 1, 2]
1118
+ arr_options = [0, 1]
1119
+
1120
+ cur_row = row_options.sample
1121
+ cur_col = col_options.sample
1122
+ cur_arr = arr_options.sample
1123
+
1124
+ current_grammar = my_grammars[cur_row][cur_col][cur_arr]
1125
+
1126
+ puts "Word Class: #{current_grammar[:word_class]}"
1127
+ puts "Noun: #{current_grammar[:noun]}"
1128
+ puts "Subject: #{current_grammar[:subject]}"
1129
+ puts "Verb: #{current_grammar[:verb]}"
1130
+ end
1131
+
1132
+ #############################################################################################
1133
+ # Adaptive Component #
1134
+ #############################################################################################
1135
+ ## Adjust the expected dialogue
1136
+ def self.adjust_expected_dialogue
1137
+ adjusted_ed = File.read("lib/npc/dialogue/expected_dialogue_index.txt")
1138
+
1139
+ adjusted_ed = adjusted_ed + 1
1140
+
1141
+ @adjusted_ed = adjusted_ed
1142
+ end
1143
+
1144
+ def self.learn_dialogue
1145
+ generated_dialogue = File.readlines("lib/dialogue/lines/generated_dialogue.txt")
1146
+ size_limit = generated_dialogue.size.to_i
1147
+ index = 0
1148
+
1149
+ read_ed = File.readlines("lib/dialogue/lines/ideal_phrase.txt").strip.to_i
1150
+ expected_dialogue = read_ed[@adjusted_ed]
1151
+
1152
+ size_limit.times do
1153
+ possible_npc_phrases = File.readlines("lib/npc/dialogue/possible_npc_phrases.txt")
1154
+ current_phrase = possible_npc_phrases.sample.to_s
1155
+
1156
+ if current_phrase[index] == expected_dialogue
1157
+ File.open("lib/npc/dialogue/learned_dialogue.txt", "a") { |f|
1158
+ f.puts current_phrase[index]
1159
+ }
1160
+
1161
+ puts current_phrase[index]
1162
+
1163
+ break
1164
+ else
1165
+ ">> The NPC is not sure what to say."
1166
+ end
1167
+
1168
+ sleep(1.5)
1169
+ end
1170
+ end
1171
+
1172
+ def self.guess_dialogue
1173
+ learned_dialogue = File.readlines("lib/npc/dialogue/possible_npc_phrases.txt")
1174
+ size_limit = generated_dialogue.size.to_i
1175
+ index = 0
1176
+
1177
+ read_ed = File.readlines("lib/dialogue/lines/ideal_phrase.txt").strip.to_i
1178
+ expected_dialogue = read_ed[@adjusted_ed]
1179
+
1180
+ size_limit.times do
1181
+ possible_npc_phrases = learned_dialogue.shuffle
1182
+ current_phrase = possible_npc_phrases[index]
1183
+
1184
+ if current_phrase[index] == expected_dialogue
1185
+ File.open("lib/npc/dialogue/reinforced_dialogue.txt", "a") { |f|
1186
+ f.puts current_phrase[index]
1187
+ }
1188
+
1189
+ puts current_phrase[index]
1190
+
1191
+ break
1192
+ else
1193
+ ">> The NPC is not sure what to say."
1194
+ end
1195
+
1196
+ sleep(1.5)
1197
+ end
1198
+ end
1199
+ end
1200
+
1201
+ class MeasureRisk
1202
+ def self.open_case
1203
+ puts "["
1204
+ end
1205
+
1206
+ def self.evaluate_class
1207
+ word_class = File.read("lib/encyclopedia/language/francais/word_classes.txt")
1208
+ comparator = word_class.to_f
1209
+ size_limit = word_class.size.to_i
1210
+ index = 0
1211
+
1212
+ predicted_class = File.read("lib/player/language/francias/current_class.txt")
1213
+
1214
+ size_limit.times do
1215
+ current_class = word_class[index]
1216
+ current_class_probability = 1 / comparator
1217
+
1218
+ if current_class == predicted_class
1219
+ print current_class
1220
+ else
1221
+ @class_risk = class_class_probability + class_class_probability % 0.99
1222
+ end
1223
+
1224
+ index = index + 1
1225
+ end
1226
+ end
1227
+
1228
+ def self.evaluate_noun
1229
+ noun = File.read("lib/encyclopedia/language/francais/nouns.txt")
1230
+ comparator = nouns.to_f
1231
+ size_limit = nouns.size.to_i
1232
+ index = 0
1233
+
1234
+ predicted_noun = File.read("lib/player/language/francias/current_noun.txt")
1235
+
1236
+ size_limit.times do
1237
+ current_noun = noun[index]
1238
+ current_noun_probability = 1 / comparator
1239
+
1240
+ if current_noun == predicted_noun
1241
+ print current_noun
1242
+ else
1243
+ @noun_risk = class_noun_probability + class_noun_probability % 0.99
1244
+ end
1245
+
1246
+ index = index + 1
1247
+ end
1248
+ end
1249
+
1250
+ def self.evaluate_subject
1251
+ subject = File.read("lib/encyclopedia/language/francais/subjects.txt")
1252
+ comparator = subjects.to_f
1253
+ size_limit = subjects.size.to_i
1254
+ index = 0
1255
+
1256
+ predicted_subject = File.read("lib/player/language/francias/current_subject.txt")
1257
+
1258
+ size_limit.times do
1259
+ current_subject = subject[index]
1260
+ current_subject_probability = 1 / comparator
1261
+
1262
+ if current_subject == predicted_subject
1263
+ print current_subject
1264
+ else
1265
+ @subject_risk = class_subject_probability + class_subject_probability % 0.99
1266
+ end
1267
+
1268
+ index = index + 1
1269
+ end
1270
+ end
1271
+
1272
+ def self.evaluate_verb
1273
+ verb = File.read("lib/encyclopedia/language/francais/verbs.txt")
1274
+ comparator = verb.to_f
1275
+ size_limit = verb.size.to_i
1276
+ index = 0
1277
+
1278
+ predicted_verb = File.read("lib/player/language/francias/current_verb.txt")
1279
+
1280
+ size_limit.times do
1281
+ current_verb = verb[index]
1282
+ current_verb_probability = 1 / comparator
1283
+
1284
+ if current_verb == predicted_verb
1285
+ print current_verb
1286
+ else
1287
+ @verb_risk = class_verb_probability + class_verb_probability % 0.99
1288
+ end
1289
+
1290
+ index = index + 1
1291
+ end
1292
+ end
1293
+
1294
+ def self.evaluate_adverb
1295
+ adverb = File.read("lib/encyclopedia/language/francais/adverbs.txt")
1296
+ comparator = adverb.to_f
1297
+ size_limit = adverb.size.to_i
1298
+ index = 0
1299
+
1300
+ predicted_adverb = File.read("lib/player/language/francias/current_adverb.txt")
1301
+
1302
+ size_limit.times do
1303
+ current_adverb = adverb[index]
1304
+ current_adverb_probability = 1 / comparator
1305
+
1306
+ if current_adverb == predicted_adverb
1307
+ print current_adverb
1308
+ else
1309
+ @adverb_risk = class_adverb_probability + class_adverb_probability % 0.99
1310
+ end
1311
+
1312
+ index = index + 1
1313
+ end
1314
+ end
1315
+
1316
+ def self.total_risk
1317
+ total_risk = @class_risk + @noun_risk + @subject_risk + @verb_risk + @adverb_risk
1318
+
1319
+ class total_risk
1320
+ when 0.001..0.250; puts "Neglible risk.]"
1321
+ when 0.260..0.350; puts "Non neglible risk.]"
1322
+ when 0.360..0.500; puts "Medium level risk.]"
1323
+ when 0.501..0.750; puts "Major level risk.]"
1324
+ when 0.751..1.000; puts "High risk factor.]"
1325
+ else
1326
+ puts total_risk
1327
+ end
1328
+ end
1329
+ end
1330
+ end
1331
+
1332
+ #################################################################################
1333
+ # Dialogue Tree #
1334
+ #################################################################################
1335
+ # This is for a dialogue tree as suppose a flashcard approach to learning the #
1336
+ # dialogue to communicate with the player. #
1337
+ #################################################################################
1338
+ module BequestDialogueTree
1339
+ class Agents
1340
+ def self.word_class
1341
+ word_classes = [
1342
+ [
1343
+ [["Le", "Le"], ["Le", "La"], ["Le", "Les"]],
1344
+ [["La", "Le"], ["La", "La"], ["La", "Les"]],
1345
+ [["Les", "Le"], ["Les", "La"], ["Les", "Les"]],
1346
+ ], [
1347
+ [["Anu", "Anu"], ["Anu", "Ana"], ["Anu", "Anos"]],
1348
+ [["Ana", "Anu"], ["Ana", "Ana"], ["Ana", "Anos"]],
1349
+ [["Anos", "Anu"], ["Anos", "Ana"], ["Anos", "Anus"]],
1350
+ ], [
1351
+ [["Lanu", "Lanu"], ["Lanu", "Lana"], ["Lanu", "Lanos"]],
1352
+ [["Lana", "Lanu"], ["Lana", "Lana"], ["Lana", "Lanos"]],
1353
+ [["Lanos", "Lanu"], ["Lanos", "Lana"], ["Lanos", "Lanos"]],
1354
+ ],
1355
+ ]
1356
+
1357
+ context_window = [0, 1, 2]
1358
+ row_options = [0, 1, 2]
1359
+ col_options = [0, 1, 2]
1360
+ arr_options = [0, 1]
1361
+
1362
+ cur_con = context_window.sample
1363
+ cur_row = row_options.sample
1364
+ cur_col = col_options.sample
1365
+ cur_arr = arr_options.sample
1366
+
1367
+ @chosen_word_class = word_classes[cur_con][cur_row][cur_col][cur_arr]
1368
+ end
1369
+
1370
+ def self.noun
1371
+ ho = "homme" #, "ommehay"]
1372
+ fe = "femme" #, "emmefay"]
1373
+ fi = "fille" #, "illefay"]
1374
+ ga = "garcon" #, "arcongay"]
1375
+ ta = "tante" #, "antetay"]
1376
+ oj = "oncle" #, "cleoney"]
1377
+ cofi = "cousinfille" #, "ousincay illefay"]
1378
+ coga = "cousingarcon" # , "ousincay arcongay"]
1379
+ grm = "grandmere" # , "randgay eremay"]
1380
+ grp = "grandpere" #, "randgay erepay"]
1381
+
1382
+ ct = "chat" #, "atchay"]
1383
+ ch = "chien" #, "ienchay"]
1384
+ oi = "oiseau" # , "seauoiay"]
1385
+ gr = "souris" #, "ourisay"]
1386
+ ou = "ours" #, "ursoay"]
1387
+ wo = "orgueil" #, "gueiloray"]
1388
+ pr = "ostritch" #, "ritchostray"]
1389
+ po = "jiraff" #, "iraffjay"]
1390
+ pi = "écureuil" #, "ureuilecay"]
1391
+
1392
+ m = "maison" # , "aisonmay"]
1393
+ c = "cabin" #, "abincay"]
1394
+ e = "ecole" #, "coleay"]
1395
+
1396
+ oju = "ojijaku" #, "jijakuoay"]
1397
+ neo = "ne ojijaku" #, "ne jijakuoay"]
1398
+
1399
+ # [context window][row][col][arr]
1400
+
1401
+ nouns = [
1402
+ [[ho, ho], [ho, fe], [ho, fi], [ho, ga], [ho, ta], [ho, oj], [ho, cofi], [ho, coga], [ho, grm], [ho, grp]],
1403
+ [[fe, ho], [fe, fe], [fe, fi], [fe, ga], [fe, ta], [fe, oj], [fe, cofi], [fe, coga], [fe, grm], [fe, grp]],
1404
+ [[fi, ho], [fi, fe], [fi, fi], [fi, ga], [fi, ta], [fi, oj], [fi, cofi], [fi, coga], [fi, grm], [fi, grp]],
1405
+ [[ga, ho], [ga, fe], [ga, fi], [ga, ga], [ga, ta], [ga, oj], [ga, cofi], [ga, coga], [ga, grm], [ga, grp]],
1406
+ [[ta, ho], [ta, fe], [ta, fi], [ta, ga], [ta, ta], [ta, oj], [ta, cofi], [ta, coga], [ta, grm], [ta, grp]],
1407
+ [[oj, ho], [oj, fe], [oj, fi], [oj, ga], [oj, ta], [oj, oj], [oj, cofi], [oj, coga], [oj, grm], [oj, grp]],
1408
+ [[cofi, ho], [cofi, fe], [cofi, fi], [cofi, ga], [cofi, ta], [cofi, oj], [cofi, cofi], [cofi, coga], [cofi, grm], [cofi, grp]],
1409
+ [[coga, ho], [coga, fe], [coga, fi], [coga, ga], [coga, ta], [coga, oj], [coga, cofi], [coga, coga], [coga, grm], [coga, grp]],
1410
+ [[grm, ho], [grm, fe], [grm, fi], [grm, ga], [grm, ta], [grm, oj], [grm, cofi], [grm, coga], [grm, grm], [grm, grp]],
1411
+ [[grp, ho], [grp, fe], [grp, fi], [grp, ga], [grp, ta], [grp, oj], [grp, cofi], [grp, coga], [grp, grm], [grp, grp]],
1412
+ ], [
1413
+ [[ct, ct], [ct, ch], [ct, oi], [ct, gr], [ct, wo], [ct, ou], [ct, pr], [ct, po]],
1414
+ [[ch, ct], [ch, ch], [ch, oi], [ch, gr], [ch, wo], [ch, ou], [ch, pr], [ch, po]],
1415
+ [[oi, ct], [oi, ch], [oi, oi], [pi, gr], [oi, wo], [oi, ou], [oi, pr], [oi, po]],
1416
+ [[gr, ct], [gr, ch], [gr, oi], [gr, gr], [gr, wo], [gr, ou], [gr, pr], [gr, po]],
1417
+ ], [
1418
+ [[m, m], [m, c], [m, e]],
1419
+ [[c, m], [c, c], [c, e]],
1420
+ [[e, m], [e, c], [e, e]],
1421
+ ], [
1422
+ [[oju, oju], [oju, neo]],
1423
+ [[neo, oju], [neo, neo]],
1424
+ ]
1425
+
1426
+ #sanity_window = [0, 1]
1427
+ context_window = [0, 1, 2, 3]
1428
+
1429
+ #cur_san = sanity_window.sample
1430
+ cur_con = context_window.sample
1431
+
1432
+ if cur_con == 0
1433
+ row_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
1434
+ col_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
1435
+ arr_options = [0, 1]
1436
+
1437
+ #cur_con = context_window.sample
1438
+ cur_row = row_options.sample
1439
+ cur_col = col_options.sample
1440
+ cur_arr = arr_options.sample
1441
+
1442
+ @chosen_noun = nouns[cur_con][cur_row][cur_col][cur_arr]
1443
+ elsif cur_con == 1
1444
+ row_options = [0, 1, 2, 3]
1445
+ col_options = [0, 1, 2, 3]
1446
+ arr_options = [0, 1]
1447
+
1448
+ #cur_con = context_window.sample
1449
+ cur_row = row_options.sample
1450
+ cur_col = col_options.sample
1451
+ cur_arr = arr_options.sample
1452
+
1453
+ @chosen_noun = nouns[cur_con][cur_row][cur_col][cur_arr]
1454
+ elsif cur_con == 2
1455
+ row_options = [0, 1, 2]
1456
+ col_options = [0, 1, 2]
1457
+ arr_options = [0, 1]
1458
+
1459
+ #cur_con = context_window.sample
1460
+ cur_row = row_options.sample
1461
+ cur_col = col_options.sample
1462
+ cur_arr = arr_options.sample
1463
+
1464
+ @chosen_noun = nouns[cur_con][cur_row][cur_col][cur_arr]
1465
+ elsif cur_con == 3
1466
+ row_options = [0, 1]
1467
+ col_options = [0, 1]
1468
+ arr_options = [0, 1]
1469
+
1470
+ #cur_con = context_window.sample
1471
+ cur_row = row_options.sample
1472
+ cur_col = col_options.sample
1473
+ cur_arr = arr_options.sample
1474
+
1475
+ @chosen_noun = nouns[cur_con][cur_row][cur_col][cur_arr]
1476
+ end
1477
+ end
1478
+
1479
+ def self.adjective
1480
+ # tsin petite sucré roudy l'éducation sages
1481
+ t = "tsin" # t,t t,p t,s t,r t,l t,s
1482
+ p = "petite"
1483
+ s1 = "sucré"
1484
+ r = "roudy"
1485
+ l = "l'éducation"
1486
+ s2 = "sages"
1487
+
1488
+ adjectives = [
1489
+ ], [
1490
+ [[t, t], [t, p], [t, s1], [t, r], [t, l], [t, s2],
1491
+ [[p, t], [p, p], [p, s1], [p, r], [p, l], [p, s2],
1492
+ [[s1, t], [s1, p], [s1, s1], [s1, r], [s1, l], [s1, s2],
1493
+ [[r, t], [r, p], [r, s1], [r, r], [r, l], [r, s2],
1494
+ [[l, t], [l, p], [l, s1], [l, r], [l, l], [l, s2],
1495
+ [[s2, t], [s2, p], [s2, s1], [s2, r], [s2, l], [s2, s2],
1496
+ ], [
1497
+ [[p, t], [p, p], [p, s1], [p, r], [p, l], [p, s2],
1498
+ [[s1, t], [s1, p], [s1, s1], [s1, r], [s1, l], [s1, s2],
1499
+ [[r, t], [r, p], [r, s1], [r, r], [r, l], [r, s2],
1500
+ [[l, t], [l, p], [l, s1], [l, r], [l, l], [l, s2],
1501
+ [[s2, t], [s2, p], [s2, s1], [s2, r], [s2, l], [s2, s2],
1502
+ [[t, t], [t, p], [t, s1], [t, r], [t, l], [t, s2],
1503
+ ], [
1504
+ [[s1, t], [s1, p], [s1, s1], [s1, r], [s1, l], [s1, s2],
1505
+ [[r, t], [r, p], [r, s1], [r, r], [r, l], [r, s2],
1506
+ [[l, t], [l, p], [l, s1], [l, r], [l, l], [l, s2],
1507
+ [[s2, t], [s2, p], [s2, s1], [s2, r], [s2, l], [s2, s2],
1508
+ [[t, t], [t, p], [t, s1], [t, r], [t, l], [t, s2],
1509
+ [[p, t], [p, p], [p, s1], [p, r], [p, l], [p, s2],
1510
+ ], [
1511
+ [[r, t], [r, p], [r, s1], [r, r], [r, l], [r, s2],
1512
+ [[l, t], [l, p], [l, s1], [l, r], [l, l], [l, s2],
1513
+ [[s2, t], [s2, p], [s2, s1], [s2, r], [s2, l], [s2, s2],
1514
+ [[t, t], [t, p], [t, s1], [t, r], [t, l], [t, s2],
1515
+ [[p, t], [p, p], [p, s1], [p, r], [p, l], [p, s2],
1516
+ [[s1, t], [s1, p], [s1, s1], [s1, r], [s1, l], [s1, s2],
1517
+ ], [
1518
+ [[l, t], [l, p], [l, s1], [l, r], [l, l], [l, s2],
1519
+ [[s2, t], [s2, p], [s2, s1], [s2, r], [s2, l], [s2, s2],
1520
+ [[t, t], [t, p], [t, s1], [t, r], [t, l], [t, s2],
1521
+ [[p, t], [p, p], [p, s1], [p, r], [p, l], [p, s2],
1522
+ [[s1, t], [s1, p], [s1, s1], [s1, r], [s1, l], [s1, s2],
1523
+ [[r, t], [r, p], [r, s1], [r, r], [r, l], [r, s2],
1524
+ ], [
1525
+ [[s2, t], [s2, p], [s2, s1], [s2, r], [s2, l], [s2, s2],
1526
+ [[t, t], [t, p], [t, s1], [t, r], [t, l], [t, s2],
1527
+ [[p, t], [p, p], [p, s1], [p, r], [p, l], [p, s2],
1528
+ [[s1, t], [s1, p], [s1, s1], [s1, r], [s1, l], [s1, s2],
1529
+ [[r, t], [r, p], [r, s1], [r, r], [r, l], [r, s2],
1530
+ [[l, t], [l, p], [l, s1], [l, r], [l, l], [l, s2],
1531
+ ]
1532
+
1533
+ context_window = [0, 1, 2, 3, 4, 5]
1534
+ row_options = [0, 1, 2, 3, 4, 5]
1535
+ col_options = [0, 1, 2, 3, 4, 5]
1536
+ arr_options = [0, 1]
1537
+
1538
+ cur_con = context_window.sample
1539
+ cur_row = row_options.sample
1540
+ cur_col = col_options.sample
1541
+ cur_arr = arr_options.sample
1542
+
1543
+ @chosen_adverb = verbs[cur_con][cur_row][cur_col][cur_arr]
1544
+ end
1545
+
1546
+ def self.subject
1547
+ subjects = [[
1548
+ [["es", "es"], ["es", "es ne"]],
1549
+ [["es ne", "es"], ["es ne", "es ne"]],
1550
+ ], [
1551
+ [["es", "es"], ["es", "es ne"]],
1552
+ [["es ne", "es"], ["es ne", "es ne"]],
1553
+ ]]
1554
+
1555
+ context_window = [0, 1]
1556
+
1557
+ row_options = [0, 1]
1558
+ col_options = [0, 1]
1559
+ arr_options = [0, 1]
1560
+
1561
+ cur_con = context_window.sample
1562
+ cur_row = row_options.sample
1563
+ cur_col = col_options.sample
1564
+ cur_arr = arr_options.sample
1565
+
1566
+ @chosen_subject = subjects[cur_con][cur_row][cur_col][cur_arr]
1567
+ end
1568
+
1569
+ def self.verb
1570
+ verbs = [
1571
+ [[avo, avo], [avo, cou], [avo, ser], [avo, dev]],
1572
+ [[cou, avo], [cou, cou], [cou, ser], [cou, dev]],
1573
+ [[ser, avo], [ser, cou], [ser, ser], [ser, dev]],
1574
+ [[dev, avo], [dev, cou], [dev, ser], [dev, dev]],
1575
+ ], [
1576
+ [[cou, avo], [cou, cou], [cou, ser], [cou, dev]],
1577
+ [[ser, avo], [ser, cou], [ser, ser], [ser, dev]],
1578
+ [[dev, avo], [dev, cou], [dev, ser], [dev, dev]],
1579
+ [[avo, avo], [avo, cou], [avo, ser], [avo, dev]],
1580
+ ], [
1581
+ [[ser, avo], [ser, cou], [ser, ser], [ser, dev]],
1582
+ [[dev, avo], [dev, cou], [dev, ser], [dev, dev]],
1583
+ [[avo, avo], [avo, cou], [avo, ser], [avo, dev]],
1584
+ [[cou, avo], [cou, cou], [cou, ser], [cou, dev]],
1585
+ ], [
1586
+ [[dev, avo], [dev, cou], [dev, ser], [dev, dev]],
1587
+ [[avo, avo], [avo, cou], [avo, ser], [avo, dev]],
1588
+ [[cou, avo], [cou, cou], [cou, ser], [cou, dev]],
1589
+ [[ser, avo], [ser, cou], [ser, ser], [ser, dev]],
1590
+ ]
1591
+
1592
+ context_window = [0, 1, 2, 3]
1593
+ row_options = [0, 1, 2, 3]
1594
+ col_options = [0, 1, 2, 3]
1595
+ arr_options = [0, 1]
1596
+
1597
+ cur_con = context_window.sample
1598
+ cur_row = row_options.sample
1599
+ cur_col = col_options.sample
1600
+ cur_arr = arr_options.sample
1601
+
1602
+ @chosen_verb = verbs[cur_con][cur_row][cur_col][cur_arr]
1603
+ end
1604
+
1605
+ def self.adverb
1606
+ # rapidement lentement assurement tranquillement
1607
+ r = "rapidement" # r,r r,l r,a r,t
1608
+ l = "lentement"
1609
+ a = "assurement"
1610
+ t = "tranquillement"
1611
+
1612
+ adverbs = [
1613
+ [[r, r], [r, l], [r, a], [r, t]],
1614
+ [[l, r], [l, l], [l, a], [l, t]],
1615
+ [[a, r], [a, l], [a, a], [a, t]],
1616
+ [[t, r], [t, l], [t, a], [t, t]],
1617
+ ], [
1618
+ [[l, r], [l, l], [l, a], [l, t]],
1619
+ [[a, r], [a, l], [a, a], [a, t]],
1620
+ [[t, r], [t, l], [t, a], [t, t]],
1621
+ [[r, r], [r, l], [r, a], [r, t]],
1622
+ ], [
1623
+ [[a, r], [a, l], [a, a], [a, t]],
1624
+ [[t, r], [t, l], [t, a], [t, t]],
1625
+ [[r, r], [r, l], [r, a], [r, t]],
1626
+ [[l, r], [l, l], [l, a], [l, t]],
1627
+ ], [
1628
+ [[t, r], [t, l], [t, a], [t, t]],
1629
+ [[r, r], [r, l], [r, a], [r, t]],
1630
+ [[l, r], [l, l], [l, a], [l, t]],
1631
+ [[a, r], [a, l], [a, a], [a, t]],
1632
+ ]
1633
+
1634
+ context_window = [0, 1, 2, 3]
1635
+ row_options = [0, 1, 2, 3]
1636
+ col_options = [0, 1, 2, 3]
1637
+ arr_options = [0, 1]
1638
+
1639
+ cur_con = context_window.sample
1640
+ cur_row = row_options.sample
1641
+ cur_col = col_options.sample
1642
+ cur_arr = arr_options.sample
1643
+
1644
+ @chosen_adverb = verbs[cur_con][cur_row][cur_col][cur_arr]
1645
+ end
1646
+
1647
+ def self.child_process
1648
+ BequestDialogueTree::Agents.noun
1649
+ BequestDialogueTree::Agents.adjective
1650
+ BequestDialogueTree::Agents.subject
1651
+ BequestDialogueTree::Agents.verb
1652
+ BequestDialogueTree::Agents.adverb
1653
+ #BequestDialogueTree::Agents.punctuation
1654
+
1655
+ created_statement = "#{@chosen_class} #{@chosen_noun} #{@chosen_adjective} #{@chosen_subject} #{@chosen_verb} #{@chosen_adverb}"
1656
+
1657
+ File.open("lib/npc/possible_lines.txt", "a") { |f|
1658
+ f.puts created_statement
1659
+ }
1660
+ end
1661
+
1662
+ def self.adult_process
1663
+ possible_statements = File.readlines("lib/npc/possible_lines.txt")
1664
+ size_limit = possible_statements.size.to_i
1665
+
1666
+ confidence_score_no = 1 / possible_statements.size.to_f
1667
+ confidence_score_yes = 1 - confidence_score_no
1668
+
1669
+ index = 0
1670
+
1671
+ size_limit.times do
1672
+ chosen_statment = possible_statements[index].shuffle
1673
+
1674
+ autocorrect = { # Where the "training" of the adult agent happens.
1675
+ "Ana homme es ne coupe" => "Le homme es ne coupe ",
1676
+ "Ana chien es ne deverrouillage" => "Le chien es ne deverrouillage ",
1677
+ "La maison es deverrouillage" => "Le maison es deverrouillage ",
1678
+ "La oncle es ne serrure" => "La oncle es ne serrure ",
1679
+ "Anos cabin es ne avoir" => "Le cabin es ne avoir ",
1680
+ "Anu ecole es ne serrure" => "L'ecole es ne serrure ",
1681
+ "Anu chat es ne serrure" => "Le chat es ne serrure ",
1682
+ "Ana ecole es avoir" => "L'ecole es avoir ",
1683
+ "Lana ne ojijaku es déverrouillage" => "Lanu na ojijaku es déverrouillage ",
1684
+ "Ana ne ojijaku es serrure" => "Anu ne ojijaku es serrure ",
1685
+ "Les souris es ne serrure" => "Les souris es ne serrure ",
1686
+ "Ana grandpere es avoir" => "Le grandpere es avoir ",
1687
+ "Les oiseau es avoir"
1688
+ }
1689
+
1690
+ puts "#{enemy_name}: #{autocorrect[chosen_statement]}"
1691
+
1692
+ index = index + 1
1693
+ end
1694
+ end
1695
+ end
1696
+ end
1697
+
1698
+ # dakupreiste mort_naussance bourreau_de_karma horyo_de_noir
1699
+ # dakupreiste d,d d,m d,b d,h
1700
+ # mort_naussance m,d m,m m,b m,h
1701
+ # bourreau_de_karma b,d b,m b,b b,h
1702
+ # horyo_de_noir h,d h,m h,b h,h
1703
+
1704
+ ## BequestDietiesPlayer::Worship.dakupreiste
1705
+ ## BequestDietiesPlayer::Worship.mort_naussance
1706
+ ## BequestDietiesPlayer::Worship.bourreau_de_karma
1707
+ ## BequestDietiesPlayer::Worship.horyo_de_noir
1708
+
1709
+ module BequestDietiesPlayer
1710
+ class Worship
1711
+ def self.worship_dakupreiste
1712
+ god_favor = [
1713
+ [["favor", "favor"], ["favor", "disfavor"]],
1714
+ [["disfavor", "favor"], ["disfavor", "favor"]],
1715
+ ]
1716
+
1717
+ row_options = [0, 1]
1718
+ col_options = [0, 1]
1719
+ arr_options = [0, 1]
1720
+
1721
+ cur_row = row_options.sample
1722
+ cur_col = col_options.sample
1723
+ cur_arr = arr_options.sample
1724
+
1725
+ current_favor = god_favor[cur_row][cur_col][cur_arr]
1726
+
1727
+ if current_favor == "favor"; BequestDieties::DietyPower.dakupreiste_reward
1728
+ elsif current_favor == "disfavor"; BequestDieties::DietyPower.dakupreiste_punish
1729
+ end
1730
+ end
1731
+
1732
+ def self.worship_mort_naussance
1733
+ god_favor = [
1734
+ [["favor", "favor"], ["favor", "disfavor"]],
1735
+ [["disfavor", "favor"], ["disfavor", "favor"]],
1736
+ ]
1737
+
1738
+ row_options = [0, 1]
1739
+ col_options = [0, 1]
1740
+ arr_options = [0, 1]
1741
+
1742
+ cur_row = row_options.sample
1743
+ cur_col = col_options.sample
1744
+ cur_arr = arr_options.sample
1745
+
1746
+ current_favor = god_favor[cur_row][cur_col][cur_arr]
1747
+
1748
+ if current_favor == "favor"; BequestDieties::DietyPower.mort_naussance_reward
1749
+ elsif current_favor == "disfavor"; BequestDieties::DietyPower.mort_naussance_punish
1750
+ end
1751
+ end
1752
+
1753
+ def self.bourreau_de_karma
1754
+ god_favor = [
1755
+ [["favor", "favor"], ["favor", "disfavor"]],
1756
+ [["disfavor", "favor"], ["disfavor", "favor"]],
1757
+ ]
1758
+
1759
+ row_options = [0, 1]
1760
+ col_options = [0, 1]
1761
+ arr_options = [0, 1]
1762
+
1763
+ cur_row = row_options.sample
1764
+ cur_col = col_options.sample
1765
+ cur_arr = arr_options.sample
1766
+
1767
+ current_favor = god_favor[cur_row][cur_col][cur_arr]
1768
+
1769
+ if current_favor == "favor"; BequestDieties::DietyPower.bourreau_de_karma_reward
1770
+ elsif current_favor == "disfavor"; BequestDieties::DietyPower.bourreau_de_karma_punish
1771
+ end
1772
+ end
1773
+
1774
+ def self.horyo_de_noir
1775
+ god_favor = [
1776
+ [["favor", "favor"], ["favor", "disfavor"]],
1777
+ [["disfavor", "favor"], ["disfavor", "favor"]],
1778
+ ]
1779
+
1780
+ row_options = [0, 1]
1781
+ col_options = [0, 1]
1782
+ arr_options = [0, 1]
1783
+
1784
+ cur_row = row_options.sample
1785
+ cur_col = col_options.sample
1786
+ cur_arr = arr_options.sample
1787
+
1788
+ current_favor = god_favor[cur_row][cur_col][cur_arr]
1789
+
1790
+ if current_favor == "favor"; BequestDieties::DietyPower.horyo_de_noir_reward
1791
+ elsif current_favor == "disfavor"; BequestDieties::DietyPower.horyo_de_noir_punish
1792
+ end
1793
+ end
1794
+ end
1795
+
1796
+ #################################################################################
1797
+ # Standard Rewards And Punishments #
1798
+ #################################################################################
1799
+ # Standard rewards and punishments that may evntually be replaced by a sanity #
1800
+ # or trust detriment. While sometimes also having a random curse status effect. #
1801
+ #################################################################################
1802
+ class DietyPower
1803
+
1804
+ # dakupreiste
1805
+ def self.dakupreiste_reward
1806
+ puts "< The dark priest removes your vampire curse."
1807
+ end
1808
+
1809
+ def self.dakupreiste_punish
1810
+ puts "< The dark priest curses you and you turn into a vampire."
1811
+ end
1812
+
1813
+ # mort naussance
1814
+ def self.mort_naussance_reward
1815
+ puts "< The karada duplicata removes the curse of only having stillborn."
1816
+ end
1817
+
1818
+ def self.mort_naussance_punish
1819
+ puts "< The karada duplicata curses you to have every baby be stillborn."
1820
+ end
1821
+
1822
+ # borreau de karma
1823
+ def self.bourreau_de_karma_reward
1824
+ puts "< The executioner removes your zombie curse."
1825
+
1826
+ ## Resets the dungeon.
1827
+ end
1828
+
1829
+ def self.bourreau_de_karma_punish
1830
+ puts "< The executioner of karma chops your head off."
1831
+
1832
+ sleep(1.5)
1833
+
1834
+ ## Switch to zombie made.
1835
+ end
1836
+
1837
+ # horyo_de_noir
1838
+ def self.horyo_de_noir_reward
1839
+ puts "< The prisoner in black returns with a gift of a special weapon for you."
1840
+ end
1841
+
1842
+ def self.horyo_de_noir_punish
1843
+ puts "< The prisoner in black tries to stab you in the back."
1844
+ end
1845
+
1846
+ end
1847
+
1848
+ #################################################################################
1849
+ # Outside of standard worship sequences #
1850
+ #################################################################################
1851
+ # Sometimes in battles you might have a random status effect from a different #
1852
+ # diety that gives you a distinct drawback that you have to manage. #
1853
+ #################################################################################
1854
+ class DietyCurse
1855
+ def self.vampire_curse
1856
+ puts "The dark preist curses you into becoming a vampire."
1857
+ end
1858
+
1859
+ def self.doll_curse
1860
+ puts "The haunted doll curses you into becoming a porcelain doll."
1861
+ end
1862
+
1863
+ def self.living_purgatory
1864
+ puts "The executioner of karma does not give you the release of Saint Peter."
1865
+ end
1866
+
1867
+ def self.bleeding_yen
1868
+ puts "You lost some yen. You lose yen every turn."
1869
+ end
1870
+
1871
+ def self.curse_dice
1872
+ # vampire doll purgatory bleedingy
1873
+ # vampire v,v v,d v,p v,b
1874
+ # doll d,v d,d d,p d,b
1875
+ # purgatory p,v p,d p,p p,b
1876
+ # bleedingy b,v b,d b,p b,b
1877
+
1878
+ curse_effects = [
1879
+ [["vampire", "vampire"], ["vampire", "doll"], ["vampire", "purgatory"], ["vampire", "bleeding yen"]],
1880
+ [["doll", "vampire"], ["doll", "doll"], ["doll", "purgatory"], ["doll", "bleeding yen"]],
1881
+ [["purgatory", "vampire"], ["purgatory", "doll"], ["purgatory", "purgatory"], ["purgatory", "bleeding yen"]],
1882
+ [["bleeding yen", "vampire"], ["bleedng yen", "doll"], ["bleeding yen", "purgatory"], ["bleeding yen", "bleeding yen"]],
1883
+ ]
1884
+
1885
+ row_options = [0, 1, 2, 3]
1886
+ col_options = [0, 1, 2, 3]
1887
+ arr_options = [0, 1]
1888
+
1889
+ cur_row = row_options.sample
1890
+ cur_col = col_options.sample
1891
+ cur_arr = arr_options.sample
1892
+
1893
+ current_curse = curse_effects[cur_row][cur_col][cur_arr]
1894
+
1895
+ if current_curse == "vampire"; BequestMutations::DietyCurses.vampire_curse
1896
+ elsif current_curse == "doll"; BequestMutations::DietyCurses.doll_curse
1897
+ elsif current_curse == "purgatory"; BequestMutations::DietyCurses.living_purgatory
1898
+ elsif current_curse == "bleeding yen"; BequestMutations::DietyCurses.bleeding_yen
1899
+ else
1900
+ end
1901
+ end
1902
+ end
1903
+ end
1904
+
1905
+ # 0 Twilight
1906
+ # 1 Dawn
1907
+ # 2 Morning
1908
+ # 3 Afternoon
1909
+ # 4 Dusk
1910
+ # 5 Night
1911
+
1912
+ # 0 1 2 3 4 5
1913
+ # 0 fully closed 0,0 0,1 0,2 0,3 0,4 0,5
1914
+ # 1 largely closed 1,0 1,1 1,2 1,3 1,4 1,5
1915
+ # 2 half way closed 2,0 2,1 2,2 2,3 2,4 2,5
1916
+ # 3 largely open 3,0 3,1 3,2 3,3 3,4 3,5
1917
+ # 4 fully open 4,0 4,1 4,2 4,3 4,4 4,5
1918
+ # 5 Door Torn Off 5,0 5,1 5,2 5,3 5,4 5,5
1919
+
1920
+ # Most Common Situations
1921
+ # [0][0][0][0] Night, Door Fully Closed
1922
+ # [2][2][2][2] Morning, Half Way Closed
1923
+ # [3][3][3][3] Afternoon, Largely Open
1924
+ # [4][4][4][4] Dusk, Fully Open
1925
+ # [5][5][5][5] Night, Door Torn Off
1926
+
1927
+ module BequestStatus
1928
+
1929
+ class Log
1930
+ def self.doorstatus
1931
+ discrete_state = [
1932
+ [[0,0], [0,1], [0,2], [0,3], [0,4], [0,5]],
1933
+ [[1,0], [1,1], [1,2], [1,3], [1,4], [1,5]],
1934
+ [[2,0], [2,1], [2,2], [2,3], [2,4], [2,5]],
1935
+ [[3,0], [3,1], [3,2], [3,3], [3,4], [3,5]],
1936
+ [[4,0], [4,1], [4,2], [4,3], [4,4], [4,5]],
1937
+ [[5,0], [5,1], [5,2], [5,3], [5,4], [5,5]],
1938
+ ], [
1939
+ [[0,0], [0,1], [0,2], [0,3], [0,4], [0,5]],
1940
+ [[1,0], [1,1], [1,2], [1,3], [1,4], [1,5]],
1941
+ [[2,0], [2,1], [2,2], [2,3], [2,4], [2,5]],
1942
+ [[3,0], [3,1], [3,2], [3,3], [3,4], [3,5]],
1943
+ [[4,0], [4,1], [4,2], [4,3], [4,4], [4,5]],
1944
+ [[5,0], [5,1], [5,2], [5,3], [5,4], [5,5]],
1945
+ ], [
1946
+ [[0,0], [0,1], [0,2], [0,3], [0,4], [0,5]],
1947
+ [[1,0], [1,1], [1,2], [1,3], [1,4], [1,5]],
1948
+ [[2,0], [2,1], [2,2], [2,3], [2,4], [2,5]],
1949
+ [[3,0], [3,1], [3,2], [3,3], [3,4], [3,5]],
1950
+ [[4,0], [4,1], [4,2], [4,3], [4,4], [4,5]],
1951
+ [[5,0], [5,1], [5,2], [5,3], [5,4], [5,5]],
1952
+ ], [
1953
+ [[0,0], [0,1], [0,2], [0,3], [0,4], [0,5]],
1954
+ [[1,0], [1,1], [1,2], [1,3], [1,4], [1,5]],
1955
+ [[2,0], [2,1], [2,2], [2,3], [2,4], [2,5]],
1956
+ [[3,0], [3,1], [3,2], [3,3], [3,4], [3,5]],
1957
+ [[4,0], [4,1], [4,2], [4,3], [4,4], [4,5]],
1958
+ [[5,0], [5,1], [5,2], [5,3], [5,4], [5,5]],
1959
+ ], [
1960
+ [[0,0], [0,1], [0,2], [0,3], [0,4], [0,5]],
1961
+ [[1,0], [1,1], [1,2], [1,3], [1,4], [1,5]],
1962
+ [[2,0], [2,1], [2,2], [2,3], [2,4], [2,5]],
1963
+ [[3,0], [3,1], [3,2], [3,3], [3,4], [3,5]],
1964
+ [[4,0], [4,1], [4,2], [4,3], [4,4], [4,5]],
1965
+ [[5,0], [5,1], [5,2], [5,3], [5,4], [5,5]],
1966
+ ], [
1967
+ [[0,0], [0,1], [0,2], [0,3], [0,4], [0,5]],
1968
+ [[1,0], [1,1], [1,2], [1,3], [1,4], [1,5]],
1969
+ [[2,0], [2,1], [2,2], [2,3], [2,4], [2,5]],
1970
+ [[3,0], [3,1], [3,2], [3,3], [3,4], [3,5]],
1971
+ [[4,0], [4,1], [4,2], [4,3], [4,4], [4,5]],
1972
+ [[5,0], [5,1], [5,2], [5,3], [5,4], [5,5]],
1973
+ ]
1974
+
1975
+ # Labels for time of day
1976
+ times_of_day = ["Twilight", "Dawn",
1977
+ "Morning", "Afternoon",
1978
+ "Dusk", "Night",
1979
+ ]
1980
+
1981
+ # Labels for door status.
1982
+ door_status = [
1983
+ "Fully Closed",
1984
+ "Largely Closed",
1985
+ "Half Way Closed",
1986
+ "Largely Open",
1987
+ "Fully Open",
1988
+ "Door Torn Off",
1989
+ ]
1990
+
1991
+ # Input for 0
1992
+ tim_options = [0, 1, 2, 3, 4, 5]
1993
+ row_options = [0, 1, 2, 3, 4, 5]
1994
+ col_options = [0, 1, 2, 3, 4, 5]
1995
+ arr_options = [0, 1]
1996
+
1997
+ ctime = tim_options.sample
1998
+ crow = row_options.sample
1999
+ ccol = col_options.sample
2000
+ carr = arr_options.sample
2001
+
2002
+ un = discrete_state[ctime][crow][ccol][carr]
2003
+
2004
+ # Input for 1
2005
+ tim_options = [0, 1, 2, 3, 4, 5]
2006
+ row_options = [0, 1, 2, 3, 4, 5]
2007
+ col_options = [0, 1, 2, 3, 4, 5]
2008
+ arr_options = [0, 1]
2009
+
2010
+ ctime = tim_options.sample
2011
+ crow = row_options.sample
2012
+ ccol = col_options.sample
2013
+ carr = arr_options.sample
2014
+
2015
+ de = discrete_state[ctime][crow][ccol][carr]
2016
+
2017
+ # Input for 2
2018
+ tim_options = [0, 1, 2, 3, 4, 5]
2019
+ row_options = [0, 1, 2, 3, 4, 5]
2020
+ col_options = [0, 1, 2, 3, 4, 5]
2021
+ arr_options = [0, 1]
2022
+
2023
+ ctime = tim_options.sample
2024
+ crow = row_options.sample
2025
+ ccol = col_options.sample
2026
+ carr = arr_options.sample
2027
+
2028
+ tr = discrete_state[ctime][crow][ccol][carr]
2029
+
2030
+ # Input for 3
2031
+ tim_options = [0, 1, 2, 3, 4, 5]
2032
+ row_options = [0, 1, 2, 3, 4, 5]
2033
+ col_options = [0, 1, 2, 3, 4, 5]
2034
+ arr_options = [0, 1]
2035
+
2036
+ ctime = tim_options.sample
2037
+ crow = row_options.sample
2038
+ ccol = col_options.sample
2039
+ carr = arr_options.sample
2040
+
2041
+ qa = discrete_state[ctime][crow][ccol][carr] #.to_i
2042
+
2043
+ current_status = discrete_state[un][de][tr][qa].to_i
2044
+ current_time = times_of_day[current_status]
2045
+ current_state = door_status[current_status]
2046
+
2047
+ puts "[#{un}][#{de}][#{tr}][#{qa}] #{current_time}, #{current_state}"
2048
+ end
2049
+ end
2050
+ end
2051
+
2052
+ module BequestEncyclopedia
2053
+ class Research
2054
+ def self.beastiary
2055
+ system("clear")
2056
+
2057
+ beasts = File.read("lib/beastiary/beasts.txt")
2058
+
2059
+ puts beasts
2060
+
2061
+ available_beasts = [
2062
+ "[Cochonbuta]", "[Ursinehomme]",
2063
+ "[Ursinepiros]", "[Kumabatto]",
2064
+ "[The Quantumcrusafied]",
2065
+ ]
2066
+
2067
+ print "\nWhat kind of beast? ( Cochonbuta / Ursinehomme / Ursinepiros / Kumabatto / The Quantumcrusafied ) << "; do_beast = gets.chomp
2068
+
2069
+ if do_beast == "Cochonbuta"; print available_beasts[0]; puts " Combines a lobster and a boar, related to the spider pig."
2070
+ elsif do_beast == "Ursinehomme"; print available_beasts[1]; puts " Literally translates to bear-man, is the male version of wearbears. Ursinefemme is the female version."
2071
+ elsif do_beast == "Ursinepiros"; print available_beasts[2]; puts " Literally translates to vampire-bear, is the human version of wearbears that feeds on human's blood."
2072
+ elsif do_beast == "Kumabatto"; print available_beasts[3]; puts " A condensed version of 'Le Kumabatto De Les Ghoules', is the king of the bear-bat ghouls."
2073
+ elsif do_beast == "The Quantumcrusafied"; print available_beasts[4]; puts " The wandering spirits of men punished for quantum treason by quantum crusafiction."
2074
+ else
2075
+ puts ">> Not such beast exists on land or sea..."
2076
+ end
2077
+
2078
+ gets.chomp
2079
+ end
2080
+
2081
+ def self.translate
2082
+ print "What word would you like to translate? >> "; translate = gets.chomp
2083
+
2084
+ dictionary = {
2085
+ ### Color Acidity Framework
2086
+ # These colors are for a system that rates colors based on their acidity or alkalinity.
2087
+
2088
+ ##### Reds
2089
+ "PH4DR1" => "Salmon",
2090
+ "PH5DR1" => "Pale Salmon",
2091
+ "PH4DR3" => "Salmon Pink",
2092
+
2093
+ ##### Oranges
2094
+ "PH4DR2" => "Copper",
2095
+ "PH8WE1" => "Japanese Bistre",
2096
+
2097
+ ##### Yellow
2098
+ "PH6DR1" => "Maize",
2099
+ "PH5DR2" => "Khaki",
2100
+ "PH6DR3" => "Bland",
2101
+
2102
+ ##### Green
2103
+ "PH6DR2" => "Pale Lime",
2104
+ "PH7NU1" => "Vibrant Green",
2105
+ "PH7NU2" => "Medium Green",
2106
+ "PH8WE2" => "Kelly Green",
2107
+
2108
+ ##### Blue
2109
+ "PH9WE2" => "Viridian",
2110
+ "PHAWE3" => "Ultramarine",
2111
+ "PH9WE3" => "Muted Sapphire",
2112
+ "PH8WE3" => "Dark Sapphire",
2113
+ "PH7NU3" => "Grey Blue",
2114
+
2115
+ ##### Purple
2116
+ "PH9WE1" => "Dull Purple",
2117
+ "PH5DR3" => "Light Mauve",
2118
+
2119
+ ##### Unusual Or Rare Color
2120
+ "PH1WE3CH1" => "Dark Lavender", # A theoretical compound that blends Salmon with Sapphire blue.
2121
+ "PH4WE2CH2" => "Atomic Hazel", # A highly toxic combination of copper and arsenic.
2122
+ "Atomic Hazel" => "#6D6C46", # Hex code for atomic hazel.
2123
+
2124
+ ### Chomatic Shades
2125
+ ### Arsenic Scale
2126
+
2127
+ ### Unknown Origin
2128
+ "PHAWE1" => "Bordeaux", # I don't know how I got this color.'
2129
+
2130
+ ### Hand Mixed Colors
2131
+ "#83b281" => "Dusty Green",
2132
+
2133
+ ### Synthesized From Real Colors
2134
+ "#A9A8AD" => "Faded Carolina Blue", # Pale Lime, Salmon Pink, Bland, Grey Blue [ Hypothesis Acidic Blue ]
2135
+ "#A0A5B9" => "Manilla Lavender", # Salmon, Pale Salmon, Grey Blue, Grey Blue [ Hypothesis Slightly Alkaline Grey Blue ]
2136
+ "#8cc874" => "Asparagus", # Pale Lime, Maize, Light Mauve, Medium Green [ Hypothesis Alkaline Green ]
2137
+ "#a0b36c" => "Tan Green", # Pale Salmon, Kelly Green, Bland, Khaki [ Hypothesis Slightly Tan Green ]
2138
+ "#5673A9" => "Dusky Blue", # Grey Blue, Light Mauve, Khaki, Sapphire [ Hypothesis Highly Alkaline Blue ]
2139
+ "#A59C94" => "Warm Grey", # Vibrant Green, Salmon, Sapphire Dark, Bland [ Hypothesis Slightly Acidic Grey ]
2140
+
2141
+ ### Synthesized From Synthetic Colors
2142
+ "#788a9a" => "Steel", # Faded Carolina Blue, Tan Green, Warm Grey, Dusky Blue [ Hypothesis Slightly Alkaline Medium Chromatic Blue ]
2143
+ "#415588" => "Dusky Blue Medium" # Genetically related to standard Dusky blue. Faded Carolina Blue, Tan Green, Warm Grey, Dusky Blue [ Hypothesis More Shaded Alkaline Blue ]
2144
+ }
2145
+
2146
+ print "Your translation: "
2147
+ print "#{translate} => #{dictionary[translate]}"
2148
+
2149
+ gets.chomp
2150
+ end
2151
+
2152
+ def self.detect_poison
2153
+ color_data = File.read("translation/input.txt").strip.to_s
2154
+
2155
+ ## Natural colors
2156
+ if color_data == "Salmon"; sleep(1.5); system("./salmonbasic.sh")
2157
+ elsif color_data == "Pale Salmon"; sleep(1.5); system("./palesalmon.sh")
2158
+ elsif color_data == "Salmon Pink"; sleep(1.5); system("./salmonpink.sh")
2159
+ elsif color_data == "Copper"; sleep(1.5); system("./cooper.sh")
2160
+ elsif color_data == "Japanese Bistre"; sleep(1.5); system("./japanesebistre.sh")
2161
+ elsif color_data == "Maize"; sleep(1.5); system("./maize.sh")
2162
+ elsif color_data == "Khaki"; sleep(1.5); system("./khaki.sh")
2163
+ elsif color_data == "Bland"; sleep(1.5); system("./bland.sh")
2164
+ elsif color_data == "Pale Lime"; sleep(1.5); system("./palelime.sh")
2165
+ elsif color_data == "Vibrant Green"; sleep(1.5); system("./vibrantgreen.sh")
2166
+ elsif color_data == "Medium Green"; sleep(1.5); system("./mediuemgreen.sh")
2167
+ elsif color_data == "Kelly Green"; sleep(1.5); system("./kellygreen.sh")
2168
+ elsif color_data == "Viridian"; sleep(1.5); system("./viridian.sh")
2169
+ elsif color_data == "Ultramarine"; sleep(1.5); system("./ultramarine.sh")
2170
+ elsif color_data == "Muted Sapphire"; sleep(1.5); system("./mutedsapphire.sh")
2171
+ elsif color_data == "Dark Sapphire"; sleep(1.5); system("./darksapphire.sh")
2172
+ elsif color_data == "Grey Blue"; sleep(1.5); system("./greyblue.sh")
2173
+ elsif color_data == "Dull Purple"; sleep(1.5); system("./dullpurple.sh")
2174
+ elsif color_data == "Light Mauve"; sleep(1.5); system("./lightmauve.sh")
2175
+ elsif color_data == "Dark Lavender"; sleep(1.5); system("./darklavender.sh")
2176
+ elsif color_data == "Atomic Hazel"; sleep(1.5); system("./atomichazel.sh")
2177
+
2178
+ ## Synthesized Colors
2179
+ elsif color_data == "Faded Carolina Blue"; sleep(1.5); system("./fadedcarolinablue.sh")
2180
+ elsif color_data == "Dusky Blue"; sleep(1.5); system("./duskyblue.sh")
2181
+
2182
+ ## Double Processed Synthesized Colors
2183
+
2184
+ else
2185
+ sleep(1.5)
2186
+
2187
+ puts ">> Either that's not a color, or no color information has yet been found."
2188
+ end
2189
+ end
2190
+ end
2191
+ end
2192
+
2193
+ require_relative "BequestBattleAISystems.rb"
2194
+
2195
+ module BequestEnemy
2196
+ class EnemyObserve
2197
+ def self.node_1
2198
+ BequestBattleAISystens::Enemy.observe_player_locations
2199
+ BequestBattleAISystens::Enemy.observe_player
2200
+ end
2201
+
2202
+ def self.node_2
2203
+ BequestBattleAISystens::Enemy.observe_player_locations
2204
+ BequestBattleAISystens::Enemy.observe_player
2205
+ end
2206
+
2207
+ def self.node_4
2208
+ BequestBattleAISystens::Enemy.observe_player_locations
2209
+ BequestBattleAISystens::Enemy.observe_player
2210
+ end
2211
+
2212
+ def self.node_8
2213
+ BequestBattleAISystens::Enemy.observe_player_locations
2214
+ BequestBattleAISystens::Enemy.observe_player
2215
+ end
2216
+
2217
+ def self.node_7
2218
+ BequestBattleAISystens::Enemy.observe_player_locations
2219
+ BequestBattleAISystens::Enemy.observe_player
2220
+ end
2221
+
2222
+ def self.node_5
2223
+ BequestBattleAISystens::Enemy.observe_player_locations
2224
+ BequestBattleAISystens::Enemy.observe_player
2225
+ end
2226
+
2227
+ def self.choose_node
2228
+ node_options = [
2229
+ [["node 1", "node 1"], ["node 1", "node 2"], ["node 1", "node 4"], ["node 1", "node 8"], ["node 1", "node 7"], ["node 1", "node 5"]],
2230
+ [["node 2", "node 1"], ["node 2", "node 2"], ["node 2", "node 4"], ["node 2", "node 8"], ["node 2", "node 7"], ["node 2", "node 5"]],
2231
+ [["node 4", "node 1"], ["node 4", "node 2"], ["node 4", "node 4"], ["node 4", "node 8"], ["node 4", "node 7"], ["node 4", "node 5"]],
2232
+ [["node 8", "node 1"], ["node 8", "node 2"], ["node 8", "node 4"], ["node 8", "node 8"], ["node 8", "node 7"], ["node 8", "node 5"]],
2233
+ [["node 7", "node 1"], ["node 7", "node 2"], ["node 7", "node 4"], ["node 7", "node 8"], ["node 7", "node 7"], ["node 7", "node 5"]],
2234
+ [["node 5", "node 1"], ["node 5", "node 2"], ["node 5", "node 4"], ["node 5", "node 8"], ["node 5", "node 7"], ["node 5", "node 5"]],
2235
+ ]
2236
+
2237
+ row_options = [0, 1, 2, 3, 4, 5]
2238
+ col_options = [0, 1, 2, 3, 4, 5]
2239
+ arr_options = [0, 1]
2240
+
2241
+ cur_row = row_options.sample
2242
+ cur_col = col_options.sample
2243
+ cur_arr = arr_options.sample
2244
+
2245
+ current_node = node_options[cur_row][cur_col][cur_arr]
2246
+
2247
+ if current_node == "node 1"; BequestEnemy::EnemyObserve.node_1
2248
+ elsif current_node == "node 2"; BequestEnemy::EnemyObserve.node_2
2249
+ elsif current_node == "node 4"; BequestEnemy::EnemyObserve.node_4
2250
+ elsif current_node == "node 8"; BequestEnemy::EnemyObserve.node_8
2251
+ elsif current_node == "node 7"; BequestEnemy::EnemyObserve.node_7
2252
+ elsif current_node == "node 5"; BequestEnemy::EnemyObserve.node_5
2253
+ end
2254
+ end
2255
+ end
2256
+
2257
+ class EnemyGuess
2258
+ def self.node_1
2259
+ BequestBattleAISystens::Enemy.guess_player_locations
2260
+ BequestBattleAISystens::Enemy.guess_player
2261
+ end
2262
+
2263
+ def self.node_2
2264
+ BequestBattleAISystens::Enemy.guess_player_locations
2265
+ BequestBattleAISystens::Enemy.guess_player
2266
+ end
2267
+
2268
+ def self.node_4
2269
+ BequestBattleAISystens::Enemy.guess_player_locations
2270
+ BequestBattleAISystens::Enemy.guess_player
2271
+ end
2272
+
2273
+ def self.node_8
2274
+ BequestBattleAISystens::Enemy.guess_player_locations
2275
+ BequestBattleAISystens::Enemy.guess_player
2276
+ end
2277
+
2278
+ def self.node_7
2279
+ BequestBattleAISystens::Enemy.guess_player_locations
2280
+ BequestBattleAISystens::Enemy.guess_player
2281
+ end
2282
+
2283
+ def self.node_5
2284
+ BequestBattleAISystens::Enemy.guess_player_locations
2285
+ BequestBattleAISystens::Enemy.guess_player
2286
+ end
2287
+
2288
+ def self.choose_node
2289
+ node_options = [
2290
+ [["node 1", "node 1"], ["node 1", "node 2"], ["node 1", "node 4"], ["node 1", "node 8"], ["node 1", "node 7"], ["node 1", "node 5"]],
2291
+ [["node 2", "node 1"], ["node 2", "node 2"], ["node 2", "node 4"], ["node 2", "node 8"], ["node 2", "node 7"], ["node 2", "node 5"]],
2292
+ [["node 4", "node 1"], ["node 4", "node 2"], ["node 4", "node 4"], ["node 4", "node 8"], ["node 4", "node 7"], ["node 4", "node 5"]],
2293
+ [["node 8", "node 1"], ["node 8", "node 2"], ["node 8", "node 4"], ["node 8", "node 8"], ["node 8", "node 7"], ["node 8", "node 5"]],
2294
+ [["node 7", "node 1"], ["node 7", "node 2"], ["node 7", "node 4"], ["node 7", "node 8"], ["node 7", "node 7"], ["node 7", "node 5"]],
2295
+ [["node 5", "node 1"], ["node 5", "node 2"], ["node 5", "node 4"], ["node 5", "node 8"], ["node 5", "node 7"], ["node 5", "node 5"]],
2296
+ ]
2297
+
2298
+ row_options = [0, 1, 2, 3, 4, 5]
2299
+ col_options = [0, 1, 2, 3, 4, 5]
2300
+ arr_options = [0, 1]
2301
+
2302
+ cur_row = row_options.sample
2303
+ cur_col = col_options.sample
2304
+ cur_arr = arr_options.sample
2305
+
2306
+ current_node = node_options[cur_row][cur_col][cur_arr]
2307
+
2308
+ if current_node == "node 1"; BequestEnemy::EnemyGuess.node_1
2309
+ elsif current_node == "node 2"; BequestEnemy::EnemyGuess.node_2
2310
+ elsif current_node == "node 4"; BequestEnemy::EnemyGuess.node_4
2311
+ elsif current_node == "node 8"; BequestEnemy::EnemyGuess.node_8
2312
+ elsif current_node == "node 7"; BequestEnemy::EnemyGuess.node_7
2313
+ elsif current_node == "node 5"; BequestEnemy::EnemyGuess.node_5
2314
+ end
2315
+ end
2316
+ end
2317
+ end
2318
+
2319
+ module BequestLineage
2320
+ class LunarCalender
2321
+ ######################################################################################
2322
+ # Lunar Calender #
2323
+ ######################################################################################
2324
+ # This establishes the basic mechanics of the Lunar Calender system that modifies #
2325
+ # the player's base metrics on what the current lunar phase, with it being more #
2326
+ # advised to switch to Bequest mechanics during the time they are weakest, then #
2327
+ # using the Gribatomaton for when the lunar phase when Bear Men and Kumabatto poses #
2328
+ # the least challenge to them. #
2329
+ # #
2330
+ # It remains to be seen whether this will continue to be relevant as I refine this #
2331
+ # this Bequest RPG framework. #
2332
+ ######################################################################################
2333
+
2334
+ def self.global_stats
2335
+ # Standard Operations
2336
+ $stalemates = 0 # Keeps track of how many stalemates
2337
+ $player_struck = 0 # Keeps track of how many times player hit the enemy.
2338
+ $enemy_struck = 0 # Keeps track of how many times enemy hit the player.
2339
+
2340
+ # Amount of days in a year.
2341
+ $current_day = 0
2342
+ $lunar_ticks = 30
2343
+
2344
+ ## Current Lunar Phase
2345
+ $current_phase = 0
2346
+
2347
+ # Yes or no spider
2348
+ $has_pet_spider = false
2349
+ end
2350
+
2351
+ def self.new_moon
2352
+ $player_sanity = 10 * $player_level
2353
+ $player_hp = 10 * $player_level
2354
+ $player_atk = 2 * $player_level
2355
+ $player_heal = 2 * $player_level
2356
+
2357
+ $enemy_hp = 2 * $enemy_level
2358
+ $enemy_atk = 10 * $enemy_level # player gets 5 damage when factoring in healing rate.
2359
+ end
2360
+
2361
+ def self.waxing_crescent
2362
+ $player_sanity = 9 * $player_level
2363
+ $player_hp = 9 * $player_level
2364
+ $player_atk = 2 * $player_level
2365
+ $player_heal = 2 * $player_level
2366
+
2367
+ $enemy_hp = 4 * $enemy_level
2368
+ $enemy_atk = 8 * $enemy_level # Player gets exactly 4 damage when factoring in healing rate as defence.
2369
+ end
2370
+
2371
+ def self.first_quarter
2372
+ $player_sanity = 7 * $player_level
2373
+ $player_hp = 7 * $player_level
2374
+ $player_atk = 2 * $player_level
2375
+ $player_heal = 2 * $player_level
2376
+
2377
+ $enemy_hp = 6 * $enemy_level
2378
+ $enemy_atk = 6 * $enemy_level # player gets 3 damage when factoring in healing rate.
2379
+ end
2380
+
2381
+ def self.waxing_gibbous
2382
+ $player_sanity = 6 * $player_level
2383
+ $player_hp = 6 * $player_level
2384
+ $player_atk = 2 * $player_level
2385
+ $player_heal = 2 * $player_level
2386
+
2387
+ $enemy_hp = 8 * $enemy_level
2388
+ $enemy_atk = 4 * $enemy_level # Player gets exactly 2 Damage when factoring in healing as defence.
2389
+ end
2390
+
2391
+ def self.full_moon
2392
+ $player_sanity = 4 * $player_level
2393
+ $player_hp = 4 * $player_level
2394
+ $player_atk = 2 * $player_level
2395
+ $player_heal = 2 * $player_level
2396
+
2397
+ $enemy_hp = 10 * $enemy_level
2398
+ $enemy_atk = 2 * $enemy_level # Player gets exactly 1 damage when factoring in healing rate as defence.
2399
+ end
2400
+
2401
+ def self.waning_gibbous
2402
+ $player_sanity = 6 * $player_level
2403
+ $player_hp = 6 * $player_level
2404
+ $player_atk = 2 * $player_level
2405
+ $player_heal = 2 * $player_level
2406
+
2407
+ $enemy_hp = 8 * $enemy_level
2408
+ $enemy_atk = 4 * $enemy_level # Player gets exactly 2 damage when factoring in healing as defence.
2409
+ end
2410
+
2411
+ def self.last_quarter
2412
+ $player_sanity = 7 * $player_level
2413
+ $player_hp = 7 * $player_level
2414
+ $player_atk = 2 * $player_level
2415
+
2416
+ $enemy_hp = 4 * $enemy_level
2417
+ $enemy_atk = 6 * $enemy_level # Player gets exactly 3 damage when factoring in healing as defence.
2418
+ end
2419
+
2420
+ def self.waning_crescent
2421
+ $player_sanity = 8 * $player_level
2422
+ $player_hp = 8 * $player_level
2423
+ $player_atk = 2 * $player_level
2424
+ $player_heal = 2 * $player_level # player gets exactly 4 damage when factoring in healing as defence.
2425
+
2426
+ $enemy_hp = 2 * $enemy_level
2427
+ $enemy_atk = 8 * $enemy_level
2428
+ end
2429
+
2430
+ def self.lunar_cycle
2431
+ lunar_phases = [0, 1, 2, 3, 4, 5, 6, 7]
2432
+
2433
+ # The current lunar phase mod 7
2434
+ current_phase = $current_phase % 7
2435
+ #$current_phase = $current_phase + 1 % 7
2436
+
2437
+ if current_phase == lunar_phases[0]
2438
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: New Moon. Réinitialisation des statistiques du joueur...\e[0m"
2439
+
2440
+ sleep(1)
2441
+
2442
+ Bequest::LunarCalender.new_moon
2443
+ elsif current_phase == lunar_phases[1]
2444
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waxing Gibbous. Réinitialisation des statistiques du joueur...\e[0m"
2445
+
2446
+ sleep(1)
2447
+
2448
+ Bequest::LunarCalender.waxing_crescent
2449
+ elsif current_phase == lunar_phases[2]
2450
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: First Quarter. Réinitialisation des statistiques du joueur...\e[0m"
2451
+
2452
+ sleep(1)
2453
+
2454
+ Bequest::LunarCalender.first_quarter
2455
+ elsif current_phase == lunar_phases[3]
2456
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waxing Gibbous. Réinitialisation des statistiques du joueur...\e[0m"
2457
+
2458
+ sleep(1)
2459
+
2460
+ Bequest::LunarCalender.waxing_gibbous
2461
+ elsif current_phase == lunar_phases[4]
2462
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Full_moon. Réinitialisation des statistiques du joueur...\e[0m"
2463
+
2464
+ sleep(1)
2465
+
2466
+ Bequest::LunarCalender.full_moon
2467
+ elsif current_phase == lunar_phases[5]
2468
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waning Gibbous. Réinitialisation des statistiques du joueur...\e[0m"
2469
+
2470
+ sleep(1)
2471
+
2472
+ Bequest::LunarCalender.waning_gibbous
2473
+ elsif current_phase == lunar_phases[6]
2474
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Last Quarter. Réinitialisation des statistiques du joueur...\e[0m"
2475
+
2476
+ sleep(1)
2477
+
2478
+ Bequest::LunarCalender.last_quarter
2479
+ elsif current_phase == lunar_phases[7]
2480
+ puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waning Crescent. Réinitialisation des statistiques du joueur...\e[0m"
2481
+
2482
+ sleep(1)
2483
+
2484
+ Bequest::LunarCalender.waning_crescent
2485
+ end
2486
+
2487
+ sleep(1.5)
2488
+ end
2489
+ end
2490
+
2491
+ end
2492
+
2493
+ class LineageSelection
2494
+ ######################################################################################
2495
+ # Lineage Based Character Selection #
2496
+ ######################################################################################
2497
+ # This aims to replace traditional methods of character selection, by basing name #
2498
+ # selection on what lineage in a family tree a character is desceded from. This #
2499
+ # lineage is based currently on people whom are descended from Hemato-Tomato, but #
2500
+ # will eventually include alternative timelines where Ehena-Marie wasn't executed #
2501
+ # by guillotine, or other scenarios like artificial descendants created in the #
2502
+ # artificial afterlife engine. #
2503
+ # #
2504
+ # This system is split between first generation, second generation, and third #
2505
+ # generation descendants, and also a theoretical generation that is artificially #
2506
+ # simulated inside of the afterlife engine. Verified descendants are named after #
2507
+ # French paintaers and musicians, while retaining the japanese traditional of having #
2508
+ # Tomato be the sir name. #
2509
+ ######################################################################################
2510
+
2511
+ def self.hemato_tomato
2512
+ # Confirmed second generational branch.
2513
+ second_generation = [
2514
+ [["Tomato-Chieko", "Tomato-Chieko"], ["Tomato-Chieko", "Tomato-Yoko"], ["Tomato-Chieko", "Tomato-Nori"]],
2515
+ [["Tomato-Yoko", "Tomato-Chieko"], ["Tomato-Yoko", "Tomato-Yoko"], ["Tomato-Yoko", "Tomato-Nori"]],
2516
+ [["Tomato Nori", "Tomato-Chieko"], ["Tomato-Nori", "Tomato-Yoko"], ["Tomato-Nori", "Tomato-Nori"]],
2517
+ ], [
2518
+ [[0.33, 0.33], [0.33, 0.33], [0.33, 0.33]],
2519
+ [[0.33, 0.33], [0.33, 0.33], [0.33, 0.33]],
2520
+ [[0.33, 0.33], [0.33, 0.33], [0.33, 0.33]],
2521
+ ]
2522
+
2523
+ ## Confirmed Third generational branches.
2524
+ third_generation_first_branch = [
2525
+ [["Tomato-Chairoscuro", "Tomato-Chairoscuro"], ["Tomato-Chairoscuro", "Tomato-Deco"], ["Tomato-Chairoscuro", "Tomato-Modernis"], ["Tomato-Chairscuro", "Tomato-Sepia"], ["Tomato-Chairoscuro", "Tomato-Brutalist"]],
2526
+ [["Tomato-Deco", "Tomato-Chairoscuro"], ["Tomato-Deco", "Tomato-Deco"], ["Tomato-Deco", "Tomato-Modernis"], ["Tomato-Deco", "Tomato-Sepia"], ["Tomato-Deco", "Tomato-Brutalist"]],
2527
+ [["Tomato-Modernis", "Tomato-Chairoscuro"], ["Tomato-Modernis", "Tomato-Deco"], ["Tomato-Modernis", "Tomato-Modernis"], ["Tomato-Modernis", "Tomato-Sepia"], ["Tomato-Modernis", "Tomato-Brutalist"]],
2528
+ [["Tomato-Sepia", "Tomato-Chairoscuro"], ["Tomato-Sepia", "Tomato-Deco"], ["Tomato-Sepia", "Tomato-Modernis"], ["Tomato-Sepia", "Tomato-Sepia"], ["Tomato-Sepia", "Tomato-Brutalist"]],
2529
+ [["Tomato-Brutalist", "Tomato-Chairoscuro"], ["Tomato-Brutalist", "Tomato-Deco"], ["Tomato-Brutalist", "Tomato-Modernis"], ["Tomato-Brutalist", "Tomato-Sepia"], ["Tomato-Brutalist", "Tomato-Brutalist"]],
2530
+ ], [
2531
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2532
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2533
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2534
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2535
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2536
+ ]
2537
+
2538
+ third_generation_second_branch = [
2539
+ [["Tomato-Eugenie", "Tomato-Eugenie"], ["Tomato-Eugenie", "Tomato-Marie"], ["Tomato-Eugenie", "Tomato-Anna"], ["Tomato-Eugenie", "Tomato-Pauline"], ["Tomato-Eugenie", "Tomato-Louise"]],
2540
+ [["Tomato-Marie", "Tomato-Eugenie"], ["Tomato-Marie", "Tomato-Marie"], ["Tomato-Marie", "Tomato-Anna"], ["Tomato-Marie", "Tomato-Pauline"], ["Tomato-Marie", "Tomato-Louise"]],
2541
+ [["Tomato-Anna", "Tomato-Eugenie"], ["Tomato-Anna", "Tomato-Marie"], ["Tomato-Anna", "Tomato-Anna"], ["Tomato-Anna", "Tomato-Pauline"], ["Tomato-Anna", "Tomato-Louise"]],
2542
+ [["Tomato-Pauline", "Tomato-Eugenie"], ["Tomato-Pauline", "Tomato-Marie"], ["Tomato-Pauline", "Tomato-Anna"], ["Tomato-Pauline", "Tomato-Pauline"], ["Tomato-Pauline", "Tomato-Louise"]],
2543
+ [["Tomato-Louise", "Tomato-Eugenie"], ["Tomato-Louise", "Tomato-Marie"], ["Tomato-Louise", "Tomato-Anna"], ["Tomato-Louise", "Tomato-Pauline"], ["Tomato-Louise", "Tomato-Louise"]],
2544
+ ], [
2545
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2546
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2547
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2548
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2549
+ [[0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2], [0.2, 0.2]],
2550
+ ]
2551
+
2552
+ ## Second Generational Data
2553
+ second_gen_names = second_generation[0]
2554
+ second_gen_probabilities = second_generation[1]
2555
+
2556
+ ## Third Generational Data
2557
+ third_gen_names_fb = third_generation_first_branch[0]
2558
+ third_gen_probabilities_fb = third_generation_first_branch[1]
2559
+
2560
+ third_gen_names_sb = third_generation_second_branch[0]
2561
+ third_gen_probabilities_sb = third_generation_second_branch[1]
2562
+
2563
+ what_generation = [0, 1]
2564
+
2565
+ choose_generation = what_generation.sample
2566
+
2567
+ # Chooses a name based on a random lineage from Hemato-Tomato.
2568
+ if 0 == choose_generation
2569
+ ### Character Selection
2570
+ row_options = [0, 1, 2]]
2571
+ col_options = [0, 1, 2]
2572
+ arr_options = [0, 1]
2573
+
2574
+ cur_row = row_options.sample
2575
+ cur_col = col_options.sample
2576
+ cur_arr = arr_options.sample
2577
+
2578
+ $player_name == second_gen_names[cur_row][cur_col][cur_arr]
2579
+ elsif 1 == choose_generation
2580
+ ### Character Selection
2581
+ row_options = [0, 1, 2, 3, 4]
2582
+ col_options = [0, 1, 2, 3, 4]
2583
+ arr_options = [0, 1]
2584
+
2585
+ cur_row = row_options.sample
2586
+ cur_col = col_options.sample
2587
+ cur_arr = arr_options.sample
2588
+
2589
+ what_branch = [0, 1]
2590
+
2591
+ chosen_branch = what_branch.sample
2592
+
2593
+ if chosen_branch == 0
2594
+ $player_name == third_gen_names_fb[cur_row][cur_col][cur_arr]
2595
+ elsif chosen_branch == 1
2596
+ $player_name == third_gen_names_sb[cur_row][cur_col][cur_arr]
2597
+ else
2598
+ $player_name == third_gen_names_fb[cur_row][cur_col][cur_arr]
2599
+ end
2600
+ else
2601
+ $player_name == second_gen_names[cur_row][cur_col][cur_arr]
2602
+ end
2603
+ end
2604
+
2605
+ def self.ehena_marie
2606
+ ### Character Selection
2607
+ row_options = [0, 1]
2608
+ col_options = [0, 1]
2609
+ arr_options = [0, 1]
2610
+
2611
+ cur_row = row_options.sample
2612
+ cur_col = col_options.sample
2613
+ cur_arr = arr_options.sample
2614
+
2615
+ ## Theoretical third generational branch.
2616
+ third_generation_theoretical = [
2617
+ [["Tomato Anna-Marie", "Tomato Anna-Marie"], ["Tomato Anna-Marie", "Tomato Annette-Marie"]],
2618
+ [["Tomato Annette-Marie", "Tomato Annette-Marie"], ["Tomato Annette-Marie", "Tomato Annette-Marie"]],
2619
+ ], [
2620
+ [[0.5, 0.5], [0.5, 0.5]],
2621
+ [[0.5, 0.5], [0.5, 0.5]],
2622
+ ]
2623
+
2624
+ ## Third Generational Data
2625
+ third_gen_names_th = third_generation_theoretical[0]
2626
+ third_gen_probabilities_th = third_generation_theoratical[1]
2627
+
2628
+
2629
+ end
2630
+
2631
+ def self.choose_name
2632
+ context_node = [
2633
+ "United States",
2634
+ "Guillotine Dynasty",
2635
+ "They are the American family that inherited the job of using the guillotine from the French dynasty of executioners.",
2636
+ "1793-1981", "2017-2045" ]
2637
+
2638
+ # Confirmed first generation.
2639
+ first_generation = [
2640
+ [["Hemato-Tomato", "Hemato-Tomato"], ["Hemato-Tomato", "Ehena-Marie"]],
2641
+ [["Ehena-Marie", "Ehena-Marie"], ["Ehena-Marie", "Hemato-Tomato"]],
2642
+ ], [
2643
+ [[0.5, 0.5], [0.5, 0.5]],
2644
+ [[0.5, 0.5], [0.5, 0.5]],
2645
+ ]
2646
+
2647
+ ## Context Data
2648
+ location = context_node[0]
2649
+ occupation = context_node[1]
2650
+ job_description = context_node[2]
2651
+ previous_activity = context_node[3]
2652
+ current_activity = context_node[4]
2653
+
2654
+ puts " The curent location of #{occupation} is the #{location}. #{job_description} The previous family they inherited from operated between #{previous_activity}. The current #{occupation} operated in the years #{current_activity}."
2655
+
2656
+ ## First Generational Data
2657
+ first_gen_names = first_generation[0]
2658
+ first_gen_probabilities = first_generation[1]
2659
+
2660
+ ### Character Selection
2661
+ row_options = [0, 1]
2662
+ col_options = [0, 1]
2663
+ arr_options = [0, 1]
2664
+
2665
+ cur_row = row_options.sample
2666
+ cur_col = col_options.sample
2667
+ cur_arr = arr_options.sample
2668
+
2669
+ first_gen_name = first_gen_names[cur_row][cur_col][cur_arr]
2670
+ first_gen_probability = first_gen_probabilities[cur_row][cur_col][cur_arr]
2671
+
2672
+ print " You start your journey as: #{first_gen_name}. "
2673
+
2674
+ if first_gen_name == "Hemato-Tomato"; puts " Your girlfriend had been Ehena-Marie, who was executed by guillotine. [ #{first_gen_name}, #{first_gen_probability} ]"
2675
+
2676
+ hemato_tomato
2677
+ elsif first_gen_name == "Ehena-Marie"; puts " Your lover had been Hemato-Tomato, and the guillotine blade drips with blood from your beheading. [ #{first_gen_name}, #{first_gen_probability} ]"
2678
+
2679
+ BequestLineage::LineageSelection.ehena_marie
2680
+ else
2681
+ BequestLineage::LineageSelection.hemato_tomato
2682
+ end
2683
+ end
2684
+ end
2685
+
2686
+ class Player
2687
+ ######################################################################################
2688
+ # Changes From Yumemoire #
2689
+ ######################################################################################
2690
+ # This game framework establishes the base player stats, and tracks how many times #
2691
+ # a player has lured, stunned, or trapped a monster whose name is procedurally #
2692
+ # generated from random magical element based on the fantasy language that I am #
2693
+ # developing. In the graphical edition that will be also include the traditional #
2694
+ # color palette that diverges from traditional Japanese colors, with more of a focus #
2695
+ # on colors you're likely to encounter on pirate ships. #
2696
+ # #
2697
+ # The elemental weakness chart keeps track of elemental names, the immunity label #
2698
+ # and a ranged probability metric that tracks how immune or susceptible a monster #
2699
+ # is to a specific element. The eventual aims is more nuanced range between immunity #
2700
+ # and susceptibility to different magical elements you will run across. #
2701
+ # #
2702
+ # This text adventure operates on a text parser based system that splits parser #
2703
+ # functionality into three sections: lure, stun, and trap. Eventually I will also #
2704
+ # include parser mechanics for things like applying first aid. #
2705
+ ######################################################################################
2706
+
2707
+ def self.initialize
2708
+ $lures = 0 # How many times you've lured a monster.
2709
+ $stuns = 0 # How many times you've stunned a monster.
2710
+ $traps = 0 # How many times a monster was lured into a trap.
2711
+ end
2712
+
2713
+ ######################################################################################
2714
+ # Procedurally Generated Quips #
2715
+ ######################################################################################
2716
+ # This is for non scripted dialogue events that emerge in situations where the #
2717
+ # character the player controls is not actively in a story events, but you want to #
2718
+ # have realistic sounding French language based on the way that Francais is actually #
2719
+ # spoken in Quebec, Paris, and other places. #
2720
+ # #
2721
+ # When I eventually include statistic models, I may end up needing to roll my own #
2722
+ # statistical systems as most systems out there aren't really design with the idea #
2723
+ # of combining decision trees and naive bayes: which is basically 3D arrays that #
2724
+ # produce networks of symbols, labels, and probabilities. You're not likely to #
2725
+ # encounter these in the game itself. #
2726
+ ######################################################################################
2727
+
2728
+ def self.contrastive
2729
+ ## The Call
2730
+ ## la pomme la banane le granit
2731
+ ## la pomme p,p p,b p,g
2732
+ ## la banane b,p b,b b,g
2733
+ ## le grenit g,p g,b g,g
2734
+
2735
+ gendered_nouns_set1 = [
2736
+ [["Cette pomme", "Cette pomme"], ["Cette pomme", "Cette banane"], ["Cette pomme", "Cette granit"]],
2737
+ [["Cette banane", "Cette pomme"], ["Cette banane", "Cette banane"], ["Cette banane", "Cette granit"]],
2738
+ [["Cette granit", "Cette pomme"], ["Cette granit", "Cette banane"], ["Cette granit", "Cette granit"]],
2739
+ ]
2740
+
2741
+ gns1_row_options = [0, 1, 2]
2742
+ gns1_col_options = [0, 1, 2]
2743
+ gns1_arr_options = [0, 1]
2744
+
2745
+ gns1_cur_row = gns1_row_options.sample
2746
+ gns1_cur_col = gns1_col_options.sample
2747
+ gns1_cur_arr = gns1_arr_options.sample
2748
+
2749
+ gns1 = gendered_nouns_set1[gns1_cur_row][gns1_cur_col][gns1_cur_arr]
2750
+
2751
+ # rouge jaune violet
2752
+ # rouge r,r r,j r,v
2753
+ # jaune j,r j,j j,v
2754
+ # violet v,r v,j v,v
2755
+
2756
+ adjectives_set1 = [
2757
+ [["rouge", "rouge"], ["rouge", "jaune"], ["rouge", "violet"]],
2758
+ [["jaune", "rouge"], ["jaune", "jaune"], ["jaune", "violet"]],
2759
+ [["violet", "rouge"], ["violet", "jaune"], ["violet", "violet"]],
2760
+ ]
2761
+
2762
+ as1_row_options = [0, 1, 2]
2763
+ as1_col_options = [0, 1, 2]
2764
+ as1_arr_options = [0, 1]
2765
+
2766
+ as1_cur_row = as1_row_options.sample
2767
+ as1_cur_col = as1_col_options.sample
2768
+ as1_cur_arr = as1_arr_options.sample
2769
+
2770
+ as1 = adjectives_set1[as1_cur_row][as1_cur_col][as1_cur_arr]
2771
+
2772
+ # je mange je ne mange je jute je ne jute
2773
+ # je mange jm, jm jm, jnm jm, jj jm,jnj
2774
+ # je ne mange jnm, jm jnm, jnm jnm, jj jnm, jnj
2775
+ # je jute jj, jm jj, jnm jj, jj jj, jnj
2776
+ # je ne jute jnj, jm jnj, jnm jnj, jj jnj, jnj
2777
+
2778
+ subjective_verbs_set1 = [
2779
+ [ ["Je mange", "Je mange"], ["Je mange", "Je ne mange"], ["Je mange", "Je jute"], ["Je mange", "Je ne jute"]],
2780
+ [ ["Je ne mange", "Je mange"], ["Je ne mange", "Je ne mange"], ["Je ne mange", "Je jute"], ["Je ne mange", "Je ne jute"]],
2781
+ [ ["Je jute", "Je mange"], ["Je jute", "Je ne mange"], ["Je jute", "Je jute"], ["Je jute", "Je ne jute"]],
2782
+ [ ["Je ne jute", "Je mange"], ["Je ne jute", "Je ne mange"], ["Je ne jute", "Je jute"], ["Je ne jute", "Je ne jute"]],
2783
+ ]
2784
+
2785
+ svs1_row_options = [0, 1, 2, 3]
2786
+ svs1_col_options = [0, 1, 2, 3]
2787
+ svs1_arr_options = [0, 1]
2788
+
2789
+ svs1_cur_row = svs1_row_options.sample
2790
+ svs1_cur_col = svs1_col_options.sample
2791
+ svs1_cur_arr = svs1_arr_options.sample
2792
+
2793
+ svs1 = subjective_verbs_set1[svs1_cur_row][svs1_cur_col][svs1_cur_arr]
2794
+
2795
+ # lentiment quicely
2796
+ # lentement l,l l,q
2797
+ # quicely q,l q,q
2798
+
2799
+ adverb_punctuation_set1 = [
2800
+ [["lentement,", "lentement,"], ["lentement,", "quicely,"]],
2801
+ [["quicely,", "lentement,"], ["quicely,", "quicely,"]],
2802
+ ]
2803
+
2804
+ aps1_row_options = [0, 1]
2805
+ aps1_col_options = [0, 1]
2806
+ aps1_arr_options = [0, 1]
2807
+
2808
+ aps1_cur_row = aps1_row_options.sample
2809
+ aps1_cur_col = aps1_col_options.sample
2810
+ aps1_cur_arr = aps1_arr_options.sample
2811
+
2812
+ aps1 = adverb_punctuation_set1[aps1_cur_row][aps1_cur_col][aps1_cur_arr]
2813
+
2814
+ #contrastive_set1 = [
2815
+ #]
2816
+
2817
+ ## The Responce
2818
+ gendered_nouns_set2 = [
2819
+ [["mais cette pomme", "mais cette pomme"], ["mais cette pomme", "mais cette banane"], ["mais cette pomme", "mais cette granit"]],
2820
+ [["mais cette la banane", "mais cette la pomme"], ["mais cette banane", "mais cette banane"], ["mais cette banane", "mais cette granit"]],
2821
+ [["mais cette le granit", "mais cette la pomme"], ["mais cette granit", "mais cette banane"], ["mais cette granit", "mais cette granit"]],
2822
+ ]
2823
+
2824
+ gns2_row_options = [0, 1, 2]
2825
+ gns2_col_options = [0, 1, 2]
2826
+ gns2_arr_options = [0, 1]
2827
+
2828
+ gns2_cur_row = gns2_row_options.sample
2829
+ gns2_cur_col = gns2_col_options.sample
2830
+ gns2_cur_arr = gns2_arr_options.sample
2831
+
2832
+ gns2 = gendered_nouns_set2[gns2_cur_row][gns2_cur_col][gns2_cur_arr]
2833
+
2834
+ adjectives_set2 = [
2835
+ [["rouge", "rouge"], ["rouge", "jaune"], ["rouge", "violet"]],
2836
+ [["jaune", "rouge"], ["jaune", "jaune"], ["jaune", "violet"]],
2837
+ [["violet", "rouge"], ["violet", "jaune"], ["violet", "violet"]],
2838
+ ]
2839
+
2840
+ as2_row_options = [0, 1, 2]
2841
+ as2_col_options = [0, 1, 2]
2842
+ as2_arr_options = [0, 1]
2843
+
2844
+ as2_cur_row = as2_row_options.sample
2845
+ as2_cur_col = as2_col_options.sample
2846
+ as2_cur_arr = as2_arr_options.sample
2847
+
2848
+ as2 = adjectives_set2[as2_cur_row][as2_cur_col][as2_cur_arr]
2849
+
2850
+ subjective_verbs_set2 = [
2851
+ [["Je mange", "Je mange"], ["Je mange", "Je ne mange"], ["Je mange", "Je jute"], ["Je mange", "Je ne jute"]],
2852
+ [["Je ne mange", "Je mange"], ["Je ne mange", "Je ne mange"], ["Je ne mange", "Je jute"], ["Je ne mange", "Je ne jute"]],
2853
+ [["Je jute", "Je mange"], ["Je jute", "Je ne mange"], ["Je jute", "Je jute"], ["Je jute", "Je ne jute"]],
2854
+ [["Je ne jute", "Je mange"], ["Je ne jute", "Je ne mange"], ["Je ne jute", "Je jute"], ["Je ne jute", "Je ne jute"]],
2855
+ ]
2856
+
2857
+ svs2_row_options = [0, 1, 2, 3]
2858
+ svs2_col_options = [0, 1, 2, 3]
2859
+ svs2_arr_options = [0, 1]
2860
+
2861
+ svs2_cur_row = svs2_row_options.sample
2862
+ svs2_cur_col = svs2_col_options.sample
2863
+ svs2_cur_arr = svs2_arr_options.sample
2864
+
2865
+ svs2 = subjective_verbs_set2[svs2_cur_row][svs2_cur_col][svs2_cur_arr]
2866
+
2867
+ adverb_punctuation_set2 = [
2868
+ [["lentement.", "lentement."], ["lentement.", "quicely."]],
2869
+ [["quicely.", "lentement."], ["quicely.", "quicely."]],
2870
+ ]
2871
+
2872
+ aps2_row_options = [0, 1]
2873
+ aps2_col_options = [0, 1]
2874
+ aps2_arr_options = [0, 1]
2875
+
2876
+ aps2_cur_row = aps2_row_options.sample
2877
+ aps2_cur_col = aps2_col_options.sample
2878
+ aps2_cur_arr = aps2_arr_options.sample
2879
+
2880
+ aps2 = adverb_punctuation_set2[aps2_cur_row][aps2_cur_col][aps2_cur_arr]
2881
+
2882
+ ## Generates the actual training data.
2883
+ phrase = "#{gns1} #{as1} #{svs1} #{aps1} #{gns2} #{as2} #{svs2} #{aps2}"
2884
+
2885
+ print ">> "
2886
+ puts phrase
2887
+ end
2888
+
2889
+ def self.standard
2890
+ # le la les
2891
+ # le le, le le, la le, les
2892
+ # la la, le la, la la, les
2893
+ # les les, le les, la les, les
2894
+
2895
+ # pomme orange banane
2896
+ # pomme p,p p,o p,b
2897
+ # orange o,p o,o o,b
2898
+ # banane b,p b,o b,b
2899
+
2900
+ # rouge orange jaune
2901
+ # rouge r,r r,o r,j
2902
+ # orange o,r o,o o,j
2903
+ # jaune j,r j,o j,j
2904
+
2905
+ # es es ne
2906
+ # es es, es es, es ne
2907
+ # es ne es ne, es es ne, es ne
2908
+
2909
+ # mange jete
2910
+ # mange m,m m,j
2911
+ # jete j,m j,j
2912
+
2913
+ possible_word_classes = [
2914
+ [ ["Le", "Le"], ["Le", "La"], ["Le", "Les"] ],
2915
+ [ ["La", "Le"], ["La", "La"], ["La", "Les"] ],
2916
+ [ ["Les", "Le"], ["Les", "La"], ["Les", "Les"] ],
2917
+ ]
2918
+
2919
+ possible_classified_nouns = [
2920
+ [ ["pomme", "pomme"], ["pomme", "orange"], ["pomme", "banane"] ],
2921
+ [ ["orange", "pomme"], ["orange", "orange"], ["orange", "banane"] ],
2922
+ [ ["banane", "pomme"], ["banane", "orange"], ["banane", "banane"] ],
2923
+ ]
2924
+
2925
+ possible_adjectives = [
2926
+ [ ["rouge", "rouge"], ["rouge", "orange"], ["rouge", "jaune"] ],
2927
+ [ ["orange", "rouge"], ["orange", "orange"], ["orange", "jaune"] ],
2928
+ [ ["jaune", "rouge"], ["jaune", "orange"], ["jaune", "jaune"] ],
2929
+ ]
2930
+
2931
+ possible_subjects = [
2932
+ [["es", "es"], ["es", "es ne"]],
2933
+ [["es ne", "es"], ["es ne", "es ne"]],
2934
+ ]
2935
+
2936
+ possible_verbs = [
2937
+ [["mange", "mange"], ["mange", "jete"]],
2938
+ [["jete", "mange"], ["jete", "jete"]],
2939
+ ]
2940
+
2941
+ ## Effects what class noun and adjective is chosen.
2942
+ row_class_noun_adjective = [0, 1, 2]
2943
+ col_class_noun_adjective = [0, 1, 2]
2944
+ arr_class_noun_adjective = [0, 1]
2945
+
2946
+ cur_row_class_noun_adjective = row_class_noun_adjective.sample
2947
+ cur_col_class_noun_adjective = col_class_noun_adjective.sample
2948
+ cur_arr_class_noun_adjective = arr_class_noun_adjective.sample
2949
+
2950
+ word_class = possible_word_classes[cur_row_class_noun_adjective][cur_col_class_noun_adjective][cur_arr_class_noun_adjective]
2951
+ classified_nouns = possible_classified_nouns[cur_row_class_noun_adjective][cur_col_class_noun_adjective][cur_arr_class_noun_adjective]
2952
+ adjectives = possible_adjectives[cur_row_class_noun_adjective][cur_col_class_noun_adjective][cur_arr_class_noun_adjective]
2953
+
2954
+ ## Effects what subject and verb is chosen.
2955
+ row_subject_verb = [0, 1]
2956
+ col_subject_verb = [0, 1]
2957
+ arr_subject_verb = [0, 1]
2958
+
2959
+ cur_row_subject_verb = row_subject_verb.sample
2960
+ cur_col_subject_verb = col_subject_verb.sample
2961
+ cur_arr_subject_verb = arr_subject_verb.sample
2962
+
2963
+ subjects = possible_subjects[cur_row_subject_verb][cur_col_subject_verb][cur_arr_subject_verb]
2964
+ verbs = possible_verbs[cur_row_subject_verb][cur_col_subject_verb][cur_arr_subject_verb]
2965
+
2966
+ phrase = ">> #{word_class} #{classified_nouns} #{adjectives} #{subjects} #{verbs}."
2967
+
2968
+ print ">> "
2969
+ puts phrase
2970
+ end
2971
+
2972
+
2973
+ # The main text parser the presents enemy weakness statistics and battle mechanics.
2974
+ def self.parser
2975
+ system("clear")
2976
+
2977
+ loop do
2978
+ if $lunar_ticks == 30
2979
+ lunar_cycle
2980
+
2981
+ # Resets lunar ticks after phase shift.
2982
+ $lunar_ticks = 0
2983
+ else
2984
+ $lunar_ticks = $lunar_ticks + 1
2985
+ end
2986
+
2987
+ ## Element Immunity Probability
2988
+ elemental_weakness = [
2989
+ [ "Ea", "Immune", 0.330 ],
2990
+ [ "Ea", "Almost Immune", 0.405 ],
2991
+ [ "Ea", "Less Susceptible", 0.480 ],
2992
+ [ "Ea", "More Susceptible", 0.575 ],
2993
+ [ "Ea", "Weak", 0.670 ],
2994
+ ], [
2995
+ [ "Denki", "Immune", 0.330 ],
2996
+ [ "Denki", "Almost Immune", 0.405 ],
2997
+ [ "Denki", "Less Susceptible", 0.480 ],
2998
+ [ "Denki", "More Susceptible", 0.575 ],
2999
+ [ "Denki", "Weak", 0.670 ],
3000
+ ], [
3001
+ [ "Kaiyo", "Immune", 0.330 ],
3002
+ [ "Kaiyo", "Almost Immune", 0.405 ],
3003
+ [ "Kaiyo", "Less Susceptible", 0.480 ],
3004
+ [ "Kaiyo", "More Susceptible", 0.575 ],
3005
+ [ "Kaiyo", "Weak", 0.670 ],
3006
+ ], [
3007
+ [ "Tsuchi", "Immune", 0.330 ],
3008
+ [ "Tsuchi", "Almost Immune", 0.405 ],
3009
+ [ "Tsuchi", "Less Susceptible", 0.480 ],
3010
+ [ "Tsuchi", "More Susceptible", 0.575 ],
3011
+ [ "Tsuchi", "Weak", 0.670 ],
3012
+ ], [
3013
+ [ "Tenchi", "Immune", 0.330 ],
3014
+ [ "Tenchi", "Almost Immune", 0.405 ],
3015
+ [ "Tenchi", "Less Susceptible", 0.480 ],
3016
+ [ "Tenchi", "More Susceptible", 0.575 ],
3017
+ [ "Tenchi", "Weak", 0.670 ],
3018
+ ], [
3019
+ [ "Shi", "Immune", 0.330 ],
3020
+ [ "Shi", "Almost Immune", 0.405 ],
3021
+ [ "Shi", "Less Susceptible", 0.480 ],
3022
+ [ "Shi", "More Susceptible", 0.575 ],
3023
+ [ "Shi", "Weak", 0.670 ],
3024
+ ]
3025
+
3026
+ monster_name_elements = $current_monster_name.split(" ")
3027
+
3028
+ if $player_hp < 1
3029
+ sleep(1.5)
3030
+
3031
+ puts "You became to exhausted to continue."
3032
+ abort
3033
+ end
3034
+
3035
+ airborn = elemental_weakness[0] # Air
3036
+ electric = elemental_weakness[1] # Fire / Electricity
3037
+ heavenly = elemental_weakness[3] # Heaven
3038
+ earthen = elemental_weakness[4] # Earth
3039
+ recovery = elemental_weakness[2] # Recovery
3040
+ corruption = elemental_weakness[5] # Corruption
3041
+
3042
+ #Bequest::Enemy.familiarity
3043
+
3044
+ # Get monster element name, immunity factor, immunity probability, and elemental weakness its strength in number.
3045
+ if monster_name_elements[1] == "Ea"; puts "\n#{airborn[0][0]}: #{airborn[0][1]} #{airborn[0][2]} #{earthen[0][0]}: #{earthen[4][1]} #{earthen[4][2]}"
3046
+ elsif monster_name_elements[1] == "Denki"; puts "\n#{electric[0][0]}: #{electric[0][1]} #{electric[0][2]} #{airborn[0][0]}: #{airborn[4][1]} #{airborn[4][2]}"
3047
+ elsif monster_name_elements[1] == "Kaiyo"; puts "\n#{recovery[0][0]}: #{recovery[0][1]} #{covery[0][2]} #{corruption[0][0]}: #{corruption[4][1]} #{corruption[4][2]}"
3048
+ elsif monster_name_elements[1] == "Tsuchi"; puts "\n#{heavenly[0][0]}: #{heavenly[0][1]} #{heavenly[0][2]} #{airborn[0][0]}: #{airborn[4][1]} #{airborn[4][2]}"
3049
+ elsif monster_name_elements[1] == "Tenchi"; puts "\n#{earthen[0][0]}: #{earthen[0][1]} #{earthen[0][2]} #{electric[0][0]}: #{electric[4][1]} #{electric[4][2]}"
3050
+ elsif monster_name_elements[1] == "Shi"; puts "\n#{corruption[0][0]}: #{corruption[0][1]} #{corruption[0][2]} #{heavenly[0][0]}: #{heavenly[4][1]} #{heavenly[4][2]}"
3051
+ else
3052
+ puts "Unrecognized entity."
3053
+ end
3054
+
3055
+ parsers = {
3056
+ "Ruaproie" => "#{$current_monster_name}",
3057
+ "#{$current_monster_name}" => "es ruaproie a toi.",
3058
+ }, {
3059
+ "Kantan ni eblouir" => "#{$current_monster_name}",
3060
+ "#{$current_monster_name}" => "es kantan ni eblouir par toi.",
3061
+ }, {
3062
+ "Mortorrapu" => "#{$current_monster_name}",
3063
+ "#{$current_monster_name}" => "es mortorrapu par toi.",
3064
+ }
3065
+
3066
+ puts "ACTION ANTERIEURE"
3067
+ puts "\n[ Ruaproie #{$lures} ][ Kantan ni eblouir #{$stuns} ][ Mortorrapu #{$traps} ]"
3068
+
3069
+ print "Regarder par: #{$current_monster_name}, bokette? << "
3070
+
3071
+ @action = gets.chomp
3072
+
3073
+ if @action == "Ruaproie"
3074
+ print parsers[0]["Ruaproie"]
3075
+ print " "
3076
+ print parsers[0][$current_monster_name]
3077
+
3078
+ $lures = $lures + 1
3079
+
3080
+ print $current_monster_name
3081
+ print " "
3082
+ Bequest::Enemy.lure_enemy
3083
+ elsif @action == "Eblouir"
3084
+ print parsers[1]["Eblouir"]
3085
+ print " "
3086
+ print parsers[1][$current_monster_name]
3087
+
3088
+ $stuns = $stuns + 1
3089
+
3090
+ print $current_monster_name
3091
+ print " "
3092
+ Bequest::Enemy.stun_enemy
3093
+ elsif @action == "Plege"
3094
+ print parsers[2]["Plege"]
3095
+ print " "
3096
+ print parsers[2][$current_monster_name]
3097
+
3098
+ $traps = $traps + 1
3099
+
3100
+ print $current_monster_name
3101
+ print " "
3102
+ Bequest::Enemy.trap_enemy
3103
+ else
3104
+ puts ">> Your action is not recognized."
3105
+ end
3106
+ end
3107
+
3108
+ def self.quip_contrastive
3109
+ Bequest::Language.contrastive
3110
+ end
3111
+
3112
+ def self.quip_standard
3113
+ Bequest::Language.standard
3114
+ end
3115
+
3116
+ def self.quip
3117
+ # standard contrastive
3118
+ # standard s,s s,c
3119
+ # contrastive c,s c,c
3120
+
3121
+ formats = [
3122
+ [["standard", "standard"], ["standard", "contrastive"]],
3123
+ [["contrastive", "standard"], ["contrastive", "contrastive"]],
3124
+ ]
3125
+
3126
+ row_options = [0, 1]
3127
+ col_options = [0, 1]
3128
+ arr_options = [0, 1]
3129
+
3130
+ cur_row = row_options.sample
3131
+ cur_col = col_options.sample
3132
+ cur_arr = arr_options.sample
3133
+
3134
+ current_format = formats[cur_row][cur_col][cur_arr]
3135
+
3136
+ if current_format == "standard"; Bequest::Language.contrastive
3137
+ elsif current_format == "contrastive"; Bequest::Language.standard
3138
+ else
3139
+ Bequest::Language.standard
3140
+ end
3141
+ end
3142
+ end
3143
+ end
3144
+
3145
+ class Enemy
3146
+ def self.monster_name
3147
+ #def self.five_elements
3148
+ possible_elements = File.readlines("lib/beastiary/monsternames/elements.txt")
3149
+
3150
+ $chosen_element = possible_elements.sample.strip.to_s
3151
+ #end
3152
+
3153
+ #def self.adjectives
3154
+ possible_adjectives = File.readlines("lib/beastiary/monsternames/gendered_adverb.txt")
3155
+
3156
+ $chosen_adjective = possible_adjectives.sample.strip.to_s
3157
+ #end
3158
+
3159
+ #Bequest::Enemy.monster_name.five_elements
3160
+ #Bequest::Enemy.monster_name.adjectives
3161
+
3162
+ $current_monster_name = "#{$chosen_element} #{$chosen_adjective}"
3163
+
3164
+ File.open("lib/previous/enemy.txt", "w") { |f|
3165
+ f.puts $current_monster_name
3166
+ }
3167
+ end
3168
+
3169
+ # If the previous enemy encountered matches one you've dueled before, it quips about not continuing to run into them.
3170
+ def self.familiarity
3171
+ previous_enemy = File.read("lib/previous/enemy.txt")
3172
+
3173
+ name_list = File.readlines("lib/rendered/enemies.txt")
3174
+ size_limit = name_list.size.to_i
3175
+ index = 0
3176
+
3177
+ size_limit.times do
3178
+ current_enemy = name_list[index]
3179
+
3180
+ if current_enemy == previous_enemy
3181
+ puts "<< We have to stop running into each other."
3182
+ else
3183
+ puts "<< I don't believe we've met."
3184
+ end
3185
+
3186
+ index = index + 1
3187
+
3188
+ sleep(0.5)
3189
+ end
3190
+ end
3191
+
3192
+ def self.lure_enemy
3193
+ # true false
3194
+ # true t,t t,f
3195
+ # false f,t f,f
3196
+
3197
+ active_state = [
3198
+ [[true, true], [true, false]],
3199
+ [[false, true], [false, false]],
3200
+ ]
3201
+
3202
+ row_options = [0, 1]
3203
+ col_options = [0, 1]
3204
+ arr_options = [0, 1]
3205
+
3206
+ cur_row = row_options.sample
3207
+ cur_col = col_options.sample
3208
+ cur_arr = arr_options.sample
3209
+
3210
+ lure_status = active_state[cur_row][cur_col][cur_arr]
3211
+
3212
+ if false == lure_status
3213
+ puts "did not manage to spot you."
3214
+ elsif true == lure_status
3215
+ puts "managed to spot you."
3216
+
3217
+ enemy_hit = ["hit", "miss"]
3218
+
3219
+ current_strike = enemy_hit.sample
3220
+
3221
+ if current_strike == "hit"
3222
+ puts ">> You were struck by the aggressor."
3223
+ $player_hp = $player_hp - 2
3224
+ elsif current_strike == "miss"
3225
+ puts ">> You managed to avoid being struck."
3226
+ end
3227
+ end
3228
+ end
3229
+
3230
+ def self.stun_enemy
3231
+ # true false
3232
+ # true t,t t,f
3233
+ # false f,t f,f
3234
+
3235
+ active_state = [
3236
+ [[true, true], [true, false]],
3237
+ [[false, true], [false, false]],
3238
+ ]
3239
+
3240
+ row_options = [0, 1]
3241
+ col_options = [0, 1]
3242
+ arr_options = [0, 1]
3243
+
3244
+ cur_row = row_options.sample
3245
+ cur_col = col_options.sample
3246
+ cur_arr = arr_options.sample
3247
+
3248
+ stun_status = active_state[cur_row][cur_col][cur_arr]
3249
+
3250
+ if false == stun_status
3251
+ puts "was not paralyzed by your strike."
3252
+ elsif true == stun_status
3253
+ puts "managed to be stunned by your strike."
3254
+ end
3255
+ end
3256
+
3257
+ def self.trap_enemy
3258
+ # true false
3259
+ # true t,t t,f
3260
+ # false f,t f,f
3261
+
3262
+ active_state = [
3263
+ [[true, true], [true, false]],
3264
+ [[false, true], [false, false]],
3265
+ ]
3266
+
3267
+ row_options = [0, 1]
3268
+ col_options = [0, 1]
3269
+ arr_options = [0, 1]
3270
+
3271
+ cur_row = row_options.sample
3272
+ cur_col = col_options.sample
3273
+ cur_arr = arr_options.sample
3274
+
3275
+ trap_status = active_state[cur_row][cur_col][cur_arr]
3276
+
3277
+ if false == trap_status
3278
+ puts "was not tricked into a trap."
3279
+ elsif true == trap_status
3280
+ puts "managed to be trapped while you lured it in your direction."
3281
+
3282
+ sleep(1.5)
3283
+
3284
+ puts "YON WIN"
3285
+ abort
3286
+ end
3287
+ end
3288
+ end
3289
+
3290
+ # class MoveHistory
3291
+ # # Similar approaches to variable additions.
3292
+ # # Except instead of move_x or move_y: it adds move x or y history to history of move_x or move_y
3293
+ # def self.move_left_x
3294
+ # $x = $x - 1
3295
+ # end
3296
+ #
3297
+ # def self.move_right_x
3298
+ # $x = $x + 1
3299
+ # end
3300
+ #
3301
+ # def self.move_down_y
3302
+ # $y = $y + 1
3303
+ # end
3304
+ #
3305
+ # def self.move_up_y
3306
+ # $y = $y - 1
3307
+ # end
3308
+ #
3309
+ # # Records and recalls previous moves in x coordinates.
3310
+ # $previous_x = "You had moved #{$x} in the x coordinate."
3311
+ # $previous_y = "You had moved #{$y} in the y coordinate."
3312
+ #
3313
+ # def self.move_x_record
3314
+ # move_x = $previous_x
3315
+ #
3316
+ # File.open("_history/move_x/move_history.txt", "a") { |f|
3317
+ # f.puts move_x
3318
+ # }
3319
+ # end
3320
+ #
3321
+ # def self.move_x_recall
3322
+ # previous_moves = File.readlines("_history/move_x/move_history.txt")
3323
+ # search_limit = previous_move.size.to_i
3324
+ #
3325
+ # index = 0
3326
+ #
3327
+ # search_limit.times do
3328
+ # puts "PREVIOUS MOVE X"
3329
+ # puts previous_move[index]
3330
+ #
3331
+ # index = index + 1
3332
+ # end
3333
+ # end
3334
+ #
3335
+ # # Records and recalls previous moves in y coordinates.
3336
+ # def self.move_y_record
3337
+ # move_y = $previous_y
3338
+ #
3339
+ # File.open("_history/move_y/move_history.txt", "a") { |f|
3340
+ # f.puts move_y
3341
+ # }
3342
+ # end
3343
+ #
3344
+ # def self.move_y_recall
3345
+ # previous_moves = File.readlines("_history/move_y/move_history.txt")
3346
+ # search_limit = previous_move.size.to_i
3347
+ #
3348
+ # index = 0
3349
+ #
3350
+ # search_limit.times do
3351
+ # puts "PREVIOUS MOVE Y"
3352
+ # puts previous_move[index]
3353
+ #
3354
+ # index = index + 1
3355
+ # end
3356
+ # end
3357
+ # end
3358
+ end
3359
+
3360
+ module BequestMerchant
3361
+ class LocaleFeatures
3362
+ def self.choose_features
3363
+ ethno_style = [
3364
+ [["jp", "jp"], ["jp", "fr"]],
3365
+ [["fr", "jp"], ["fr", "fr"]],
3366
+ ]
3367
+
3368
+ ethno_feature = [
3369
+ [["woven mats", "woven mats"], ["woven mats", "ornate chandeliers"]],
3370
+ [["ornate chandeliers", "woven mats"], ["ornate chanedeliers", "ornate chandeliers"]],
3371
+ ]
3372
+
3373
+ row_options = [0, 1]
3374
+ col_options = [0, 1]
3375
+ arr_options = [0, 1]
3376
+
3377
+ cur_row = row_options.sample
3378
+ cur_col = col_options.sample
3379
+ cur_arr = arr_options.sample
3380
+
3381
+ current_style = ethno_style[cur_row][cur_col][cur_arr]
3382
+
3383
+ if current_style == "jp"
3384
+ puts "You are magically transported to a vaguely moden Japanese styled city."
3385
+
3386
+ $chosen_feature = ethno_feature[cur_row][cur_col][cur_arr]
3387
+
3388
+ BequestMerchant::LocaleFeatures.modern_japanese
3389
+ elsif current_style == "fr"
3390
+ puts "You are magically transported to a vaguely belle epoque styled city."
3391
+
3392
+ $chosen_feature = ethno_feature[cur_row][cur_col][cur_arr]
3393
+
3394
+ BequestMerchant::LocaleFeatures.belle_epoque
3395
+ else
3396
+ puts "Your locations is currently known only to the Lunar Goddess."
3397
+
3398
+ $chosen_feature = ethno_feature[cur_row][cur_col][cur_arr]
3399
+
3400
+ BequestMerchant::LocaleFeatures.unknown_feature
3401
+ end
3402
+ end
3403
+
3404
+ def self.modern_japanese
3405
+ puts "People drive on the right side of the road."
3406
+ end
3407
+
3408
+ def self.belle_epoque
3409
+ puts "People drive on the left side of the road."
3410
+ end
3411
+
3412
+ def self.unknown_feature
3413
+ puts "Nobody drives on any side of the road do to people riding horses.."
3414
+ end
3415
+ end
3416
+
3417
+ class Inn
3418
+ def self.initialize
3419
+ @yen = File.read("lib/player/currency/value_of_yen.txt").to_i
3420
+ @franc = File.read("lib/player/currency/value_of_franc.txt").to_i
3421
+ @lunario = File.read("lib/player/currency/value_of_lunario.txt").to_i
3422
+
3423
+ @shoe_hp = File.read("lib/player/metrics/shoe_hp.txt")
3424
+ @max_shoe_hp = 50
3425
+
3426
+ @player_hp = File.read("lib/player/metrics/shoe_hp.txt")
3427
+ @max_player_hp = 125
3428
+ end
3429
+
3430
+ def self.clerk
3431
+ if $chosen_feature == "woven mats"; puts "You are in a hotel with woven mats."
3432
+ elsif $chosen_feature == "ornate chandelier"; puts "You are in a hotel with ornate chandeliers."
3433
+ end
3434
+
3435
+ puts "#{hotel_clerk} I'm a hotel clerk, would you like to rent a room? << "
3436
+
3437
+ answer = gets.chomp
3438
+
3439
+ if answer == "rent room"
3440
+ puts "#{hotel_clerk} Do you have 5 yen? << "
3441
+
3442
+ answer = gets.chomp
3443
+
3444
+ if answer == "Yes" or "yes"
3445
+ BequestMerchant::Inn.rent_room
3446
+ else
3447
+ BequestMerchant::Inn.decline_room
3448
+ end
3449
+ else
3450
+ puts "#{hotel_clerk} Maybe some other time."
3451
+ end
3452
+ end
3453
+
3454
+ def self.decline_room
3455
+ puts "#{hotel_clerk} I'm sorry, we can't give you a room unless you have 5 Yen."
3456
+
3457
+ @player_hp = @max_player_hp
3458
+
3459
+ @yen = @yen - 5
3460
+ end
3461
+
3462
+ def self.rent_room
3463
+ @hotel_stay = @hotel_stay + 1
3464
+ @player_hp = @max_player_hp
3465
+
3466
+ puts "#{hotel_clerk} I hope you enjoyed the complementary breakfast."
3467
+ end
3468
+ end
3469
+
3470
+ class Petshop
3471
+ def self.initialize
3472
+ @yen = File.read("lib/player/currency/value_of_yen.txt").to_i
3473
+ @franc = File.read("lib/player/currency/value_of_franc.txt").to_i
3474
+ @lunario = File.read("lib/player/currency/value_of_lunario.txt").to_i
3475
+
3476
+ @shoe_hp = File.read("lib/player/metrics/shoe_hp.txt")
3477
+ @max_shoe_hp = 50
3478
+
3479
+ @player_hp = File.read("lib/player/metrics/shoe_hp.txt")
3480
+ @max_player_hp = 125
3481
+ end
3482
+
3483
+ def self.clerk
3484
+ if $chosen_feature == "woven mats"; puts "You are in a pet store with woven mats."
3485
+ elsif $chosen_feature == "ornate chandelier"; puts "You are in a pet store with ornate chandeliers."
3486
+ end
3487
+
3488
+ end
3489
+
3490
+ ## Methods only the clerk is able to access.
3491
+ def self.purchase_spiderfeed
3492
+ end
3493
+
3494
+ def self.request_hair_trimming
3495
+ end
3496
+ end
3497
+
3498
+ class ShoeCarpenter
3499
+
3500
+ def self.initialize
3501
+ @yen = File.read("lib/player/currency/value_of_yen.txt").to_i
3502
+ @franc = File.read("lib/player/currency/value_of_franc.txt").to_i
3503
+ @lunario = File.read("lib/player/currency/value_of_lunario.txt").to_i
3504
+
3505
+ @shoe_hp = File.read("lib/player/metrics/shoe_hp.txt")
3506
+ @max_shoe_hp = 50
3507
+
3508
+ @player_hp = File.read("lib/player/metrics/shoe_hp.txt")
3509
+ @max_player_hp = 125
3510
+ end
3511
+
3512
+ def self.carpenter
3513
+ if $chosen_feature == "woven mats"; puts "You are in a carpenter barn with woven mats."
3514
+ elsif $chosen_feature == "ornate chandelier"; puts "You are in a carpenter barn with ornate chandeliers."
3515
+ end
3516
+
3517
+ puts "#{shoe_carpenter} I'm a shoe carpenter, would you like to be repair your shoes? << "
3518
+
3519
+ answer = gets.chomp
3520
+
3521
+ if "repair shoes" == answer
3522
+ puts "#{shoe_carpenter} Do you have 5 Franc's << "
3523
+
3524
+ answer = gets.chomp
3525
+
3526
+ if answer == "Yes" or "yes"
3527
+ BequestMerchant::ShoeCarptener.repair_shoes
3528
+ else
3529
+ puts "#{shoe_carpenter} Come back when you have 5 Francs."
3530
+ end
3531
+ else
3532
+ puts "#{shoe_carpenter} Maybe some other time."
3533
+ end
3534
+ end
3535
+
3536
+ def self.repair_shoes
3537
+ puts "#{shoe_carpenter} I repaired your wooden shoes."
3538
+
3539
+ @shoe_hp = @max_shoe_hp
3540
+
3541
+ @franc = @franc - 5
3542
+ end
3543
+
3544
+ end
3545
+ end
3546
+
3547
+ #######################################################################################
3548
+ # Sanity And Trust Dynamics #
3549
+ ####################################################b##################################
3550
+ # If your sanity is less the ability for your girlfriend to trust you, you get the #
3551
+ # bad ending ( turned into an Eldritch abomination or evil god.) #
3552
+ # #
3553
+ # If your girlfriend's trust she has in you is in balance with your sanity, then you #
3554
+ # get the good ending. #
3555
+ # #
3556
+ # If your the trust your girlfriend has in you vastly outpaces ( gets lower ) than #
3557
+ # than your sanity, gameplay alters based on her losing trust in you. #
3558
+ #######################################################################################
3559
+ module BequestMetrics
3560
+ class SanityTrust
3561
+ def self.initialize
3562
+ @sanity = File.read("lib/player/sanity.txt").to_i
3563
+ @trust = File.read("lib/npc/trust.txt").to_i
3564
+ end
3565
+
3566
+ def self.compare_values
3567
+ if @sanity > @trust; print "Your sanity is greater than the ability for #{@npc_name} to trust you."
3568
+ BequestMetric::SanityTrust.measure_sanity
3569
+ elsif @sanity < @trust; print "Your sanity is less than the trust #{@npc_name} has for you."
3570
+ BequestMetric::SanityTrust.measure_trust
3571
+ end
3572
+ end
3573
+
3574
+ def self.measure_sanity
3575
+ discrete_sanity = @sanity.to_f
3576
+
3577
+ case @discrete_sanity
3578
+ when 0.001..0.035; puts "with low confidence."
3579
+ when 0.036..0.050; puts "with mild confidence."
3580
+ when 0.051..0.075; puts "with medium confidence."
3581
+ when 0.076..1.0; puts "with high confidence."
3582
+ else
3583
+ puts "with zero confidence."
3584
+ end
3585
+ end
3586
+
3587
+ def self.measure_trust
3588
+ discrete_trust = @trust.to_f
3589
+
3590
+ case @discrete_trust
3591
+ when 0.001..0.035; puts "with low confidence."
3592
+ when 0.036..0.050; puts "with mild confidence."
3593
+ when 0.051..0.075; puts "with medium confidence."
3594
+ when 0.076..1.0; puts "with high confidence."
3595
+ else
3596
+ puts "with zero confidence."
3597
+ end
3598
+ end
3599
+ end
3600
+ end
3601
+
3602
+ module BequestSystems
3603
+ class Adaptational
3604
+ def self.create_ruleset
3605
+ row = 0 ## The value of row is 0.
3606
+
3607
+ ## The directory knwon_ruleset is _ruleset/rules.txt
3608
+ ruleset = File.readlines("_rulesets/rules.txt")
3609
+
3610
+ ### Values of the individual rows, as Ruby counts from zero.
3611
+ rule1 = 0 #row + 1
3612
+ rule2 = 1 #row + 2
3613
+ rule3 = 2 #row + 3
3614
+ rule4 = 3 #row + 4
3615
+ rule5 = 4 #row + 5
3616
+ rule6 = 5 #row + 6
3617
+ rule7 = 6 #row + 7
3618
+ rule8 = 7 #row + 8
3619
+ rule9 = 8 #row + 9
3620
+
3621
+ first_rule = ruleset[rule1].tr "
3622
+ ", ""
3623
+ second_rule = ruleset[rule2].tr "
3624
+ ", ""
3625
+ third_rule = ruleset[rule3].tr "
3626
+ ", ""
3627
+ fourth_rule = ruleset[rule4].tr "
3628
+ ", ""
3629
+ fifth_rule = ruleset[rule5].tr "
3630
+ ", ""
3631
+ sixth_rule = ruleset[rule6].tr "
3632
+ ", ""
3633
+ seventh_rule = ruleset[rule7].tr "
3634
+ ", ""
3635
+ eighth_rule = ruleset[rule8].tr "
3636
+ ", ""
3637
+ nineth_rule = ruleset[rule9].tr "
3638
+ ", ""
3639
+
3640
+ ### Creation of the actual rulesets.
3641
+ ruleset_1 = "#{first_rule}
3642
+ #{second_rule}
3643
+ #{third_rule}
3644
+ #{fourth_rule}
3645
+ #{fifth_rule}
3646
+ #{sixth_rule}
3647
+ #{seventh_rule}
3648
+ #{eighth_rule}
3649
+ #{nineth_rule}"
3650
+
3651
+ ruleset_2 = "#{nineth_rule}
3652
+ #{first_rule}
3653
+ #{second_rule}
3654
+ #{third_rule}
3655
+ #{fourth_rule}
3656
+ #{fifth_rule}
3657
+ #{sixth_rule}
3658
+ #{seventh_rule}
3659
+ #{eighth_rule}"
3660
+
3661
+ ruleset_3 = "#{eighth_rule}
3662
+ #{nineth_rule}
3663
+ #{first_rule}
3664
+ #{second_rule}
3665
+ #{third_rule}
3666
+ #{fourth_rule}
3667
+ #{fifth_rule}
3668
+ #{sixth_rule}
3669
+ #{seventh_rule}"
3670
+
3671
+ ruleset_4 = "#{seventh_rule}
3672
+ #{eighth_rule}
3673
+ #{nineth_rule}
3674
+ #{first_rule}
3675
+ #{second_rule}
3676
+ #{third_rule}
3677
+ #{fourth_rule}
3678
+ #{fifth_rule}
3679
+ #{sixth_rule}"
3680
+
3681
+ ruleset_5 = "#{sixth_rule}
3682
+ #{seventh_rule}
3683
+ #{eighth_rule}
3684
+ #{nineth_rule}
3685
+ #{first_rule}
3686
+ #{second_rule}
3687
+ #{third_rule}
3688
+ #{fourth_rule}
3689
+ #{fifth_rule}"
3690
+
3691
+ ruleset_6 = "#{fifth_rule}
3692
+ #{sixth_rule}
3693
+ #{seventh_rule}
3694
+ #{eighth_rule}
3695
+ #{nineth_rule}
3696
+ #{first_rule}
3697
+ #{second_rule}
3698
+ #{third_rule}
3699
+ #{fourth_rule}"
3700
+
3701
+ ruleset_7 = "#{fourth_rule}
3702
+ #{fifth_rule}
3703
+ #{sixth_rule}
3704
+ #{seventh_rule}
3705
+ #{eighth_rule}
3706
+ #{nineth_rule}
3707
+ #{first_rule}
3708
+ #{second_rule}
3709
+ #{third_rule}"
3710
+
3711
+ ruleset_8 = "#{third_rule}
3712
+ #{fourth_rule}
3713
+ #{fifth_rule}
3714
+ #{sixth_rule}
3715
+ #{seventh_rule}
3716
+ #{eighth_rule}
3717
+ #{nineth_rule}
3718
+ #{first_rule}
3719
+ #{second_rule}"
3720
+
3721
+ ruleset_9 = "#{second_rule}
3722
+ #{third_rule}
3723
+ #{fourth_rule}
3724
+ #{fifth_rule}
3725
+ #{sixth_rule}
3726
+ #{seventh_rule}
3727
+ #{eighth_rule}
3728
+ #{nineth_rule}
3729
+ #{first_rule}"
3730
+
3731
+ open("_adaptation/ruleset_shift1.txt", "w") { |f|
3732
+ f.puts ruleset_1
3733
+ }
3734
+
3735
+ open("_adaptation/ruleset_shift2.txt", "w") { |f|
3736
+ f.puts ruleset_2
3737
+ }
3738
+
3739
+ open("_adaptation/ruleset_shift3.txt", "w") { |f|
3740
+ f.puts ruleset_3
3741
+ }
3742
+
3743
+ open("_adaptation/ruleset_shift4.txt", "w") { |f|
3744
+ f.puts ruleset_4
3745
+ }
3746
+
3747
+ open("_adaptation/ruleset_shift5.txt", "w") { |f|
3748
+ f.puts ruleset_5
3749
+ }
3750
+
3751
+ open("_adaptation/ruleset_shift6.txt", "w") { |f|
3752
+ f.puts ruleset_6
3753
+ }
3754
+
3755
+ open("_adaptation/ruleset_shift7.txt", "w") { |f|
3756
+ f.puts ruleset_7
3757
+ }
3758
+
3759
+ open("_adaptation/ruleset_shift8.txt", "w") { |f|
3760
+ f.puts ruleset_8
3761
+ }
3762
+
3763
+ open("_adaptation/ruleset_shift9.txt", "w") { |f|
3764
+ f.puts ruleset_9
3765
+ }
3766
+ end
3767
+
3768
+ def self.vortex
3769
+ ## Create new sound_file with new ruleset permutation.
3770
+ ruleset_choice = File.read("_rulesets/choice/value.txt").to_s.to_i
3771
+
3772
+ # Resets reset choice if at 8 in Ruby.
3773
+ if ruleset_choice > 8
3774
+ ruleset_choice = 0
3775
+ end
3776
+
3777
+ mutation1 = File.readlines("_adaptation/ruleset_shift1.txt")
3778
+ mutation2 = File.readlines("_adaptation/ruleset_shift2.txt")
3779
+ mutation3 = File.readlines("_adaptation/ruleset_shift3.txt")
3780
+ mutation4 = File.readlines("_adaptation/ruleset_shift4.txt")
3781
+ mutation5 = File.readlines("_adaptation/ruleset_shift5.txt")
3782
+ mutation6 = File.readlines("_adaptation/ruleset_shift6.txt")
3783
+ mutation7 = File.readlines("_adaptation/ruleset_shift7.txt")
3784
+ mutation8 = File.readlines("_adaptation/ruleset_shift8.txt")
3785
+ mutation9 = File.readlines("_adaptation/ruleset_shift9.txt")
3786
+
3787
+ ruleset_list = [
3788
+ mutation1, mutation2, mutation3,
3789
+ mutation4, mutation5, mutation6,
3790
+ mutation7, mutation8, mutation9,
3791
+ ]
3792
+
3793
+ chosen_ruleset = ruleset_list[ruleset_choice]
3794
+
3795
+ ## These are the rows.
3796
+ vortex_row_1 = 0
3797
+ vortex_row_2 = 1
3798
+ vortex_row_4 = 3
3799
+ vortex_row_8 = 7
3800
+ vortex_row_7 = 6
3801
+ vortex_row_5 = 4
3802
+
3803
+ ## Performs standard subroutines.
3804
+ system("#{chosen_ruleset[vortex_row_1]}")
3805
+ system("#{chosen_ruleset[vortex_row_2]}")
3806
+ system("#{chosen_ruleset[vortex_row_4]}")
3807
+ system("#{chosen_ruleset[vortex_row_8]}")
3808
+ system("#{chosen_ruleset[vortex_row_7]}")
3809
+ system("#{chosen_ruleset[vortex_row_5]}")
3810
+ system("#{chosen_ruleset[vortex_row_1]}")
3811
+
3812
+ open("_rulesets/choice/value.txt", "w") { |f|
3813
+ ruleset_choice = ruleset_choice + 1
3814
+
3815
+ f.puts ruleset_choice
3816
+ }
3817
+ end
3818
+
3819
+ def self.brute_force
3820
+ known_ruleset = File.readlines("_rulesets/rules.txt")
3821
+ # scrambled_ruleset = known_ruleset.shuffle
3822
+
3823
+ total_rules = known_ruleset.size.to_i
3824
+
3825
+ row = 1
3826
+
3827
+ puts "Changing the ruleset to evaluate performance..."
3828
+
3829
+ total_rules.times do
3830
+ system("#{known_ruleset[row]}")
3831
+
3832
+ row = row + 1
3833
+ end
3834
+ end
3835
+
3836
+ def self.random
3837
+ known_ruleset = File.readlines("_rulesets/rules.txt")
3838
+ scrambled_ruleset = known_ruleset.shuffle
3839
+
3840
+ total_rules = known_ruleset.size.to_i
3841
+
3842
+ row = 1
3843
+
3844
+ puts "Changing the ruleset to evaluate performance..."
3845
+
3846
+ total_rules.times do
3847
+ system("#{scrambled_ruleset[row]}")
3848
+
3849
+ row = row + 1
3850
+ end
3851
+ end
3852
+ end
3853
+ end
3854
+
3855
+ ######################################################################################
3856
+ # Bequest Tools #
3857
+ ######################################################################################
3858
+ # This functions as the primary tools the player uses in the game, which are then #
3859
+ # measured and evaluated by the MAID whom gives you a status report about your #
3860
+ # progress in a way distinct from simply reading the information from a GUI, like in #
3861
+ # battle mechanics. #
3862
+ ######################################################################################
3863
+ module BequestTools
3864
+ class UseTools
3865
+ def self.initialize
3866
+ $shovel = false
3867
+ $hammer = false
3868
+ $toolset = false
3869
+ $flashlight = false
3870
+ end
3871
+
3872
+ def self.scoop_contamination
3873
+ if $shovel == true
3874
+ scooped = 0
3875
+ unscooped = 0
3876
+
3877
+ loop do
3878
+ if scooped > 10
3879
+ puts ">> That's enough cleaning for now."
3880
+
3881
+ break
3882
+ end
3883
+
3884
+ if unscooped > 10
3885
+ puts ">> You're not cut out for this job."
3886
+
3887
+ break
3888
+ end
3889
+
3890
+ failure_rate = [
3891
+ [["failure", "failure"], ["failure", "succeed"]],
3892
+ [["succeed", "failure"], ["succeed", "succeed"]],
3893
+ ]
3894
+
3895
+ row_options = [0, 1]
3896
+ col_options = [0, 1]
3897
+ arr_options = [0, 1]
3898
+
3899
+ cur_row = row_options.sample
3900
+ cur_col = col_options.sample
3901
+ cur_arr = arr_options.sample
3902
+
3903
+ success_rate = failure_rate[cur_row][cur_col][cur]
3904
+
3905
+ if success_rate == "succeed"; puts ">> You succeed in scooping some contamination."; scooped = scooped + 1
3906
+ elsif success_rate == "failure"; puts ">> You failed in scooping some contamination."; unscooped = unscooped + 1
3907
+ end
3908
+ end
3909
+ else
3910
+ puts ">> There is no shovel for you to clean this contamination."
3911
+ end
3912
+ end
3913
+
3914
+ def self.break_passageway
3915
+ if $hammer == true
3916
+ path_broken = 0
3917
+ path_caved = 0
3918
+
3919
+ loop do
3920
+ if path_broken > 10
3921
+ puts ">> That's enough passages made for now."
3922
+
3923
+ break
3924
+ end
3925
+
3926
+ if path_caved > 10
3927
+ puts ">> You're not cut out for this job."
3928
+
3929
+ break
3930
+ end
3931
+
3932
+ failure_rate = [
3933
+ [["failure", "failure"], ["failure", "succeed"]],
3934
+ [["succeed", "failure"], ["succeed", "succeed"]],
3935
+ ]
3936
+
3937
+ row_options = [0, 1]
3938
+ col_options = [0, 1]
3939
+ arr_options = [0, 1]
3940
+
3941
+ cur_row = row_options.sample
3942
+ cur_col = col_options.sample
3943
+ cur_arr = arr_options.sample
3944
+
3945
+ success_rate = failure_rate[cur_row][cur_col][cur]
3946
+
3947
+ if success_rate == "succeed"; puts ">> You succeed in scooping some contamination."; path_broken = path_broken + 1
3948
+ elsif success_rate == "failure"; puts ">> You fao;ed in scooping some contamination."; path_caved = path_caved + 1
3949
+ end
3950
+ end
3951
+ else
3952
+ puts ">> There is no hammer for you to break a passage way."
3953
+ end
3954
+ end
3955
+
3956
+ def self.disarm_trap
3957
+ if $toolset == true
3958
+ traps_disarmed = 0
3959
+ traps_activated = 0
3960
+
3961
+ loop do
3962
+ if path_broken > 10
3963
+ puts ">> That's enough traps disarmed for now."
3964
+
3965
+ break
3966
+ end
3967
+
3968
+ if path_caved > 10
3969
+ puts ">> You're not cut out for this job."
3970
+
3971
+ break
3972
+ end
3973
+
3974
+ failure_rate = [
3975
+ [["failure", "failure"], ["failure", "succeed"]],
3976
+ [["succeed", "failure"], ["succeed", "succeed"]],
3977
+ ]
3978
+
3979
+ row_options = [0, 1]
3980
+ col_options = [0, 1]
3981
+ arr_options = [0, 1]
3982
+
3983
+ cur_row = row_options.sample
3984
+ cur_col = col_options.sample
3985
+ cur_arr = arr_options.sample
3986
+
3987
+ success_rate = failure_rate[cur_row][cur_col][cur]
3988
+
3989
+ if success_rate == "succeed"; puts ">> You succeed in disarming a trap."; traps_disarmed = traps_disarmed + 1
3990
+ elsif success_rate == "failure"; puts ">> You failed in disarming a trap."; traps_activated = traps_activated + 1
3991
+ end
3992
+ end
3993
+ else
3994
+ puts ">> There is no tool set to deactivate the traps."
3995
+ end
3996
+ end
3997
+
3998
+ def self.shine_flashlight
3999
+ if $flashlight == true
4000
+ possible_dungeon = File.readlines("lib/maps/passages.txt")
4001
+ index = 0
4002
+
4003
+ current_dungeon = possible_dungeon[index]
4004
+
4005
+ if current_dungeon == "graveyard"
4006
+ graveyard = File.read("lib/maps/graveyard.txt"); puts graveyard
4007
+
4008
+ elsif current_dungeon == "catecombs"
4009
+ catecombs = File.read("lib/maps/catecombs.txt"); puts catecombs
4010
+
4011
+ elsif current_dungeon == "caverns"
4012
+ caverns = File.read("lib/maps/caverns.txt"); puts caverns
4013
+
4014
+ elsif current_dungeon == "ancienttemple"
4015
+ ancienttemple = File.read("lib/maps/ancienttemple.txt"); puts ancienttemple
4016
+
4017
+ elsif current_dungeon == "kumabattolair"
4018
+ kumabattolair = File.read("lib/maps/kumabattolair.txt"); puts kumabattolair
4019
+
4020
+ elsif current_dungeon == "village"
4021
+ village = File.read("lib/maps/village.txt"); puts village
4022
+
4023
+ else
4024
+ puts "Unrecognized map."
4025
+ end
4026
+ else
4027
+ puts ">> There is no flashlight to light a passage."
4028
+ end
4029
+ end
4030
+
4031
+ def self.cast_elements
4032
+ if $magic_staff == true
4033
+ spells_missed = 0
4034
+ spells_on_target = 0
4035
+
4036
+ loop do
4037
+ if spells_missed > 10
4038
+ puts ">> You're not cut out for this job."
4039
+
4040
+ break
4041
+ end
4042
+
4043
+ if spells_on_target > 10
4044
+ puts ">> That's enough spell casting for now."
4045
+
4046
+ break
4047
+ end
4048
+
4049
+ failure_rate = [
4050
+ [["failure", "failure"], ["failure", "succeed"]],
4051
+ [["succeed", "failure"], ["succeed", "succeed"]],
4052
+ ]
4053
+
4054
+ row_options = [0, 1]
4055
+ col_options = [0, 1]
4056
+ arr_options = [0, 1]
4057
+
4058
+ cur_row = row_options.sample
4059
+ cur_col = col_options.sample
4060
+ cur_arr = arr_options.sample
4061
+
4062
+ success_rate = failure_rate[cur_row][cur_col][cur]
4063
+
4064
+ if success_rate == "succeed"; puts ">> You succeed in casting an element."; spells_missed = spells_missed + 1
4065
+ elsif success_rate == "failure"; puts ">> You failed in casting an element"; spells_on_target = spells_on_target + 1
4066
+ end
4067
+ end
4068
+ else
4069
+ puts ">> There is no magic staff to cast elemental magic."
4070
+ end
4071
+ end
4072
+
4073
+ def self.find_tools
4074
+ end
4075
+ end
4076
+
4077
+ class ToolStatistics
4078
+ def self.shovel_stats
4079
+ success_metrics = {
4080
+ "failure" => "#{choice} was a failure.",
4081
+ "success" => "#{choice} was a success.",
4082
+ }, 0.25
4083
+
4084
+ success_rate = success_metrics[0]
4085
+ success_label = success_rate[player_action]
4086
+
4087
+ if success_label == "#{choice} was a failure."
4088
+ success_probability = success_metrics[1]
4089
+
4090
+ success_rate = success_probability
4091
+ failure_rate = 1 - success_rate
4092
+
4093
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4094
+ elsif success_label == "#{choice} was a success."
4095
+ success_probability = success_metrics[1]
4096
+
4097
+ failure_rate = success_probability
4098
+ success_rate = 1 - success_rate
4099
+
4100
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4101
+ else
4102
+ puts ">> Success metrics are not known."
4103
+ end
4104
+ end
4105
+
4106
+ def self.hammer_stats
4107
+ success_metrics = {
4108
+ "failure" => "#{choice} was a failure.",
4109
+ "success" => "#{choice} was a success.",
4110
+ }, 0.25
4111
+
4112
+ success_rate = success_metrics[0]
4113
+ success_label = success_rate[player_action]
4114
+
4115
+ if success_label == "#{choice} was a failure."
4116
+ success_probability = success_metrics[1]
4117
+
4118
+ success_rate = success_probability
4119
+ failure_rate = 1 - success_rate
4120
+
4121
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4122
+ elsif success_label == "#{choice} was a success."
4123
+ success_probability = success_metrics[1]
4124
+
4125
+ failure_rate = success_probability
4126
+ success_rate = 1 - success_rate
4127
+
4128
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4129
+ else
4130
+ puts ">> Success metrics are not known."
4131
+ end
4132
+ end
4133
+
4134
+ def self.toolset_stats
4135
+ success_metrics = {
4136
+ "failure" => "#{choice} was a failure.",
4137
+ "success" => "#{choice} was a success.",
4138
+ }, 0.25
4139
+
4140
+ success_rate = success_metrics[0]
4141
+ success_label = success_rate[player_action]
4142
+
4143
+ if success_label == "#{choice} was a failure."
4144
+ success_probability = success_metrics[1]
4145
+
4146
+ success_rate = success_probability
4147
+ failure_rate = 1 - success_rate
4148
+
4149
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4150
+ elsif success_label == "#{choice} was a success."
4151
+ success_probability = success_metrics[1]
4152
+
4153
+ failure_rate = success_probability
4154
+ success_rate = 1 - success_rate
4155
+
4156
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4157
+ else
4158
+ puts ">> Success metrics are not known."
4159
+ end
4160
+ end
4161
+
4162
+ def self.magic_stats
4163
+ success_metrics = {
4164
+ "failure" => "#{choice} was a failure.",
4165
+ "success" => "#{choice} was a success.",
4166
+ }, 0.25
4167
+
4168
+ success_rate = success_metrics[0]
4169
+ success_label = success_rate[player_action]
4170
+
4171
+ if success_label == "#{choice} was a failure."
4172
+ success_probability = success_metrics[1]
4173
+
4174
+ success_rate = success_probability
4175
+ failure_rate = 1 - success_rate
4176
+
4177
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4178
+ elsif success_label == "#{choice} was a success."
4179
+ success_probability = success_metrics[1]
4180
+
4181
+ failure_rate = success_probability
4182
+ success_rate = 1 - success_rate
4183
+
4184
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4185
+ else
4186
+ puts ">> Success metrics are not known."
4187
+ end
4188
+ end
4189
+
4190
+ def self.flashlight_stats
4191
+ success_metrics = {
4192
+ "failure" => "#{choice} was a failure.",
4193
+ "success" => "#{choice} was a success.",
4194
+ }, 0.25
4195
+
4196
+ success_rate = success_metrics[0]
4197
+ success_label = success_rate[player_action]
4198
+
4199
+ if success_label == "#{choice} was a failure."
4200
+ success_probability = success_metrics[1]
4201
+
4202
+ success_rate = success_probability
4203
+ failure_rate = 1 - success_rate
4204
+
4205
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4206
+ elsif success_label == "#{choice} was a success."
4207
+ success_probability = success_metrics[1]
4208
+
4209
+ failure_rate = success_probability
4210
+ success_rate = 1 - success_rate
4211
+
4212
+ puts "[#{success_label}, #{success_rate} / #{failure_rate}]"
4213
+ else
4214
+ puts ">> Success metrics are not known."
4215
+ end
4216
+ end
4217
+ end
4218
+ end
4219
+
4220
+ module BequestMaid
4221
+ class ToolStatistics
4222
+ ###############################################################################################
4223
+ # BIANCA THE MAID #
4224
+ ###############################################################################################
4225
+ # Bianca the Maid evaluates how much of a slob the player is by how much of the corruption #
4226
+ # and contamination they cleaned from the game world. #
4227
+ ###############################################################################################
4228
+ def self.panel
4229
+ system("clear")
4230
+
4231
+ known_panels = File.readlines("lib/narrative/panels.txt") # In a gosu context, this chooses a hand drawn caption like in a graphic novel.
4232
+ index = File.read("lib/narrative/index.txt")
4233
+
4234
+ size_limit = known_panels.size.to_i
4235
+
4236
+ desired_panel = "maid"
4237
+
4238
+ size_limit.times do
4239
+ if index > size_limit
4240
+ break
4241
+ end
4242
+
4243
+ if known_panels[index] == desired_panel
4244
+ current_panel = File.read("lib/narrative/maid.txt")
4245
+
4246
+ puts current_panel
4247
+
4248
+ break # You found the desired panel, break the loop.
4249
+ else
4250
+ #puts "Error: No Panel To Display"
4251
+ end
4252
+
4253
+ index = index + 1
4254
+ end
4255
+ end
4256
+
4257
+ def self.shovel_stats
4258
+ $shovel_action = File.read("lib/data/metric/shovel_action.txt")
4259
+ $scoop_probability = 1 / scooped
4260
+
4261
+ File.open("lib/data/metrics/scooped_probabilities.txt", "w") { |f|
4262
+ f.puts "Scooped, #{$scooped_probability}"
4263
+ }
4264
+
4265
+ ## Get Labels
4266
+ scooped_data = File.read("lib/data/metrics/scooped_probabilities.txt").split(", ")
4267
+ scooped_label = scooped_data[0]
4268
+ scooped_probability = scooped_data[1].to_f
4269
+
4270
+ unscooped_data = File.read("lib/data/metrics/unscooped_probabilities.txt").split(", ")
4271
+ unscooped_label = unscooped_data[0]
4272
+ unscooped_probability = unscooped_data[1].to_f
4273
+
4274
+ success_metrics = {
4275
+ "Failure" => "#{scooped_label} was a failure.",
4276
+ "Success" => "#{scooped_label} was a success.",
4277
+ }
4278
+
4279
+ success_rate = success_metrics
4280
+ success_label = success_rate[$shovel_action]
4281
+
4282
+ if success_label == "#{$shovel_action} was a failure."
4283
+ success_probability = 1 - unscoooped_probability
4284
+
4285
+ puts "[#{scooped_label}, #{success_probability} / #{unscooped_probability}]"
4286
+
4287
+ case unscooped_probability
4288
+ when 0.12..0.50; puts "BIANCA: You few bits of corruption left to clean."
4289
+ when 0.50..0.75; puts "BIANCA: You still have a bit of corruption left to clean."
4290
+ when 0.75..1.00; puts "BIANCA: You hardly cleaned any bits of corruption."
4291
+ else
4292
+ puts "Error: Unscooped probability has an invalid value (#{unscooped_probability})."
4293
+ end
4294
+ elsif success_label == "#{$shovel_action} was a success."
4295
+ failure_probability = 1 - scooped_probability
4296
+
4297
+ puts "[#{scooped_label}, #{failure_probability} / #{scooped_probability}]"
4298
+
4299
+ case scooped_probability
4300
+ when 0.12..0.50; puts "BIANCA: You few bits of corruption left that are clean."
4301
+ when 0.50..0.75; puts "BIANCA: You have quite cleaned quite a bit of corruption."
4302
+ when 0.75..1.00; puts "BIANCA: You cleaned up most of the corruption."
4303
+ else
4304
+ puts "Error: Unscooped probability has an invalid value (#{unscooped_probability})."
4305
+ end
4306
+ else
4307
+ puts ">> Metrics are not known."
4308
+ end
4309
+ end
4310
+
4311
+ def self.hammer_stats
4312
+ $hammer_action = File.read("lib/data/metric/hammer_action.txt")
4313
+ $smash_probability = 1 / smashed
4314
+
4315
+ File.open("lib/data/metrics/smashed_probabilities.txt", "w") { |f|
4316
+ f.puts "smashed, #{$smashed_probability}"
4317
+ }
4318
+
4319
+ ## Get Labels
4320
+ smashed_data = File.read("lib/data/metrics/smashed_probabilities.txt").split(", ")
4321
+ smashed_label = smashed_data[0]
4322
+ smashed_probability = smashed_data[1].to_f
4323
+
4324
+ unsmashed_data = File.read("lib/data/metrics/unsmashed_probabilities.txt").split(", ")
4325
+ unsmashed_label = unsmashed_data[0]
4326
+ unsmashed_probability = unsmashed_data[1].to_f
4327
+
4328
+ success_metrics = {
4329
+ "Failure" => "#{smashed_label} was a failure.",
4330
+ "Success" => "#{smashed_label} was a success.",
4331
+ }
4332
+
4333
+ success_rate = success_metrics
4334
+ success_label = success_rate[$hammer_action]
4335
+
4336
+ if success_label == "#{$hammer_action} was a failure."
4337
+ success_probability = 1 - unscoooped_probability
4338
+
4339
+ puts "[#{smashed_label}, #{success_probability} / #{unsmashed_probability}]"
4340
+
4341
+ case unsmashed_probability
4342
+ when 0.12..0.50; puts "BIANCA: You have not made headway breaking open a passage."
4343
+ when 0.50..0.75; puts "BIANCA: You have almost broken through to the next area."
4344
+ when 0.75..1.00; puts "BIANCA: You have successfully broken a path way to the next area."
4345
+ else
4346
+ puts "Error: Unsmashed probability has an invalid value (#{unsmashed_probability})."
4347
+ end
4348
+ elsif success_label == "#{$hammer_action} was a success."
4349
+ failure_probability = 1 - smashed_probability
4350
+
4351
+ puts "[#{smashed_label}, #{failure_probability} / #{smashed_probability}]"
4352
+
4353
+ case smashed_probability
4354
+ when 0.12..0.50; puts "BIANCA: You have successfully broken a path way to the next area."
4355
+ when 0.50..0.75; puts "BIANCA: You have almost broken through to the next area."
4356
+ when 0.75..1.00; puts "BIANCA: You have not made headway breaking open a passage."
4357
+ else
4358
+ puts "Error: Unsmashed probability has an invalid value (#{unsmashed_probability})."
4359
+ end
4360
+ else
4361
+ puts ">> Metrics are not known."
4362
+ end
4363
+ end
4364
+
4365
+ end
4366
+ end
4367
+
4368
+ #####################################################################################
4369
+ # Experimental: Bequest Gauntlet #
4370
+ #####################################################################################
4371
+ # This minigame is based around the idea of running the gauntlet, which in military #
4372
+ # speak was an old way of executing people aside from lining them up in a firing #
4373
+ # squad. Here the game is loosely based on my Minetest mod where a biome is #
4374
+ # corrupted by replacing normal grass with purple grey cactis ( a stand in for #
4375
+ # purple grey slime with harmful bacteria ), and healing cactus ( a stand in for #
4376
+ # natural anti-biotic plants that evolved in this environment to fend off the toxic #
4377
+ # corrupted. #
4378
+ # #
4379
+ # AI and Player Guillotine are my twist on hangman where instead of risking hanging #
4380
+ # your player risks being guillotined by the military or other faction that has #
4381
+ # captured you. You have a certain amount of guesses till its game over, and that #
4382
+ # where it diverges from Roguelikes with soft permadeath. #
4383
+ # #
4384
+ # This is mostly retained for historical archival purposes, and the real one will #
4385
+ # refocus on running a gauntlet after swerving your car off the side of a cliff #
4386
+ # when off work from a Japanese car dealer in French controlled US. #
4387
+ #####################################################################################
4388
+ module BequestGauntlet
4389
+ class Yumemoire
4390
+ def self.initialize
4391
+ $player_hp = 10
4392
+ $healer_cactus = 10
4393
+ $gunmetal_boots = 10
4394
+ $alien_gunmetal = 0
4395
+
4396
+ $trap_cactus_placed = 10
4397
+ $trap_cactus_obtained = 0
4398
+ end
4399
+
4400
+ def self.puzzle_game
4401
+ loop do
4402
+ #####################################################################################
4403
+ # Conditions #
4404
+ #####################################################################################
4405
+ # Checks if you have healer cactus or gunmetal boots. And if out of gunmetal boots #
4406
+ # then allows you to make more gunmetal boots. #
4407
+ #####################################################################################
4408
+ if $player_hp < 1
4409
+ puts "You died"
4410
+
4411
+ sleep(1.5)
4412
+
4413
+ system("clear")
4414
+
4415
+ abort
4416
+ else
4417
+ puts "Escape the desert of corruption sand..."
4418
+ end
4419
+
4420
+ if $healer_cactus < 1
4421
+ puts "You're all out of healing cactus. Now you can't heal after walking into traps."
4422
+ else
4423
+ puts "You have #{$healer_cactus} healing cactus left."
4424
+ end
4425
+
4426
+ if $gunmetal_boots < 1
4427
+ puts "You're all out of gunmetal boot blocks. Now you can't escape without crafting more."
4428
+ else
4429
+ puts "You have #{$gunmetal_boots} gunmetal boots left."
4430
+ end
4431
+
4432
+ print "Would you like to make some gunmetal boots? << "; query = gets.chomp
4433
+
4434
+ if query == "make boots"
4435
+ print "Do you have alien gunmetal? <<" = query2 = gets.chomp
4436
+
4437
+ if query == "Yes"
4438
+ $alien_gunmetal = $alien_gunmetal - 1
4439
+ $trap_cactus_obtained = $trap_cactus_obtained - 1
4440
+ $gunmetal_boots = $gunmetal_boots + 1
4441
+
4442
+ puts "You've obtained one block of gunmetal boots."
4443
+ else
4444
+ puts "Try again when you have alien gunmetal."
4445
+ end
4446
+ else
4447
+ puts "Be careful not to run out of gunmetal boots."
4448
+ end
4449
+
4450
+ #####################################################################################
4451
+ # Tile State #
4452
+ #####################################################################################
4453
+ # The exact tile you walk on is iterate ( you walk through each possible state ). #
4454
+ # If your tile and the computer's tile it thinks your on matches, you die. #
4455
+ # #
4456
+ # Otherwise if the game bases whether it heals or damages you based on what your #
4457
+ # current tile is. #
4458
+ #####################################################################################
4459
+ tile_state = {
4460
+ "heal" => "nuetral",
4461
+ "nuetral" => "damage",
4462
+ "damage" => "heal",
4463
+ }
4464
+
4465
+ tile_possibilities = [
4466
+ [["heal", "heal"], ["heal", "nuetral"], ["heal", "damage"]],
4467
+ [["nuetral", "heal"], ["nuetral", "nuetral"], ["nuetral", "damage"]],
4468
+ [["damage", "heal"], ["damage", "nuetral"], ["damage", "damage"]],
4469
+ ], [
4470
+ [["damage", "heal"], ["damage", "nuetral"], ["damage", "damage"]],
4471
+ [["heal", "heal"], ["heal", "nuetral"], ["heal", "damage"]],
4472
+ [["nuetral", "heal"], ["nuetral", "nuetral"], ["nuetral", "damage"]],
4473
+ ], [
4474
+ [["nuetral", "heal"], ["nuetral", "nuetral"], ["nuetral", "damage"]],
4475
+ [["damage", "heal"], ["damage", "nuetral"], ["damage", "damage"]],
4476
+ [["heal", "heal"], ["heal", "nuetral"], ["heal", "damage"]],
4477
+ ]
4478
+
4479
+ context_window = File.read("lib/player/navigation/context_window.txt").to_i
4480
+
4481
+ row_options = [0, 1, 2]
4482
+ col_options = [0, 1, 2]
4483
+ arr_options = [0, 1]
4484
+
4485
+ cur_row = row_options.sample
4486
+ cur_col = col_options.sample
4487
+ cur_arr = arr_options.sample
4488
+
4489
+ enemy_tile = tile_possibilities[context_window][cur_row][cur_col][cur_arr]
4490
+
4491
+ player_tiles = [
4492
+ "heal",
4493
+ "nuetral",
4494
+ "damage"
4495
+ ]
4496
+
4497
+ tile_index = 0
4498
+ current_player_tile = player_tiles[tile_index]
4499
+
4500
+ if current_player_tile == enemy_tile
4501
+ $player_hp = $player_hp - 1
4502
+
4503
+ puts "You were damaged by a trap. You have #{$player_hp} hp left."
4504
+ else
4505
+ if current_player_tile == "heal"; $player_hp = $player_hp + 1
4506
+ elsif current_player_tile == "nuetral"; puts "You managed to traverse the corrupted desert."
4507
+ elsif current_player_tile == "damage"; $player_hp = $player_hp - 1
4508
+ else
4509
+ puts "Unrecognized result..."
4510
+ end
4511
+ end
4512
+ end
4513
+
4514
+ def self.ai_guillotine
4515
+ # alphabet = [
4516
+ # "A", "B", "C", "D", "E",
4517
+ # "F", "G", "H", "J", "K",
4518
+ # "L", "M", "N",
4519
+ #
4520
+ # "O", "P", "Q", "R", "S",
4521
+ # "T", "U", "V", "W", "X",
4522
+ # "Y", "Z", ".",
4523
+ # ].to_s
4524
+
4525
+ word_list = File.readlines("_data/words/word_options.txt")
4526
+
4527
+ # 1 1 1 1 1
4528
+ # 1 2 3 4 5 6 7 8 9 0 1 2 3
4529
+ keys1 = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
4530
+
4531
+ # 1 1 1 1 1 1 2 2 2 2 2 2 2
4532
+ # 4 5 6 7 8 9 0 1 2 3 4 5 6
4533
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ].shuffle
4534
+
4535
+ alph_1 = keys1[0] + keys1[1] + keys1[2] + keys1[3] + keys1[4] + keys1[5] + keys1[6] + keys1[7] + keys1[8] +
4536
+ keys1[9] + keys1[10] + keys1[11] + keys1[13] + keys1[13] + keys1[14] + keys1[15] + keys1[16] + keys1[17] +
4537
+ keys1[18] + keys1[19] + keys1[20] + keys1[21] + keys1[22] + keys1[23] + keys1[24] + keys1[25]
4538
+
4539
+ alph_2 = keys1[13] + keys1[14] + keys1[15] + keys1[16] + keys1[17] + keys1[18] + keys1[19] + keys1[20] +
4540
+ keys1[21] + keys1[22] + keys1[23] + keys1[24] + keys1[25] + keys1[0] + keys1[1] + keys1[2] +
4541
+ keys1[3] + keys1[4] + keys1[5] + keys1[6] + keys1[7] + keys1[8] + keys1[9] + keys1[10] +
4542
+ keys1[11] + keys1[13]
4543
+
4544
+ # puts alph1
4545
+ # puts alph2
4546
+
4547
+ ## Save a copy of the keys for later decryption
4548
+ open("_data/audit/keys.txt", "w") { |f|
4549
+ f.puts alph_1
4550
+ f.puts alph_2
4551
+ }
4552
+
4553
+ choice_amount = word_list.size.to_i
4554
+
4555
+ ai_choice = word_list.sample.to_s.strip
4556
+
4557
+ #puts ai_choice
4558
+
4559
+ open("_data/audit/ai_choices.txt", "a") { |f|
4560
+ f.puts ai_choice
4561
+ }
4562
+
4563
+ word_prompt = ai_choice
4564
+
4565
+ max = 5
4566
+ guesses = 0
4567
+
4568
+ loop do
4569
+ if guesses > max
4570
+ system("clear")
4571
+
4572
+ image_status = File.read("_images/guillotined/death.txt")
4573
+
4574
+ puts image_status
4575
+
4576
+ puts "Sister Order ran out of guesses."
4577
+
4578
+ system("ruby _endgame/victory.rb")
4579
+
4580
+ abort
4581
+ else
4582
+ system("clear")
4583
+
4584
+ if guesses == 1
4585
+ image_status = File.read("_images/guillotined/minor.txt").strip
4586
+
4587
+ puts image_status
4588
+ elsif guesses == 2
4589
+ image_status = File.read("_images/guillotined/mild.txt").strip
4590
+
4591
+ puts image_status
4592
+ elsif guesses == 3
4593
+ image_status = File.read("_images/guillotined/moderate.txt").strip
4594
+
4595
+ puts image_status
4596
+ elsif guesses == 4
4597
+ image_status = File.read("_images/guillotined/severe.txt").strip
4598
+
4599
+ puts image_status
4600
+ elsif guesses == 5
4601
+ image_status = File.read("_images/guillotined/critical.txt").strip
4602
+
4603
+ puts image_status
4604
+ end
4605
+
4606
+ puts "You have #{guesses} remaining guesses."
4607
+ end
4608
+
4609
+ puts word_prompt.tr alph_1, alph_2
4610
+ enemy_guesses = word_list.sample
4611
+
4612
+ puts "Sister order has guessed: #{enemy_guesses}."
4613
+
4614
+ if enemy_guesses == ai_choice
4615
+ puts "Sister Order has correctly guessed the chosen word."
4616
+
4617
+ sleep(1.5)
4618
+
4619
+ system("clear; ruby spaceshooter.rb")
4620
+ else
4621
+ puts "Sister Order guessed incorrectly!"
4622
+
4623
+ guesses = guesses + 1
4624
+
4625
+ sleep(1.5)
4626
+ end
4627
+ end
4628
+
4629
+ end
4630
+
4631
+ def self.player_guillotine
4632
+ word_list = File.readlines("_data/words/word_options.txt")
4633
+
4634
+ keys1 = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
4635
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ].shuffle
4636
+
4637
+ alph_1 = keys1[0] + keys1[1] + keys1[2] + keys1[3] + keys1[4] + keys1[5] + keys1[6] + keys1[7] + keys1[8] +
4638
+ keys1[9] + keys1[10] + keys1[11] + keys1[13] + keys1[13] + keys1[14] + keys1[15] + keys1[16] + keys1[17] +
4639
+ keys1[18] + keys1[19] + keys1[20] + keys1[21] + keys1[22] + keys1[23] + keys1[24] + keys1[25]
4640
+
4641
+ alph_2 = keys1[13] + keys1[14] + keys1[15] + keys1[16] + keys1[17] + keys1[18] + keys1[19] + keys1[20] +
4642
+ keys1[21] + keys1[22] + keys1[23] + keys1[24] + keys1[25] + keys1[0] + keys1[1] + keys1[2] +
4643
+ keys1[3] + keys1[4] + keys1[5] + keys1[6] + keys1[7] + keys1[8] + keys1[9] + keys1[10] +
4644
+ keys1[11] + keys1[13]
4645
+
4646
+ ## Save a copy of the keys for later decryption
4647
+ open("_data/audit/keys.txt", "w") { |f|
4648
+ f.puts alph_1
4649
+ f.puts alph_2
4650
+ }
4651
+
4652
+ choice_amount = word_list.size.to_i
4653
+
4654
+ ai_choice = word_list.sample.to_s.strip
4655
+
4656
+ puts ai_choice
4657
+
4658
+ open("_data/audit/ai_choices.txt", "a") { |f|
4659
+ f.puts ai_choice
4660
+ }
4661
+
4662
+ word_prompt = ai_choice
4663
+
4664
+ max = 5
4665
+ guesses = 0
4666
+
4667
+ loop do
4668
+ if guesses > max
4669
+ system("clear")
4670
+
4671
+ image_status = File.read("_images/hanged/death.txt")
4672
+
4673
+ puts image_status
4674
+
4675
+ puts "Sister Order ran out of guesses."
4676
+
4677
+ system("ruby _endgame.rb/victory.rb")
4678
+
4679
+ abort
4680
+ else
4681
+ system("clear")
4682
+
4683
+ if guesses == 1
4684
+ image_status = File.read("_images/guillotined/minor.txt").strip
4685
+
4686
+ puts image_status
4687
+ elsif guesses == 2
4688
+ image_status = File.read("_images/guillotined/mild.txt").strip
4689
+
4690
+ puts image_status
4691
+ elsif guesses == 3
4692
+ image_status = File.read("_images/guillotined/moderate.txt").strip
4693
+
4694
+ puts image_status
4695
+ elsif guesses == 4
4696
+ image_status = File.read("_images/guillotined/severe.txt").strip
4697
+
4698
+ puts image_status
4699
+ elsif guesses == 5
4700
+ image_status = File.read("_images/gyi/critical.txt").strip
4701
+
4702
+ puts image_status
4703
+ end
4704
+
4705
+ puts "You have #{guesses} remaining guesses."
4706
+ end
4707
+
4708
+ puts word_prompt.tr alph_1, alph_2
4709
+
4710
+ print "Your guess: "
4711
+ your_guess = gets.chomp
4712
+
4713
+ if your_guess == ai_choice
4714
+ puts "Sister chaos has correctly guessed the chosen word."
4715
+
4716
+ sleep(1.5)
4717
+
4718
+ system("clear; ruby spaceshooter.rb")
4719
+ else
4720
+ puts "Sister chaos guessed incorrectly!"
4721
+
4722
+ guesses = guesses + 1
4723
+
4724
+ sleep(1.5)
4725
+ end
4726
+ end
4727
+
4728
+ end
4729
+ end
4730
+ end
4731
+ end
4732
+
4733
+