gemwarrior 0.7.0 → 0.7.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 +57 -33
- data/lib/gemwarrior/entities/entity.rb +2 -2
- data/lib/gemwarrior/entities/items/couch.rb +2 -2
- data/lib/gemwarrior/entities/items/herb.rb +25 -0
- data/lib/gemwarrior/entities/items/tower_switch.rb +1 -1
- data/lib/gemwarrior/entities/location.rb +31 -9
- data/lib/gemwarrior/entities/monster.rb +25 -13
- data/lib/gemwarrior/entities/monsters/alexandrat.rb +2 -1
- data/lib/gemwarrior/entities/monsters/amberoo.rb +2 -1
- data/lib/gemwarrior/entities/monsters/amethystle.rb +2 -1
- data/lib/gemwarrior/entities/monsters/apatiger.rb +2 -1
- data/lib/gemwarrior/entities/monsters/aquamarine.rb +2 -1
- data/lib/gemwarrior/entities/monsters/bloodstorm.rb +2 -1
- data/lib/gemwarrior/entities/monsters/citrinaga.rb +2 -1
- data/lib/gemwarrior/entities/monsters/coraliz.rb +2 -1
- data/lib/gemwarrior/entities/monsters/cubicat.rb +2 -1
- data/lib/gemwarrior/entities/monsters/diaman.rb +2 -1
- data/lib/gemwarrior/entities/player.rb +7 -0
- data/lib/gemwarrior/evaluator.rb +6 -8
- data/lib/gemwarrior/inventory.rb +1 -1
- data/lib/gemwarrior/misc/version.rb +1 -1
- data/lib/gemwarrior/repl.rb +5 -1
- data/lib/gemwarrior/world.rb +51 -20
- 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: 67ea8f41e66cefdb26f55bab9513248528d266dd
|
4
|
+
data.tar.gz: f4aa74c3a8220b407c712e33e26231415b984c71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 796d0ac2f729bbf56141ce0c332b624d621b255d700d3612b00e19586c57480126d315d9e585aecbbed20fdf357eb5e129959574798a0a4a68b3677b5443fea2
|
7
|
+
data.tar.gz: a1d75556f09323bff027fa802e0efad73bebf1581f7d9351e6d8b06d494216cb468e90277e8357c2b441fc95473c3969c25935aee38233083b0512d9d66d8710
|
data/lib/gemwarrior/battle.rb
CHANGED
@@ -12,6 +12,9 @@ module Gemwarrior
|
|
12
12
|
ERROR_ATTACK_OPTION_INVALID = 'That will not do anything against the monster.'
|
13
13
|
BEAST_MODE_ATTACK = 100
|
14
14
|
|
15
|
+
## MESSAGES
|
16
|
+
TEXT_ESCAPE = 'POOF'
|
17
|
+
|
15
18
|
attr_accessor :world, :player, :monster
|
16
19
|
|
17
20
|
def initialize(options)
|
@@ -48,20 +51,30 @@ module Gemwarrior
|
|
48
51
|
end
|
49
52
|
|
50
53
|
puts
|
51
|
-
|
54
|
+
print "PLAYER :: #{player.hp_cur.to_s.rjust(3)} HP"
|
55
|
+
if world.debug_mode
|
56
|
+
print " (LVL: #{player.level})"
|
57
|
+
end
|
58
|
+
print "\n"
|
59
|
+
|
52
60
|
print "MONSTER :: "
|
53
61
|
if world.debug_mode || PlayerLevels::get_level_stats(player.level)[:special_abilities].include?(:rocking_vision)
|
54
62
|
print "#{monster.hp_cur.to_s.rjust(3)}"
|
55
63
|
else
|
56
64
|
print "???"
|
57
65
|
end
|
58
|
-
print " HP
|
66
|
+
print " HP"
|
67
|
+
if world.debug_mode
|
68
|
+
print " (LVL: #{monster.level})"
|
69
|
+
end
|
70
|
+
print "\n"
|
59
71
|
puts
|
60
72
|
|
61
73
|
puts 'What do you do?'
|
62
74
|
puts "[Fight/Attack][Look][Run]".colorize(:color => :yellow)
|
63
|
-
cmd = gets.chomp.downcase
|
64
75
|
|
76
|
+
cmd = gets.chomp.downcase
|
77
|
+
|
65
78
|
# player action
|
66
79
|
case cmd
|
67
80
|
when 'fight', 'f', 'attack', 'a'
|
@@ -77,8 +90,16 @@ module Gemwarrior
|
|
77
90
|
puts "You miss entirely!".colorize(:yellow)
|
78
91
|
end
|
79
92
|
when 'look', 'l'
|
80
|
-
|
81
|
-
|
93
|
+
print "#{monster.name}".colorize(:white)
|
94
|
+
print " (#{monster.hp_cur}/#{monster.hp_max} HP): #{monster.description}\n"
|
95
|
+
puts "It has some distinguishing features, too: face is #{monster.face}, hands are #{monster.hands}, and general mood is #{monster.mood}."
|
96
|
+
if world.debug_mode
|
97
|
+
puts "If defeated, will receive:"
|
98
|
+
puts " >> XP : #{monster.xp}"
|
99
|
+
puts " >> ROX : #{monster.rox}"
|
100
|
+
puts " >> ITEMS: #{monster.inventory.list_contents}"
|
101
|
+
next
|
102
|
+
end
|
82
103
|
when 'run', 'r'
|
83
104
|
if player_escape?
|
84
105
|
monster.hp_cur = monster.hp_max
|
@@ -100,22 +121,9 @@ module Gemwarrior
|
|
100
121
|
|
101
122
|
private
|
102
123
|
|
103
|
-
|
104
|
-
if (monster.dexterity > player.dexterity)
|
105
|
-
return true
|
106
|
-
else
|
107
|
-
dex_diff = player.dexterity - monster.dexterity
|
108
|
-
rand_dex = rand(0..dex_diff)
|
109
|
-
if rand_dex % 2 > 0
|
110
|
-
return true
|
111
|
-
else
|
112
|
-
return false
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
124
|
+
# NEUTRAL
|
117
125
|
def calculate_damage_to(entity)
|
118
|
-
miss = rand(0..100)
|
126
|
+
miss = rand(0..(100 + entity.defense))
|
119
127
|
if (miss < 15)
|
120
128
|
0
|
121
129
|
else
|
@@ -148,6 +156,21 @@ module Gemwarrior
|
|
148
156
|
return hit.join
|
149
157
|
end
|
150
158
|
|
159
|
+
# MONSTER
|
160
|
+
def monster_strikes_first?
|
161
|
+
if (monster.dexterity > player.dexterity)
|
162
|
+
return true
|
163
|
+
else
|
164
|
+
dex_diff = player.dexterity - monster.dexterity
|
165
|
+
rand_dex = rand(0..dex_diff)
|
166
|
+
if rand_dex % 2 > 0
|
167
|
+
return true
|
168
|
+
else
|
169
|
+
return false
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
151
174
|
def monster_attacks_player
|
152
175
|
puts "#{monster.name} attacks you!"
|
153
176
|
dmg = calculate_damage_to(player)
|
@@ -160,16 +183,7 @@ module Gemwarrior
|
|
160
183
|
puts "#{monster.name} misses entirely!".colorize(:yellow)
|
161
184
|
end
|
162
185
|
end
|
163
|
-
|
164
|
-
def calculate_monster_damage
|
165
|
-
miss = rand(0..100)
|
166
|
-
if (miss < 15)
|
167
|
-
0
|
168
|
-
else
|
169
|
-
rand(player.atk_lo..player.atk_hi)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
186
|
+
|
173
187
|
def monster_near_death?
|
174
188
|
((monster.hp_cur.to_f / monster.hp_max.to_f) < 0.10)
|
175
189
|
end
|
@@ -194,20 +208,30 @@ module Gemwarrior
|
|
194
208
|
end
|
195
209
|
else
|
196
210
|
puts 'You get the following spoils of war:'
|
197
|
-
puts " XP
|
198
|
-
puts " ROX: #{monster.rox}".colorize(:green)
|
211
|
+
puts " XP : #{monster.xp}".colorize(:green)
|
212
|
+
puts " ROX : #{monster.rox}".colorize(:green)
|
213
|
+
unless monster.inventory.nil?
|
214
|
+
puts " ITEMS: #{monster.inventory.list_contents}".colorize(:green) unless monster.inventory.items.empty?
|
215
|
+
end
|
199
216
|
print_battle_line
|
200
217
|
update_player_stats
|
201
218
|
world.location_by_coords(player.cur_coords).remove_monster(monster.name)
|
202
219
|
end
|
203
220
|
end
|
204
221
|
|
222
|
+
# PLAYER
|
205
223
|
def update_player_stats
|
206
224
|
old_player_level = PlayerLevels::check_level(player.xp)
|
207
225
|
|
208
226
|
player.xp = player.xp + monster.xp
|
209
227
|
player.rox = player.rox + monster.rox
|
210
228
|
|
229
|
+
monster_items = monster.inventory.items
|
230
|
+
binding.pry
|
231
|
+
unless monster_items.nil?
|
232
|
+
player.inventory.items.concat monster_items unless monster_items.empty?
|
233
|
+
end
|
234
|
+
|
211
235
|
new_player_level = PlayerLevels::check_level(player.xp)
|
212
236
|
|
213
237
|
if new_player_level > old_player_level
|
@@ -266,7 +290,7 @@ module Gemwarrior
|
|
266
290
|
def print_escape_text
|
267
291
|
escape = Thread.new do
|
268
292
|
print "* "
|
269
|
-
print "#{Matrext::process({ :phrase =>
|
293
|
+
print "#{Matrext::process({ :phrase => TEXT_ESCAPE, :oneline => true })}"
|
270
294
|
print " *\n"
|
271
295
|
end
|
272
296
|
return escape.join
|
@@ -17,8 +17,8 @@ module Gemwarrior
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def use
|
20
|
-
puts 'Your body comes to rest somewhere below the surface of the cloudy apparatus, almost as if it were floating *amongst* the couch. The feeling is heavenly, and you actually feel somewhat
|
21
|
-
puts
|
20
|
+
puts 'Your body comes to rest somewhere below the surface of the cloudy apparatus, almost as if it were floating *amongst* the couch. The feeling is heavenly, and you actually feel somewhat better after getting back up.'
|
21
|
+
puts 'You regain a hit point.'
|
22
22
|
{:type => 'rest', :data => 1}
|
23
23
|
end
|
24
24
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# lib/gemwarrior/entities/items/herb.rb
|
2
|
+
# Item::Herb
|
3
|
+
|
4
|
+
require_relative '../item'
|
5
|
+
|
6
|
+
module Gemwarrior
|
7
|
+
class Herb < Item
|
8
|
+
def initialize
|
9
|
+
self.name = 'herb'
|
10
|
+
self.description = 'Green and leafy, this wild herb looks edible.'
|
11
|
+
self.atk_lo = nil
|
12
|
+
self.atk_hi = nil
|
13
|
+
self.takeable = true
|
14
|
+
self.useable = true
|
15
|
+
self.equippable = false
|
16
|
+
self.equipped = false
|
17
|
+
end
|
18
|
+
|
19
|
+
def use
|
20
|
+
puts 'You place the herb in your mouth, testing its texture. The mysterious herb is easily chewable, and you are able to swallow it without much effort. Slight tingles travel up and down your spine.'
|
21
|
+
puts 'You regain a few hit points.'
|
22
|
+
{:type => 'health', :data => rand(3..5)}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -7,7 +7,7 @@ module Gemwarrior
|
|
7
7
|
class TowerSwitch < Item
|
8
8
|
def initialize
|
9
9
|
self.name = 'tower_switch'
|
10
|
-
self.description = 'A pedestal about 4 feet in height rises up from the ground, a switch atop it. It is labeled "Tower"
|
10
|
+
self.description = 'A pedestal about 4 feet in height rises up from the ground, a switch atop it. It is labeled "Tower" with choices for "Yes" and "No". It is set to "No".'
|
11
11
|
self.atk_lo = nil
|
12
12
|
self.atk_hi = nil
|
13
13
|
self.takeable = false
|
@@ -28,10 +28,12 @@ module Gemwarrior
|
|
28
28
|
self.checked_for_monsters = false
|
29
29
|
end
|
30
30
|
|
31
|
-
def status
|
32
|
-
status_text = name.ljust(26).upcase
|
33
|
-
status_text << coords.values.to_a.to_s
|
34
|
-
status_text << " #{
|
31
|
+
def status(debug_mode = false)
|
32
|
+
status_text = name.ljust(26).upcase.colorize(:green)
|
33
|
+
status_text << coords.values.to_a.to_s.colorize(:white)
|
34
|
+
status_text << " DL[#{danger_level.to_s.ljust(8)}] ".colorize(:white) if debug_mode
|
35
|
+
status_text << " MLR[#{monster_level_range.to_s.ljust(6)}] ".colorize(:white) if debug_mode
|
36
|
+
status_text << " #{description}\n".colorize(:white)
|
35
37
|
end
|
36
38
|
|
37
39
|
def remove_item(item_name)
|
@@ -90,15 +92,27 @@ module Gemwarrior
|
|
90
92
|
end
|
91
93
|
|
92
94
|
def list_items
|
93
|
-
|
95
|
+
if items.length > 0
|
96
|
+
items.map(&:name)
|
97
|
+
else
|
98
|
+
[]
|
99
|
+
end
|
94
100
|
end
|
95
101
|
|
96
102
|
def list_monsters
|
97
|
-
|
103
|
+
if monsters_abounding.length > 0
|
104
|
+
monsters_abounding.map(&:name)
|
105
|
+
else
|
106
|
+
[]
|
107
|
+
end
|
98
108
|
end
|
99
109
|
|
100
110
|
def list_bosses
|
101
|
-
|
111
|
+
if bosses_abounding.length > 0
|
112
|
+
bosses_abounding.map(&:name)
|
113
|
+
else
|
114
|
+
[]
|
115
|
+
end
|
102
116
|
end
|
103
117
|
|
104
118
|
def list_paths
|
@@ -108,7 +122,15 @@ module Gemwarrior
|
|
108
122
|
valid_paths.push(key.to_s)
|
109
123
|
end
|
110
124
|
end
|
111
|
-
return
|
125
|
+
return valid_paths
|
126
|
+
end
|
127
|
+
|
128
|
+
def list_actionable_words
|
129
|
+
actionable_words = []
|
130
|
+
actionable_words.push(monsters_abounding.map(&:name)) unless monsters_abounding.empty?
|
131
|
+
actionable_words.push(bosses_abounding.map(&:name)) unless bosses_abounding.empty?
|
132
|
+
actionable_words.push(items.map(&:name)) unless items.empty?
|
133
|
+
actionable_words.join(', ')
|
112
134
|
end
|
113
135
|
|
114
136
|
def populate_monsters(monsters_available)
|
@@ -120,7 +142,7 @@ module Gemwarrior
|
|
120
142
|
# get random non-boss monster
|
121
143
|
loop do
|
122
144
|
random_monster = monsters_available[rand(0..monsters_available.length-1)]
|
123
|
-
unless random_monster.is_boss
|
145
|
+
unless random_monster.is_boss || !self.monster_level_range.include?(random_monster.level)
|
124
146
|
break
|
125
147
|
end
|
126
148
|
end
|
@@ -2,24 +2,36 @@
|
|
2
2
|
# Monster creature
|
3
3
|
|
4
4
|
require_relative 'creature'
|
5
|
+
require_relative 'items/herb'
|
5
6
|
|
6
7
|
module Gemwarrior
|
7
8
|
class Monster < Creature
|
8
|
-
|
9
|
+
INVENTORY_ITEMS_DEFAULT = [Herb.new]
|
10
|
+
|
11
|
+
attr_accessor :inventory, :battlecry, :is_boss
|
9
12
|
|
13
|
+
def initialize
|
14
|
+
if [true, false].sample
|
15
|
+
self.inventory = Inventory.new([INVENTORY_ITEMS_DEFAULT[rand(0..INVENTORY_ITEMS_DEFAULT.length-1)]])
|
16
|
+
else
|
17
|
+
self.inventory = Inventory.new
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
10
21
|
def describe
|
11
|
-
status_text = name.upcase.ljust(26)
|
12
|
-
status_text << "LEVEL: #{level.to_s.rjust(2)}, "
|
13
|
-
status_text << "HP: #{hp_cur.to_s.rjust(3)}/#{hp_max.to_s.rjust(3)} "
|
14
|
-
status_text << "ATK: #{atk_lo.to_s.rjust(2)}-#{atk_hi.to_s.rjust(2)} "
|
15
|
-
status_text << "DEF: #{defense.to_s.rjust(2)} "
|
16
|
-
status_text << "DEX: #{dexterity.to_s.rjust(2)} "
|
17
|
-
status_text << "ROX: #{rox.to_s.rjust(3)} "
|
18
|
-
status_text << "XP: #{xp.to_s.rjust(3)} "
|
19
|
-
status_text << "FACE: #{face.ljust(12)} "
|
20
|
-
status_text << "HANDS: #{hands.ljust(12)} "
|
21
|
-
status_text << "MOOD: #{mood.ljust(12)}"
|
22
|
-
status_text << "INV: #{inventory.list_contents}
|
22
|
+
status_text = name.upcase.ljust(26).colorize(:green)
|
23
|
+
status_text << "LEVEL: #{level.to_s.rjust(2)}, ".colorize(:white)
|
24
|
+
status_text << "HP: #{hp_cur.to_s.rjust(3)}/#{hp_max.to_s.rjust(3)} ".colorize(:white)
|
25
|
+
status_text << "ATK: #{atk_lo.to_s.rjust(2)}-#{atk_hi.to_s.rjust(2)} ".colorize(:white)
|
26
|
+
status_text << "DEF: #{defense.to_s.rjust(2)} ".colorize(:white)
|
27
|
+
status_text << "DEX: #{dexterity.to_s.rjust(2)} ".colorize(:white)
|
28
|
+
status_text << "ROX: #{rox.to_s.rjust(3)} ".colorize(:white)
|
29
|
+
status_text << "XP: #{xp.to_s.rjust(3)} ".colorize(:white)
|
30
|
+
status_text << "FACE: #{face.ljust(12)} ".colorize(:white)
|
31
|
+
status_text << "HANDS: #{hands.ljust(12)} ".colorize(:white)
|
32
|
+
status_text << "MOOD: #{mood.ljust(12)}".colorize(:white)
|
33
|
+
status_text << "INV: #{inventory.list_contents}".colorize(:white)
|
34
|
+
status_text << "\n"
|
23
35
|
end
|
24
36
|
end
|
25
37
|
end
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Alexandrat < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'alexandrat'
|
10
12
|
self.description = 'Tiny, but fierce, color-changing rodent.'
|
11
13
|
self.face = 'ugly'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(level..(level * 1.5).floor)
|
21
23
|
self.dexterity = rand(1..3)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 2))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Amberoo < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'amberoo'
|
10
12
|
self.description = 'Fossilized and jumping around like an adorably dangerous threat from the past.'
|
11
13
|
self.face = 'punchy'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand((level * 2)..(level * 2.5).floor)
|
21
23
|
self.dexterity = rand(3..4)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 2))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Amethystle < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'amethystle'
|
10
12
|
self.description = 'Sober and contemplative, it moves with purplish tentacles swaying in the breeze.'
|
11
13
|
self.face = 'sharp'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(2..4)
|
21
23
|
self.dexterity = rand(1..2)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 2))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Apatiger < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'apatiger'
|
10
12
|
self.description = 'Apathetic about most everything as it lazes around, save for eating you.'
|
11
13
|
self.face = 'calloused'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(4..7)
|
21
23
|
self.dexterity = rand(3..7)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 2))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Aquamarine < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'aquamarine'
|
10
12
|
self.description = 'It is but one of the few, the proud, the underwater.'
|
11
13
|
self.face = 'strained'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(3..5)
|
21
23
|
self.dexterity = rand(4..6)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 2))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Bloodstorm < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'bloodstorm'
|
10
12
|
self.description = 'A literal swirling, maniacal vortex of human hemoglobin.'
|
11
13
|
self.face = 'bloody'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(6..7)
|
21
23
|
self.dexterity = rand(5..7)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 2))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Citrinaga < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'citrinaga'
|
10
12
|
self.description = 'Refreshing in its shiny, gleaming effectiveness at ending your life.'
|
11
13
|
self.face = 'shiny'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(7..9)
|
21
23
|
self.dexterity = rand(6..7)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 3))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Coraliz < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'coraliz'
|
10
12
|
self.description = 'Small blue lizard that slithers around, nipping at your ankles.'
|
11
13
|
self.face = 'spotted'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(4..6)
|
21
23
|
self.dexterity = rand(7..9)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 3))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Cubicat < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'cubicat'
|
10
12
|
self.description = 'Perfectly geometrically cubed feline, fresh from its woven enclosure, claws at the ready.'
|
11
13
|
self.face = 'striking'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(5..7)
|
21
23
|
self.dexterity = rand(8..10)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 2))
|
26
27
|
|
@@ -6,6 +6,8 @@ require_relative '../monster'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Diaman < Monster
|
8
8
|
def initialize
|
9
|
+
super
|
10
|
+
|
9
11
|
self.name = 'diaman'
|
10
12
|
self.description = 'Crystalline structure in the form of a man, lumbering toward you, with outstretched, edged pincers.'
|
11
13
|
self.face = 'bright'
|
@@ -20,7 +22,6 @@ module Gemwarrior
|
|
20
22
|
self.defense = rand(5..7)
|
21
23
|
self.dexterity = rand(8..10)
|
22
24
|
|
23
|
-
self.inventory = Inventory.new
|
24
25
|
self.rox = rand((level * 2)..(level * 3))
|
25
26
|
self.xp = rand(level..(level * 2))
|
26
27
|
|
data/lib/gemwarrior/evaluator.rb
CHANGED
@@ -113,7 +113,7 @@ module Gemwarrior
|
|
113
113
|
end
|
114
114
|
when 'map', 'm'
|
115
115
|
world.print_map
|
116
|
-
when 'stat', '
|
116
|
+
when 'stat', 's'
|
117
117
|
if param1.nil?
|
118
118
|
puts ERROR_DEBUG_STAT_PARAM_MISSING
|
119
119
|
return DEBUG_STAT_PARAMS
|
@@ -230,11 +230,8 @@ module Gemwarrior
|
|
230
230
|
when 'dmg'
|
231
231
|
world.player.take_damage(result[:data])
|
232
232
|
return
|
233
|
-
when 'rest'
|
234
|
-
world.player.
|
235
|
-
if world.player.hp_cur > world.player.hp_max
|
236
|
-
world.player.hp_cur = world.player.hp_max
|
237
|
-
end
|
233
|
+
when 'rest', 'health'
|
234
|
+
world.player.heal_damage(result[:data])
|
238
235
|
return
|
239
236
|
else
|
240
237
|
return
|
@@ -330,9 +327,10 @@ module Gemwarrior
|
|
330
327
|
i = i + 1
|
331
328
|
end
|
332
329
|
print_separator
|
333
|
-
|
334
|
-
print_separator
|
330
|
+
|
335
331
|
if world.debug_mode
|
332
|
+
puts " DEBUG COMMANDS"
|
333
|
+
print_separator
|
336
334
|
i = 0
|
337
335
|
devcommands.each do |cmd|
|
338
336
|
puts " #{cmd.ljust(9)}, #{devaliases[i].ljust(2)} -- #{devcmd_descriptions[i]}"
|
data/lib/gemwarrior/inventory.rb
CHANGED
data/lib/gemwarrior/repl.rb
CHANGED
@@ -49,10 +49,14 @@ module Gemwarrior
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
52
|
+
def print_logo
|
53
53
|
puts "/-+-+-+ +-+-+-+-+-+-+-\\".colorize(:yellow)
|
54
54
|
puts '|G|E|M| |W|A|R|R|I|O|R|'.colorize(:yellow)
|
55
55
|
puts "\\-+-+-+ +-+-+-+-+-+-+-/".colorize(:yellow)
|
56
|
+
end
|
57
|
+
|
58
|
+
def print_splash_message
|
59
|
+
print_logo
|
56
60
|
0.upto(SPLASH_MESSAGE.length-1) do print '=' end
|
57
61
|
puts
|
58
62
|
puts SPLASH_MESSAGE
|
data/lib/gemwarrior/world.rb
CHANGED
@@ -71,7 +71,7 @@ module Gemwarrior
|
|
71
71
|
puts '[PLAYERS]'
|
72
72
|
player.check_self(false)
|
73
73
|
when 'monsters'
|
74
|
-
puts
|
74
|
+
puts "[MONSTERS](#{monsters.length})"
|
75
75
|
if details
|
76
76
|
monsters.map { |m| print m.describe unless m.is_boss}
|
77
77
|
monsters.map { |m| print m.describe if m.is_boss }
|
@@ -80,7 +80,13 @@ module Gemwarrior
|
|
80
80
|
monster_text = ">> monsters: #{monsters.map(&:name).join(', ')}"
|
81
81
|
end
|
82
82
|
when 'items'
|
83
|
-
|
83
|
+
item_count = 0
|
84
|
+
locations.each do |l|
|
85
|
+
l.items.each do |i|
|
86
|
+
item_count = item_count + 1
|
87
|
+
end
|
88
|
+
end
|
89
|
+
puts "[ITEMS](#{item_count})"
|
84
90
|
if details
|
85
91
|
locations.each do |l|
|
86
92
|
l.items.map { |i| print i.status }
|
@@ -94,9 +100,9 @@ module Gemwarrior
|
|
94
100
|
">> #{item_list.sort.join(', ')}"
|
95
101
|
end
|
96
102
|
when 'locations'
|
97
|
-
puts
|
103
|
+
puts "[LOCATIONS](#{locations.length})"
|
98
104
|
if details
|
99
|
-
locations.map { |l| print l.status }
|
105
|
+
locations.map { |l| print l.status(self.debug_mode) }
|
100
106
|
return
|
101
107
|
else
|
102
108
|
">> #{locations.map(&:name).join(', ')}"
|
@@ -126,37 +132,62 @@ module Gemwarrior
|
|
126
132
|
|
127
133
|
def describe(point)
|
128
134
|
desc_text = ""
|
129
|
-
desc_text << "[ #{point.name} ]
|
135
|
+
desc_text << "[ #{point.name} ]".colorize(:green)
|
136
|
+
|
137
|
+
if debug_mode
|
138
|
+
desc_text << " DL[#{point.danger_level.to_s}] MLR[#{point.monster_level_range.to_s}]".colorize(:yellow)
|
139
|
+
end
|
140
|
+
|
141
|
+
desc_text << "\n"
|
130
142
|
desc_text << point.description
|
131
143
|
|
132
144
|
point.populate_monsters(self.monsters) unless point.checked_for_monsters?
|
133
145
|
|
134
|
-
desc_text << point.list_items
|
135
|
-
desc_text << point.list_monsters
|
136
|
-
desc_text << point.list_bosses
|
137
|
-
desc_text << point.list_paths
|
146
|
+
desc_text << "\n >> Curious object(s): #{point.list_items.join(', ')}" unless point.list_items.empty?
|
147
|
+
desc_text << "\n >> Monster(s) abound: #{point.list_monsters.join(', ')}" unless point.list_monsters.empty?
|
148
|
+
desc_text << "\n >> Boss(es) abound: #{point.list_bosses.join(', ')}" unless point.list_bosses.empty?
|
149
|
+
desc_text << "\n >> Paths: #{point.list_paths.join(', ')}"
|
150
|
+
|
151
|
+
if debug_mode
|
152
|
+
desc_text << "\n >>> Actionable words: "
|
153
|
+
desc_text << point.list_actionable_words.colorize(:white)
|
154
|
+
end
|
155
|
+
|
156
|
+
return desc_text
|
138
157
|
end
|
139
158
|
|
140
159
|
def describe_entity(point, entity_name)
|
141
|
-
if point.
|
160
|
+
if point.list_items.map{|i| i.downcase}.include?(entity_name)
|
142
161
|
point.items.each do |i|
|
143
|
-
if i.name.eql?(entity_name)
|
144
|
-
|
162
|
+
if i.name.downcase.eql?(entity_name.downcase)
|
163
|
+
if debug_mode
|
164
|
+
return i.status
|
165
|
+
else
|
166
|
+
return i.description
|
167
|
+
end
|
145
168
|
end
|
146
169
|
end
|
147
170
|
elsif
|
148
|
-
if point.
|
171
|
+
if point.list_monsters.map{|m| m.downcase}.include?(entity_name)
|
149
172
|
point.monsters_abounding.each do |m|
|
150
|
-
if m.name.eql?(entity_name)
|
151
|
-
|
173
|
+
if m.name.downcase.eql?(entity_name.downcase)
|
174
|
+
if debug_mode
|
175
|
+
return m.describe
|
176
|
+
else
|
177
|
+
return m.description
|
178
|
+
end
|
152
179
|
end
|
153
180
|
end
|
154
181
|
end
|
155
182
|
elsif
|
156
|
-
if point.
|
183
|
+
if point.list_bosses.map{|b| b.downcase}.include?(entity_name)
|
157
184
|
point.bosses_abounding.each do |b|
|
158
|
-
if b.name.eql?(entity_name)
|
159
|
-
|
185
|
+
if b.name.downcase.eql?(entity_name.downcase)
|
186
|
+
if debug_mode
|
187
|
+
return b.describe
|
188
|
+
else
|
189
|
+
return b.description
|
190
|
+
end
|
160
191
|
end
|
161
192
|
end
|
162
193
|
end
|
@@ -238,7 +269,7 @@ module Gemwarrior
|
|
238
269
|
)
|
239
270
|
locations.push(Location.new({
|
240
271
|
:name => 'Cave (Antechamber)',
|
241
|
-
:description => 'Now inside the
|
272
|
+
:description => 'Now inside the cavern, you confirm there are stacktites, stonemites, rocksites, and even some pebblejites.',
|
242
273
|
:coords => {:x => 7, :y => 0},
|
243
274
|
:locs_connected => {:north => true, :east => true, :south => false, :west => true},
|
244
275
|
:danger_level => :moderate,
|
@@ -381,7 +412,7 @@ module Gemwarrior
|
|
381
412
|
)
|
382
413
|
locations.push(Location.new({
|
383
414
|
:name => 'Sky Tower (Armory)',
|
384
|
-
:description => 'Weapons of all kinds litter the ground and are hung on hooks from the wall
|
415
|
+
:description => 'Weapons of all kinds litter the ground and are hung on hooks from the wall. Tower assailants beware/rejoice!',
|
385
416
|
:coords => {:x => 4, :y => 4},
|
386
417
|
:locs_connected => {:north => true, :east => true, :south => false, :west => false},
|
387
418
|
:danger_level => :moderate,
|
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.7.
|
4
|
+
version: 0.7.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-06-
|
11
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|
@@ -186,6 +186,7 @@ files:
|
|
186
186
|
- lib/gemwarrior/entities/items/floor_tile.rb
|
187
187
|
- lib/gemwarrior/entities/items/flower.rb
|
188
188
|
- lib/gemwarrior/entities/items/gun.rb
|
189
|
+
- lib/gemwarrior/entities/items/herb.rb
|
189
190
|
- lib/gemwarrior/entities/items/massive_door.rb
|
190
191
|
- lib/gemwarrior/entities/items/sparklything.rb
|
191
192
|
- lib/gemwarrior/entities/items/stalactite.rb
|