gemwarrior 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gemwarrior/arena.rb +10 -5
- data/lib/gemwarrior/battle.rb +25 -57
- data/lib/gemwarrior/entities/item.rb +1 -0
- data/lib/gemwarrior/entities/items/herb.rb +1 -0
- data/lib/gemwarrior/entities/items/pond.rb +1 -1
- data/lib/gemwarrior/entities/player.rb +78 -24
- data/lib/gemwarrior/evaluator.rb +41 -13
- data/lib/gemwarrior/inventory.rb +4 -2
- data/lib/gemwarrior/misc/player_levels.rb +35 -35
- data/lib/gemwarrior/repl.rb +1 -2
- data/lib/gemwarrior/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 877ec35a557a565c6297fd1254125da52bd0f994
|
4
|
+
data.tar.gz: 3e81dde82503f12558cab8de01604342e1794512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57f4c3245515b5af14ab08c55247340fe6aba4c1f9ec68ba7863d4c44478c4e76f6a78c8fde8bcd31daf5b2bde0cb5f87ea208871793fd88bbe21ee3b8576463
|
7
|
+
data.tar.gz: b9aaa6b225669244a13d2e9405cf1961fd868b1ad150a997c33e2c9cb35024a93d4a3836bfd2233c5ba6f3a20a66f7c9ec9c34e657c941f80d3c1e2c80404e51
|
data/lib/gemwarrior/arena.rb
CHANGED
@@ -16,14 +16,18 @@ module Gemwarrior
|
|
16
16
|
def start
|
17
17
|
print_arena_intro
|
18
18
|
|
19
|
-
|
19
|
+
arena_monsters_vanquished = 0
|
20
20
|
|
21
21
|
loop do
|
22
22
|
monster = generate_monster
|
23
23
|
battle = Battle.new({:world => self.world, :player => self.player, :monster => monster})
|
24
|
-
battle.start(is_arena = true)
|
24
|
+
result = battle.start(is_arena = true)
|
25
|
+
|
26
|
+
if result.eql?('death')
|
27
|
+
return 'exit'
|
28
|
+
end
|
25
29
|
|
26
|
-
|
30
|
+
arena_monsters_vanquished += 1
|
27
31
|
|
28
32
|
puts 'Do you wish to continue fighting in the Arena? (Y/N)'
|
29
33
|
answer = gets.chomp.downcase
|
@@ -32,11 +36,12 @@ module Gemwarrior
|
|
32
36
|
when 'yes', 'y'
|
33
37
|
next
|
34
38
|
else
|
35
|
-
bonus_rox =
|
36
|
-
bonus_xp =
|
39
|
+
bonus_rox = arena_monsters_vanquished * 25
|
40
|
+
bonus_xp = arena_monsters_vanquished * 10
|
37
41
|
player.rox = player.rox + bonus_rox
|
38
42
|
player.xp = player.xp + bonus_xp
|
39
43
|
puts 'You decided you\'ve had enough of the exhausting Arena for one day and exit the main stage.'
|
44
|
+
puts "You defeated #{arena_monsters_vanquished} monsters!"
|
40
45
|
puts "You have gained #{bonus_rox} rox and #{bonus_xp} XP!"
|
41
46
|
|
42
47
|
return print_arena_outro
|
data/lib/gemwarrior/battle.rb
CHANGED
@@ -5,8 +5,6 @@ require_relative 'misc/player_levels'
|
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Battle
|
8
|
-
include PlayerLevels
|
9
|
-
|
10
8
|
# CONSTANTS
|
11
9
|
## ERRORS
|
12
10
|
ERROR_ATTACK_OPTION_INVALID = 'That will not do anything against the monster.'
|
@@ -15,13 +13,13 @@ module Gemwarrior
|
|
15
13
|
## MESSAGES
|
16
14
|
TEXT_ESCAPE = 'POOF'
|
17
15
|
|
18
|
-
attr_accessor :world, :player, :monster, :
|
16
|
+
attr_accessor :world, :player, :monster, :player_is_defending
|
19
17
|
|
20
18
|
def initialize(options)
|
21
|
-
self.world
|
22
|
-
self.player
|
23
|
-
self.monster
|
24
|
-
self.
|
19
|
+
self.world = options.fetch(:world)
|
20
|
+
self.player = options.fetch(:player)
|
21
|
+
self.monster = options.fetch(:monster)
|
22
|
+
self.player_is_defending = false
|
25
23
|
end
|
26
24
|
|
27
25
|
def start(is_arena = nil, is_event = nil)
|
@@ -53,8 +51,10 @@ module Gemwarrior
|
|
53
51
|
return
|
54
52
|
elsif player_dead?
|
55
53
|
player_death
|
54
|
+
return 'death'
|
56
55
|
end
|
57
56
|
|
57
|
+
# check for near death
|
58
58
|
if player_near_death?
|
59
59
|
puts "You are almost dead!\n".colorize(:yellow)
|
60
60
|
end
|
@@ -63,14 +63,16 @@ module Gemwarrior
|
|
63
63
|
end
|
64
64
|
|
65
65
|
puts
|
66
|
-
|
66
|
+
|
67
|
+
# print health info
|
68
|
+
print "#{player.name.upcase.ljust(12)} :: #{player.hp_cur.to_s.rjust(3)} HP"
|
67
69
|
if world.debug_mode
|
68
70
|
print " (LVL: #{player.level})"
|
69
71
|
end
|
70
72
|
print "\n"
|
71
73
|
|
72
|
-
print "
|
73
|
-
if world.debug_mode ||
|
74
|
+
print "#{monster.name.upcase.ljust(12)} :: "
|
75
|
+
if world.debug_mode || player.special_abilities.include?(:rocking_vision)
|
74
76
|
print "#{monster.hp_cur.to_s.rjust(3)}"
|
75
77
|
else
|
76
78
|
print "???"
|
@@ -82,8 +84,9 @@ module Gemwarrior
|
|
82
84
|
print "\n"
|
83
85
|
puts
|
84
86
|
|
85
|
-
self.
|
87
|
+
self.player_is_defending = false
|
86
88
|
|
89
|
+
# battle options prompt
|
87
90
|
puts 'What do you do?'
|
88
91
|
print '['.colorize(:yellow)
|
89
92
|
print 'F'.colorize(:green)
|
@@ -94,14 +97,16 @@ module Gemwarrior
|
|
94
97
|
print 'efend]['.colorize(:yellow)
|
95
98
|
print 'L'.colorize(:green)
|
96
99
|
print 'ook]['.colorize(:yellow)
|
100
|
+
print 'P'.colorize(:green)
|
101
|
+
print 'ass]['.colorize(:yellow)
|
97
102
|
print 'R'.colorize(:green)
|
98
103
|
print 'un]'.colorize(:yellow)
|
99
104
|
print "\n"
|
100
105
|
|
101
|
-
|
106
|
+
player_action = STDIN.gets.chomp.downcase
|
102
107
|
|
103
108
|
# player action
|
104
|
-
case
|
109
|
+
case player_action
|
105
110
|
when 'fight', 'f', 'attack', 'a'
|
106
111
|
puts "You attack #{monster.name}#{player.cur_weapon_name}!"
|
107
112
|
dmg = calculate_damage_to(monster)
|
@@ -116,7 +121,9 @@ module Gemwarrior
|
|
116
121
|
end
|
117
122
|
when 'defend', 'd'
|
118
123
|
puts 'You dig in and defend this round.'
|
119
|
-
self.
|
124
|
+
self.player_is_defending = true
|
125
|
+
when 'pass', 'p'
|
126
|
+
puts 'You decide to pass your turn for some reason. Brave!'
|
120
127
|
when 'look', 'l'
|
121
128
|
print "#{monster.name}".colorize(:white)
|
122
129
|
print " (#{monster.hp_cur}/#{monster.hp_max} HP): #{monster.description}\n"
|
@@ -164,7 +171,7 @@ module Gemwarrior
|
|
164
171
|
rand(atk_range)
|
165
172
|
else
|
166
173
|
dmg = rand(monster.atk_lo..monster.atk_hi)
|
167
|
-
dmg = dmg - (entity.defense / 2) if
|
174
|
+
dmg = dmg - (entity.defense / 2) if player_is_defending
|
168
175
|
return dmg
|
169
176
|
end
|
170
177
|
end
|
@@ -205,9 +212,6 @@ module Gemwarrior
|
|
205
212
|
dmg = calculate_damage_to(player)
|
206
213
|
if dmg > 0
|
207
214
|
take_damage(player, dmg)
|
208
|
-
if player_dead?
|
209
|
-
player_death
|
210
|
-
end
|
211
215
|
else
|
212
216
|
puts "#{monster.name} misses entirely!".colorize(:yellow)
|
213
217
|
end
|
@@ -242,13 +246,13 @@ module Gemwarrior
|
|
242
246
|
])
|
243
247
|
puts monster.defeated_text
|
244
248
|
gets
|
245
|
-
exit
|
249
|
+
return 'exit'
|
246
250
|
else
|
247
251
|
puts 'You just beat a boss monster. Way to go!'
|
248
252
|
puts " XP : #{monster.xp}".colorize(:green)
|
249
253
|
puts " ROX: #{monster.rox}".colorize(:green)
|
250
254
|
print_battle_line
|
251
|
-
|
255
|
+
player.update_stats(monster)
|
252
256
|
world.location_by_coords(player.cur_coords).remove_monster(monster.name)
|
253
257
|
end
|
254
258
|
else
|
@@ -259,47 +263,12 @@ module Gemwarrior
|
|
259
263
|
puts " ITEMS: #{monster.inventory.list_contents}".colorize(:green) unless monster.inventory.items.empty?
|
260
264
|
end
|
261
265
|
print_battle_line
|
262
|
-
|
266
|
+
player.update_stats(monster)
|
263
267
|
world.location_by_coords(player.cur_coords).remove_monster(monster.name)
|
264
268
|
end
|
265
269
|
end
|
266
270
|
|
267
271
|
# PLAYER
|
268
|
-
def update_player_stats
|
269
|
-
old_player_level = PlayerLevels::check_level(player.xp)
|
270
|
-
|
271
|
-
player.xp = player.xp + monster.xp
|
272
|
-
player.rox = player.rox + monster.rox
|
273
|
-
|
274
|
-
monster_items = monster.inventory.items
|
275
|
-
unless monster_items.nil?
|
276
|
-
player.inventory.items.concat monster_items unless monster_items.empty?
|
277
|
-
end
|
278
|
-
|
279
|
-
new_player_level = PlayerLevels::check_level(player.xp)
|
280
|
-
|
281
|
-
if new_player_level > old_player_level
|
282
|
-
Animation::run({:phrase => '** LEVEL UP! **'})
|
283
|
-
new_stats = PlayerLevels::get_level_stats(new_player_level)
|
284
|
-
|
285
|
-
player.level = new_stats[:level]
|
286
|
-
puts "You are now level #{player.level}!"
|
287
|
-
player.hp_cur = new_stats[:hp_max]
|
288
|
-
player.hp_max = new_stats[:hp_max]
|
289
|
-
puts "You now have #{player.hp_max} hit points!"
|
290
|
-
player.stam_cur = new_stats[:stam_max]
|
291
|
-
player.stam_max = new_stats[:stam_max]
|
292
|
-
puts "You now have #{player.stam_max} stamina points!"
|
293
|
-
player.atk_lo = new_stats[:atk_lo]
|
294
|
-
player.atk_hi = new_stats[:atk_hi]
|
295
|
-
puts "You now have an attack of #{player.atk_lo}-#{player.atk_hi}!"
|
296
|
-
player.defense = new_stats[:defense]
|
297
|
-
puts "You now have #{player.defense} defensive points!"
|
298
|
-
player.dexterity = new_stats[:dexterity]
|
299
|
-
puts "You now have #{player.dexterity} dexterity points!"
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
272
|
def player_near_death?
|
304
273
|
((player.hp_cur.to_f / player.hp_max.to_f) < 0.10 && !player.god_mode)
|
305
274
|
end
|
@@ -312,7 +281,6 @@ module Gemwarrior
|
|
312
281
|
puts "You are dead, slain by the #{monster.name}!".colorize(:red)
|
313
282
|
puts 'Your adventure ends here. Try again next time!'.colorize(:red)
|
314
283
|
print_battle_line
|
315
|
-
return 'exit'
|
316
284
|
end
|
317
285
|
|
318
286
|
def player_escape?
|
@@ -21,7 +21,7 @@ module Gemwarrior
|
|
21
21
|
|
22
22
|
def use(player = nil)
|
23
23
|
puts 'You gently place your fingers on the pond\'s rippling surface.'
|
24
|
-
|
24
|
+
|
25
25
|
if (NEEDED_ITEMS - player.inventory.items.map(&:name)).empty?
|
26
26
|
puts 'The pond water explodes with a force that knocks you back onto the ground. When you come to, you notice the depression in the ground where the pond once was now has a new curious object!'
|
27
27
|
self.description = 'A barren depression in the ground is all that is left of the pond.'
|
@@ -12,37 +12,39 @@ module Gemwarrior
|
|
12
12
|
include PlayerLevels
|
13
13
|
|
14
14
|
attr_accessor :stam_cur, :stam_max, :cur_coords,
|
15
|
-
:god_mode, :beast_mode, :use_wordnik,
|
15
|
+
:god_mode, :beast_mode, :use_wordnik, :special_abilities,
|
16
16
|
:monsters_killed, :items_taken, :movements_made, :rests_taken
|
17
17
|
|
18
18
|
def initialize(options)
|
19
|
-
self.name
|
20
|
-
self.description
|
21
|
-
self.use_wordnik
|
19
|
+
self.name = generate_name
|
20
|
+
self.description = options.fetch(:description)
|
21
|
+
self.use_wordnik = options.fetch(:use_wordnik)
|
22
22
|
|
23
|
-
self.face
|
24
|
-
self.hands
|
25
|
-
self.mood
|
23
|
+
self.face = generate_face(use_wordnik)
|
24
|
+
self.hands = generate_hands(use_wordnik)
|
25
|
+
self.mood = generate_mood(use_wordnik)
|
26
26
|
|
27
|
-
self.level
|
28
|
-
self.xp
|
29
|
-
self.hp_cur
|
30
|
-
self.hp_max
|
31
|
-
self.atk_lo
|
32
|
-
self.atk_hi
|
27
|
+
self.level = options.fetch(:level)
|
28
|
+
self.xp = options.fetch(:xp)
|
29
|
+
self.hp_cur = options.fetch(:hp_cur)
|
30
|
+
self.hp_max = options.fetch(:hp_max)
|
31
|
+
self.atk_lo = options.fetch(:atk_lo)
|
32
|
+
self.atk_hi = options.fetch(:atk_hi)
|
33
33
|
|
34
|
-
self.defense
|
35
|
-
self.dexterity
|
34
|
+
self.defense = options.fetch(:defense)
|
35
|
+
self.dexterity = options.fetch(:dexterity)
|
36
36
|
|
37
|
-
self.inventory
|
38
|
-
self.rox
|
37
|
+
self.inventory = Inventory.new([Herb.new])
|
38
|
+
self.rox = options.fetch(:rox)
|
39
39
|
|
40
|
-
self.stam_cur
|
41
|
-
self.stam_max
|
42
|
-
self.cur_coords
|
40
|
+
self.stam_cur = options.fetch(:stam_cur)
|
41
|
+
self.stam_max = options.fetch(:stam_max)
|
42
|
+
self.cur_coords = options.fetch(:cur_coords)
|
43
43
|
|
44
|
-
self.god_mode
|
45
|
-
self.beast_mode
|
44
|
+
self.god_mode = options.fetch(:god_mode)
|
45
|
+
self.beast_mode = options.fetch(:beast_mode)
|
46
|
+
|
47
|
+
self.special_abilities = []
|
46
48
|
|
47
49
|
self.monsters_killed = 0
|
48
50
|
self.items_taken = 0
|
@@ -63,6 +65,13 @@ module Gemwarrior
|
|
63
65
|
else
|
64
66
|
weapon_slot = '(unarmed)'
|
65
67
|
end
|
68
|
+
|
69
|
+
abilities = ''
|
70
|
+
if special_abilities.empty?
|
71
|
+
abilities = 'none'
|
72
|
+
else
|
73
|
+
abilities = special_abilities.join(', ')
|
74
|
+
end
|
66
75
|
|
67
76
|
self_text = "NAME : #{self.name}\n"
|
68
77
|
self_text << "POSITION : #{self.cur_coords.values.to_a}\n"
|
@@ -73,6 +82,7 @@ module Gemwarrior
|
|
73
82
|
self_text << "ATTACK : #{self.atk_lo}-#{self.atk_hi}\n"
|
74
83
|
self_text << "DEXTERITY : #{self.dexterity}\n"
|
75
84
|
self_text << "DEFENSE : #{self.defense}\n"
|
85
|
+
self_text << "ABILITIES : #{abilities}\n"
|
76
86
|
if debug_mode
|
77
87
|
self_text << "GOD_MODE : #{self.god_mode}\n"
|
78
88
|
self_text << "BEAST_MODE: #{self.beast_mode}\n"
|
@@ -185,7 +195,10 @@ module Gemwarrior
|
|
185
195
|
|
186
196
|
def attack(world, monster)
|
187
197
|
battle = Battle.new({:world => world, :player => self, :monster => monster})
|
188
|
-
battle.start
|
198
|
+
result = battle.start
|
199
|
+
if result.eql?('death')
|
200
|
+
return 'exit'
|
201
|
+
end
|
189
202
|
end
|
190
203
|
|
191
204
|
def has_weapon_equipped?
|
@@ -214,13 +227,54 @@ module Gemwarrior
|
|
214
227
|
self.hp_cur = self.hp_max
|
215
228
|
end
|
216
229
|
end
|
230
|
+
|
231
|
+
def update_stats(monster)
|
232
|
+
old_player_level = PlayerLevels::check_level(self.xp)
|
233
|
+
|
234
|
+
self.xp = self.xp + monster.xp
|
235
|
+
self.rox = self.rox + monster.rox
|
236
|
+
|
237
|
+
monster_items = monster.inventory.items
|
238
|
+
unless monster_items.nil?
|
239
|
+
self.inventory.items.concat monster_items unless monster_items.empty?
|
240
|
+
end
|
241
|
+
|
242
|
+
new_player_level = PlayerLevels::check_level(self.xp)
|
243
|
+
|
244
|
+
if new_player_level > old_player_level
|
245
|
+
Animation::run({:phrase => '** LEVEL UP! **'})
|
246
|
+
new_stats = PlayerLevels::get_level_stats(new_player_level)
|
247
|
+
|
248
|
+
self.level = new_stats[:level]
|
249
|
+
puts "You are now level #{self.level}!"
|
250
|
+
self.hp_cur = new_stats[:hp_max]
|
251
|
+
self.hp_max = new_stats[:hp_max]
|
252
|
+
puts "You now have #{self.hp_max} hit points!"
|
253
|
+
self.stam_cur = new_stats[:stam_max]
|
254
|
+
self.stam_max = new_stats[:stam_max]
|
255
|
+
puts "You now have #{self.stam_max} stamina points!"
|
256
|
+
self.atk_lo = new_stats[:atk_lo]
|
257
|
+
self.atk_hi = new_stats[:atk_hi]
|
258
|
+
puts "You now have an attack of #{self.atk_lo}-#{self.atk_hi}!"
|
259
|
+
self.defense = new_stats[:defense]
|
260
|
+
puts "You now have #{self.defense} defensive points!"
|
261
|
+
self.dexterity = new_stats[:dexterity]
|
262
|
+
puts "You now have #{self.dexterity} dexterity points!"
|
263
|
+
unless new_stats[:special_abilities].nil?
|
264
|
+
unless self.special_abilities.include?(new_stats[:special_abilities])
|
265
|
+
self.special_abilities.push(new_stats[:special_abilities])
|
266
|
+
puts "You learned a new ability: #{new_stats[:special_abilities]}!"
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
217
271
|
|
218
272
|
private
|
219
273
|
|
220
274
|
def player_death
|
221
275
|
puts 'Your actions have reduced you to death.'.colorize(:red)
|
222
276
|
puts 'Your adventure ends here. Try again next time!'.colorize(:red)
|
223
|
-
exit
|
277
|
+
return 'exit'
|
224
278
|
end
|
225
279
|
|
226
280
|
# TRAVEL
|
data/lib/gemwarrior/evaluator.rb
CHANGED
@@ -127,7 +127,7 @@ module Gemwarrior
|
|
127
127
|
return DEBUG_STAT_PARAMS
|
128
128
|
else
|
129
129
|
case param1
|
130
|
-
when 'hp_cur'
|
130
|
+
when 'hp_cur', 'hp'
|
131
131
|
unless param2.nil?
|
132
132
|
param2 = param2.to_i
|
133
133
|
if param2.is_a? Numeric
|
@@ -182,6 +182,19 @@ module Gemwarrior
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
end
|
185
|
+
when 'experience', 'xp'
|
186
|
+
unless param2.nil?
|
187
|
+
param2 = param2.to_i
|
188
|
+
if param2.is_a? Numeric
|
189
|
+
if param2 >= 0
|
190
|
+
world.player.xp = param2
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
when 'inventory', 'inv'
|
195
|
+
unless param2.nil?
|
196
|
+
world.player.inventory.items.push(eval(param2).new)
|
197
|
+
end
|
185
198
|
else
|
186
199
|
return ERROR_DEBUG_STAT_PARAM_INVALID
|
187
200
|
end
|
@@ -266,28 +279,39 @@ module Gemwarrior
|
|
266
279
|
else
|
267
280
|
item_name = param1
|
268
281
|
result = nil
|
269
|
-
location_inventory = world.location_by_coords(world.player.cur_coords).items
|
270
282
|
|
271
|
-
|
272
|
-
|
283
|
+
player_inventory = world.player.inventory.items
|
284
|
+
location_inventory = world.location_by_coords(world.player.cur_coords).items
|
285
|
+
|
286
|
+
if player_inventory.map(&:name).include?(item_name)
|
287
|
+
player_inventory.each do |i|
|
273
288
|
if i.name.eql?(item_name)
|
274
289
|
if i.useable
|
275
290
|
result = i.use(world.player)
|
291
|
+
if i.consumable
|
292
|
+
world.player.inventory.remove_item(i.name)
|
293
|
+
return
|
294
|
+
else
|
295
|
+
return
|
296
|
+
end
|
276
297
|
else
|
277
298
|
return ERROR_USE_PARAM_UNUSEABLE
|
278
299
|
end
|
279
300
|
end
|
280
301
|
end
|
281
|
-
elsif
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
if i.
|
287
|
-
|
302
|
+
elsif location_inventory.map(&:name).include?(item_name)
|
303
|
+
location_inventory.each do |i|
|
304
|
+
if i.name.eql?(item_name)
|
305
|
+
if i.useable
|
306
|
+
result = i.use(world.player)
|
307
|
+
if i.consumable
|
308
|
+
world.location_by_coords(world.player.cur_coords).remove_item(i)
|
309
|
+
return
|
288
310
|
else
|
289
|
-
return
|
311
|
+
return
|
290
312
|
end
|
313
|
+
else
|
314
|
+
return ERROR_USE_PARAM_UNUSEABLE
|
291
315
|
end
|
292
316
|
end
|
293
317
|
end
|
@@ -319,7 +343,11 @@ module Gemwarrior
|
|
319
343
|
end
|
320
344
|
when 'arena'
|
321
345
|
arena = Arena.new({:world => world, :player => world.player})
|
322
|
-
arena.start
|
346
|
+
result = arena.start
|
347
|
+
|
348
|
+
if result.eql?('exit')
|
349
|
+
return 'exit'
|
350
|
+
end
|
323
351
|
when 'item'
|
324
352
|
world.location_by_coords(world.player.cur_coords).add_item(result[:data])
|
325
353
|
return
|
data/lib/gemwarrior/inventory.rb
CHANGED
@@ -102,9 +102,11 @@ module Gemwarrior
|
|
102
102
|
|
103
103
|
def remove_item(item_name)
|
104
104
|
if contains_item?(item_name)
|
105
|
-
items.
|
105
|
+
items.delete_at(items.map(&:name).index(item_name) || items.length)
|
106
106
|
|
107
|
-
|
107
|
+
unless self.weapon.nil?
|
108
|
+
self.weapon = nil if self.weapon.name.eql?(item_name)
|
109
|
+
end
|
108
110
|
|
109
111
|
return "The #{item_name} has been thrown on the ground, but far out of reach, and you're much too lazy to go get it now, so it's as good as gone."
|
110
112
|
else
|
@@ -7,59 +7,59 @@ module Gemwarrior
|
|
7
7
|
case level
|
8
8
|
when 1
|
9
9
|
{
|
10
|
-
:level
|
11
|
-
:hp_max
|
12
|
-
:atk_lo
|
13
|
-
:defense
|
14
|
-
:special_abilities =>
|
10
|
+
:level => 1, :xp_start => 0,
|
11
|
+
:hp_max => 30, :stam_max => 20,
|
12
|
+
:atk_lo => 1, :atk_hi => 2,
|
13
|
+
:defense => 5, :dexterity => 5,
|
14
|
+
:special_abilities => nil
|
15
15
|
}
|
16
16
|
when 2
|
17
17
|
{
|
18
|
-
:level
|
19
|
-
:hp_max
|
20
|
-
:atk_lo
|
21
|
-
:defense
|
22
|
-
:special_abilities =>
|
18
|
+
:level => 2, :xp_start => 50,
|
19
|
+
:hp_max => 35, :stam_max => 25,
|
20
|
+
:atk_lo => 2, :atk_hi => 3,
|
21
|
+
:defense => 6, :dexterity => 6,
|
22
|
+
:special_abilities => :rocking_vision
|
23
23
|
}
|
24
24
|
when 3
|
25
25
|
{
|
26
|
-
:level
|
27
|
-
:hp_max
|
28
|
-
:atk_lo
|
29
|
-
:defense
|
30
|
-
:special_abilities =>
|
26
|
+
:level => 3, :xp_start => 120,
|
27
|
+
:hp_max => 45, :stam_max => 30,
|
28
|
+
:atk_lo => 3, :atk_hi => 5,
|
29
|
+
:defense => 7, :dexterity => 8,
|
30
|
+
:special_abilities => :rock_slide
|
31
31
|
}
|
32
32
|
when 4
|
33
33
|
{
|
34
|
-
:level
|
35
|
-
:hp_max
|
36
|
-
:atk_lo
|
37
|
-
:defense
|
38
|
-
:special_abilities =>
|
34
|
+
:level => 4, :xp_start => 250,
|
35
|
+
:hp_max => 55, :stam_max => 35,
|
36
|
+
:atk_lo => 5, :atk_hi => 6,
|
37
|
+
:defense => 8, :dexterity => 9,
|
38
|
+
:special_abilities => :stone_face
|
39
39
|
}
|
40
40
|
when 5
|
41
41
|
{
|
42
|
-
:level
|
43
|
-
:hp_max
|
44
|
-
:atk_lo
|
45
|
-
:defense
|
46
|
-
:special_abilities =>
|
42
|
+
:level => 5, :xp_start => 600,
|
43
|
+
:hp_max => 70, :stam_max => 45,
|
44
|
+
:atk_lo => 7, :atk_hi => 8,
|
45
|
+
:defense => 10, :dexterity => 11,
|
46
|
+
:special_abilities => :graniton
|
47
47
|
}
|
48
48
|
when 6
|
49
49
|
{
|
50
|
-
:level
|
51
|
-
:hp_max
|
52
|
-
:atk_lo
|
53
|
-
:defense
|
54
|
-
:special_abilities =>
|
50
|
+
:level => 6, :xp_start => 1000,
|
51
|
+
:hp_max => 85, :stam_max => 60,
|
52
|
+
:atk_lo => 8, :atk_hi => 10,
|
53
|
+
:defense => 13, :dexterity => 13,
|
54
|
+
:special_abilities => :gleam
|
55
55
|
}
|
56
56
|
when 7
|
57
57
|
{
|
58
|
-
:level
|
59
|
-
:hp_max
|
60
|
-
:atk_lo
|
61
|
-
:defense
|
62
|
-
:special_abilities =>
|
58
|
+
:level => 7, :xp_start => 1500,
|
59
|
+
:hp_max => 100, :stam_max => 80,
|
60
|
+
:atk_lo => 10, :atk_hi => 12,
|
61
|
+
:defense => 15, :dexterity => 16,
|
62
|
+
:special_abilities => :break_through
|
63
63
|
}
|
64
64
|
end
|
65
65
|
end
|
data/lib/gemwarrior/repl.rb
CHANGED
@@ -100,7 +100,6 @@ module Gemwarrior
|
|
100
100
|
|
101
101
|
def print_stats(duration, pl)
|
102
102
|
puts '######################################################################'
|
103
|
-
puts
|
104
103
|
print 'Gem Warrior'.colorize(:color => :white, :background => :black)
|
105
104
|
print " played for #{duration[:mins].to_s.colorize(:color => :white, :background => :black)} minutes, #{duration[:secs].to_s.colorize(:color => :white, :background => :black)} seconds, and #{duration[:ms].to_s.colorize(:color => :white, :background => :black)} milliseconds\n"
|
106
105
|
puts '----------------------------------------------------------------------'
|
@@ -111,7 +110,7 @@ module Gemwarrior
|
|
111
110
|
print "traveled #{pl.movements_made.to_s.colorize(:color => :white, :background => :black)} time(s)"
|
112
111
|
print "\n".ljust(8)
|
113
112
|
print "rested #{pl.rests_taken.to_s.colorize(:color => :white, :background => :black)} time(s)"
|
114
|
-
|
113
|
+
print "\n"
|
115
114
|
puts '######################################################################'
|
116
115
|
end
|
117
116
|
|
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.9.
|
4
|
+
version: 0.9.2
|
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-07-
|
11
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|