YumemoireFramework 0.1.1
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.
- checksums.yaml +7 -0
- data/README.md +35 -0
- data/Rakefile +4 -0
- data/lib/YumemoireFramework/version.rb +5 -0
- data/lib/YumemoireFramework.rb +2467 -0
- data/sig/YumemoireFramework.rbs +4 -0
- metadata +48 -0
|
@@ -0,0 +1,2467 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "YumemoireFramework/version"
|
|
4
|
+
|
|
5
|
+
module YumemoireFramework
|
|
6
|
+
class Error < StandardError; end
|
|
7
|
+
|
|
8
|
+
class Title
|
|
9
|
+
def self.main
|
|
10
|
+
puts "\e[38;2;187;127;118m \e[8;42;107t"
|
|
11
|
+
|
|
12
|
+
loop do
|
|
13
|
+
system("clear")
|
|
14
|
+
|
|
15
|
+
title_text = File.read("lib/images/title/title2.txt")
|
|
16
|
+
|
|
17
|
+
puts title_text
|
|
18
|
+
|
|
19
|
+
print "What would you like to do? [ Play / Language / Quit ] >> "; option = gets.chomp
|
|
20
|
+
|
|
21
|
+
if option == "Play"
|
|
22
|
+
YumemoireFramework::GlobalStats.assign_metrics
|
|
23
|
+
|
|
24
|
+
YumemoireFramework::HumanMode.parser
|
|
25
|
+
#elsif option == "Beastiary"
|
|
26
|
+
#system("cd lib/beastiary; ruby beastiary.rb")
|
|
27
|
+
elsif option == "Language"
|
|
28
|
+
print ">> Glossary or translation? >> "; lang_choice = gets.chomp
|
|
29
|
+
|
|
30
|
+
if lang_choice == "Glossary"
|
|
31
|
+
YumemoireFramework::Encyclopedia.study
|
|
32
|
+
elsif lang_choice == "Translate"
|
|
33
|
+
YumemoireFramework::Encyclopedia.translate
|
|
34
|
+
elsif lang_choice == "Detect Poison"
|
|
35
|
+
YumemoireFramework::Encyclopedia.detect_poison
|
|
36
|
+
else
|
|
37
|
+
puts ">> This language option does not exist."
|
|
38
|
+
end
|
|
39
|
+
#elsif option == "Laboratory"
|
|
40
|
+
#print "What type of color synthesis? >> "; synthesis_type = gets.chomp
|
|
41
|
+
|
|
42
|
+
#if synthesis_type == "Real"
|
|
43
|
+
#system("cd lib/laboratory/AutomixREAL; ./routine.sh")
|
|
44
|
+
#elsif synthesis_type == "Synthetic"
|
|
45
|
+
#system("cd lib/laboratory/AutomixSYNTH; ./routine.sh")
|
|
46
|
+
#else
|
|
47
|
+
#puts ">> There is no such laboratory..."
|
|
48
|
+
|
|
49
|
+
#abort
|
|
50
|
+
#end
|
|
51
|
+
elsif option == "Quit"
|
|
52
|
+
system("clear")
|
|
53
|
+
|
|
54
|
+
abort
|
|
55
|
+
else
|
|
56
|
+
puts "Unregonized command..."
|
|
57
|
+
|
|
58
|
+
sleep(1.5)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class GlobalStats
|
|
65
|
+
def self.assign_metrics
|
|
66
|
+
##########################################################################################
|
|
67
|
+
# Global variables that effect gameplay. #
|
|
68
|
+
##########################################################################################
|
|
69
|
+
# Standard Operations
|
|
70
|
+
$stalemates = 0 # Keeps track of how many stalemates
|
|
71
|
+
$player_struck = 0 # Keeps track of how many times player hit the enemy.
|
|
72
|
+
$enemy_struck = 0 # Keeps track of how many times enemy hit the player.
|
|
73
|
+
|
|
74
|
+
# Current Lunar Phase
|
|
75
|
+
$current_phase = File.read("lib/data/lunar_calender/current_phase.txt").strip.to_i # 0
|
|
76
|
+
|
|
77
|
+
## Amount of days in a year.
|
|
78
|
+
$current_day = 0
|
|
79
|
+
$lunar_ticks = 30
|
|
80
|
+
|
|
81
|
+
# One allows you to always maintain a certain maximum reset hp. The other can be altered.
|
|
82
|
+
$true_reset_hp = File.read("lib/player_stats/true_reset_hp.txt").strip.to_i
|
|
83
|
+
$reset_hp = File.read("lib/player_stats/reset_hp.txt").strip.to_i
|
|
84
|
+
|
|
85
|
+
# Standard base stats
|
|
86
|
+
$personal_demon_metric = File.read("lib/data/user/personal_demon_metric.txt").strip.to_i
|
|
87
|
+
$player_healing_rate = File.read("lib/player_stats/player_healing_rate.txt").strip.to_i
|
|
88
|
+
|
|
89
|
+
$player_hp = File.read("lib/player_stats/player_hp.txt").strip.to_i
|
|
90
|
+
$player_atk = File.read("lib/player_stats/player_atk.txt").strip.to_i
|
|
91
|
+
$player_heal = $player_healing_rate
|
|
92
|
+
|
|
93
|
+
$enemy_hp = 10
|
|
94
|
+
$enemy_atk = 2
|
|
95
|
+
$enemy_heal = 4
|
|
96
|
+
|
|
97
|
+
# Resets the player's HP
|
|
98
|
+
$true_hp_reset = 10
|
|
99
|
+
$reset_hp = 10
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
class LunarCalender
|
|
104
|
+
##########################################################################################
|
|
105
|
+
# Lunar Phase #
|
|
106
|
+
##########################################################################################
|
|
107
|
+
def lunar_cycle
|
|
108
|
+
lunar_phases = [0, 1, 2, 3, 4, 5, 6, 7]
|
|
109
|
+
|
|
110
|
+
# The current lunar phase mod 7
|
|
111
|
+
current_phase = $current_phase % 7
|
|
112
|
+
$current_phase = $current_phase + 1 % 7
|
|
113
|
+
|
|
114
|
+
if current_phase == lunar_phases[0]
|
|
115
|
+
puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Full Moon. Réinitialisation des statistiques du joueur...\e[0m"
|
|
116
|
+
|
|
117
|
+
sleep(1)
|
|
118
|
+
|
|
119
|
+
$player_hp = -10
|
|
120
|
+
$player_atk = 4
|
|
121
|
+
$player_heal = 2
|
|
122
|
+
|
|
123
|
+
# Negative Healing ala illness
|
|
124
|
+
#$player_illness = 2
|
|
125
|
+
elsif current_phase == lunar_phases[1]
|
|
126
|
+
puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waning Gibbous. Réinitialisation des statistiques du joueur...\e[0m"
|
|
127
|
+
|
|
128
|
+
sleep(1)
|
|
129
|
+
|
|
130
|
+
$player_hp = -8
|
|
131
|
+
$player_atk = 6
|
|
132
|
+
$player_heal = 2
|
|
133
|
+
|
|
134
|
+
# Negative Healing ala illness
|
|
135
|
+
#$player_illness = 2
|
|
136
|
+
elsif current_phase == lunar_phases[2]
|
|
137
|
+
puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: First Quarter. Réinitialisation des statistiques du joueur...\e[0m"
|
|
138
|
+
|
|
139
|
+
sleep(1)
|
|
140
|
+
|
|
141
|
+
$player_hp = -6
|
|
142
|
+
$player_atk = 8
|
|
143
|
+
$player_heal = 2
|
|
144
|
+
|
|
145
|
+
# Negative Healing ala illness
|
|
146
|
+
#$player_illness = 2
|
|
147
|
+
elsif current_phase == lunar_phases[3]
|
|
148
|
+
puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waxing Crescent. Réinitialisation des statistiques du joueur...\e[0m"
|
|
149
|
+
|
|
150
|
+
sleep(1)
|
|
151
|
+
|
|
152
|
+
$player_hp = -4
|
|
153
|
+
$player_atk = 8
|
|
154
|
+
$player_heal = 2
|
|
155
|
+
|
|
156
|
+
# Negative Healing ala illness
|
|
157
|
+
#$player_illness = 2
|
|
158
|
+
elsif current_phase == lunar_phases[4]
|
|
159
|
+
puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: New Moon. Réinitialisation des statistiques du joueur...\e[0m"
|
|
160
|
+
|
|
161
|
+
sleep(1)
|
|
162
|
+
|
|
163
|
+
$player_hp = -2
|
|
164
|
+
$player_atk = 10
|
|
165
|
+
$player_heal = 2
|
|
166
|
+
|
|
167
|
+
# Negative Healing ala illness
|
|
168
|
+
#$player_illness = 8
|
|
169
|
+
|
|
170
|
+
gets.chomp
|
|
171
|
+
|
|
172
|
+
abort
|
|
173
|
+
elsif current_phase == lunar_phases[5]
|
|
174
|
+
puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waning Crescent. Réinitialisation des statistiques du joueur...\e[0m"
|
|
175
|
+
|
|
176
|
+
sleep(1)
|
|
177
|
+
|
|
178
|
+
$player_hp = -5
|
|
179
|
+
$player_atk = 8
|
|
180
|
+
$player_heal = 2
|
|
181
|
+
|
|
182
|
+
# Negative Healing ala illness
|
|
183
|
+
#$player_illness = 6
|
|
184
|
+
elsif current_phase == lunar_phases[6]
|
|
185
|
+
puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Third Quarter. Réinitialisation des statistiques du joueur...\e[0m"
|
|
186
|
+
|
|
187
|
+
sleep(1)
|
|
188
|
+
|
|
189
|
+
$player_hp = -7
|
|
190
|
+
$player_atk = 10
|
|
191
|
+
$player_heal = 2
|
|
192
|
+
|
|
193
|
+
# Negative Healing ala illness
|
|
194
|
+
#$player_illness = 4
|
|
195
|
+
elsif current_phase == lunar_phases[7]
|
|
196
|
+
puts "\e[38;2;187;127;118mLa phase lunaire actuelle est: Waning Gibbous. Réinitialisation des statistiques du joueur...\e[0m"
|
|
197
|
+
|
|
198
|
+
sleep(1)
|
|
199
|
+
|
|
200
|
+
$player_hp = -9
|
|
201
|
+
$player_atk = 2
|
|
202
|
+
$player_heal = 2
|
|
203
|
+
|
|
204
|
+
# Negative Healing ala illness
|
|
205
|
+
#$player_illness = 2
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
sleep(1.5)
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
class Marketplace
|
|
213
|
+
#######################################################################################
|
|
214
|
+
# Inn Mechanics #
|
|
215
|
+
#######################################################################################
|
|
216
|
+
# Subroutine for staying at an inn.
|
|
217
|
+
def stay_at_inn
|
|
218
|
+
if $player_hp > 0
|
|
219
|
+
if $player_yen >= 172
|
|
220
|
+
sleep(1.5)
|
|
221
|
+
|
|
222
|
+
puts "\e[38;2;187;127;118mInn Keeper: Have a nice stay!\e[0m"
|
|
223
|
+
|
|
224
|
+
$player_hp = $reset_hp
|
|
225
|
+
$player_yen = $player_yen - 172
|
|
226
|
+
|
|
227
|
+
sleep(1.5)
|
|
228
|
+
else
|
|
229
|
+
sleep(1.5)
|
|
230
|
+
|
|
231
|
+
puts "\e[38;2;187;127;118mInn Keeper: Seems you don't have enough Yen.\e[0m"
|
|
232
|
+
|
|
233
|
+
sleep(1.5)
|
|
234
|
+
end
|
|
235
|
+
else
|
|
236
|
+
sleep(1.5)
|
|
237
|
+
|
|
238
|
+
puts "\e[38;2;187;127;118mInn Keeper: Seems like you don't need the sleep!\e[0m"
|
|
239
|
+
|
|
240
|
+
sleep(1.5)
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
########################################################################################
|
|
245
|
+
# Armoury Mechanics #
|
|
246
|
+
########################################################################################
|
|
247
|
+
def visit_armoury
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
class DialogueScript
|
|
252
|
+
#######################################################################################
|
|
253
|
+
# Dialogue Script #
|
|
254
|
+
#######################################################################################
|
|
255
|
+
def self.word_lengths
|
|
256
|
+
def self.one_character
|
|
257
|
+
dipthongs = File.readlines("lib/data/dipthongs.txt")
|
|
258
|
+
|
|
259
|
+
generated_word = dipthongs.sample.strip.to_s
|
|
260
|
+
|
|
261
|
+
masculine = generated_word.chop + "u"
|
|
262
|
+
feminine = generated_word.chop + "a"
|
|
263
|
+
plural = generated_word.chop + "os"
|
|
264
|
+
|
|
265
|
+
puts "Single"
|
|
266
|
+
puts "#{masculine} #{feminine} #{plural}"
|
|
267
|
+
|
|
268
|
+
puts " "
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def three_character
|
|
272
|
+
dipthongs = File.readlines("lib/data/dipthongs.txt")
|
|
273
|
+
|
|
274
|
+
component_one = dipthongs.sample.strip.to_s
|
|
275
|
+
component_two = dipthongs.sample.strip.to_s
|
|
276
|
+
component_tre = dipthongs.sample.strip.to_s
|
|
277
|
+
|
|
278
|
+
generated_word = component_one + component_two + component_tre
|
|
279
|
+
|
|
280
|
+
masculine = generated_word.chop + "u"
|
|
281
|
+
feminine = generated_word.chop + "a"
|
|
282
|
+
plural = generated_word.chop + "os"
|
|
283
|
+
|
|
284
|
+
puts "Triple"
|
|
285
|
+
puts "#{masculine} #{feminine} #{plural}"
|
|
286
|
+
|
|
287
|
+
puts " "
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def self.five_character
|
|
291
|
+
dipthongs = File.readlines("lib/data/dipthongs.txt")
|
|
292
|
+
|
|
293
|
+
component_one = dipthongs.sample.strip.to_s
|
|
294
|
+
component_two = dipthongs.sample.strip.to_s
|
|
295
|
+
component_tre = dipthongs.sample.strip.to_s
|
|
296
|
+
component_fro = dipthongs.sample.strip.to_s
|
|
297
|
+
component_fiv = dipthongs.sample.strip.to_s
|
|
298
|
+
|
|
299
|
+
generated_word = component_one + component_two + component_tre + component_fro + component_fiv
|
|
300
|
+
|
|
301
|
+
masculine = generated_word.chop + "u"
|
|
302
|
+
feminine = generated_word.chop + "a"
|
|
303
|
+
plural = generated_word.chop + "os"
|
|
304
|
+
|
|
305
|
+
puts "Septuple"
|
|
306
|
+
puts "#{masculine} #{feminine} #{plural}"
|
|
307
|
+
|
|
308
|
+
puts " "
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def seven_character
|
|
312
|
+
dipthongs = File.readlines("lib/data/dipthongs.txt")
|
|
313
|
+
|
|
314
|
+
component_one = dipthongs.sample.strip.to_s
|
|
315
|
+
component_two = dipthongs.sample.strip.to_s
|
|
316
|
+
component_tre = dipthongs.sample.strip.to_s
|
|
317
|
+
component_fro = dipthongs.sample.strip.to_s
|
|
318
|
+
component_fiv = dipthongs.sample.strip.to_s
|
|
319
|
+
component_six = dipthongs.sample.strip.to_s
|
|
320
|
+
component_sev = dipthongs.sample.strip.to_s
|
|
321
|
+
|
|
322
|
+
generated_word = component_one + component_two + component_tre + component_fro + component_fiv + component_six + component_sev
|
|
323
|
+
|
|
324
|
+
masculine = generated_word.chop + "u"
|
|
325
|
+
feminine = generated_word.chop + "a"
|
|
326
|
+
plural = generated_word.chop + "os"
|
|
327
|
+
|
|
328
|
+
puts "Seven"
|
|
329
|
+
puts "#{masculine} #{feminine} #{plural}"
|
|
330
|
+
|
|
331
|
+
puts " "
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
def self.procedural_euphemisms
|
|
335
|
+
french_noun_list = File.readlines("lib/data/words/french_noun_list.txt").shuffle
|
|
336
|
+
|
|
337
|
+
# French Noun List
|
|
338
|
+
# De le pomme
|
|
339
|
+
# De le banane
|
|
340
|
+
# De le pommme de terre
|
|
341
|
+
|
|
342
|
+
hybrid_compound_list = File.readlines("lib/data/words/hybrid_compound_list.txt".shuffle
|
|
343
|
+
|
|
344
|
+
# Hybrid Compound List
|
|
345
|
+
# Te daidakorolavu - Man's first time bath.
|
|
346
|
+
# Ta daidakorolava - Woman's first time bath.
|
|
347
|
+
# Deso daidakorolavos - Couple's first time bath.
|
|
348
|
+
# Te shadodoru - Man's Brown slope. Edit: In practice a door.
|
|
349
|
+
# Ta shadodora - Woman's brown slope.
|
|
350
|
+
# Deso shadodoros - Couple's brown slope.
|
|
351
|
+
# Te ribingurumuguachu - Man in living room painting with gouache.
|
|
352
|
+
# Ta ribingurumuguacha - Woman in living room painting with gouache.
|
|
353
|
+
# Deso ribingurumuguachos - Couple in living room painting with gouache.
|
|
354
|
+
# Te shinkupratiqueu - Man at sink dispensery.
|
|
355
|
+
# Ta shinkupratiquea - Woman at sink dispensery.
|
|
356
|
+
# Deso shinkupratiqueos - Couple at sink dispensery.
|
|
357
|
+
# Te basurumumerdu - Man's bathroom shit. Men's toilet
|
|
358
|
+
# Ta basurumumerda - Woman's bathroom shit. Woman's toilet
|
|
359
|
+
# Deso basurumumerdos - Couple's bathroomshit. Couple's toilet
|
|
360
|
+
# Te basurumucanapu - Man's bathroom couch.
|
|
361
|
+
# Ta basurumucanapa - Woman's bathroom couch.
|
|
362
|
+
# Deso basurumucanapos - Couple's bathroom couch.
|
|
363
|
+
# Te garejisortiu - Men's garage exit.
|
|
364
|
+
# Ta garejisortia - Women's garage exit.
|
|
365
|
+
# Deso garejisortios - Couple's garage exit.
|
|
366
|
+
|
|
367
|
+
init_vector = File.read("lib/data/npc/input.txt").strip.to_i
|
|
368
|
+
|
|
369
|
+
current_french_noun = french_noun_list[init_vector]
|
|
370
|
+
current_hybrid_compound = hybrid_compound_list[init_vector]
|
|
371
|
+
|
|
372
|
+
current_phrase = "Context 1: #{current_hybrid_compound} #{current_french_noun}"
|
|
373
|
+
alt_current_phrase = "Context 2: #{current_french_noun} #{current_hybrid_compound}"
|
|
374
|
+
|
|
375
|
+
puts current_phrase
|
|
376
|
+
puts alt_current_phrase
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
def self.child_process
|
|
380
|
+
BequestDialogueTree::Agents.child_process
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
def self.adult_process
|
|
384
|
+
BequestDialogueTree::Agents.adult_process
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
class Encyclopedia
|
|
390
|
+
def self.monsternames
|
|
391
|
+
def self.monster_name
|
|
392
|
+
def self.five_elements
|
|
393
|
+
possible_elements = File.readlines("monsternames/elements.txt")
|
|
394
|
+
|
|
395
|
+
$chosen_element = possible_elements.sample.strip.to_s
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
def self.adjectives
|
|
399
|
+
possible_adjectives = File.readlines("monsternames/gendered_adverb.txt")
|
|
400
|
+
|
|
401
|
+
$chosen_adjective = possible_adjectives.sample.strip.to_s
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
YumemoireFramework::Encyclopedia.monster_name.five_elements
|
|
406
|
+
YumemoireFramework::Encyclopedia.monster_name.adjectives
|
|
407
|
+
|
|
408
|
+
$current_monster_name = $chosen_element + " " + $chosen_adjective
|
|
409
|
+
|
|
410
|
+
puts "Created monster name: #{$current_monster_name}"
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
def self.beastiary
|
|
414
|
+
system("clear")
|
|
415
|
+
|
|
416
|
+
beasts = File.read("beasts/beasts.txt")
|
|
417
|
+
|
|
418
|
+
puts beasts
|
|
419
|
+
|
|
420
|
+
available_beasts = [
|
|
421
|
+
"[Cochonbuta]", "[Ursinehomme]",
|
|
422
|
+
"[Ursinepiros]", "[Kumabatto]",
|
|
423
|
+
"[The Quantumcrusafied]",
|
|
424
|
+
]
|
|
425
|
+
|
|
426
|
+
print "\nWhat kind of beast? ( Cochonbuta / Ursinehomme / Ursinepiros / Kumabatto / The Quantumcrusafied ) << "; do_beast = gets.chomp
|
|
427
|
+
|
|
428
|
+
if do_beast == "Cochonbuta"; print available_beasts[0]; puts " Combines a lobster and a boar, related to the spider pig."
|
|
429
|
+
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."
|
|
430
|
+
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."
|
|
431
|
+
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."
|
|
432
|
+
elsif do_beast == "The Quantumcrusafied"; print available_beasts[4]; puts " The wandering spirits of men punished for quantum treason by quantum crusafiction."
|
|
433
|
+
else
|
|
434
|
+
puts ">> Not such beast exists on land or sea..."
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
gets.chomp
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
def self.study
|
|
441
|
+
system("clear")
|
|
442
|
+
|
|
443
|
+
word_index = File.read("lib/encyclopedia/encyclopedia/glossary.txt")
|
|
444
|
+
|
|
445
|
+
puts word_index
|
|
446
|
+
|
|
447
|
+
print "\nWhat word would you like to look up? >> "; research = gets.chomp
|
|
448
|
+
|
|
449
|
+
if research == "Lunario"
|
|
450
|
+
puts "BOB >> This is the largest form of in game currency, and is not used in ordinary game mechanics. It is mainly used for giving offerings to the lunar goddess, or paying the fair for dimension hopping that will come in the tiles version."
|
|
451
|
+
|
|
452
|
+
gets.chomp
|
|
453
|
+
elsif research == "Yen"
|
|
454
|
+
puts "BOB >> The smallest form of in game currency, this is mainly used for smaller fair items."
|
|
455
|
+
|
|
456
|
+
gets.chomp
|
|
457
|
+
|
|
458
|
+
elsif research == "Franc"
|
|
459
|
+
puts "BOB >> This is the largest form of in game currency within the scope of standard in game use. Once the tiles version of released, Lunario exists as travel currency."
|
|
460
|
+
|
|
461
|
+
gets.chomp
|
|
462
|
+
elsif research == "RPS"
|
|
463
|
+
puts "BOB >> RPS ia the ancronym for a form of games based on the mechanics of rock, paper, and scissors."
|
|
464
|
+
|
|
465
|
+
gets.chomp
|
|
466
|
+
elsif research == "exit"
|
|
467
|
+
abort
|
|
468
|
+
else
|
|
469
|
+
end
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
def self.translate
|
|
473
|
+
print "What word would you like to translate? >> "; translate = gets.chomp
|
|
474
|
+
|
|
475
|
+
# Get the word count based on how many words are in a sentence.
|
|
476
|
+
#word_count = translate.split(" ").to_i
|
|
477
|
+
|
|
478
|
+
dictionary = {
|
|
479
|
+
## Word Classes
|
|
480
|
+
|
|
481
|
+
## Francophonic
|
|
482
|
+
"Le" => "The ( Masculine ) [ Francophonic ]",
|
|
483
|
+
"La" => "The ( Feminine ) [ Francophonic ]",
|
|
484
|
+
"Les" => "The ( Plural ) [ Francophonic ]",
|
|
485
|
+
"Un" => "A [ Francophonic ]",
|
|
486
|
+
"Une" => "An [ Francophonic ]",
|
|
487
|
+
"Des" => "Some [ Francophonic ]",
|
|
488
|
+
|
|
489
|
+
## Japonic
|
|
490
|
+
"Anu" => "The ( Masculine ) [ Pseudo-Japonic ]",
|
|
491
|
+
"Ana" => "The ( Feminine ) [ Pseudo-Japonic ]",
|
|
492
|
+
"Anos" => "The ( Plural ) [ Pseudo-Japonic ]",
|
|
493
|
+
"Tu" => "A [ Pseudo-Japonic ]",
|
|
494
|
+
"Ta" => "An [ Pseudo-Japonic ]",
|
|
495
|
+
"Tos" => "Some [ Pseudo-Japaonic ]",
|
|
496
|
+
|
|
497
|
+
## German By Route Of Alsatian
|
|
498
|
+
"Der" => "The ( Masculine ) [ Germanic ]",
|
|
499
|
+
"Die" => "The ( Feminine ) [ Germanic ]",
|
|
500
|
+
"Das" => "The ( Plural ) [ Germanic ]",
|
|
501
|
+
"A" => "A [ Germanic ]",
|
|
502
|
+
"Ein" => "An [ Germanic ]",
|
|
503
|
+
|
|
504
|
+
## Compound Word Specific Word Classes
|
|
505
|
+
"Lanu" => "The ( masculine ) [ Ahusacos Specific ]",
|
|
506
|
+
"Lana" => "The ( feminine ) [ Ahusacos Specific ]",
|
|
507
|
+
"Lanos" => "The ( plural ) [ Ahusacos Specific ]",
|
|
508
|
+
"Tun" => "A [ Ahusacos Specific ]",
|
|
509
|
+
"Tan" => "An [ Ahusacos Specific ]",
|
|
510
|
+
"Deso" => "It / Some [ Ahusacos Specific ]",
|
|
511
|
+
|
|
512
|
+
## Negation Clauses
|
|
513
|
+
"Ne" => "Not [ Francophonic ]",
|
|
514
|
+
"Na" => "Not [ Japonic ]",
|
|
515
|
+
"Nix " => "Not [ Hybrid ]",
|
|
516
|
+
"Nein" => "Not [ Germanic ]",
|
|
517
|
+
|
|
518
|
+
## Personal Pronouns
|
|
519
|
+
"Je" => "I",
|
|
520
|
+
"Vous" => "You all",
|
|
521
|
+
"Toi" => "You",
|
|
522
|
+
"Nous" => "We",
|
|
523
|
+
"Il" => "He",
|
|
524
|
+
"Ils" => "Him",
|
|
525
|
+
"Elle" => "She",
|
|
526
|
+
"Elles" => "Her",
|
|
527
|
+
|
|
528
|
+
## Common Posessives
|
|
529
|
+
"mien" => "mine",
|
|
530
|
+
"votre" => "your",
|
|
531
|
+
"tien" => "yours",
|
|
532
|
+
"notre" => "our",
|
|
533
|
+
"notres" => "ours",
|
|
534
|
+
"sien" => "his",
|
|
535
|
+
"sienne" => "hers",
|
|
536
|
+
|
|
537
|
+
## Not used outside of context of military context, used to refer to groups of units.
|
|
538
|
+
## In practice, right-wing factions use the wrong plural pronoun to misgender entire units
|
|
539
|
+
## as a way to lower moral of left-wing factions. Because of this, after the Franco-Japanese
|
|
540
|
+
## Wars, they stopped being used widely.
|
|
541
|
+
|
|
542
|
+
## War Plurals
|
|
543
|
+
"Nousil" => "He plural",
|
|
544
|
+
"Nousils" => "Him plural",
|
|
545
|
+
"Nouselle" => "She plural",
|
|
546
|
+
"Nouselles" => "Her plural",
|
|
547
|
+
|
|
548
|
+
## Plural Posessives
|
|
549
|
+
"sienotre" => "our men",
|
|
550
|
+
"sienenotre" => "our women",
|
|
551
|
+
"sienotres" => "our men's",
|
|
552
|
+
"sienenotres" => "our women's",
|
|
553
|
+
|
|
554
|
+
## Famille / Family
|
|
555
|
+
|
|
556
|
+
### Francophonic
|
|
557
|
+
"Pere" => "Father",
|
|
558
|
+
"Mere" => "Mother",
|
|
559
|
+
"Frere" => "Brother",
|
|
560
|
+
"Soeur" => "Sister",
|
|
561
|
+
"Cousifrere" => "Male Cousin",
|
|
562
|
+
"Cousisoeur" => "Female Cousin",
|
|
563
|
+
"Cousiles" => "Both Cousins",
|
|
564
|
+
"Tante" => "Aunt",
|
|
565
|
+
"Oncle" => "Uncle",
|
|
566
|
+
|
|
567
|
+
### Color Acidity Framework
|
|
568
|
+
# These colors are for a system that rates colors based on their acidity or alkalinity.
|
|
569
|
+
|
|
570
|
+
##### Reds
|
|
571
|
+
"PH4DR1" => "Salmon",
|
|
572
|
+
"PH5DR1" => "Pale Salmon",
|
|
573
|
+
"PH4DR3" => "Salmon Pink",
|
|
574
|
+
|
|
575
|
+
##### Oranges
|
|
576
|
+
"PH4DR2" => "Copper",
|
|
577
|
+
"PH8WE1" => "Japanese Bistre",
|
|
578
|
+
|
|
579
|
+
##### Yellow
|
|
580
|
+
"PH6DR1" => "Maize",
|
|
581
|
+
"PH5DR2" => "Khaki",
|
|
582
|
+
"PH6DR3" => "Bland",
|
|
583
|
+
|
|
584
|
+
##### Green
|
|
585
|
+
"PH6DR2" => "Pale Lime",
|
|
586
|
+
"PH7NU1" => "Vibrant Green",
|
|
587
|
+
"PH7NU2" => "Medium Green",
|
|
588
|
+
"PH8WE2" => "Kelly Green",
|
|
589
|
+
|
|
590
|
+
##### Blue
|
|
591
|
+
"PH9WE2" => "Viridian",
|
|
592
|
+
"PHAWE3" => "Ultramarine",
|
|
593
|
+
"PH9WE3" => "Muted Sapphire",
|
|
594
|
+
"PH8WE3" => "Dark Sapphire",
|
|
595
|
+
"PH7NU3" => "Grey Blue",
|
|
596
|
+
|
|
597
|
+
##### Purple
|
|
598
|
+
"PH9WE1" => "Dull Purple",
|
|
599
|
+
"PH5DR3" => "Light Mauve",
|
|
600
|
+
|
|
601
|
+
##### Unusual Or Rare Color
|
|
602
|
+
"PH1WE3CH1" => "Dark Lavender", # A theoretical compound that blends Salmon with Sapphire blue.
|
|
603
|
+
"PH4WE2CH2" => "Atomic Hazel", # A highly toxic combination of copper and arsenic.
|
|
604
|
+
"Atomic Hazel" => "#6D6C46", # Hex code for atomic hazel.
|
|
605
|
+
|
|
606
|
+
### Chomatic Shades
|
|
607
|
+
### Arsenic Scale
|
|
608
|
+
|
|
609
|
+
### Unknown Origin
|
|
610
|
+
"PHAWE1" => "Bordeaux", # I don't know how I got this color.'
|
|
611
|
+
|
|
612
|
+
### Hand Mixed Colors
|
|
613
|
+
"#83b281" => "Dusty Green",
|
|
614
|
+
|
|
615
|
+
### Synthesized From Real Colors
|
|
616
|
+
"#A9A8AD" => "Faded Carolina Blue", # Pale Lime, Salmon Pink, Bland, Grey Blue [ Hypothesis Acidic Blue ]
|
|
617
|
+
"#A0A5B9" => "Manilla Lavender", # Salmon, Pale Salmon, Grey Blue, Grey Blue [ Hypothesis Slightly Alkaline Grey Blue ]
|
|
618
|
+
"#8cc874" => "Asparagus", # Pale Lime, Maize, Light Mauve, Medium Green [ Hypothesis Alkaline Green ]
|
|
619
|
+
"#a0b36c" => "Tan Green", # Pale Salmon, Kelly Green, Bland, Khaki [ Hypothesis Slightly Tan Green ]
|
|
620
|
+
"#5673A9" => "Dusky Blue", # Grey Blue, Light Mauve, Khaki, Sapphire [ Hypothesis Highly Alkaline Blue ]
|
|
621
|
+
"#A59C94" => "Warm Grey", # Vibrant Green, Salmon, Sapphire Dark, Bland [ Hypothesis Slightly Acidic Grey ]
|
|
622
|
+
|
|
623
|
+
### Synthesized From Synthetic Colors
|
|
624
|
+
"#788a9a" => "Steel", # Faded Carolina Blue, Tan Green, Warm Grey, Dusky Blue [ Hypothesis Slightly Alkaline Medium Chromatic Blue ]
|
|
625
|
+
"#415588" => "Dusky Blue Medium" # Genetically related to standard Dusky blue. Faded Carolina Blue, Tan Green, Warm Grey, Dusky Blue [ Hypothesis More Shaded Alkaline Blue ]
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
print "Your translation: "
|
|
629
|
+
print "#{translate} => #{dictionary[translate]}"
|
|
630
|
+
puts " "
|
|
631
|
+
|
|
632
|
+
gets.chomp
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
def self.detect_poison
|
|
636
|
+
color_data = File.read("translation/input.txt").strip.to_s
|
|
637
|
+
|
|
638
|
+
## Natural colors
|
|
639
|
+
if color_data == "Salmon"; sleep(1.5); system("./salmonbasic.sh")
|
|
640
|
+
elsif color_data == "Pale Salmon"; sleep(1.5); system("./palesalmon.sh")
|
|
641
|
+
elsif color_data == "Salmon Pink"; sleep(1.5); system("./salmonpink.sh")
|
|
642
|
+
elsif color_data == "Copper"; sleep(1.5); system("./cooper.sh")
|
|
643
|
+
elsif color_data == "Japanese Bistre"; sleep(1.5); system("./japanesebistre.sh")
|
|
644
|
+
elsif color_data == "Maize"; sleep(1.5); system("./maize.sh")
|
|
645
|
+
elsif color_data == "Khaki"; sleep(1.5); system("./khaki.sh")
|
|
646
|
+
elsif color_data == "Bland"; sleep(1.5); system("./bland.sh")
|
|
647
|
+
elsif color_data == "Pale Lime"; sleep(1.5); system("./palelime.sh")
|
|
648
|
+
elsif color_data == "Vibrant Green"; sleep(1.5); system("./vibrantgreen.sh")
|
|
649
|
+
elsif color_data == "Medium Green"; sleep(1.5); system("./mediuemgreen.sh")
|
|
650
|
+
elsif color_data == "Kelly Green"; sleep(1.5); system("./kellygreen.sh")
|
|
651
|
+
elsif color_data == "Viridian"; sleep(1.5); system("./viridian.sh")
|
|
652
|
+
elsif color_data == "Ultramarine"; sleep(1.5); system("./ultramarine.sh")
|
|
653
|
+
elsif color_data == "Muted Sapphire"; sleep(1.5); system("./mutedsapphire.sh")
|
|
654
|
+
elsif color_data == "Dark Sapphire"; sleep(1.5); system("./darksapphire.sh")
|
|
655
|
+
elsif color_data == "Grey Blue"; sleep(1.5); system("./greyblue.sh")
|
|
656
|
+
elsif color_data == "Dull Purple"; sleep(1.5); system("./dullpurple.sh")
|
|
657
|
+
elsif color_data == "Light Mauve"; sleep(1.5); system("./lightmauve.sh")
|
|
658
|
+
elsif color_data == "Dark Lavender"; sleep(1.5); system("./darklavender.sh")
|
|
659
|
+
elsif color_data == "Atomic Hazel"; sleep(1.5); system("./atomichazel.sh")
|
|
660
|
+
|
|
661
|
+
## Synthesized Colors
|
|
662
|
+
elsif color_data == "Faded Carolina Blue"; sleep(1.5); system("./fadedcarolinablue.sh")
|
|
663
|
+
elsif color_data == "Dusky Blue"; sleep(1.5); system("./duskyblue.sh")
|
|
664
|
+
|
|
665
|
+
## Double Processed Synthesized Colors
|
|
666
|
+
|
|
667
|
+
else
|
|
668
|
+
sleep(1.5)
|
|
669
|
+
|
|
670
|
+
puts ">> Either that's not a color, or no color information has yet been found."
|
|
671
|
+
end
|
|
672
|
+
end
|
|
673
|
+
end
|
|
674
|
+
|
|
675
|
+
class DamageFormulas
|
|
676
|
+
########################################################################################
|
|
677
|
+
# Damage Formulas For Players And Enemies #
|
|
678
|
+
########################################################################################
|
|
679
|
+
def player_damage_rate
|
|
680
|
+
#set_player_stats
|
|
681
|
+
#set_enemy_stats
|
|
682
|
+
|
|
683
|
+
def_dice = [ 'full_damage', 'half_damage', 'missed', 'critical' ]
|
|
684
|
+
|
|
685
|
+
roll_dice = def_dice.sample
|
|
686
|
+
|
|
687
|
+
if roll_dice == 'full_damage'
|
|
688
|
+
damage = $player_atk
|
|
689
|
+
|
|
690
|
+
$enemy_hp = $enemy_hp - damage
|
|
691
|
+
|
|
692
|
+
puts "\e[38;2;187;127;118mSister Chaos has attacked Sister Order for full damage.\e[0m"
|
|
693
|
+
|
|
694
|
+
sleep(1.5)
|
|
695
|
+
elsif roll_dice == 'critical'
|
|
696
|
+
damage = $player_atk * 2
|
|
697
|
+
|
|
698
|
+
$enemy_hp = $enemy_hp - damage
|
|
699
|
+
|
|
700
|
+
puts "\e[38;2;187;127;118mSister Chaos has attacked Sister Order for double damage.\e[0m"
|
|
701
|
+
|
|
702
|
+
sleep(1.5)
|
|
703
|
+
elsif roll_dice == 'half_damage'
|
|
704
|
+
damage = $player_atk / 2
|
|
705
|
+
|
|
706
|
+
$enemy_hp = $enemy_hp - damage
|
|
707
|
+
|
|
708
|
+
puts "\e[38;2;187;127;118mSister Chaos has attacked Sister Order for half damage.\e[0m"
|
|
709
|
+
|
|
710
|
+
sleep(1.5)
|
|
711
|
+
elsif roll_dice == 'missed'
|
|
712
|
+
puts "\e[38;2;187;127;118mSister Chaos has missed Sister Order.\e[0m"
|
|
713
|
+
|
|
714
|
+
sleep(1.5)
|
|
715
|
+
end
|
|
716
|
+
end
|
|
717
|
+
|
|
718
|
+
def enemy_damage_rate
|
|
719
|
+
#set_player_stats
|
|
720
|
+
#set_enemy_stats
|
|
721
|
+
|
|
722
|
+
def_dice = [ 'full_damage', 'half_damage', 'missed', 'critical' ]
|
|
723
|
+
|
|
724
|
+
roll_dice = def_dice.sample
|
|
725
|
+
|
|
726
|
+
if roll_dice == 'full_damage'
|
|
727
|
+
damage = $enemy_atk
|
|
728
|
+
|
|
729
|
+
$player_hp = $player_hp - damage
|
|
730
|
+
|
|
731
|
+
puts "\e[38;2;187;127;118mSister Order has attacked Sister Chaos for full damage.\e[0m"
|
|
732
|
+
|
|
733
|
+
sleep(1.5)
|
|
734
|
+
elsif roll_dice == 'critical'
|
|
735
|
+
damage = $enemy_atk * 2
|
|
736
|
+
|
|
737
|
+
$player_hp = $player_hp - damage
|
|
738
|
+
|
|
739
|
+
puts "\e[38;2;187;127;118mSister Order has attacked Sister Chaos for double damage.\e[0m"
|
|
740
|
+
|
|
741
|
+
sleep(1.5)
|
|
742
|
+
elsif roll_dice == 'half_damage'
|
|
743
|
+
damage = $enemy_atk / 2
|
|
744
|
+
|
|
745
|
+
$player_hp = $player_hp - damage
|
|
746
|
+
|
|
747
|
+
puts "\e[38;2;187;127;118mSister Order has attacked Sister Chaos for half damage.\e[0m"
|
|
748
|
+
|
|
749
|
+
sleep(1.5)
|
|
750
|
+
elsif roll_dice == 'missed'
|
|
751
|
+
puts "\e[38;2;187;127;118mSister Order has missed the Sister Chaos.\e[0m"
|
|
752
|
+
|
|
753
|
+
sleep(1.5)
|
|
754
|
+
end
|
|
755
|
+
end
|
|
756
|
+
end
|
|
757
|
+
|
|
758
|
+
class ZombieMode
|
|
759
|
+
###############################################################################################
|
|
760
|
+
# AI Decision Making #
|
|
761
|
+
###############################################################################################
|
|
762
|
+
def self.ai_decision
|
|
763
|
+
cchoice = @choice
|
|
764
|
+
|
|
765
|
+
## Determining user data and user choice.
|
|
766
|
+
value = File.read("lib/input/user/user_choice.txt").to_s.to_i
|
|
767
|
+
|
|
768
|
+
user_data = File.readlines("lib/data/user/candidates.txt")
|
|
769
|
+
user_choice = user_data[value]
|
|
770
|
+
|
|
771
|
+
## Processing AI focused data
|
|
772
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
773
|
+
ai_initial_candidate = user_data[ai_choice]
|
|
774
|
+
ai_search_limit = user_data.size.to_i
|
|
775
|
+
|
|
776
|
+
## Create AI data from user data.
|
|
777
|
+
ai_search_limit.times do
|
|
778
|
+
if ai_choice == user_choice
|
|
779
|
+
#puts "\e[38;2;187;127;118m The specific candidate was found. Terminating selection..."
|
|
780
|
+
|
|
781
|
+
ai_data = user_data.slice!(ai_choice)
|
|
782
|
+
|
|
783
|
+
open("lib/data/ai/candidates.txt", "w") { |f|
|
|
784
|
+
f.puts ai_data
|
|
785
|
+
}
|
|
786
|
+
else
|
|
787
|
+
puts "\e[38;2;187;127;118mL'ennemi découvre que vous n'avez pas fait ce choix...\e[0m"
|
|
788
|
+
end
|
|
789
|
+
|
|
790
|
+
sleep(1.5)
|
|
791
|
+
end
|
|
792
|
+
|
|
793
|
+
## AI processing data.
|
|
794
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
795
|
+
ai_data = File.readlines("lib/data/ai/candidates.txt")
|
|
796
|
+
ai_search_limit = ai_data.size.to_i
|
|
797
|
+
ai_next_candidate = ai_data[ai_choice]
|
|
798
|
+
|
|
799
|
+
ai_search_limit.times do
|
|
800
|
+
if ai_next_candidate == user_choice
|
|
801
|
+
ai_final_candidate = ai_next_candidate
|
|
802
|
+
|
|
803
|
+
puts "\e[38;2;187;127;118mCandidate found, processing input...\e[0m"; sleep(1)
|
|
804
|
+
|
|
805
|
+
# Breaks the loop if an appropriate candidate is found.
|
|
806
|
+
|
|
807
|
+
sleep(1.5)
|
|
808
|
+
|
|
809
|
+
conditions = ["Sword", "Stone", "Tarp"]
|
|
810
|
+
|
|
811
|
+
decision_made = conditions.sample
|
|
812
|
+
|
|
813
|
+
puts "\e[38;2;187;127;118mBy process of elimination, the bot chose: #{ai_data}\e[0m"
|
|
814
|
+
|
|
815
|
+
@cchoice = "#{ai_data}"
|
|
816
|
+
|
|
817
|
+
puts $cchoice
|
|
818
|
+
|
|
819
|
+
break
|
|
820
|
+
else
|
|
821
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
822
|
+
ai_data = File.readlines("lib/data/ai/candidates.txt")
|
|
823
|
+
ai_search_limit = ai_data.size.to_i
|
|
824
|
+
ai_next_candidate = ai_data[ai_choice]
|
|
825
|
+
|
|
826
|
+
ai_data = user_data.slice!(ai_choice).strip
|
|
827
|
+
|
|
828
|
+
puts "\e[38;2;187;127;118mEnemy found the option #{ai_data}\e[0m"
|
|
829
|
+
|
|
830
|
+
enemy_decision = ["choose", "skip"]
|
|
831
|
+
|
|
832
|
+
decision_made = enemy_decision.sample
|
|
833
|
+
|
|
834
|
+
if decision_made == "choose"
|
|
835
|
+
puts "\e[38;2;187;127;118mThe enemy chose: #{ai_data}, but found it causes a stalemate. Makes a new decision\e[0m"
|
|
836
|
+
|
|
837
|
+
@cchoice = "#{ai_data}"
|
|
838
|
+
|
|
839
|
+
enemy_decision = ["Epee", "Ishi", "Bache"]
|
|
840
|
+
|
|
841
|
+
decision_made = enemy_decision.sample
|
|
842
|
+
|
|
843
|
+
if decision_made == "Sword"
|
|
844
|
+
@cchoice = "Epee"
|
|
845
|
+
elsif decision_made == "Stone"
|
|
846
|
+
@cchoice = "Ishi"
|
|
847
|
+
elsif decision_made == "Tarp"
|
|
848
|
+
@cchoice = "Bache"
|
|
849
|
+
end
|
|
850
|
+
|
|
851
|
+
break
|
|
852
|
+
else
|
|
853
|
+
puts "\e[38;2;187;127;118mEnemy weighed the option of choosing #{ai_data}, but decided to skip its turn.\e[0m"
|
|
854
|
+
|
|
855
|
+
break
|
|
856
|
+
end
|
|
857
|
+
|
|
858
|
+
sleep(1.5)
|
|
859
|
+
|
|
860
|
+
open("lib/data/ai/candidates.txt", "w") { |f|
|
|
861
|
+
f.puts ai_data
|
|
862
|
+
}
|
|
863
|
+
end
|
|
864
|
+
end
|
|
865
|
+
|
|
866
|
+
def self.parser
|
|
867
|
+
loop do
|
|
868
|
+
system("clear")
|
|
869
|
+
|
|
870
|
+
if $current_day < $lunar_ticks
|
|
871
|
+
this_day = 29
|
|
872
|
+
|
|
873
|
+
puts "\e[38;2;187;127;118mLa prochaine phase lunaire est en cours: #{this_day - $current_day} days...\e[0m"
|
|
874
|
+
else
|
|
875
|
+
lunar_cycle
|
|
876
|
+
|
|
877
|
+
# Reset lunar ticks to twenty days away.
|
|
878
|
+
$current_day = 1
|
|
879
|
+
end
|
|
880
|
+
|
|
881
|
+
puts "\e[38;2;187;127;118m[ Currency is #{$player_franc} Francs And #{$player_yen} Yen ]\e[0m"
|
|
882
|
+
|
|
883
|
+
puts "\e[38;2;187;127;118m\n[ Stalemates: #{$stalemates} ] [ Player Strikes: #{$player_struck} ] [ Enemy Strikes: #{$enemy_struck} ]\e[0m"
|
|
884
|
+
puts "\e[38;2;187;127;118m [ #{$player_lunario} Lunario ( You wont need this for most game functions. ) ]"
|
|
885
|
+
|
|
886
|
+
puts "\e[38;2;187;127;118m\n\e[0m"
|
|
887
|
+
puts "\e[38;2;187;127;118mSouer De Chaos ( Ana Nuveyatusuki ) HP: #{$player_hp} \e[0m"
|
|
888
|
+
puts "\e[38;2;187;127;118mSouer De Commande ( Ana Nuveyatusuki ) HP: #{$enemy_hp}\e[0m"
|
|
889
|
+
puts "\e[38;2;187;127;118m\n\e[0m"
|
|
890
|
+
|
|
891
|
+
if $player_hp > 0
|
|
892
|
+
system("clear")
|
|
893
|
+
|
|
894
|
+
puts "\e[38;2;187;127;118mYou've been zombiefied!\e[0m"
|
|
895
|
+
|
|
896
|
+
sleep(1.5)
|
|
897
|
+
|
|
898
|
+
system("ruby rockpaper.rb")
|
|
899
|
+
elsif $enemy_hp <= 0
|
|
900
|
+
puts "\e[38;2;187;127;118mYou won\e[0m"
|
|
901
|
+
|
|
902
|
+
gets.chomp
|
|
903
|
+
|
|
904
|
+
abort
|
|
905
|
+
end
|
|
906
|
+
|
|
907
|
+
conditions = {
|
|
908
|
+
"Epee" => "Ishi",
|
|
909
|
+
"Ishi" => "Bache",
|
|
910
|
+
"Bache" => "Epee",
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
puts "\e[38;2;187;127;118mTo heal the player, type: Chomp\e[0m"
|
|
914
|
+
|
|
915
|
+
print "\e[38;2;164;145;91m\nEpee, Ishi, or Bache >> \e[0m"
|
|
916
|
+
@choice = gets.chomp.capitalize
|
|
917
|
+
|
|
918
|
+
if @choice == "Epee"
|
|
919
|
+
open("lib/input/user/user_choice.txt", "w") { |f|
|
|
920
|
+
f.puts "0"
|
|
921
|
+
}
|
|
922
|
+
elsif @choice == "Ishi"
|
|
923
|
+
open("lib/input/user/user_choice.txt", "w") { |f|
|
|
924
|
+
f.puts "1"
|
|
925
|
+
}
|
|
926
|
+
elsif @choice == "Bache"
|
|
927
|
+
open("lib/input/user/user_choice.txt", "w") { |f|
|
|
928
|
+
f.puts "2"
|
|
929
|
+
}
|
|
930
|
+
elsif @choice == "Chomp"
|
|
931
|
+
open("lib/input/user/user_choice.txt", "w") { |f|
|
|
932
|
+
f.puts "2"
|
|
933
|
+
}
|
|
934
|
+
end
|
|
935
|
+
|
|
936
|
+
puts " "
|
|
937
|
+
sleep(1.5)
|
|
938
|
+
|
|
939
|
+
# Experiment with using an enemy that learns from player's decisions.'
|
|
940
|
+
YumemoireFramework::ZombieMode.ai_decision
|
|
941
|
+
|
|
942
|
+
if conditions[@choice] == @cchoice
|
|
943
|
+
#puts "\e[38;2;187;127;118m You were struck by the enemy!"
|
|
944
|
+
|
|
945
|
+
$enemy_struck = $enemy_struck + 1
|
|
946
|
+
|
|
947
|
+
# The amount of damage player gets is based on the enemies attack power.
|
|
948
|
+
#$player_hp = $player_hp - $enemy_atk
|
|
949
|
+
YumemoireFramework::DamageFormulas.enemy_damage_rate
|
|
950
|
+
elsif @cchoice == @choice
|
|
951
|
+
puts "\e[38;2;187;127;118mYou reach a stalemate.\e[0m"
|
|
952
|
+
|
|
953
|
+
$stalemates = $stalemates + 1
|
|
954
|
+
elsif conditions[@cchoice] == @choice
|
|
955
|
+
#puts "\e[38;2;187;127;118m You struck the enemy!"
|
|
956
|
+
|
|
957
|
+
$player_struck = $player_struck + 1
|
|
958
|
+
|
|
959
|
+
# The amount of damage enemy recieves is based on the player's attack power.
|
|
960
|
+
#$enemy_hp = $enemy_hp - $player_atk
|
|
961
|
+
YumemoireFramework::DamageFormulas.player_damage_rate
|
|
962
|
+
elsif @choice == "Chomp"
|
|
963
|
+
puts "\e[38;2;187;127;118mYou tried staying at an inn, but hotels don't take the undead...'\e[0m"
|
|
964
|
+
|
|
965
|
+
sleep(1.5)
|
|
966
|
+
|
|
967
|
+
YumemoireFramework::ZombieMode.consumption
|
|
968
|
+
else
|
|
969
|
+
puts "\e[38;2;187;127;118m#{@choice} is not a valid option\e[0m"
|
|
970
|
+
end
|
|
971
|
+
|
|
972
|
+
$current_day = $current_day + 1
|
|
973
|
+
end
|
|
974
|
+
end
|
|
975
|
+
end
|
|
976
|
+
|
|
977
|
+
###############################################################################################
|
|
978
|
+
# Zombie State Minigame #
|
|
979
|
+
###############################################################################################
|
|
980
|
+
#$true_reset_hp = File.read("lib/player_stats/true_reset_hp.txt").strip.to_i
|
|
981
|
+
$reset_hp = File.read("lib/player_stats/reset_hp.txt").strip.to_i
|
|
982
|
+
$player_hp = File.read("lib/player_stats/zombie_player_hp.txt").strip.to_i
|
|
983
|
+
|
|
984
|
+
def self.reset_standard_hp_restoration
|
|
985
|
+
puts "The curse of being a zombie has been lifted. You can not die like any other mortal."
|
|
986
|
+
|
|
987
|
+
$reset_hp = $true_reset_hp
|
|
988
|
+
end
|
|
989
|
+
|
|
990
|
+
def self.cremation
|
|
991
|
+
puts "You've self cremated."
|
|
992
|
+
|
|
993
|
+
sleep(1.5)
|
|
994
|
+
|
|
995
|
+
puts "You've opted to self cremate. Restarting the map."
|
|
996
|
+
|
|
997
|
+
$player_hp = $reset_hp
|
|
998
|
+
|
|
999
|
+
puts "Now returning to human form..."
|
|
1000
|
+
|
|
1001
|
+
system("ruby rockpaper.rb")
|
|
1002
|
+
end
|
|
1003
|
+
|
|
1004
|
+
def self.consumption
|
|
1005
|
+
puts "You've eaten parts of your own corpse."
|
|
1006
|
+
|
|
1007
|
+
sleep(1.5)
|
|
1008
|
+
|
|
1009
|
+
$reset_hp = $reset_hp - 1
|
|
1010
|
+
$player_hp = $reset_hp
|
|
1011
|
+
|
|
1012
|
+
print "Your HP was replinished but "
|
|
1013
|
+
|
|
1014
|
+
puts " you lost 3 hit points from consuming your own body."
|
|
1015
|
+
|
|
1016
|
+
File.open("lib/player_stats/zombie_player_hp.txt", "w") { |f|
|
|
1017
|
+
$player_hp = $player_hp + 3
|
|
1018
|
+
|
|
1019
|
+
f.puts $player_hp -20
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
File.open("lib/player_stats/reset_hp.txt", "w") { |f|
|
|
1023
|
+
$reset_hp = $reset_hp - 3
|
|
1024
|
+
|
|
1025
|
+
f.puts $reset_hp
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
system("ruby rock_paper_zombie.rb")
|
|
1029
|
+
end
|
|
1030
|
+
|
|
1031
|
+
def self.final_wishes
|
|
1032
|
+
print "Do you wish to self-cremate or continue this battle? ( cremate / consumption ) << "
|
|
1033
|
+
|
|
1034
|
+
choose_your_fate = gets.chomp
|
|
1035
|
+
|
|
1036
|
+
if choose_your_fate == "cremate"
|
|
1037
|
+
YumemoreFramework::ZombieMode.cremation
|
|
1038
|
+
elsif choose_your_fate == "consumption"
|
|
1039
|
+
YumemoreFramework::ZombieMode.consumption
|
|
1040
|
+
else
|
|
1041
|
+
puts ">> Last wishes not understoood, defaulting to self-cremation."
|
|
1042
|
+
end
|
|
1043
|
+
end
|
|
1044
|
+
end
|
|
1045
|
+
|
|
1046
|
+
class BezerkerMode
|
|
1047
|
+
###############################################################################################
|
|
1048
|
+
# AI Decision Making #
|
|
1049
|
+
###############################################################################################
|
|
1050
|
+
def self.ai_decision
|
|
1051
|
+
cchoice = @choice
|
|
1052
|
+
|
|
1053
|
+
## Determining user data and user choice.
|
|
1054
|
+
value = File.read("lib/input/user/user_choice.txt").to_s.to_i
|
|
1055
|
+
|
|
1056
|
+
user_data = File.readlines("lib/data/user/candidates.txt")
|
|
1057
|
+
user_choice = user_data[value]
|
|
1058
|
+
|
|
1059
|
+
## Processing AI focused data
|
|
1060
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
1061
|
+
ai_initial_candidate = user_data[ai_choice]
|
|
1062
|
+
ai_search_limit = user_data.size.to_i
|
|
1063
|
+
|
|
1064
|
+
## Create AI data from user data.
|
|
1065
|
+
ai_search_limit.times do
|
|
1066
|
+
if ai_choice == user_choice
|
|
1067
|
+
#puts "\e[38;2;187;127;118m The specific candidate was found. Terminating selection..."
|
|
1068
|
+
|
|
1069
|
+
ai_data = user_data.slice!(ai_choice)
|
|
1070
|
+
|
|
1071
|
+
open("lib/data/ai/candidates.txt", "w") { |f|
|
|
1072
|
+
f.puts ai_data
|
|
1073
|
+
}
|
|
1074
|
+
else
|
|
1075
|
+
puts "\e[38;2;187;127;118mL'ennemi découvre que vous n'avez pas fait ce choix...\e[0m"
|
|
1076
|
+
end
|
|
1077
|
+
|
|
1078
|
+
sleep(1.5)
|
|
1079
|
+
end
|
|
1080
|
+
|
|
1081
|
+
## AI processing data.
|
|
1082
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
1083
|
+
ai_data = File.readlines("lib/data/ai/candidates.txt")
|
|
1084
|
+
ai_search_limit = ai_data.size.to_i
|
|
1085
|
+
ai_next_candidate = ai_data[ai_choice]
|
|
1086
|
+
|
|
1087
|
+
ai_search_limit.times do
|
|
1088
|
+
if ai_next_candidate == user_choice
|
|
1089
|
+
ai_final_candidate = ai_next_candidate
|
|
1090
|
+
|
|
1091
|
+
puts "\e[38;2;187;127;118mCandidate found, processing input...\e[0m"; sleep(1)
|
|
1092
|
+
|
|
1093
|
+
# Breaks the loop if an appropriate candidate is found.
|
|
1094
|
+
|
|
1095
|
+
sleep(1.5)
|
|
1096
|
+
|
|
1097
|
+
conditions = ["Sword", "Stone", "Tarp"]
|
|
1098
|
+
|
|
1099
|
+
decision_made = conditions.sample
|
|
1100
|
+
|
|
1101
|
+
puts "\e[38;2;187;127;118mBy process of elimination, the bot chose: #{ai_data}\e[0m"
|
|
1102
|
+
|
|
1103
|
+
@cchoice = "#{ai_data}"
|
|
1104
|
+
|
|
1105
|
+
puts $cchoice
|
|
1106
|
+
|
|
1107
|
+
break
|
|
1108
|
+
else
|
|
1109
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
1110
|
+
ai_data = File.readlines("lib/data/ai/candidates.txt")
|
|
1111
|
+
ai_search_limit = ai_data.size.to_i
|
|
1112
|
+
ai_next_candidate = ai_data[ai_choice]
|
|
1113
|
+
|
|
1114
|
+
ai_data = user_data.slice!(ai_choice).strip
|
|
1115
|
+
|
|
1116
|
+
puts "\e[38;2;187;127;118mEnemy found the option #{ai_data}\e[0m"
|
|
1117
|
+
|
|
1118
|
+
enemy_decision = ["choose", "skip"]
|
|
1119
|
+
|
|
1120
|
+
decision_made = enemy_decision.sample
|
|
1121
|
+
|
|
1122
|
+
if decision_made == "choose"
|
|
1123
|
+
puts "\e[38;2;187;127;118mThe enemy chose: #{ai_data}, but found it causes a stalemate. Makes a new decision\e[0m"
|
|
1124
|
+
|
|
1125
|
+
@cchoice = "#{ai_data}"
|
|
1126
|
+
|
|
1127
|
+
enemy_decision = ["Epee", "Ishi", "Bache"]
|
|
1128
|
+
|
|
1129
|
+
decision_made = enemy_decision.sample
|
|
1130
|
+
|
|
1131
|
+
if decision_made == "Sword"
|
|
1132
|
+
@cchoice = "Epee"
|
|
1133
|
+
elsif decision_made == "Stone"
|
|
1134
|
+
@cchoice = "Ishi"
|
|
1135
|
+
elsif decision_made == "Tarp"
|
|
1136
|
+
@cchoice = "Bache"
|
|
1137
|
+
end
|
|
1138
|
+
|
|
1139
|
+
break
|
|
1140
|
+
else
|
|
1141
|
+
puts "\e[38;2;187;127;118mEnemy weighed the option of choosing #{ai_data}, but decided to skip its turn.\e[0m"
|
|
1142
|
+
|
|
1143
|
+
break
|
|
1144
|
+
end
|
|
1145
|
+
|
|
1146
|
+
sleep(1.5)
|
|
1147
|
+
|
|
1148
|
+
open("lib/data/ai/candidates.txt", "w") { |f|
|
|
1149
|
+
f.puts ai_data
|
|
1150
|
+
}
|
|
1151
|
+
end
|
|
1152
|
+
end
|
|
1153
|
+
end
|
|
1154
|
+
|
|
1155
|
+
#############################################################################################
|
|
1156
|
+
# Standard methods for player autonomy in the game. #
|
|
1157
|
+
#############################################################################################
|
|
1158
|
+
def self.full_player_control
|
|
1159
|
+
#player_heal = $healing_rate
|
|
1160
|
+
|
|
1161
|
+
# Loop for full player control
|
|
1162
|
+
|
|
1163
|
+
# Least damaging, yet most efficient healing and other maintence.
|
|
1164
|
+
|
|
1165
|
+
conditions = {
|
|
1166
|
+
"Epee" => "Ishi",
|
|
1167
|
+
"Ishi" => "Bache",
|
|
1168
|
+
"Bache" => "Epee",
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
bezerker_chance = ["autonomy", "autonomy", "autonomy", "autonomy"]
|
|
1172
|
+
|
|
1173
|
+
chance_of_bezerker = bezerker_chance.sample
|
|
1174
|
+
|
|
1175
|
+
if chance_of_bezerker == "autonomy"
|
|
1176
|
+
print "Player Choice >> "; @choice = gets.chomp
|
|
1177
|
+
else
|
|
1178
|
+
puts "Player lost control of the MC..."
|
|
1179
|
+
|
|
1180
|
+
sleep(1.5)
|
|
1181
|
+
|
|
1182
|
+
@choice = File.readlines("lib/data/ai/player_patterns/observed_player_actions.txt").sample.strip.to_s
|
|
1183
|
+
end
|
|
1184
|
+
|
|
1185
|
+
@cchoice = File.readlines("lib/data/ai/enemy_patterns/observed_enemy_actions.txt").sample.strip.to_s
|
|
1186
|
+
|
|
1187
|
+
puts "The enemy chose: #{@cchoice}"
|
|
1188
|
+
|
|
1189
|
+
if @choice == "Epee"
|
|
1190
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1191
|
+
f.puts "0"
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
# Records a history of player actions.
|
|
1195
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1196
|
+
f.puts "0"
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
# Allows enemey to learn about player patterns.
|
|
1200
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1201
|
+
f.puts "Epee"
|
|
1202
|
+
}
|
|
1203
|
+
elsif @choice == "Ishi"
|
|
1204
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1205
|
+
f.puts "1"
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
# Records a history of player actions.
|
|
1209
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1210
|
+
f.puts "1"
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
# Allows enemey to learn about player patterns.
|
|
1214
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1215
|
+
f.puts "Ishi"
|
|
1216
|
+
}
|
|
1217
|
+
elsif @choice == "Bache"
|
|
1218
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1219
|
+
f.puts "2"
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
# Records a history of player actions.
|
|
1223
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1224
|
+
f.puts "2"
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
# Allows enemey to learn about player patterns.
|
|
1228
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1229
|
+
f.puts "Bache"
|
|
1230
|
+
}
|
|
1231
|
+
elsif @choice == "Sleep"
|
|
1232
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1233
|
+
f.puts "2"
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
# Records a history of player actions. This one defaults to bache even though its a distinct action.
|
|
1237
|
+
open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1238
|
+
f.puts "2"
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
# Allows enemey to learn about player patterns.
|
|
1242
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1243
|
+
f.puts "Bache"
|
|
1244
|
+
}
|
|
1245
|
+
end
|
|
1246
|
+
|
|
1247
|
+
puts " "
|
|
1248
|
+
sleep(1.5)
|
|
1249
|
+
|
|
1250
|
+
# Experiment with using an enemy that learns from player's decisions.'
|
|
1251
|
+
YumemoireFramework::BezerkerMode.ai_decision
|
|
1252
|
+
|
|
1253
|
+
if conditions[@choice] == @cchoice
|
|
1254
|
+
puts "You were struck by the enemy!"
|
|
1255
|
+
|
|
1256
|
+
$player_struck = $player_struck + 1
|
|
1257
|
+
|
|
1258
|
+
# The amount of damage player gets is based on the enemies attack power.
|
|
1259
|
+
#$player_hp = $player_hp - $enemy_atk
|
|
1260
|
+
enemy_damage_rate
|
|
1261
|
+
elsif @cchoice == @choice
|
|
1262
|
+
puts "You reach a stalemate."
|
|
1263
|
+
|
|
1264
|
+
$stalemates = $stalemates + 1
|
|
1265
|
+
elsif conditions[@cchoice] == @choice
|
|
1266
|
+
puts "You struck the enemy!"
|
|
1267
|
+
|
|
1268
|
+
$enemy_struck = $enemy_struck + 1
|
|
1269
|
+
|
|
1270
|
+
# The amount of damage enemy recieves is based on the player's attack power.
|
|
1271
|
+
#$enemy_hp = $enemy_hp - $player_atk
|
|
1272
|
+
player_damage_rate
|
|
1273
|
+
elsif @choice == "Sleep"
|
|
1274
|
+
puts "\e[38;2;187;127;118mYou've opted to stay at an inn...'\e[0m"
|
|
1275
|
+
|
|
1276
|
+
sleep(1.5)
|
|
1277
|
+
|
|
1278
|
+
stay_at_inn
|
|
1279
|
+
else
|
|
1280
|
+
puts "\e[38;2;187;127;118m#{@choice} is not a valid option\e[0m"
|
|
1281
|
+
end
|
|
1282
|
+
|
|
1283
|
+
observe_enemy
|
|
1284
|
+
observe_player
|
|
1285
|
+
|
|
1286
|
+
sleep(1.5)
|
|
1287
|
+
|
|
1288
|
+
$current_day = $current_day + 1
|
|
1289
|
+
end
|
|
1290
|
+
|
|
1291
|
+
def self.mostly_player_control
|
|
1292
|
+
#player_heal = $healing_rate
|
|
1293
|
+
|
|
1294
|
+
# Loop for mostly player control
|
|
1295
|
+
|
|
1296
|
+
# More powerful than full player control, but less efficient maintanence tasks.
|
|
1297
|
+
|
|
1298
|
+
conditions = {
|
|
1299
|
+
"Epee" => "Ishi",
|
|
1300
|
+
"Ishi" => "Bache",
|
|
1301
|
+
"Bache" => "Epee",
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
bezerker_chance = ["autonomy", "autonomy", "autonomy", "bezerker"]
|
|
1305
|
+
|
|
1306
|
+
chance_of_bezerker = bezerker_chance.sample
|
|
1307
|
+
|
|
1308
|
+
if chance_of_bezerker == "autonomy"
|
|
1309
|
+
print "Player Choice >> "; @choice = gets.chomp
|
|
1310
|
+
else
|
|
1311
|
+
puts "Player lost control of the MC..."
|
|
1312
|
+
|
|
1313
|
+
sleep(1.5)
|
|
1314
|
+
|
|
1315
|
+
@choice = File.readlines("lib/data/ai/player_patterns/observed_player_actions.txt").sample.strip.to_s
|
|
1316
|
+
end
|
|
1317
|
+
|
|
1318
|
+
@cchoice = File.readlines("lib/data/ai/enemy_patterns/observed_enemy_actions.txt").sample.strip.to_s
|
|
1319
|
+
|
|
1320
|
+
puts "The enemy chose: #{@cchoice}"
|
|
1321
|
+
|
|
1322
|
+
if @choice == "Epee"
|
|
1323
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1324
|
+
f.puts "0"
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
# Records a history of player actions.
|
|
1328
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1329
|
+
f.puts "0"
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
# Allows enemey to learn about player patterns.
|
|
1333
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1334
|
+
f.puts "Epee"
|
|
1335
|
+
}
|
|
1336
|
+
elsif @choice == "Ishi"
|
|
1337
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1338
|
+
f.puts "1"
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
# Records a history of player actions.
|
|
1342
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1343
|
+
f.puts "1"
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
# Allows enemey to learn about player patterns.
|
|
1347
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1348
|
+
f.puts "Ishi"
|
|
1349
|
+
}
|
|
1350
|
+
elsif @choice == "Bache"
|
|
1351
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1352
|
+
f.puts "2"
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
# Records a history of player actions.
|
|
1356
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1357
|
+
f.puts "2"
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
# Allows enemey to learn about player patterns.
|
|
1361
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1362
|
+
f.puts "Bache"
|
|
1363
|
+
}
|
|
1364
|
+
elsif @choice == "Sleep"
|
|
1365
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1366
|
+
f.puts "2"
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
# Records a history of player actions. This one defaults to bache even though its a distinct action.
|
|
1370
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1371
|
+
f.puts "2"
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
# Allows enemey to learn about player patterns.
|
|
1375
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1376
|
+
f.puts "Bache"
|
|
1377
|
+
}
|
|
1378
|
+
end
|
|
1379
|
+
|
|
1380
|
+
puts " "
|
|
1381
|
+
sleep(1.5)
|
|
1382
|
+
|
|
1383
|
+
# Experiment with using an enemy that learns from player's decisions.'
|
|
1384
|
+
YumemoireFramework::BezerkerMode.ai_decision
|
|
1385
|
+
|
|
1386
|
+
if conditions[@choice] == @cchoice
|
|
1387
|
+
puts "You were struck by the enemy!"
|
|
1388
|
+
|
|
1389
|
+
$player_struck = $player_struck + 1
|
|
1390
|
+
|
|
1391
|
+
# The amount of damage player gets is based on the enemies attack power.
|
|
1392
|
+
#$player_hp = $player_hp - $enemy_atk
|
|
1393
|
+
YumemoireFramework::DamageFormulas.enemy_damage_rate
|
|
1394
|
+
elsif @cchoice == @choice
|
|
1395
|
+
puts "You reach a stalemate."
|
|
1396
|
+
|
|
1397
|
+
$stalemates = $stalemates + 1
|
|
1398
|
+
elsif conditions[@cchoice] == @choice
|
|
1399
|
+
puts "You struck the enemy!"
|
|
1400
|
+
|
|
1401
|
+
$enemy_struck = $enemy_struck + 1
|
|
1402
|
+
|
|
1403
|
+
# The amount of damage enemy recieves is based on the player's attack power.
|
|
1404
|
+
#$enemy_hp = $enemy_hp - $player_atk
|
|
1405
|
+
YumemoireFramework::DamageFormulas.player_damage_rate
|
|
1406
|
+
elsif @choice == "Sleep"
|
|
1407
|
+
puts "\e[38;2;187;127;118mYou've opted to stay at an inn...'\e[0m"
|
|
1408
|
+
|
|
1409
|
+
sleep(1.5)
|
|
1410
|
+
|
|
1411
|
+
stay_at_inn
|
|
1412
|
+
else
|
|
1413
|
+
puts "\e[38;2;187;127;118m#{@choice} is not a valid option\e[0m"
|
|
1414
|
+
end
|
|
1415
|
+
|
|
1416
|
+
observe_enemy
|
|
1417
|
+
observe_player
|
|
1418
|
+
|
|
1419
|
+
sleep(1.5)
|
|
1420
|
+
|
|
1421
|
+
$current_day = $current_day + 1
|
|
1422
|
+
end
|
|
1423
|
+
|
|
1424
|
+
### This section flips between automatic player and player autonomy.
|
|
1425
|
+
def self.mostly_automated_player
|
|
1426
|
+
#player_heal = $healing_rate
|
|
1427
|
+
|
|
1428
|
+
# Loop for mostly automated player.
|
|
1429
|
+
|
|
1430
|
+
# The most powerful attacks for player character, but least efficient maintance tasks.
|
|
1431
|
+
|
|
1432
|
+
conditions = {
|
|
1433
|
+
"Epee" => "Ishi",
|
|
1434
|
+
"Ishi" => "Bache",
|
|
1435
|
+
"Bache" => "Epee",
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
bezerker_chance = ["autonomy", "bezerker", "bezerker", "bezerker"]
|
|
1439
|
+
|
|
1440
|
+
chance_of_bezerker = bezerker_chance.sample
|
|
1441
|
+
|
|
1442
|
+
if chance_of_bezerker == "autonomy"
|
|
1443
|
+
print "Player Choice >> "; @choice = gets.chomp
|
|
1444
|
+
else
|
|
1445
|
+
puts "Player lost control of the MC..."
|
|
1446
|
+
|
|
1447
|
+
sleep(1.5)
|
|
1448
|
+
|
|
1449
|
+
@choice = File.readlines("lib/data/ai/player_patterns/observed_player_actions.txt").sample.strip.to_s
|
|
1450
|
+
end
|
|
1451
|
+
|
|
1452
|
+
@cchoice = File.readlines("lib/data/ai/enemy_patterns/observed_enemy_actions.txt").sample.strip.to_s
|
|
1453
|
+
|
|
1454
|
+
puts "The enemy chose: #{@cchoice}"
|
|
1455
|
+
|
|
1456
|
+
if @choice == "Epee"
|
|
1457
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1458
|
+
f.puts "0"
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
# Records a history of player actions.
|
|
1462
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1463
|
+
f.puts "0"
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
# Allows enemey to learn about player patterns.
|
|
1467
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1468
|
+
f.puts "Epee"
|
|
1469
|
+
}
|
|
1470
|
+
elsif @choice == "Ishi"
|
|
1471
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1472
|
+
f.puts "1"
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
# Records a history of player actions.
|
|
1476
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1477
|
+
f.puts "1"
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
# Allows enemey to learn about player patterns.
|
|
1481
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1482
|
+
f.puts "Ishi"
|
|
1483
|
+
}
|
|
1484
|
+
elsif @choice == "Bache"
|
|
1485
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1486
|
+
f.puts "2"
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
# Records a history of player actions.
|
|
1490
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1491
|
+
f.puts "2"
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
# Allows enemey to learn about player patterns.
|
|
1495
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1496
|
+
f.puts "Bache"
|
|
1497
|
+
}
|
|
1498
|
+
elsif @choice == "Sleep"
|
|
1499
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1500
|
+
f.puts "2"
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
# Records a history of player actions. This one defaults to bache even though its a distinct action.
|
|
1504
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1505
|
+
f.puts "2"
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
# Allows enemy to learn about player patterns.
|
|
1509
|
+
File.open("lib/data/ai/player_patterns/observed_player_actions.txt", "a") { |f|
|
|
1510
|
+
f.puts "Bache"
|
|
1511
|
+
}
|
|
1512
|
+
end
|
|
1513
|
+
|
|
1514
|
+
puts " "
|
|
1515
|
+
sleep(1.5)
|
|
1516
|
+
|
|
1517
|
+
# Experiment with using an enemy that learns from player's decisions.'
|
|
1518
|
+
YumemoireFramework::BezerkerMode.ai_decision
|
|
1519
|
+
|
|
1520
|
+
if conditions[@choice] == @cchoice
|
|
1521
|
+
puts "You were struck by the enemy!"
|
|
1522
|
+
|
|
1523
|
+
$player_struck = $player_struck + 1
|
|
1524
|
+
|
|
1525
|
+
# The amount of damage player gets is based on the enemies attack power.
|
|
1526
|
+
#$player_hp = $player_hp - $enemy_atk
|
|
1527
|
+
YumemoireFramework::DamageFormulas.enemy_damage_rate
|
|
1528
|
+
elsif @cchoice == @choice
|
|
1529
|
+
puts "You reach a stalemate."
|
|
1530
|
+
|
|
1531
|
+
$stalemates = $stalemates + 1
|
|
1532
|
+
elsif conditions[@cchoice] == @choice
|
|
1533
|
+
puts "You struck the enemy!"
|
|
1534
|
+
|
|
1535
|
+
$enemy_struck = $enemy_struck + 1
|
|
1536
|
+
|
|
1537
|
+
# The amount of damage enemy recieves is based on the player's attack power.
|
|
1538
|
+
#$enemy_hp = $enemy_hp - $player_atk
|
|
1539
|
+
YumemoireFramework::DamageFormulas.player_damage_rate
|
|
1540
|
+
elsif @choice == "Sleep"
|
|
1541
|
+
puts "\e[38;2;187;127;118mYou've opted to stay at an inn...'\e[0m"
|
|
1542
|
+
|
|
1543
|
+
sleep(1.5)
|
|
1544
|
+
|
|
1545
|
+
stay_at_inn
|
|
1546
|
+
else
|
|
1547
|
+
puts "\e[38;2;187;127;118m#{@choice} is not a valid option\e[0m"
|
|
1548
|
+
end
|
|
1549
|
+
|
|
1550
|
+
observe_enemy
|
|
1551
|
+
observe_player
|
|
1552
|
+
|
|
1553
|
+
sleep(1.5)
|
|
1554
|
+
|
|
1555
|
+
$current_day = $current_day + 1
|
|
1556
|
+
end
|
|
1557
|
+
|
|
1558
|
+
def self.fully_automated_player
|
|
1559
|
+
# Loop for fully automated player characters.
|
|
1560
|
+
|
|
1561
|
+
# Your attacks are more powerful, but you're not as efficient at maintanence.
|
|
1562
|
+
|
|
1563
|
+
guess_player_movement
|
|
1564
|
+
guess_enemy_movement
|
|
1565
|
+
|
|
1566
|
+
conditions = {
|
|
1567
|
+
"Epee" => "Ishi",
|
|
1568
|
+
"Ishi" => "Bache",
|
|
1569
|
+
"Bache" => "Epee",
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
bezerker_chance = ["bezerker", "bezerker", "bezerker", "bezerker"]
|
|
1573
|
+
|
|
1574
|
+
chance_of_bezerker = bezerker_chance.sample
|
|
1575
|
+
|
|
1576
|
+
if chance_of_bazerker == "autonomy"
|
|
1577
|
+
print "Player Choice >> "; @choice = gets.chomp
|
|
1578
|
+
else
|
|
1579
|
+
puts "Player lost control of the MC..."
|
|
1580
|
+
|
|
1581
|
+
sleep(1.5)
|
|
1582
|
+
|
|
1583
|
+
@choice = File.readlines("lib/data/ai/player_patterns/observed_player_actions.txt").sample.strip.to_s
|
|
1584
|
+
end
|
|
1585
|
+
|
|
1586
|
+
@cchoice = File.readlines("lib/data/ai/enemy_patterns/observed_enemy_actions.txt").sample.strip.to_s
|
|
1587
|
+
|
|
1588
|
+
puts "The enemy chose: #{@choice}"
|
|
1589
|
+
|
|
1590
|
+
if @choice == "Epee"
|
|
1591
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1592
|
+
f.puts "0"
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
# Records a history of player actions.
|
|
1596
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1597
|
+
f.puts "0"
|
|
1598
|
+
}
|
|
1599
|
+
elsif @choice == "Ishi"
|
|
1600
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1601
|
+
f.puts "1"
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
# Records a history of player actions.
|
|
1605
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1606
|
+
f.puts "1"
|
|
1607
|
+
}
|
|
1608
|
+
elsif @choice == "Bache"
|
|
1609
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1610
|
+
f.puts "2"
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
# Records a history of player actions.
|
|
1614
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1615
|
+
f.puts "2"
|
|
1616
|
+
}
|
|
1617
|
+
elsif @choice == "Sleep"
|
|
1618
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1619
|
+
f.puts "2"
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
# Records a history of player actions. This one defaults to bache even though its a distinct action.
|
|
1623
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1624
|
+
f.puts "2"
|
|
1625
|
+
}
|
|
1626
|
+
end
|
|
1627
|
+
|
|
1628
|
+
puts " "
|
|
1629
|
+
sleep(1.5)
|
|
1630
|
+
|
|
1631
|
+
# Experiment with using an enemy that learns from player's decisions.'
|
|
1632
|
+
YumemoireFramework::BezerkerMode.ai_decision
|
|
1633
|
+
|
|
1634
|
+
if conditions[@choice] == @cchoice
|
|
1635
|
+
puts "You were struck by the enemy!"
|
|
1636
|
+
|
|
1637
|
+
$player_struck = $player_struck + 1
|
|
1638
|
+
|
|
1639
|
+
# The amount of damage player gets is based on the enemies attack power.
|
|
1640
|
+
#$player_hp = $player_hp - $enemy_atk
|
|
1641
|
+
YumemoireFramework::DamageFormulas.enemy_damage_rate
|
|
1642
|
+
elsif @cchoice == @choice
|
|
1643
|
+
puts "You reach a stalemate."
|
|
1644
|
+
|
|
1645
|
+
$stalemates = $stalemates + 1
|
|
1646
|
+
elsif conditions[@cchoice] == @choice
|
|
1647
|
+
puts "You struck the enemy!"
|
|
1648
|
+
|
|
1649
|
+
$enemy_struck = $enemy_struck + 1
|
|
1650
|
+
|
|
1651
|
+
# The amount of damage enemy recieves is based on the player's attack power.
|
|
1652
|
+
#$enemy_hp = $enemy_hp - $player_atk
|
|
1653
|
+
YumemoireFramework::DamageFormulas.player_damage_rate
|
|
1654
|
+
elsif @choice == "Sleep"
|
|
1655
|
+
puts "\e[38;2;187;127;118mYou've opted to stay at an inn...'\e[0m"
|
|
1656
|
+
|
|
1657
|
+
sleep(1.5)
|
|
1658
|
+
|
|
1659
|
+
stay_at_inn
|
|
1660
|
+
else
|
|
1661
|
+
puts "\e[38;2;187;127;118m#{@choice} is not a valid option\e[0m"
|
|
1662
|
+
end
|
|
1663
|
+
|
|
1664
|
+
#$current_day = $current_day + 1
|
|
1665
|
+
|
|
1666
|
+
sleep(1.5)
|
|
1667
|
+
|
|
1668
|
+
$current_day = $current_day + 1
|
|
1669
|
+
end
|
|
1670
|
+
|
|
1671
|
+
def self.pdm_metric
|
|
1672
|
+
####################################################################################################
|
|
1673
|
+
# Game Loop Chooser Coming Soon #
|
|
1674
|
+
####################################################################################################
|
|
1675
|
+
pdm = $personal_demon_metric # File.read("lib/data/user/personal_demon_metric.txt").strip.to_i
|
|
1676
|
+
|
|
1677
|
+
gets.chomp
|
|
1678
|
+
|
|
1679
|
+
loop do
|
|
1680
|
+
if pdm > 100
|
|
1681
|
+
pdm = 0
|
|
1682
|
+
|
|
1683
|
+
File.open("lib/data/user/personal_demon_metric.txt", "w") { |f|
|
|
1684
|
+
f.puts pdm
|
|
1685
|
+
}
|
|
1686
|
+
end
|
|
1687
|
+
|
|
1688
|
+
system("clear")
|
|
1689
|
+
|
|
1690
|
+
if $current_day < $lunar_ticks
|
|
1691
|
+
this_day = 29
|
|
1692
|
+
|
|
1693
|
+
puts "\e[38;2;187;127;118mLa prochaine phase lunaire est en cours: #{this_day - $current_day} days...\e[0m"
|
|
1694
|
+
else
|
|
1695
|
+
lunar_cycle
|
|
1696
|
+
|
|
1697
|
+
# Reset lunar ticks to twenty days away.
|
|
1698
|
+
$current_day = 1
|
|
1699
|
+
end
|
|
1700
|
+
|
|
1701
|
+
puts "\e[38;2;187;127;118m[ Currency is #{$player_franc} Francs And #{$player_yen} Yen ]\e[0m"
|
|
1702
|
+
|
|
1703
|
+
if $wooden_shoes == true
|
|
1704
|
+
puts "[ Clog Studiness: #{$clog_sturdiness} ]"
|
|
1705
|
+
else
|
|
1706
|
+
puts "[ Clog Studiness: Inactive ]"
|
|
1707
|
+
end
|
|
1708
|
+
|
|
1709
|
+
puts "\e[38;2;187;127;118m\n[ Stalemates: #{$stalemates} ] [ Player Strikes: #{$player_struck} ] [ Enemy Strikes: #{$enemy_struck} ]\e[0m"
|
|
1710
|
+
puts "\e[38;2;187;127;118m [ #{$player_lunario} Lunario ( You wont need this for most game functions. ) ]"
|
|
1711
|
+
|
|
1712
|
+
puts "Personal Demon Metric: #{pdm}"
|
|
1713
|
+
|
|
1714
|
+
puts "\e[38;2;187;127;118m\n\e[0m"
|
|
1715
|
+
puts "\e[38;2;187;127;118mSouer De Chaos ( Ana Nuveyatusuki ) HP: #{$player_hp} \e[0m"
|
|
1716
|
+
puts "\e[38;2;187;127;118mSouer De Commande ( Ana Nuveyatusuki ) HP: #{$enemy_hp}\e[0m"
|
|
1717
|
+
puts "\e[38;2;187;127;118m\n\e[0m"
|
|
1718
|
+
|
|
1719
|
+
if pdm == 0
|
|
1720
|
+
#$healing_rate = 8
|
|
1721
|
+
|
|
1722
|
+
File.open("lib/data/user/personal_demon_metric.txt", "w") { |f|
|
|
1723
|
+
pdm = pdm + 25
|
|
1724
|
+
|
|
1725
|
+
f.puts pdm
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
YumemoireFramework::BezerkerMode.full_player_control
|
|
1729
|
+
elsif pdm >= 25
|
|
1730
|
+
#$healing_rate = 6
|
|
1731
|
+
|
|
1732
|
+
File.open("lib/data/user/personal_demon_metric.txt", "w") { |f|
|
|
1733
|
+
pdm = pdm + 25
|
|
1734
|
+
|
|
1735
|
+
f.puts pdm
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
YumemoireFramework::BezerkerMode.mostly_player_control
|
|
1739
|
+
elsif pdm >= 50
|
|
1740
|
+
#$healing_rate = 6
|
|
1741
|
+
|
|
1742
|
+
File.open("lib/data/user/personal_demon_metric.txt", "w") { |f|
|
|
1743
|
+
pdm = pdm + 25
|
|
1744
|
+
|
|
1745
|
+
f.puts pdm
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
YumemoireFramework::BezerkerMode.mostly_player_control
|
|
1749
|
+
elsif pdm >= 75
|
|
1750
|
+
#$healing_rate = 4
|
|
1751
|
+
|
|
1752
|
+
File.open("lib/data/user/personal_demon_metric.txt", "w") { |f|
|
|
1753
|
+
pdm = pdm + 25
|
|
1754
|
+
|
|
1755
|
+
f.puts pdm
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
YumemoireFramework::BezerkerMode.mostly_automated_player
|
|
1759
|
+
elsif pdm >= 100
|
|
1760
|
+
#$healing_rate = 2
|
|
1761
|
+
|
|
1762
|
+
YumemoireFramework::BezerkerMode.fully_automated_player # With full personal demon metric meaning automated beserker like mode.
|
|
1763
|
+
end
|
|
1764
|
+
|
|
1765
|
+
end
|
|
1766
|
+
end
|
|
1767
|
+
end
|
|
1768
|
+
|
|
1769
|
+
class HumanMode
|
|
1770
|
+
###############################################################################################
|
|
1771
|
+
# AI Decision Making #
|
|
1772
|
+
###############################################################################################
|
|
1773
|
+
def self.ai_decision
|
|
1774
|
+
cchoice = @choice
|
|
1775
|
+
|
|
1776
|
+
## Determining user data and user choice.
|
|
1777
|
+
value = File.read("lib/input/user/user_choice.txt").to_s.to_i
|
|
1778
|
+
|
|
1779
|
+
user_data = File.readlines("lib/data/user/candidates.txt")
|
|
1780
|
+
user_choice = user_data[value]
|
|
1781
|
+
|
|
1782
|
+
## Processing AI focused data
|
|
1783
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
1784
|
+
ai_initial_candidate = user_data[ai_choice]
|
|
1785
|
+
ai_search_limit = user_data.size.to_i
|
|
1786
|
+
|
|
1787
|
+
## Create AI data from user data.
|
|
1788
|
+
ai_search_limit.times do
|
|
1789
|
+
if ai_choice == user_choice
|
|
1790
|
+
#puts "\e[38;2;187;127;118m The specific candidate was found. Terminating selection..."
|
|
1791
|
+
|
|
1792
|
+
ai_data = user_data.slice!(ai_choice)
|
|
1793
|
+
|
|
1794
|
+
open("lib/data/ai/candidates.txt", "w") { |f|
|
|
1795
|
+
f.puts ai_data
|
|
1796
|
+
}
|
|
1797
|
+
else
|
|
1798
|
+
puts "\e[38;2;187;127;118mL'ennemi découvre que vous n'avez pas fait ce choix...\e[0m"
|
|
1799
|
+
end
|
|
1800
|
+
|
|
1801
|
+
sleep(1.5)
|
|
1802
|
+
end
|
|
1803
|
+
|
|
1804
|
+
## AI processing data.
|
|
1805
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
1806
|
+
ai_data = File.readlines("lib/data/ai/candidates.txt")
|
|
1807
|
+
ai_search_limit = ai_data.size.to_i
|
|
1808
|
+
ai_next_candidate = ai_data[ai_choice]
|
|
1809
|
+
|
|
1810
|
+
ai_search_limit.times do
|
|
1811
|
+
if ai_next_candidate == user_choice
|
|
1812
|
+
ai_final_candidate = ai_next_candidate
|
|
1813
|
+
|
|
1814
|
+
puts "\e[38;2;187;127;118mCandidate found, processing input...\e[0m"; sleep(1)
|
|
1815
|
+
|
|
1816
|
+
# Breaks the loop if an appropriate candidate is found.
|
|
1817
|
+
|
|
1818
|
+
sleep(1.5)
|
|
1819
|
+
|
|
1820
|
+
conditions = ["Sword", "Stone", "Tarp"]
|
|
1821
|
+
|
|
1822
|
+
decision_made = conditions.sample
|
|
1823
|
+
|
|
1824
|
+
puts "\e[38;2;187;127;118mBy process of elimination, the bot chose: #{ai_data}\e[0m"
|
|
1825
|
+
|
|
1826
|
+
@cchoice = "#{ai_data}"
|
|
1827
|
+
|
|
1828
|
+
puts $cchoice
|
|
1829
|
+
|
|
1830
|
+
break
|
|
1831
|
+
else
|
|
1832
|
+
ai_choice = File.read("lib/data/ai/ai_choice.txt").to_s.to_i
|
|
1833
|
+
ai_data = File.readlines("lib/data/ai/candidates.txt")
|
|
1834
|
+
ai_search_limit = ai_data.size.to_i
|
|
1835
|
+
ai_next_candidate = ai_data[ai_choice]
|
|
1836
|
+
|
|
1837
|
+
ai_data = user_data.slice!(ai_choice).strip
|
|
1838
|
+
|
|
1839
|
+
puts "\e[38;2;187;127;118mEnemy found the option #{ai_data}\e[0m"
|
|
1840
|
+
|
|
1841
|
+
enemy_decision = ["choose", "skip"]
|
|
1842
|
+
|
|
1843
|
+
decision_made = enemy_decision.sample
|
|
1844
|
+
|
|
1845
|
+
if decision_made == "choose"
|
|
1846
|
+
puts "\e[38;2;187;127;118mThe enemy chose: #{ai_data}, but found it causes a stalemate. Makes a new decision\e[0m"
|
|
1847
|
+
|
|
1848
|
+
@cchoice = "#{ai_data}"
|
|
1849
|
+
|
|
1850
|
+
enemy_decision = ["Epee", "Ishi", "Bache"]
|
|
1851
|
+
|
|
1852
|
+
decision_made = enemy_decision.sample
|
|
1853
|
+
|
|
1854
|
+
if decision_made == "Sword"
|
|
1855
|
+
@cchoice = "Epee"
|
|
1856
|
+
elsif decision_made == "Stone"
|
|
1857
|
+
@cchoice = "Ishi"
|
|
1858
|
+
elsif decision_made == "Tarp"
|
|
1859
|
+
@cchoice = "Bache"
|
|
1860
|
+
end
|
|
1861
|
+
|
|
1862
|
+
break
|
|
1863
|
+
else
|
|
1864
|
+
puts "\e[38;2;187;127;118mEnemy weighed the option of choosing #{ai_data}, but decided to skip its turn.\e[0m"
|
|
1865
|
+
|
|
1866
|
+
break
|
|
1867
|
+
end
|
|
1868
|
+
|
|
1869
|
+
sleep(1.5)
|
|
1870
|
+
|
|
1871
|
+
open("lib/data/ai/candidates.txt", "w") { |f|
|
|
1872
|
+
f.puts ai_data
|
|
1873
|
+
}
|
|
1874
|
+
end
|
|
1875
|
+
end
|
|
1876
|
+
end
|
|
1877
|
+
|
|
1878
|
+
def self.parser
|
|
1879
|
+
loop do
|
|
1880
|
+
|
|
1881
|
+
system("clear")
|
|
1882
|
+
|
|
1883
|
+
if $current_day < $lunar_ticks
|
|
1884
|
+
this_day = 29
|
|
1885
|
+
|
|
1886
|
+
puts "\e[38;2;187;127;118mLa prochaine phase lunaire est en cours: #{this_day - $current_day} days...\e[0m"
|
|
1887
|
+
else
|
|
1888
|
+
lunar_cycle
|
|
1889
|
+
|
|
1890
|
+
# Reset lunar ticks to twenty days away.
|
|
1891
|
+
$current_day = 1
|
|
1892
|
+
end
|
|
1893
|
+
|
|
1894
|
+
menu = File.read("lib/images/menus/main.txt")
|
|
1895
|
+
|
|
1896
|
+
puts menu
|
|
1897
|
+
|
|
1898
|
+
puts "\e[38;2;187;127;118m[ Currency is #{$player_franc} Francs And #{$player_yen} Yen ]\e[0m"
|
|
1899
|
+
|
|
1900
|
+
puts "\e[38;2;187;127;118m\n[ Stalemates: #{$stalemates} ] [ Player Strikes: #{$player_struck} ] [ Enemy Strikes: #{$enemy_struck} ]\e[0m"
|
|
1901
|
+
puts "\e[38;2;187;127;118m [ #{$player_lunario} Lunario ( You wont need this for most game functions. ) ]"
|
|
1902
|
+
|
|
1903
|
+
puts "\e[38;2;187;127;118m\n\e[0m"
|
|
1904
|
+
puts "\e[38;2;187;127;118mSouer De Chaos ( Ana Nuveyatusuki ) HP: #{$player_hp} \e[0m"
|
|
1905
|
+
puts "\e[38;2;187;127;118m#{$current_monster_name} HP: #{$enemy_hp}\e[0m"
|
|
1906
|
+
#puts "\e[38;2;187;127;118mSouer De Commande ( Ana Nuveyatusuki ) HP: #{$enemy_hp}\e[0m"
|
|
1907
|
+
puts "\e[38;2;187;127;118m\n\e[0m"
|
|
1908
|
+
|
|
1909
|
+
if $player_hp <= 0
|
|
1910
|
+
system("clear")
|
|
1911
|
+
|
|
1912
|
+
puts "\e[38;2;187;127;118mYou've been zombiefied!\e[0m"
|
|
1913
|
+
|
|
1914
|
+
sleep(1.5)
|
|
1915
|
+
|
|
1916
|
+
YumemoireFramework::ZombieMode.parser
|
|
1917
|
+
elsif $enemy_hp <= 0
|
|
1918
|
+
puts "\e[38;2;187;127;118mYou won\e[0m"
|
|
1919
|
+
|
|
1920
|
+
gets.chomp
|
|
1921
|
+
|
|
1922
|
+
abort
|
|
1923
|
+
end
|
|
1924
|
+
|
|
1925
|
+
conditions = {
|
|
1926
|
+
"Epee" => "Ishi",
|
|
1927
|
+
"Ishi" => "Bache",
|
|
1928
|
+
"Bache" => "Epee",
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
if $has_spider == true
|
|
1932
|
+
puts "\e[38;2;187;127;118mTo heal the player, type: Heal\e[0m"
|
|
1933
|
+
else
|
|
1934
|
+
puts "\e[38;2;187;127;118mTo heal the player, type: Sleep\e[0m"
|
|
1935
|
+
end
|
|
1936
|
+
|
|
1937
|
+
print "\e[38;2;164;145;91m\nEpee, Ishi, or Bache >> \e[0m"
|
|
1938
|
+
@choice = gets.chomp.capitalize
|
|
1939
|
+
|
|
1940
|
+
if @choice == "Epee"
|
|
1941
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1942
|
+
f.puts "0"
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
# Records a history of player actions.
|
|
1946
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1947
|
+
f.puts "0"
|
|
1948
|
+
}
|
|
1949
|
+
elsif @choice == "Ishi"
|
|
1950
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1951
|
+
f.puts "1"
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
# Records a history of player actions.
|
|
1955
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1956
|
+
f.puts "1"
|
|
1957
|
+
}
|
|
1958
|
+
elsif @choice == "Bache"
|
|
1959
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1960
|
+
f.puts "2"
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
# Records a history of player actions.
|
|
1964
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1965
|
+
f.puts "2"
|
|
1966
|
+
}
|
|
1967
|
+
elsif @choice == "Sleep"
|
|
1968
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1969
|
+
f.puts "2"
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
# Records a history of player actions. This one defaults to bache even though its a distinct action.
|
|
1973
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1974
|
+
f.puts "2"
|
|
1975
|
+
}
|
|
1976
|
+
elsif @choice == "Heal"
|
|
1977
|
+
File.open("lib/input/user/user_choice.txt", "w") { |f|
|
|
1978
|
+
f.puts "2"
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
# Records a history of player actions. This one defaults to bache even though its a distinct action.
|
|
1982
|
+
File.open("lib/data/user/chosen_action.txt", "a") { |f|
|
|
1983
|
+
f.puts "2"
|
|
1984
|
+
}
|
|
1985
|
+
end
|
|
1986
|
+
|
|
1987
|
+
puts " "
|
|
1988
|
+
sleep(1.5)
|
|
1989
|
+
|
|
1990
|
+
# Experiment with using an enemy that learns from player's decisions.'
|
|
1991
|
+
YumemoireFramework::HumanMode.ai_decision
|
|
1992
|
+
|
|
1993
|
+
if conditions[@choice] == @cchoice
|
|
1994
|
+
#puts "\e[38;2;187;127;118m You were struck by the enemy!"
|
|
1995
|
+
|
|
1996
|
+
$enemy_struck = $enemy_struck + 1
|
|
1997
|
+
|
|
1998
|
+
# The amount of damage player gets is based on the enemies attack power.
|
|
1999
|
+
#$player_hp = $player_hp - $enemy_atk
|
|
2000
|
+
YumemoireFramework::DamageFormulas.enemy_damage_rate
|
|
2001
|
+
elsif @cchoice == @choice
|
|
2002
|
+
puts "\e[38;2;187;127;118mYou reach a stalemate.\e[0m"
|
|
2003
|
+
|
|
2004
|
+
$stalemates = $stalemates + 1
|
|
2005
|
+
elsif conditions[@cchoice] == @choice
|
|
2006
|
+
#puts "\e[38;2;187;127;118m You struck the enemy!"
|
|
2007
|
+
|
|
2008
|
+
$player_struck = $player_struck + 1
|
|
2009
|
+
|
|
2010
|
+
# The amount of damage enemy recieves is based on the player's attack power.
|
|
2011
|
+
#$enemy_hp = $enemy_hp - $player_atk
|
|
2012
|
+
YumemoireFramework::DamageFormulas.player_damage_rate
|
|
2013
|
+
elsif @choice == "Sleep"
|
|
2014
|
+
puts "\e[38;2;187;127;118mYou've opted to stay at an inn...'\e[0m"
|
|
2015
|
+
|
|
2016
|
+
sleep(1.5)
|
|
2017
|
+
|
|
2018
|
+
stay_at_inn
|
|
2019
|
+
elsif @choice == "Heal"
|
|
2020
|
+
puts "\e[38;2;187;127;118mThink quickly or you wont be able to heal properly....'\e[0m"
|
|
2021
|
+
|
|
2022
|
+
sleep(1.5)
|
|
2023
|
+
|
|
2024
|
+
spider_pig_farmer
|
|
2025
|
+
else
|
|
2026
|
+
puts "\e[38;2;187;127;118m#{@choice} is not a valid option\e[0m"
|
|
2027
|
+
end
|
|
2028
|
+
|
|
2029
|
+
$current_day = $current_day + 1
|
|
2030
|
+
end
|
|
2031
|
+
end
|
|
2032
|
+
end
|
|
2033
|
+
|
|
2034
|
+
class Gribatomaton
|
|
2035
|
+
###################################################################################
|
|
2036
|
+
# Upgrades For Pet Spider #
|
|
2037
|
+
###################################################################################
|
|
2038
|
+
def self.level_one_spider
|
|
2039
|
+
$spider_hp = File.read("pet_stats/spider_hp.txt").strip.to_s
|
|
2040
|
+
$spider_atk = File.read("pet_stats/spider_atk.txt").strip.to_s
|
|
2041
|
+
$spider_heal = File.read("pet_stats/spider_heal.txt").strip.to_s
|
|
2042
|
+
end
|
|
2043
|
+
|
|
2044
|
+
def self.level_two_spider
|
|
2045
|
+
$spider_hp = File.read("pet_stats/spider_hp.txt").strip.to_s
|
|
2046
|
+
$spider_atk = File.read("pet_stats/spider_atk.txt").strip.to_s
|
|
2047
|
+
$spider_heal = File.read("pet_stats/spider_heal.txt").strip.to_s
|
|
2048
|
+
|
|
2049
|
+
File.open("pet_stats/spider_hp.txt", "w") { |f|
|
|
2050
|
+
$spider_hp = $spider_hp + 3
|
|
2051
|
+
|
|
2052
|
+
f.puts $spider_hp
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
File.open("pet_stats/spider_atk.txt", "w") { |f|
|
|
2056
|
+
$spider_atk = $spider_atk + 3
|
|
2057
|
+
|
|
2058
|
+
f.puts $spider_atk
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
File.open("pet_stats/spider_heal.txt", "w") { |f|
|
|
2062
|
+
$spider_heal = $spider_heal + 3
|
|
2063
|
+
|
|
2064
|
+
f.puts $spider_heal
|
|
2065
|
+
}
|
|
2066
|
+
end
|
|
2067
|
+
|
|
2068
|
+
def self.level_three_spider
|
|
2069
|
+
$spider_hp = File.read("pet_stats/spider_hp.txt").strip.to_s
|
|
2070
|
+
$spider_atk = File.read("pet_stats/spider_atk.txt").strip.to_s
|
|
2071
|
+
$spider_heal = File.read("pet_stats/spider_heal.txt").strip.to_s
|
|
2072
|
+
|
|
2073
|
+
File.open("pet_stats/spider_hp.txt", "w") { |f|
|
|
2074
|
+
$spider_hp = $spider_hp + 5
|
|
2075
|
+
|
|
2076
|
+
f.puts $spider_hp
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
File.open("pet_stats/spider_atk.txt", "w") { |f|
|
|
2080
|
+
$spider_atk = $spider_atk + 5
|
|
2081
|
+
|
|
2082
|
+
f.puts $spider_atk
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
File.open("pet_stats/spider_heal.txt", "w") { |f|
|
|
2086
|
+
$spider_heal = $spider_heal + 5
|
|
2087
|
+
|
|
2088
|
+
f.puts $spider_heal
|
|
2089
|
+
}
|
|
2090
|
+
end
|
|
2091
|
+
|
|
2092
|
+
def self.level_four_spider
|
|
2093
|
+
$spider_hp = File.read("pet_stats/spider_hp.txt").strip.to_s
|
|
2094
|
+
$spider_atk = File.read("pet_stats/spider_atk.txt").strip.to_s
|
|
2095
|
+
$spider_heal = File.read("pet_stats/spider_heal.txt").strip.to_s
|
|
2096
|
+
|
|
2097
|
+
File.open("pet_stats/spider_hp.txt", "w") { |f|
|
|
2098
|
+
$spider_hp = $spider_hp + 7
|
|
2099
|
+
|
|
2100
|
+
f.puts $spider_hp
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
File.open("pet_stats/spider_atk.txt", "w") { |f|
|
|
2104
|
+
$spider_atk = $spider_atk + 7
|
|
2105
|
+
|
|
2106
|
+
f.puts $spider_atk
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
File.open("pet_stats/spider_heal.txt", "w") { |f|
|
|
2110
|
+
$spider_heal = $spider_heal + 7
|
|
2111
|
+
|
|
2112
|
+
f.puts $spider_heal
|
|
2113
|
+
}
|
|
2114
|
+
end
|
|
2115
|
+
|
|
2116
|
+
def self.level_five_spider
|
|
2117
|
+
$spider_hp = File.read("pet_stats/spider_hp.txt").strip.to_s
|
|
2118
|
+
$spider_atk = File.read("pet_stats/spider_atk.txt").strip.to_s
|
|
2119
|
+
$spider_heal = File.read("pet_stats/spider_heal.txt").strip.to_s
|
|
2120
|
+
|
|
2121
|
+
File.open("pet_stats/spider_hp.txt", "w") { |f|
|
|
2122
|
+
$spider_hp = $spider_hp + 9
|
|
2123
|
+
|
|
2124
|
+
f.puts $spider_hp
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
File.open("pet_stats/spider_atk.txt", "w") { |f|
|
|
2128
|
+
$spider_atk = $spider_atk + 9
|
|
2129
|
+
|
|
2130
|
+
f.puts $spider_atk
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
File.open("pet_stats/spider_heal.txt", "w") { |f|
|
|
2134
|
+
$spider_heal = $spider_heal + 9
|
|
2135
|
+
|
|
2136
|
+
f.puts $spider_heal
|
|
2137
|
+
}
|
|
2138
|
+
end
|
|
2139
|
+
|
|
2140
|
+
def self.level_six_spider
|
|
2141
|
+
$spider_hp = File.read("pet_stats/spider_hp.txt").strip.to_s
|
|
2142
|
+
$spider_atk = File.read("pet_stats/spider_atk.txt").strip.to_s
|
|
2143
|
+
$spider_heal = File.read("pet_stats/spider_heal.txt").strip.to_s
|
|
2144
|
+
|
|
2145
|
+
File.open("pet_stats/spider_hp.txt", "w") { |f|
|
|
2146
|
+
$spider_hp = $spider_hp + 11
|
|
2147
|
+
|
|
2148
|
+
f.puts $spider_hp
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
File.open("pet_stats/spider_atk.txt", "w") { |f|
|
|
2152
|
+
$spider_atk = $spider_atk + 11
|
|
2153
|
+
|
|
2154
|
+
f.puts $spider_atk
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
File.open("pet_stats/spider_heal.txt", "w") { |f|
|
|
2158
|
+
$spider_heal = $spider_heal + 11
|
|
2159
|
+
|
|
2160
|
+
f.puts $spider_heal
|
|
2161
|
+
}
|
|
2162
|
+
end
|
|
2163
|
+
|
|
2164
|
+
def self.level_seven_spider
|
|
2165
|
+
$spider_hp = File.read("pet_stats/spider_hp.txt").strip.to_s
|
|
2166
|
+
$spider_atk = File.read("pet_stats/spider_atk.txt").strip.to_s
|
|
2167
|
+
$spider_heal = File.read("pet_stats/spider_heal.txt").strip.to_s
|
|
2168
|
+
|
|
2169
|
+
File.open("pet_stats/spider_hp.txt", "w") { |f|
|
|
2170
|
+
$spider_hp = $spider_hp + 13
|
|
2171
|
+
|
|
2172
|
+
f.puts $spider_hp
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
File.open("pet_stats/spider_atk.txt", "w") { |f|
|
|
2176
|
+
$spider_atk = $spider_atk + 13
|
|
2177
|
+
|
|
2178
|
+
f.puts $spider_atk
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
File.open("pet_stats/spider_heal.txt", "w") { |f|
|
|
2182
|
+
$spider_heal = $spider_heal + 13
|
|
2183
|
+
|
|
2184
|
+
f.puts $spider_heal
|
|
2185
|
+
}
|
|
2186
|
+
end
|
|
2187
|
+
|
|
2188
|
+
#####################################################################################################
|
|
2189
|
+
# Main Pet Spider Functionality #
|
|
2190
|
+
#####################################################################################################
|
|
2191
|
+
def self.enemy_spotted
|
|
2192
|
+
# Determines if your pet spider pig has seen the enemy.
|
|
2193
|
+
enemy_event = File.readlines("enemies/enemies_spotted/spot_enemy.txt")
|
|
2194
|
+
enemy_event_toggle = File.read("enemies/enemies_toggle/toggle_enemies.txt").strip.to_i
|
|
2195
|
+
enemy_spotted = enemy_event[enemy_event_toggle]
|
|
2196
|
+
|
|
2197
|
+
if enemy_spotted == true
|
|
2198
|
+
$enemy_hp = $enemy_hp - $spider_atk
|
|
2199
|
+
|
|
2200
|
+
puts ">> Your pet spider pig spotted #{enemy_spotted}, and was attacked by your pet spider pig..."
|
|
2201
|
+
else
|
|
2202
|
+
puts ">> Your pet spider pig hasn't spotted the enemy..."
|
|
2203
|
+
end
|
|
2204
|
+
end
|
|
2205
|
+
|
|
2206
|
+
# A list of all possible nevigations, behaviours, and noises.
|
|
2207
|
+
#def self.navigation
|
|
2208
|
+
# navigation_x = File.readlines("lifeform/aspects/navigation_x.txt")
|
|
2209
|
+
# navigation_y = File.readlines("lifeform/aspects/navigation_y.txt")
|
|
2210
|
+
#
|
|
2211
|
+
# navigational_ai = File.read("ainput/navigation/input.txt")
|
|
2212
|
+
#
|
|
2213
|
+
# if navigation_x[navigational_ai_x] == player_x and navigation_y[navigational_ai_y] == player_y
|
|
2214
|
+
# puts ">> Your pet spider pig moved in the direction of your player for ear scratches."
|
|
2215
|
+
#
|
|
2216
|
+
# enemy_spotted
|
|
2217
|
+
# else
|
|
2218
|
+
# puts ">> Your pet spider pig stays where its at sitting on its eight legs..."
|
|
2219
|
+
# end
|
|
2220
|
+
#end
|
|
2221
|
+
|
|
2222
|
+
def self.behaviours
|
|
2223
|
+
behaviours = File.readlines("lifeform/aspects/behaviours.txt")
|
|
2224
|
+
behaviours_ai = File.read("ainput/behaviours/input.txt").strip.to_i
|
|
2225
|
+
|
|
2226
|
+
current_behavours = behaviours[behaviours_ai]
|
|
2227
|
+
|
|
2228
|
+
if current_behaviours == "Spins spidersilk..."
|
|
2229
|
+
puts ">> Your pet spider pig spins some spidersilk..."
|
|
2230
|
+
elsif current_behaviours == "Bites the player..."
|
|
2231
|
+
puts ">> Your pet spider bites the player affectionately..."
|
|
2232
|
+
|
|
2233
|
+
sleep(1.5)
|
|
2234
|
+
|
|
2235
|
+
system("ruby rockpaperzombie.rb")
|
|
2236
|
+
end
|
|
2237
|
+
end
|
|
2238
|
+
|
|
2239
|
+
def self.pet_noises
|
|
2240
|
+
noises = File.readlines("lifeform/aspects/noises.txt")
|
|
2241
|
+
noises_ai = File.read("ainput/noises/input.txt").strip.to_i
|
|
2242
|
+
current_noises = noises[noises_ai]
|
|
2243
|
+
|
|
2244
|
+
elsif current_noises == "Hisses like a spider..."
|
|
2245
|
+
puts ">> Your pet spider pig hisses like a spider..."
|
|
2246
|
+
elsif current_noises == "Oinks like a baby pig..."
|
|
2247
|
+
puts ">> Your pet spider pig oinks like a baby pig..."
|
|
2248
|
+
end
|
|
2249
|
+
end
|
|
2250
|
+
|
|
2251
|
+
def self.spider_damage_formula
|
|
2252
|
+
#Switch to routine determine damage rate.
|
|
2253
|
+
healing_accuracy = {
|
|
2254
|
+
"enemy" => "gribatomaton",
|
|
2255
|
+
"gribatomaton" => "player",
|
|
2256
|
+
"player" => "enemy",
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
@cchoice_healing_options = [ "enemy", "gribatomaton", "player" ]
|
|
2260
|
+
|
|
2261
|
+
@landed_choice = @cchoice_healing_options.sample
|
|
2262
|
+
|
|
2263
|
+
if @cchoice_chosen_healing == "enemy"; # Enemy damages the spider.
|
|
2264
|
+
# Enemy launches its counter attack.
|
|
2265
|
+
elsif @cchoice_chosen_healing == "gribatomaton"; # Spider damages the enemy.
|
|
2266
|
+
# Spider successfully damages the enemy.
|
|
2267
|
+
elsif @cchoice_chosen_healing == "player"; # Enemy damages the plauer.
|
|
2268
|
+
# Player counter attacks the enemy.
|
|
2269
|
+
end
|
|
2270
|
+
end
|
|
2271
|
+
|
|
2272
|
+
def self.enemy_damage_formula
|
|
2273
|
+
#Switch to routine determine damage rate.
|
|
2274
|
+
|
|
2275
|
+
@cchoice_healing_options = [ "enemy", "gribatomaton", "player" ]
|
|
2276
|
+
|
|
2277
|
+
@landed_choice = @cchoice_healing_options.sample
|
|
2278
|
+
|
|
2279
|
+
if @cchoice_chosen_healing == "enemy"; # Enemy is damaged by the spider.
|
|
2280
|
+
# Counterattack for spider.
|
|
2281
|
+
elsif @cchoice_chosen_healing == "gribatomaton"; # Spider is damaged the enemy.
|
|
2282
|
+
# Enemey successfully damages the spider.
|
|
2283
|
+
elsif @cchoice_chosen_healing == "player"; # Enemy is damaged by the player...
|
|
2284
|
+
# Counterattack by the player.
|
|
2285
|
+
end
|
|
2286
|
+
end
|
|
2287
|
+
|
|
2288
|
+
def self.spider_pig_farmer
|
|
2289
|
+
monster_form = {
|
|
2290
|
+
"spider" => "pig",
|
|
2291
|
+
"pig" => "farmer",
|
|
2292
|
+
"farmer" => "spider",
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
print "[ Spider, Pig, Farmer ] >> "
|
|
2296
|
+
@spider_choices = ["spider", "pig", "farmer"]
|
|
2297
|
+
@choice = @spider_choices.sample
|
|
2298
|
+
|
|
2299
|
+
@cchoices = ["spider", "pig", "farmer"]
|
|
2300
|
+
@cchoice = @cchoices.sample
|
|
2301
|
+
|
|
2302
|
+
if monster_form[@cchoice] == @choice
|
|
2303
|
+
puts "Spider managed to prevent enemy from harming the player."
|
|
2304
|
+
|
|
2305
|
+
spider_damage_formula
|
|
2306
|
+
elsif monster_form[@choice] == @choice # Spider prevents attacking of player altogether.
|
|
2307
|
+
puts "Spider managed to prevent enemy from harming the player."
|
|
2308
|
+
|
|
2309
|
+
sleep(1.5)
|
|
2310
|
+
elsif @choice == @cchoice
|
|
2311
|
+
enemy_damage_formula
|
|
2312
|
+
else
|
|
2313
|
+
puts "Process was not understood..."
|
|
2314
|
+
end
|
|
2315
|
+
end
|
|
2316
|
+
end
|
|
2317
|
+
end
|
|
2318
|
+
|
|
2319
|
+
module YumemoireSpatialRelationships
|
|
2320
|
+
class Error < StandardError; end
|
|
2321
|
+
|
|
2322
|
+
class Static_Perimeters
|
|
2323
|
+
|
|
2324
|
+
# The objects within the space.
|
|
2325
|
+
def self.positive_perimeters
|
|
2326
|
+
# Base radius of static objects.
|
|
2327
|
+
base_radius = 2500
|
|
2328
|
+
|
|
2329
|
+
# Specfic multipliers for Earth index based objects.
|
|
2330
|
+
base_two = 2
|
|
2331
|
+
base_fro = 4
|
|
2332
|
+
base_six = 6
|
|
2333
|
+
base_eit = 8
|
|
2334
|
+
|
|
2335
|
+
# Size of specific objects.
|
|
2336
|
+
size_of_planets = base_radius ** base_fro
|
|
2337
|
+
size_of_moons = base_radius ** base_two
|
|
2338
|
+
size_of_stars = base_radius ** base_six
|
|
2339
|
+
size_of_blackholes = base_radius ** base_eit
|
|
2340
|
+
|
|
2341
|
+
# Total output sizes of specific objects.
|
|
2342
|
+
puts "The size of the planets is #{size_of_planets} radius."; sleep(3)
|
|
2343
|
+
puts "The size of the moons is #{size_of_moons} radius."; sleep(3)
|
|
2344
|
+
puts "The size of the stars is #{size_of_stars} radius."; sleep(3)
|
|
2345
|
+
puts "The size of a blackhole is #{size_of_blackholes} radius."; sleep(3)
|
|
2346
|
+
end
|
|
2347
|
+
|
|
2348
|
+
# Space between the objects.
|
|
2349
|
+
def self.negative_perimeters
|
|
2350
|
+
# Base distance between objects.
|
|
2351
|
+
base_distance = 1_000_000_000
|
|
2352
|
+
|
|
2353
|
+
# Estimated divider between specific objects to base distance.
|
|
2354
|
+
space_between_planets = 43.8
|
|
2355
|
+
space_between_moons = 14.6
|
|
2356
|
+
space_between_stars = 876
|
|
2357
|
+
space_between_blackholes = 2628
|
|
2358
|
+
|
|
2359
|
+
# Minimum distance between objects.
|
|
2360
|
+
planet_distance = base_distance / space_between_planets
|
|
2361
|
+
moon_distance = base_distance / space_between_moons
|
|
2362
|
+
star_distance = base_distance / space_between_stars
|
|
2363
|
+
blackhole_distance = base_distance / space_between_blackholes
|
|
2364
|
+
|
|
2365
|
+
# Actual distance between objects
|
|
2366
|
+
actual_planets = planet_distance * 10
|
|
2367
|
+
actual_moons = moon_distance * 10
|
|
2368
|
+
actual_stars = star_distance * 10
|
|
2369
|
+
actual_blackholes = blackhole_distance * 10
|
|
2370
|
+
|
|
2371
|
+
# The output results of distance between objects.
|
|
2372
|
+
puts "The distance between planets is #{actual_planets} miles."; sleep(3)
|
|
2373
|
+
puts "The distance between moons is #{actual_moons} miles."; sleep(3)
|
|
2374
|
+
puts "The distance between stars is #{actual_stars} miles."; sleep(3)
|
|
2375
|
+
puts "The distance between blackholes is #{actual_blackholes} miles."; sleep(3)
|
|
2376
|
+
end
|
|
2377
|
+
|
|
2378
|
+
end
|
|
2379
|
+
|
|
2380
|
+
# Changing perimeters
|
|
2381
|
+
class Dynamic_Perimeters
|
|
2382
|
+
|
|
2383
|
+
# The objects within the space.
|
|
2384
|
+
def self.positive_perimeters
|
|
2385
|
+
spaceship = File.read("_data/dynamic/positive_perimeters/spaceship_size.txt").strip.to_i
|
|
2386
|
+
space_station = spaceship * 200
|
|
2387
|
+
satalite = space_station / 10
|
|
2388
|
+
|
|
2389
|
+
puts "The total size of the space shuttle is #{spaceship} feet."; sleep(3)
|
|
2390
|
+
puts "The total size of the space station is #{space_station} feet."; sleep(3)
|
|
2391
|
+
puts "The total size of the satalite is #{satalite} feet."; sleep(3)
|
|
2392
|
+
end
|
|
2393
|
+
|
|
2394
|
+
# Space between the objects.
|
|
2395
|
+
def self.negative_perimeters
|
|
2396
|
+
base_multiplier = 10
|
|
2397
|
+
|
|
2398
|
+
# Minimum space between objects.
|
|
2399
|
+
space_between_spaceships = File.read("_data/dynamic/negative_perimeters/space_between_spaceships.txt").strip.to_i
|
|
2400
|
+
space_between_station = File.read("_data/dynamic/negative_perimeters/space_between_station.txt").strip.to_i
|
|
2401
|
+
space_between_satalite = File.read("_data/dynamic/negative_perimeters/space_between_satalite.txt").strip.to_i
|
|
2402
|
+
|
|
2403
|
+
# Actual space between objects
|
|
2404
|
+
actual_spaceship_distance = space_between_spaceships * base_multiplier
|
|
2405
|
+
actual_station_distance = space_between_station * base_multiplier
|
|
2406
|
+
actual_satalite_distance = space_between_satalite * base_multiplier
|
|
2407
|
+
|
|
2408
|
+
puts "The minimum space between shuttles is #{actual_spaceship_distance} feet."; sleep(3)
|
|
2409
|
+
puts "The minimum space between stations is #{actual_station_distance} feet."; sleep(3)
|
|
2410
|
+
puts "The minimum space between satalites is #{actual_satalite_distance} feet."; sleep(3)
|
|
2411
|
+
end
|
|
2412
|
+
|
|
2413
|
+
end
|
|
2414
|
+
|
|
2415
|
+
class SpatialEvaluator
|
|
2416
|
+
def self.evaluate_body
|
|
2417
|
+
require "naive_bayes"
|
|
2418
|
+
|
|
2419
|
+
spatial = NaiveBayes.new(:planet_radius,
|
|
2420
|
+
:moon_radius,
|
|
2421
|
+
:star_radius,
|
|
2422
|
+
:blackhole_radius,
|
|
2423
|
+
:distance_between_planets,
|
|
2424
|
+
:distance_between_moons,
|
|
2425
|
+
:distance_between_stars,
|
|
2426
|
+
:distance_between_blackholes,
|
|
2427
|
+
:spaceshuttle_size,
|
|
2428
|
+
:spacestation_size,
|
|
2429
|
+
:size_of_satalight,
|
|
2430
|
+
:minimum_space_between_shuttles,
|
|
2431
|
+
:minimum_space_between_stations,
|
|
2432
|
+
:minimum_space_between_satalights,
|
|
2433
|
+
)
|
|
2434
|
+
|
|
2435
|
+
spatial.train(:planet_radius, "The size of the planets is 39062500000000 radius.", "word")
|
|
2436
|
+
spatial.train(:moon_radius, "The size of the moons is 6250000 radius.", "word")
|
|
2437
|
+
spatial.train(:star_radius, "The size of the stars is 244140625000000000000 radius.", "word")
|
|
2438
|
+
spatial.train(:blackhole_radius, "The size of a blackhole is 1525878906250000000000000000 radius.", "word")
|
|
2439
|
+
spatial.train(:distance_between_planets, "The distance between planets is 228310502.28310502 miles.", "word")
|
|
2440
|
+
spatial.train(:distance_between_moons, "The distance between moons is 684931506.849315 miles.", "word")
|
|
2441
|
+
spatial.train(:distance_between_stars, "The distance between stars is 11415520 miles.", "word")
|
|
2442
|
+
spatial.train(:distance_between_blackholes, "The distance between blackholes is 3805170 miles.", "word")
|
|
2443
|
+
spatial.train(:spaceshuttle_size, "The total size of the space shuttle is 5 feet.", "word")
|
|
2444
|
+
spatial.train(:spacestation_size, "The total size of the space station is 1000 feet.", "word")
|
|
2445
|
+
spatial.train(:size_of_satalight, "The total size of the satalite is 100 feet.", "word")
|
|
2446
|
+
spatial.train(:minimum_space_between_shuttles, "The minimum space between shuttles is 50 feet.", "word")
|
|
2447
|
+
spatial.train(:minimum_space_between_stations, "The minimum space between stations is 50 feet.", "word")
|
|
2448
|
+
spatial.train(:minimum_space_between_satalights, "The minimum space between satalites is 50 feet.", "word")
|
|
2449
|
+
|
|
2450
|
+
spatial_relationships = File.readlines("_input/relationships.txt")
|
|
2451
|
+
|
|
2452
|
+
size_limit = spatial_relationships.size.to_i
|
|
2453
|
+
|
|
2454
|
+
index = 0
|
|
2455
|
+
|
|
2456
|
+
size_limit.times do
|
|
2457
|
+
classification = spatial.classify(spatial_relationships[index].strip.to_s)
|
|
2458
|
+
|
|
2459
|
+
print classification
|
|
2460
|
+
puts " "
|
|
2461
|
+
|
|
2462
|
+
index = index + 1
|
|
2463
|
+
end
|
|
2464
|
+
end
|
|
2465
|
+
|
|
2466
|
+
end
|
|
2467
|
+
end
|