gemwarrior 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gemwarrior/battle.rb +41 -8
- data/lib/gemwarrior/entities/creature.rb +1 -1
- data/lib/gemwarrior/entities/items/bed.rb +2 -2
- data/lib/gemwarrior/entities/location.rb +6 -3
- data/lib/gemwarrior/entities/monster.rb +1 -1
- data/lib/gemwarrior/entities/player.rb +9 -9
- data/lib/gemwarrior/evaluator.rb +17 -14
- data/lib/gemwarrior/game.rb +1 -0
- data/lib/gemwarrior/inventory.rb +44 -8
- data/lib/gemwarrior/misc/hr.rb +58 -0
- data/lib/gemwarrior/misc/player_levels.rb +5 -0
- data/lib/gemwarrior/repl.rb +9 -9
- data/lib/gemwarrior/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a602b9554ac2652202951d150e7ee4cfd8b27aff
|
4
|
+
data.tar.gz: acb430f7bfee61a5b97f27f811d84f8863ab6c91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46c9e9d1a246bb61f9700b2ca58ce6b607d758fccc98fc209672d0f48a3a34fd77743fa7c9ec476228d92ebb9dd7358ae5b36b375e16ab741b8bdc4426eafee3
|
7
|
+
data.tar.gz: 8be49993ada5536ac37d6882c400540047322e970c485faf441cad9fcf265088e35c9809f8b649aa0334c0ea40f405e52a47797eec7be035630710b5e96e5034
|
data/lib/gemwarrior/battle.rb
CHANGED
@@ -57,6 +57,26 @@ module Gemwarrior
|
|
57
57
|
puts " #{monster.name} strikes first!".colorize(:yellow)
|
58
58
|
monster_attacks_player
|
59
59
|
end
|
60
|
+
|
61
|
+
# LV4:STONE_FACE modifier prior to main battle to auto-win
|
62
|
+
# Doesn't work against bosses, nor if battle is an event or in the arena
|
63
|
+
if player.special_abilities.include?(:stone_face) && !monster.is_boss && !is_event && !is_arena
|
64
|
+
level_diff = (player.level - monster.level) * 4
|
65
|
+
chance_range = 0..(30 + level_diff)
|
66
|
+
roll = rand(0..100)
|
67
|
+
|
68
|
+
if GameOptions.data['debug_mode']
|
69
|
+
puts
|
70
|
+
puts " (MOD) LV4: Stone Face"
|
71
|
+
puts " Range to auto-win: #{chance_range}"
|
72
|
+
puts " Auto-win roll: #{roll}"
|
73
|
+
end
|
74
|
+
|
75
|
+
if chance_range.include?(roll)
|
76
|
+
puts " You use your STONE FACE to tell the #{monster.name} you mean business, and #{monster.name} just gives up!".colorize(:green)
|
77
|
+
return monster_death
|
78
|
+
end
|
79
|
+
end
|
60
80
|
|
61
81
|
# main battle loop
|
62
82
|
loop do
|
@@ -185,7 +205,7 @@ module Gemwarrior
|
|
185
205
|
puts ' If defeated, will receive:'
|
186
206
|
puts " >> XP : #{monster.xp}"
|
187
207
|
puts " >> ROX : #{monster.rox}"
|
188
|
-
puts " >> ITEMS: #{monster.inventory.
|
208
|
+
puts " >> ITEMS: #{monster.inventory.contents}"
|
189
209
|
next
|
190
210
|
end
|
191
211
|
when 'pass', 'p'
|
@@ -230,17 +250,26 @@ module Gemwarrior
|
|
230
250
|
|
231
251
|
atk_range = base_atk_lo..base_atk_hi
|
232
252
|
|
233
|
-
# beast mode modifier
|
253
|
+
# DEBUG(beast mode) modifier
|
234
254
|
if GameOptions.data['beast_mode']
|
235
255
|
atk_range = BEAST_MODE_ATTACK..BEAST_MODE_ATTACK
|
236
|
-
#
|
256
|
+
# LV3:ROCK_SLIDE modifier
|
237
257
|
elsif player.special_abilities.include?(:rock_slide)
|
238
258
|
lo_boost = rand(0..9)
|
259
|
+
hi_boost = lo_boost + rand(5..10)
|
260
|
+
|
261
|
+
if GameOptions.data['debug_mode']
|
262
|
+
puts
|
263
|
+
puts " (MOD) LV3: Rock Slide"
|
264
|
+
puts " Rock Slide lo_boost: #{lo_boost}"
|
265
|
+
puts " Rock Slide hi_boost: #{hi_boost}"
|
266
|
+
end
|
239
267
|
|
240
|
-
if lo_boost >=
|
241
|
-
puts "
|
242
|
-
hi_boost = lo_boost + rand(0..5)
|
268
|
+
if lo_boost >= 6
|
269
|
+
puts " You use Rock Slide for added damage!"
|
243
270
|
atk_range = (player.atk_lo + lo_boost)..(player.atk_hi + hi_boost)
|
271
|
+
else
|
272
|
+
puts " Rock Slide failed :(" if GameOptions.data['debug_mode']
|
244
273
|
end
|
245
274
|
end
|
246
275
|
|
@@ -273,7 +302,11 @@ module Gemwarrior
|
|
273
302
|
|
274
303
|
# MONSTER
|
275
304
|
def monster_strikes_first?(arena_battle = false, event_battle = false)
|
276
|
-
if
|
305
|
+
if event_battle || arena_battle
|
306
|
+
return false
|
307
|
+
elsif player.special_abilities.include?(:stone_face)
|
308
|
+
return false
|
309
|
+
elsif (monster.dexterity > player.dexterity)
|
277
310
|
return true
|
278
311
|
else
|
279
312
|
dex_diff = player.dexterity - monster.dexterity
|
@@ -353,7 +386,7 @@ module Gemwarrior
|
|
353
386
|
puts " XP : #{monster.xp}".colorize(:green)
|
354
387
|
puts " ROX : #{monster.rox}".colorize(:green)
|
355
388
|
unless monster.inventory.nil?
|
356
|
-
puts " ITEMS: #{monster.inventory.
|
389
|
+
puts " ITEMS: #{monster.inventory.contents}".colorize(:green) unless monster.inventory.items.empty?
|
357
390
|
end
|
358
391
|
print_battle_line
|
359
392
|
world.player.update_stats(reason: :monster, value: monster)
|
@@ -70,7 +70,7 @@ module Gemwarrior
|
|
70
70
|
desc_text << "DEFENSE : #{defense}\n".colorize(:white)
|
71
71
|
desc_text << "DEXTERITY : #{dexterity}\n".colorize(:white)
|
72
72
|
desc_text << "ROX : #{rox}\n".colorize(:white)
|
73
|
-
desc_text << "INVENTORY : #{inventory.
|
73
|
+
desc_text << "INVENTORY : #{inventory.contents}\n".colorize(:white)
|
74
74
|
desc_text
|
75
75
|
end
|
76
76
|
|
@@ -23,8 +23,8 @@ module Gemwarrior
|
|
23
23
|
else
|
24
24
|
Animation.run(phrase: USE_TEXT)
|
25
25
|
puts 'You unmake the bed, get under the covers, close your eyes, and begin to think about all the things you need to do today. You realize sleep is not one of them and quickly get back up, remake the bed, and get on about your day.'
|
26
|
-
puts '>> You regain
|
27
|
-
{ type: 'rest', data:
|
26
|
+
puts '>> You regain all of your hit points.'.colorize(:green)
|
27
|
+
{ type: 'rest', data: world.player.hp_max-world.player.hp_cur }
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -135,6 +135,7 @@ module Gemwarrior
|
|
135
135
|
if items.empty?
|
136
136
|
[]
|
137
137
|
else
|
138
|
+
# build hash out of location's items
|
138
139
|
item_hash = {}
|
139
140
|
self.items.map(&:name).each do |i|
|
140
141
|
i_sym = i.to_sym
|
@@ -145,10 +146,12 @@ module Gemwarrior
|
|
145
146
|
end
|
146
147
|
end
|
147
148
|
|
149
|
+
# one item? return single element array
|
148
150
|
if item_hash.length == 1
|
149
|
-
item_hash.
|
150
|
-
|
151
|
-
|
151
|
+
i = item_hash.keys
|
152
|
+
q = item_hash.values.join.to_i
|
153
|
+
return q > 1 ? ["#{q} #{i}s"] : i
|
154
|
+
# multiple items? build an array of strings
|
152
155
|
else
|
153
156
|
item_arr = []
|
154
157
|
item_hash.each do |i, q|
|
@@ -43,7 +43,7 @@ module Gemwarrior
|
|
43
43
|
desc_text << "DEX : #{dexterity}\n".colorize(:white)
|
44
44
|
desc_text << "ROX : #{rox}\n".colorize(:white)
|
45
45
|
desc_text << "XP : #{xp}\n".colorize(:white)
|
46
|
-
desc_text << "INV : #{inventory.
|
46
|
+
desc_text << "INV : #{inventory.contents}\n".colorize(:white)
|
47
47
|
desc_text << "DEAD? #{is_dead}\n".colorize(:white)
|
48
48
|
desc_text << "TALK? #{talkable}\n".colorize(:white)
|
49
49
|
desc_text << "USE? #{useable}\n".colorize(:white)
|
@@ -78,8 +78,8 @@ module Gemwarrior
|
|
78
78
|
if special_abilities.empty?
|
79
79
|
abilities = " none...yet(?)\n"
|
80
80
|
else
|
81
|
+
abilities << "\n"
|
81
82
|
special_abilities.each do |sp|
|
82
|
-
abilities << "\n"
|
83
83
|
abilities << " #{Formatting.upstyle(sp.to_s).ljust(15).colorize(:yellow)}: #{PlayerLevels.get_ability_description(sp)}\n"
|
84
84
|
end
|
85
85
|
end
|
@@ -309,7 +309,7 @@ module Gemwarrior
|
|
309
309
|
when trigger[:reason].eql?(:xp)
|
310
310
|
self.xp += trigger[:value]
|
311
311
|
when trigger[:reason].eql?(:level_bump)
|
312
|
-
next_player_level = old_player_level +
|
312
|
+
next_player_level = old_player_level + trigger[:value]
|
313
313
|
self.xp = PlayerLevels::get_level_stats(next_player_level)[:xp_start]
|
314
314
|
end
|
315
315
|
|
@@ -328,24 +328,24 @@ module Gemwarrior
|
|
328
328
|
new_stats = PlayerLevels::get_level_stats(level_to_get)
|
329
329
|
|
330
330
|
self.level = new_stats[:level]
|
331
|
-
puts "You are now level #{self.level.to_s.colorize(:
|
331
|
+
puts "You are now level #{self.level.to_s.colorize(:green)}!"
|
332
332
|
self.hp_cur = new_stats[:hp_max]
|
333
333
|
self.hp_max = new_stats[:hp_max]
|
334
|
-
puts "You now have #{self.hp_max.to_s.colorize(:
|
334
|
+
puts "You now have #{self.hp_max.to_s.colorize(:green)} hit points!"
|
335
335
|
self.stam_cur = new_stats[:stam_max]
|
336
336
|
self.stam_max = new_stats[:stam_max]
|
337
|
-
puts "You now have #{self.stam_max.to_s.colorize(:
|
337
|
+
puts "You now have #{self.stam_max.to_s.colorize(:green)} stamina points!"
|
338
338
|
self.atk_lo = new_stats[:atk_lo]
|
339
339
|
self.atk_hi = new_stats[:atk_hi]
|
340
|
-
puts "You now have an attack of #{self.atk_lo.to_s.colorize(:
|
340
|
+
puts "You now have an attack of #{self.atk_lo.to_s.colorize(:green)}-#{self.atk_hi.to_s.colorize(:green)}!"
|
341
341
|
self.defense = new_stats[:defense]
|
342
|
-
puts "You now have #{self.defense.to_s.colorize(:
|
342
|
+
puts "You now have #{self.defense.to_s.colorize(:green)} defensive points!"
|
343
343
|
self.dexterity = new_stats[:dexterity]
|
344
|
-
puts "You now have #{self.dexterity.to_s.colorize(:
|
344
|
+
puts "You now have #{self.dexterity.to_s.colorize(:green)} dexterity points!"
|
345
345
|
unless new_stats[:special_abilities].nil?
|
346
346
|
unless self.special_abilities.include?(new_stats[:special_abilities])
|
347
347
|
self.special_abilities.push(new_stats[:special_abilities])
|
348
|
-
puts "You learned a new ability: #{Formatting::upstyle(new_stats[:special_abilities]).colorize(:
|
348
|
+
puts "You learned a new ability: #{Formatting::upstyle(new_stats[:special_abilities]).colorize(:green)}!"
|
349
349
|
end
|
350
350
|
end
|
351
351
|
STDIN.getc
|
data/lib/gemwarrior/evaluator.rb
CHANGED
@@ -23,14 +23,14 @@ module Gemwarrior
|
|
23
23
|
ERROR_TALK_PARAM_UNTALKABLE = 'That cannnot be conversed with.'
|
24
24
|
ERROR_TALK_TO_PARAM_MISSING = 'You cannot just "talk to". You gotta choose someone to talk to.'
|
25
25
|
ERROR_GO_PARAM_MISSING = 'Just wander aimlessly? A direction would be nice.'
|
26
|
-
ERROR_GO_PARAM_INVALID = '
|
26
|
+
ERROR_GO_PARAM_INVALID = 'Something tells you that is not a way to go.'
|
27
27
|
ERROR_DIRECTION_PARAM_INVALID = 'You cannot go to that place.'
|
28
28
|
ERROR_ATTACK_PARAM_MISSING = 'You cannot just "attack". You gotta choose something to attack.'
|
29
29
|
ERROR_ATTACK_PARAM_INVALID = 'That monster does not exist here or can\'t be attacked.'
|
30
30
|
ERROR_TAKE_PARAM_MISSING = 'You cannot just "take". You gotta choose something to take.'
|
31
31
|
ERROR_USE_PARAM_MISSING = 'You cannot just "use". You gotta choose something to use.'
|
32
32
|
ERROR_USE_PARAM_INVALID = 'You cannot use that, as it does not exist here or in your inventory.'
|
33
|
-
ERROR_USE_PARAM_UNUSEABLE = 'That
|
33
|
+
ERROR_USE_PARAM_UNUSEABLE = 'That is not useable.'
|
34
34
|
ERROR_DROP_PARAM_MISSING = 'You cannot just "drop". You gotta choose something to drop.'
|
35
35
|
ERROR_EQUIP_PARAM_MISSING = 'You cannot just "equip". You gotta choose something to equip.'
|
36
36
|
ERROR_UNEQUIP_PARAM_MISSING = 'You cannot just "unequip". You gotta choose something to unequip.'
|
@@ -73,7 +73,7 @@ module Gemwarrior
|
|
73
73
|
'Change world global variable',
|
74
74
|
'Teleport to coordinates (5 0 0) or name (\'Home\')',
|
75
75
|
'Spawn random monster',
|
76
|
-
'Bump your character
|
76
|
+
'Bump your character up *n* levels',
|
77
77
|
'Rest, but ensure battle for testing'
|
78
78
|
]
|
79
79
|
|
@@ -324,7 +324,8 @@ module Gemwarrior
|
|
324
324
|
return world.describe(player_cur_location)
|
325
325
|
end
|
326
326
|
when 'levelbump', 'lb'
|
327
|
-
|
327
|
+
new_level = param1.nil? ? 1 : param1.to_i
|
328
|
+
world.player.update_stats(reason: :level_bump, value: new_level)
|
328
329
|
when 'restfight', 'rf'
|
329
330
|
result = world.player.rest(world, 0, true)
|
330
331
|
|
@@ -476,14 +477,17 @@ module Gemwarrior
|
|
476
477
|
result = i.use(world)
|
477
478
|
i.number_of_uses -= 1
|
478
479
|
puts ">> #{i.name} can be used #{i.number_of_uses} more time(s)."
|
480
|
+
break
|
479
481
|
else
|
480
482
|
return ">> #{i.name} cannot be used anymore."
|
481
483
|
end
|
482
484
|
elsif i.consumable
|
483
485
|
result = i.use(world)
|
484
486
|
world.player.inventory.remove_item(i.name)
|
487
|
+
break
|
485
488
|
else
|
486
489
|
result = i.use(world)
|
490
|
+
break
|
487
491
|
end
|
488
492
|
else
|
489
493
|
return ERROR_USE_PARAM_UNUSEABLE
|
@@ -499,14 +503,17 @@ module Gemwarrior
|
|
499
503
|
result = i.use(world)
|
500
504
|
i.number_of_uses -= 1
|
501
505
|
puts ">> #{i.name} can be used #{i.number_of_uses} more time(s)."
|
506
|
+
break
|
502
507
|
else
|
503
508
|
return ">> #{i.name} cannot be used anymore."
|
504
509
|
end
|
505
510
|
elsif i.consumable
|
506
511
|
result = i.use(world)
|
507
512
|
location.remove_item(i.name)
|
513
|
+
break
|
508
514
|
else
|
509
515
|
result = i.use(world)
|
516
|
+
break
|
510
517
|
end
|
511
518
|
else
|
512
519
|
return ERROR_USE_PARAM_UNUSEABLE
|
@@ -704,7 +711,7 @@ module Gemwarrior
|
|
704
711
|
player_cur_location.checked_for_monsters = false
|
705
712
|
world.describe(player_cur_location)
|
706
713
|
else
|
707
|
-
return ERROR_GO_PARAM_INVALID
|
714
|
+
return ERROR_GO_PARAM_INVALID.colorize(:red)
|
708
715
|
end
|
709
716
|
end
|
710
717
|
|
@@ -728,30 +735,26 @@ module Gemwarrior
|
|
728
735
|
return
|
729
736
|
end
|
730
737
|
|
731
|
-
def print_separator
|
732
|
-
puts '========================================================='
|
733
|
-
end
|
734
|
-
|
735
738
|
def list_commands
|
736
739
|
i = 0
|
737
|
-
|
740
|
+
Hr.print('=')
|
738
741
|
puts ' COMMAND | ALIAS | DESCRIPTION '
|
739
|
-
|
742
|
+
Hr.print('=')
|
740
743
|
commands.each do |cmd|
|
741
744
|
puts " #{cmd.ljust(11)} | #{aliases[i].ljust(5)} | #{cmd_descriptions[i]}"
|
742
745
|
i += 1
|
743
746
|
end
|
744
|
-
|
747
|
+
Hr.print('=')
|
745
748
|
|
746
749
|
if GameOptions.data['debug_mode']
|
747
750
|
puts ' DEBUG COMMANDS'
|
748
|
-
|
751
|
+
Hr.print('=')
|
749
752
|
i = 0
|
750
753
|
devcommands.each do |cmd|
|
751
754
|
puts " #{cmd.ljust(11)} | #{devaliases[i].ljust(5)} | #{devcmd_descriptions[i]}"
|
752
755
|
i += 1
|
753
756
|
end
|
754
|
-
|
757
|
+
Hr.print('=')
|
755
758
|
end
|
756
759
|
end
|
757
760
|
|
data/lib/gemwarrior/game.rb
CHANGED
@@ -10,6 +10,7 @@ require_relative 'entities/weapons/dagger'
|
|
10
10
|
require_relative 'misc/animation'
|
11
11
|
require_relative 'misc/audio'
|
12
12
|
require_relative 'misc/formatting'
|
13
|
+
require_relative 'misc/hr'
|
13
14
|
require_relative 'evaluator'
|
14
15
|
require_relative 'game_assets'
|
15
16
|
require_relative 'game_options'
|
data/lib/gemwarrior/inventory.rb
CHANGED
@@ -30,13 +30,10 @@ module Gemwarrior
|
|
30
30
|
self.items.nil? || self.items.empty?
|
31
31
|
end
|
32
32
|
|
33
|
+
# non-English-like contents of inventory for simple lists
|
33
34
|
def contents
|
34
|
-
is_empty? ? nil : list_contents
|
35
|
-
end
|
36
|
-
|
37
|
-
def list_contents
|
38
35
|
if is_empty?
|
39
|
-
|
36
|
+
nil
|
40
37
|
else
|
41
38
|
item_hash = {}
|
42
39
|
self.items.map(&:name).each do |i|
|
@@ -48,15 +45,54 @@ module Gemwarrior
|
|
48
45
|
end
|
49
46
|
end
|
50
47
|
|
48
|
+
# one item? return string
|
51
49
|
if item_hash.length == 1
|
50
|
+
i = item_hash.keys.join
|
51
|
+
q = item_hash.values.join.to_i
|
52
|
+
return q > 1 ? "#{q} #{i}s" : i
|
53
|
+
# multiple items? return array of strings to mush together
|
54
|
+
else
|
55
|
+
item_arr = []
|
52
56
|
item_hash.each do |i, q|
|
53
57
|
if q > 1
|
54
|
-
|
58
|
+
item_arr.push("#{i.to_s.colorize(:yellow)}#{'s'.colorize(:yellow)} x#{q}")
|
55
59
|
else
|
56
|
-
|
57
|
-
return "You have #{article} #{i.to_s.colorize(:yellow)}."
|
60
|
+
item_arr.push(i)
|
58
61
|
end
|
59
62
|
end
|
63
|
+
|
64
|
+
return item_arr.join(', ')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# English-like sentence summary of inventory
|
70
|
+
def list_contents
|
71
|
+
if is_empty?
|
72
|
+
'You possess nothing.'
|
73
|
+
else
|
74
|
+
# build hash of inventory's items
|
75
|
+
item_hash = {}
|
76
|
+
self.items.map(&:name).each do |i|
|
77
|
+
i_sym = i.to_sym
|
78
|
+
if item_hash.keys.include? i_sym
|
79
|
+
item_hash[i_sym] += 1
|
80
|
+
else
|
81
|
+
item_hash[i_sym] = 1
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# one item? return string
|
86
|
+
if item_hash.length == 1
|
87
|
+
i = item_hash.keys.join
|
88
|
+
q = item_hash.values.join.to_i
|
89
|
+
if q > 1
|
90
|
+
return "You have #{q} #{i.to_s.colorize(:yellow)}#{'s'.colorize(:yellow)}."
|
91
|
+
else
|
92
|
+
article = VOWELS.include?(i[0]) ? 'an' : 'a'
|
93
|
+
return "You have #{article} #{i.to_s.colorize(:yellow)}."
|
94
|
+
end
|
95
|
+
# multiple items? return array of strings to mush together
|
60
96
|
else
|
61
97
|
item_list_text = 'You have '
|
62
98
|
item_arr = []
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# lib/gemwarrior/misc/hr.rb
|
2
|
+
# Standardized, cross-platform horizontal rule
|
3
|
+
# Cribbed extensively from https://github.com/ivantsepp/hr
|
4
|
+
|
5
|
+
module Gemwarrior
|
6
|
+
module Hr
|
7
|
+
extend self
|
8
|
+
|
9
|
+
def print(*patterns)
|
10
|
+
Kernel.print string(*patterns)
|
11
|
+
end
|
12
|
+
|
13
|
+
def string(*patterns)
|
14
|
+
options = patterns.last.is_a?(Hash) ? patterns.pop : {}
|
15
|
+
column_width = get_column_width
|
16
|
+
output = patterns.map do |pattern|
|
17
|
+
pattern = pattern.to_s
|
18
|
+
times = (column_width / pattern.length) + 1
|
19
|
+
(pattern * times)[0..column_width - 1]
|
20
|
+
end.join
|
21
|
+
options = options.inject({}){|tmp,(k,v)| tmp[k.to_sym] = v.to_sym; tmp}
|
22
|
+
options.any? ? output.colorize(options) : output
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def get_column_width
|
28
|
+
column_width = 0
|
29
|
+
|
30
|
+
begin
|
31
|
+
require 'io/console'
|
32
|
+
column_width = IO.console.winsize[1]
|
33
|
+
rescue
|
34
|
+
if command_exists?('tput')
|
35
|
+
column_width = `tput cols`.to_i
|
36
|
+
elsif command_exists?('stty')
|
37
|
+
column_width = `stty size`.split.last.to_i
|
38
|
+
elsif command_exists?('mode')
|
39
|
+
mode_output = `mode`.split
|
40
|
+
column_width = mode_output[mode_output.index('Columns:')+1].to_i
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
case
|
45
|
+
when column_width.nil?, column_width <= 0
|
46
|
+
return 80
|
47
|
+
else
|
48
|
+
return column_width
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def command_exists?(command)
|
53
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).any? { |path|
|
54
|
+
(File.exist? File.join(path, "#{command}")) || (File.exist? File.join(path, "#{command}.com")) || (File.exist? File.join(path, "#{command}.exe"))
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -98,6 +98,11 @@ module Gemwarrior
|
|
98
98
|
'Allows you to see the enemy hit points while in battle.'
|
99
99
|
when :rock_slide
|
100
100
|
'Adds a random boost to the player\'s attack in battle.'
|
101
|
+
when :stone_face
|
102
|
+
'Chance to auto-win in battle against any non-boss monster (does not work in arena or if ambushed).'
|
103
|
+
#when :graniton
|
104
|
+
#when :gleam
|
105
|
+
#when :break_through
|
101
106
|
else
|
102
107
|
'Unsure, but it\'s probably cool!'
|
103
108
|
end
|
data/lib/gemwarrior/repl.rb
CHANGED
@@ -322,26 +322,26 @@ module Gemwarrior
|
|
322
322
|
|
323
323
|
def log_stats(duration, pl)
|
324
324
|
# display stats upon exit
|
325
|
-
|
325
|
+
Hr.print('#')
|
326
326
|
print 'Gem Warrior'.colorize(color: :white, background: :black)
|
327
327
|
print " v#{Gemwarrior::VERSION}".colorize(:yellow)
|
328
328
|
print " played for #{duration[:mins].to_s.colorize(color: :white, background: :black)} min(s),"
|
329
329
|
print " #{duration[:secs].to_s.colorize(color: :white, background: :black)} sec(s),"
|
330
330
|
print " and #{duration[:ms].to_s.colorize(color: :white, background: :black)} ms\n"
|
331
|
-
|
332
|
-
print "#{pl.name.ljust(10)} killed #{pl.monsters_killed.to_s.colorize(color: :
|
331
|
+
Hr.print('-')
|
332
|
+
print "#{pl.name.ljust(10)} killed #{pl.monsters_killed.to_s.colorize(color: :yellow, background: :black)} monster(s)"
|
333
333
|
print "\n".ljust(12)
|
334
|
-
print "killed #{pl.bosses_killed.to_s.colorize(color: :
|
334
|
+
print "killed #{pl.bosses_killed.to_s.colorize(color: :yellow, background: :black)} boss(es)"
|
335
335
|
print "\n".ljust(12)
|
336
|
-
print "picked up #{pl.items_taken.to_s.colorize(color: :
|
336
|
+
print "picked up #{pl.items_taken.to_s.colorize(color: :yellow, background: :black)} item(s)"
|
337
337
|
print "\n".ljust(12)
|
338
|
-
print "traveled #{pl.movements_made.to_s.colorize(color: :
|
338
|
+
print "traveled #{pl.movements_made.to_s.colorize(color: :yellow, background: :black)} time(s)"
|
339
339
|
print "\n".ljust(12)
|
340
|
-
print "rested #{pl.rests_taken.to_s.colorize(color: :
|
340
|
+
print "rested #{pl.rests_taken.to_s.colorize(color: :yellow, background: :black)} time(s)"
|
341
341
|
print "\n".ljust(12)
|
342
|
-
print "died #{pl.deaths.to_s.colorize(color: :
|
342
|
+
print "died #{pl.deaths.to_s.colorize(color: :yellow, background: :black)} time(s)"
|
343
343
|
print "\n"
|
344
|
-
|
344
|
+
Hr.print('#')
|
345
345
|
|
346
346
|
# log stats to file in home directory
|
347
347
|
File.open(GameOptions.data['log_file_path'], 'a') do |f|
|
data/lib/gemwarrior/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemwarrior
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Chadwick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|
@@ -352,6 +352,7 @@ files:
|
|
352
352
|
- lib/gemwarrior/misc/audio.rb
|
353
353
|
- lib/gemwarrior/misc/audio_cues.rb
|
354
354
|
- lib/gemwarrior/misc/formatting.rb
|
355
|
+
- lib/gemwarrior/misc/hr.rb
|
355
356
|
- lib/gemwarrior/misc/musical_notes.rb
|
356
357
|
- lib/gemwarrior/misc/name_generator.rb
|
357
358
|
- lib/gemwarrior/misc/player_levels.rb
|