gemwarrior 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 853ee5c247a788f9c35ce812d79224390703382c
4
- data.tar.gz: 8065711862b62cbaa590ae68a6f380ea75ab276b
3
+ metadata.gz: 3f015fb6369a72803beae935f2698172c35ec720
4
+ data.tar.gz: cc7a8aaae582b41fd1e27dd955e44452077e7290
5
5
  SHA512:
6
- metadata.gz: c9f881a6cea35e551d232c84893f1a12b9203c5111337c4c428c5a55672e351139a0eeb7f858f7d2f7f37bc2ce7bc8b17dc1456ddbdaabab90637cdb99cc0d3a
7
- data.tar.gz: 4c6d94b62e1dc8c93eb3d84b5be202210772320ca89b4da000a81844d6a92db1ad2f4c140495e4c7bce8caa014c82cc4a0aa60d437fe6ccb16e0a60882ef8122
6
+ metadata.gz: e6c57f60b4b3b7a56b2a88bf4f22fac3aaa9225208e78c323b95d448c08df99b4792e81546f64c03079173a4bebcc4c163884daf0088a4864a793e8636e5a696
7
+ data.tar.gz: 715ee8977a5f75bd20285fd5e54b7884d62acc7b66aefcb2c4ea08d55ca34d43742e21da427ed4f4b218c648383900b69e059377997d5c7520352aad24133938
data/README.md CHANGED
@@ -29,16 +29,16 @@ Run the commands above and you'll be whisked away to Jool, ready to start or con
29
29
  This is in super-hyper-turbo-edition pre-pre-pre-alpha right now, but a working console prompt, some commands (type `h` for a list), and a few locations exist already. Each time you start the game a new hero will be created with a randomized name, but you can change that with `> change name`.
30
30
 
31
31
  `> c` - character check for visual identity
32
- `> i [object]` - check your inventory (or an individual item within)
32
+ `> i [object]` - check your inventory (or an individual item within)
33
33
  `> ls [entity_type]` - list entities in the game (monsters, items, locations)
34
34
  `> r` - take a load off and replenish hp
35
- `> l [object]` - look at current location and its items and monsters
36
- `> t [object]` - take an item from a location
37
- `> d [object]` - drop an item from your inventory
38
- `> e [object]` - equip an item in your inventory as a weapon
35
+ `> l [object]` - look at current location and its items and monsters
36
+ `> t [object]` - take an item from a location
37
+ `> d [object]` - drop an item from your inventory
38
+ `> e [object]` - equip an item in your inventory as a weapon
39
39
  `> ue [object]` - unequip an item in your inventory
40
- `> g [direction]` - go in a direction, if possible
41
- `> a [monster]` - attack a monster
40
+ `> g [direction]` - go in a direction, if possible
41
+ `> a [monster]` - attack a monster
42
42
  `> ch [attribute]` - change some things about yourself
43
43
  `> h` - display available commands
44
44
  `> q` - quit this nonsense w/ prompt
@@ -51,12 +51,14 @@ To come:
51
51
  * ~~Ability to fight those monsters!~~
52
52
  * ~~Monsters to fight back!~~
53
53
  * ~~Items you can pick up!~~
54
+ * ~~Main Boss and Win State!~~
54
55
  * Saving!
55
56
  * Loading of said saved state!
56
57
  * More locations to move between!
58
+ * Randomized worlds!
57
59
  * Quests (maybe)!
58
60
  * Towns (maybe)!
59
- * Merchants!
61
+ * Merchants (maybe)!
60
62
  * Sound FX!
61
63
  * Music!
62
64
  * Epic Length (whereby "Epic" I mean "maybe 30 minutes"?)!
data/bin/gemwarrior CHANGED
@@ -8,7 +8,7 @@ require_relative '../lib/gemwarrior/game'
8
8
  GAME_NAME = "Gem Warrior"
9
9
 
10
10
  def parse_options
11
- options = {:god_mode => false}
11
+ options = {:god_mode => false, :beast_mode => false}
12
12
 
13
13
  optparse = OptionParser.new do |opts|
14
14
  opts.on('-v', '--version', 'Display version number and exit') do
@@ -19,6 +19,10 @@ def parse_options
19
19
  opts.on('-g', '--god', 'Set godmode to true on load') do
20
20
  options[:god_mode] = true
21
21
  end
22
+
23
+ opts.on('-b', '--beast', 'Set beastmode to true on load') do
24
+ options[:beast_mode] = true
25
+ end
22
26
  end
23
27
 
24
28
  optparse.parse!()
data/gemwarrior.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.license = 'MIT'
21
21
 
22
22
  spec.add_runtime_dependency 'os', '~> 0.9', '>= 0.9.6'
23
- spec.add_runtime_dependency 'matrext', '~> 0.2'
23
+ spec.add_runtime_dependency 'matrext', '~> 0.4.7'
24
24
  spec.add_runtime_dependency 'http', '~> 0.8.10'
25
25
  spec.add_runtime_dependency 'json', '~> 1.8.2'
26
26
  spec.add_runtime_dependency 'colorize', '~> 0.7.7'
@@ -56,7 +56,6 @@ module Gemwarrior
56
56
  puts "You attack #{monster.name}#{player.cur_weapon_name}!"
57
57
  dmg = calculate_damage_to(monster)
58
58
  if dmg > 0
59
- puts "> You wound it for #{dmg} point(s)!".colorize(:yellow)
60
59
  take_damage(monster, dmg)
61
60
  if monster_dead?
62
61
  monster_death
@@ -118,13 +117,24 @@ module Gemwarrior
118
117
 
119
118
  def take_damage(entity, dmg)
120
119
  entity.hp_cur = entity.hp_cur.to_i - dmg.to_i
120
+ who_gets_wounded = ''
121
+ if entity.eql?(monster)
122
+ who_gets_wounded = "> You wound #{monster.name} for "
123
+ else
124
+ who_gets_wounded = "> You are wounded for "
125
+ end
126
+ hit = Thread.new do
127
+ print who_gets_wounded
128
+ print "#{Matrext::process({ :phrase => dmg.to_s, :speed => :slow, :oneline => true, :alpha => false, :random => false })}"
129
+ print " point(s)!\n"
130
+ end
131
+ return hit.join
121
132
  end
122
133
 
123
134
  def monster_attacks_player
124
135
  puts "#{monster.name} attacks you!"
125
136
  dmg = calculate_damage_to(player)
126
137
  if dmg > 0
127
- puts "> You are wounded for #{dmg} point(s)!".colorize(:yellow)
128
138
  take_damage(player, dmg)
129
139
  if player_dead?
130
140
  player_death
@@ -152,13 +162,22 @@ module Gemwarrior
152
162
  end
153
163
 
154
164
  def monster_death
155
- puts "You have defeated #{monster.name}!".colorize(:green)
156
- puts 'You get the following spoils of war:'
157
- puts " XP : #{monster.xp}".colorize(:green)
158
- puts " ROX: #{monster.rox}".colorize(:green)
159
- print_battle_line
160
- update_player_stats
161
- world.location_by_coords(player.cur_coords).remove_monster(monster.name)
165
+ puts "You have defeated #{monster.name}!\n".colorize(:green)
166
+ if monster.is_boss
167
+ if monster.name.eql?("Emerald")
168
+ monster.defeated_text
169
+ exit(0)
170
+ else
171
+ puts 'You just beat a boss monster. Way to go!'
172
+ end
173
+ else
174
+ puts 'You get the following spoils of war:'
175
+ puts " XP : #{monster.xp}".colorize(:green)
176
+ puts " ROX: #{monster.rox}".colorize(:green)
177
+ print_battle_line
178
+ update_player_stats
179
+ world.location_by_coords(player.cur_coords).remove_monster(monster.name)
180
+ end
162
181
  end
163
182
 
164
183
  def update_player_stats
@@ -200,7 +219,7 @@ module Gemwarrior
200
219
  def print_escape_text
201
220
  escape = Thread.new do
202
221
  print "* "
203
- print "#{Matrext::process({ :phrase => 'POOF', :sl => true })}"
222
+ print "#{Matrext::process({ :phrase => 'POOF', :oneline => true })}"
204
223
  print " *\n"
205
224
  end
206
225
  return escape.join
@@ -0,0 +1,18 @@
1
+ # lib/gemwarrior/entities/boss.rb
2
+ # Boss monster
3
+
4
+ require_relative 'monster'
5
+
6
+ module Gemwarrior
7
+ class Boss < Monster
8
+ attr_reader :win_text
9
+
10
+ def win_text
11
+ win_text = 'You beat #{name}! You win! '
12
+ win_text << 'You become the true Gem Warrior, marry Queen Ruby, and have many fine, sparkling children. '
13
+ win_text << 'Thank you for playing. Goodbye.'
14
+ puts win_text
15
+ exit(0)
16
+ end
17
+ end
18
+ end
@@ -7,7 +7,7 @@ module Gemwarrior
7
7
  :description
8
8
 
9
9
  def status
10
- status_text = name.ljust(20).upcase
10
+ status_text = name.ljust(26).upcase
11
11
  status_text << "#{description}\n"
12
12
  end
13
13
  end
@@ -0,0 +1,19 @@
1
+ # lib/gemwarrior/entities/items/sparklything.rb
2
+ # Item::SparklyThing
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class SparklyThing < Item
8
+ def initialize
9
+ self.name = 'SparklyThing(tm)'
10
+ self.description = 'The sparkling that this thing does is unimaginably brilliant.'
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
+ end
19
+ end
@@ -7,7 +7,7 @@ module Gemwarrior
7
7
  class Stonemite < Item
8
8
  def initialize
9
9
  self.name = 'stonemite'
10
- self.description = 'Stubby cave debris that is kind of neat to look at, as it is off-grey and sparkly, but the size makes it unusable as anything but skipping on a lake or tossing to the ground.'
10
+ self.description = 'Stubby cave debris that is neat to look at, as it is off-grey and sparkly, but the size makes it unusable as anything but skipping on a lake.'
11
11
  self.atk_lo = nil
12
12
  self.atk_hi = nil
13
13
  self.takeable = true
@@ -0,0 +1,19 @@
1
+ # lib/gemwarrior/entities/items/throne.rb
2
+ # Item::Throne
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class Throne < Item
8
+ def initialize
9
+ self.name = 'throne'
10
+ self.description = 'Made of what appears to be unfulfilled desires and latent, flawed happiness, the well-crafted seat still looks kinda comfy.'
11
+ self.atk_lo = nil
12
+ self.atk_hi = nil
13
+ self.takeable = false
14
+ self.useable = false
15
+ self.equippable = false
16
+ self.equipped = false
17
+ end
18
+ end
19
+ end
@@ -11,10 +11,9 @@ module Gemwarrior
11
11
 
12
12
  ## ERRORS
13
13
  ERROR_LOCATION_ITEM_REMOVE_INVALID = 'That item cannot be removed as it does not exist here.'
14
- ERROR_LOCATION_DESCRIBE_ENTITY_INVALID = 'You do not see that here.'
15
14
 
16
15
  attr_accessor :coords, :locs_connected, :danger_level, :items,
17
- :monsters_available, :monsters_abounding, :checked_for_monsters
16
+ :monsters_abounding, :bosses_abounding, :checked_for_monsters
18
17
 
19
18
  def initialize(options)
20
19
  self.name = options.fetch(:name)
@@ -23,14 +22,14 @@ module Gemwarrior
23
22
  self.locs_connected = options.fetch(:locs_connected)
24
23
  self.danger_level = options.fetch(:danger_level)
25
24
  self.items = options.fetch(:items)
26
- self.monsters_available = options.fetch(:monsters_available)
27
25
  self.monsters_abounding = []
26
+ self.bosses_abounding = options[:bosses_abounding]
28
27
  self.checked_for_monsters = false
29
28
  end
30
29
 
31
30
  def status
32
- status_text = name.ljust(20).upcase
33
- status_text << coords.values.to_a
31
+ status_text = name.ljust(26).upcase
32
+ status_text << coords.values.to_a.to_s
34
33
  status_text << " #{description}\n"
35
34
  end
36
35
 
@@ -60,9 +59,11 @@ module Gemwarrior
60
59
  locs_connected[direction.to_sym]
61
60
  end
62
61
 
63
- def monster_by_name(name)
64
- monsters_abounding.each do |m|
65
- if m.name.eql?(name)
62
+ def monster_by_name(monster_name)
63
+ monsters_list = monsters_abounding | bosses_abounding
64
+
65
+ monsters_list.each do |m|
66
+ if m.name.downcase.eql?(monster_name.downcase)
66
67
  return m.clone
67
68
  end
68
69
  end
@@ -87,13 +88,17 @@ module Gemwarrior
87
88
  end
88
89
 
89
90
  def list_items
90
- return "\n >> Shiny object(s): #{items.map(&:name).join(', ')}" if items.length > 0
91
+ return "\n >> Curious object(s): #{items.map(&:name).join(', ')}" if items.length > 0
91
92
  end
92
93
 
93
94
  def list_monsters
94
95
  return "\n >> Monster(s) abound: #{monsters_abounding.map(&:name).join(', ')}" if monsters_abounding.length > 0
95
96
  end
96
97
 
98
+ def list_bosses
99
+ return "\n >> Boss(es) abound: #{bosses_abounding.map(&:name).join(', ')}" if bosses_abounding.length > 0
100
+ end
101
+
97
102
  def list_paths
98
103
  valid_paths = []
99
104
  locs_connected.each do |key, value|
@@ -104,11 +109,21 @@ module Gemwarrior
104
109
  return "\n >> Paths: #{valid_paths.join(', ')}"
105
110
  end
106
111
 
107
- def populate_monsters
108
- self.checked_for_monsters = true
112
+ def populate_monsters(monsters_available)
109
113
  if has_monster?
114
+ self.checked_for_monsters = true
110
115
  self.monsters_abounding = []
111
- monsters_abounding.push(monsters_available[rand(0..monsters_available.length-1)])
116
+ random_monster = nil
117
+
118
+ # get random non-boss monster
119
+ loop do
120
+ random_monster = monsters_available[rand(0..monsters_available.length-1)]
121
+ unless random_monster.is_boss
122
+ break
123
+ end
124
+ end
125
+
126
+ monsters_abounding.push(random_monster)
112
127
  else
113
128
  return nil
114
129
  end
@@ -5,10 +5,10 @@ require_relative 'creature'
5
5
 
6
6
  module Gemwarrior
7
7
  class Monster < Creature
8
- attr_accessor :battlecry
8
+ attr_accessor :battlecry, :is_boss
9
9
 
10
10
  def describe
11
- status_text = name.upcase.ljust(20)
11
+ status_text = name.upcase.ljust(26)
12
12
  status_text << "LEVEL: #{level.to_s.rjust(2)}, "
13
13
  status_text << "HP: #{hp_cur.to_s.rjust(3)}/#{hp_max.to_s.rjust(3)} "
14
14
  status_text << "ATK: #{atk_lo.to_s.rjust(2)}-#{atk_hi.to_s.rjust(2)} "
@@ -0,0 +1,54 @@
1
+ # lib/gemwarrior/entities/monsters/bosses/emerald.rb
2
+ # Emerald boss monster
3
+
4
+ require_relative '../../monster'
5
+ require_relative '../../items/sparklything'
6
+
7
+ module Gemwarrior
8
+ class Emerald < Monster
9
+ attr_accessor :defeated_text
10
+
11
+ def initialize
12
+ self.name = 'Emerald'
13
+ self.description = 'A wily, beefy, tower of a man, champion of both wisdom and strength, sporting a constant glint in his eyes.'
14
+ self.face = 'gleaming'
15
+ self.hands = 'tantalizing'
16
+ self.mood = 'enraged'
17
+
18
+ self.level = 15
19
+ self.hp_cur = rand((level * 2)..(level * 3))
20
+ self.hp_max = hp_cur
21
+ self.atk_lo = rand(level..(level * 2.5).floor)
22
+ self.atk_hi = rand((level * 2.5).floor..(level * 3).floor)
23
+ self.defense = rand(5..7)
24
+ self.dexterity = rand(8..10)
25
+
26
+ self.inventory = Inventory.new(items = [SparklyThing.new])
27
+ self.rox = rand((level * 2)..(level * 3))
28
+ self.xp = rand(level..(level * 2))
29
+
30
+ self.battlecry = 'Ha ha ha ha ha! Prepare yourself: today your whole life crumbles!'
31
+ self.is_boss = true
32
+ self.defeated_text = defeated_text
33
+ end
34
+
35
+ def defeated_text
36
+ 0.upto(9) do print '<^>' end
37
+ print "\n"
38
+ puts "You beat #{name}! You win!\n"
39
+ print "You receive the "
40
+ print "SparklyThing(tm)".colorize(:magenta)
41
+ print " and become the true "
42
+ print "Gem Warrior".colorize(:yellow)
43
+ print "!\n"
44
+ print "You decide to ignore "
45
+ print "Queen Ruby".colorize(:red)
46
+ print " and take your spoils back home\n"
47
+ print "where you live out the rest of your days staring at it, wondering\n"
48
+ print "what it was all about.\n\n"
49
+ puts "Thank you for playing. Goodbye."
50
+ 0.upto(9) do print '<^>' end
51
+ puts
52
+ end
53
+ end
54
+ end
@@ -16,7 +16,8 @@ module Gemwarrior
16
16
  HANDS_DESC = ['worn', 'balled into fists', 'relaxed', 'cracked', 'tingly', 'mom\'s spaghetti']
17
17
  MOOD_DESC = ['calm', 'excited', 'depressed', 'tense', 'lackadaisical', 'angry', 'positive']
18
18
 
19
- attr_accessor :stam_cur, :stam_max, :cur_coords, :god_mode
19
+ attr_accessor :stam_cur, :stam_max, :cur_coords,
20
+ :god_mode, :beast_mode
20
21
 
21
22
  def initialize(options)
22
23
  self.name = generate_name
@@ -25,13 +26,13 @@ module Gemwarrior
25
26
  self.face = generate_face
26
27
  self.hands = generate_hands
27
28
  self.mood = generate_mood
28
-
29
+
29
30
  self.level = options.fetch(:level)
30
31
  self.xp = options.fetch(:xp)
31
32
  self.hp_cur = options.fetch(:hp_cur)
32
33
  self.hp_max = options.fetch(:hp_max)
33
- self.atk_lo = options.fetch(:atk_lo)
34
- self.atk_hi = options.fetch(:atk_hi)
34
+ self.atk_lo = options.fetch(:beast_mode) ? 40 : options.fetch(:atk_lo)
35
+ self.atk_hi = options.fetch(:beast_mode) ? 40 : options.fetch(:atk_hi)
35
36
 
36
37
  self.defense = options.fetch(:defense)
37
38
  self.dexterity = options.fetch(:dexterity)
@@ -42,8 +43,9 @@ module Gemwarrior
42
43
  self.stam_cur = options.fetch(:stam_cur)
43
44
  self.stam_max = options.fetch(:stam_max)
44
45
  self.cur_coords = options.fetch(:cur_coords)
45
-
46
+
46
47
  self.god_mode = options.fetch(:god_mode)
48
+ self.beast_mode = options.fetch(:beast_mode)
47
49
  end
48
50
 
49
51
  def check_self(show_pic = true)
@@ -60,16 +62,17 @@ module Gemwarrior
60
62
  self.atk_hi = inventory.weapon.atk_hi
61
63
  end
62
64
 
63
- self_text = "NAME: #{name}\n"
64
- self_text = "XY : #{cur_coords.values.to_a}\n"
65
- self_text << "WPN : #{cur_weapon_name}\n"
66
- self_text << "LVL : #{level}\n"
67
- self_text << "XP : #{xp}\n"
68
- self_text << "HP : #{hp_cur}|#{hp_max}\n"
69
- self_text << "ATK : #{atk_lo}-#{atk_hi}\n"
70
- self_text << "DEX : #{dexterity}\n"
71
- self_text << "DEF : #{defense}\n"
72
- self_text << "GOD : #{god_mode}\n\n"
65
+ self_text = "NAME : #{name}\n"
66
+ self_text = "XY : #{cur_coords.values.to_a}\n"
67
+ self_text << "WPN : #{cur_weapon_name}\n"
68
+ self_text << "LVL : #{level}\n"
69
+ self_text << "XP : #{xp}\n"
70
+ self_text << "HP : #{hp_cur}/#{hp_max}\n"
71
+ self_text << "ATK : #{atk_lo}-#{atk_hi}\n"
72
+ self_text << "DEX : #{dexterity}\n"
73
+ self_text << "DEF : #{defense}\n"
74
+ self_text << "GOD : #{god_mode}\n"
75
+ self_text << "BEAST: #{beast_mode}\n\n"
73
76
 
74
77
  self_text << "#{description}\n\n"
75
78
 
@@ -148,7 +151,7 @@ module Gemwarrior
148
151
  def print_traveling_text(direction_text)
149
152
  loc = Thread.new do
150
153
  print "* "
151
- print "#{Matrext::process({ :phrase => direction_text, :sl => true })}"
154
+ print "#{Matrext::process({ :phrase => direction_text, :oneline => true })}"
152
155
  print " *\n"
153
156
  end
154
157
  return loc.join
@@ -7,29 +7,34 @@ module Gemwarrior
7
7
  class Evaluator
8
8
  # CONSTANTS
9
9
  ## MESSAGES
10
- PROGRAM_NAME = 'Gem Warrior'
11
- QUIT_MESSAGE = 'Thanks for playing the game. Until next time...'.colorize(:yellow)
12
- RESUME_MESSAGE = 'Back to adventuring!'.colorize(:green)
13
- SEPARATOR = '=========================================================================='
14
- CHANGE_PARAMS = 'Options: name'
15
- LIST_PARAMS = 'Options: monsters, items, locations'
10
+ PROGRAM_NAME = 'Gem Warrior'
11
+ QUIT_MESSAGE = 'Thanks for playing the game. Until next time...'.colorize(:yellow)
12
+ RESUME_MESSAGE = 'Back to adventuring!'.colorize(:green)
13
+ SEPARATOR = '=========================================================================='
14
+ CHANGE_PARAMS = 'Options: name'
15
+ LIST_PARAMS = 'Options: monsters, items, locations'
16
+ DEBUG_PARAMS = 'Options: vars, map, stat'
17
+ DEBUG_STAT_PARAMS = 'Options: atk_lo, atk_hi, strength, dexterity'
16
18
 
17
19
  ## ERRORS
18
- ERROR_COMMAND_INVALID = 'That is not something the game yet understands.'
19
- ERROR_LIST_PARAM_MISSING = 'You cannot just "list". You gotta choose something to list.'
20
- ERROR_CHANGE_PARAM_MISSING = 'Ch-ch-changes...are not happening because you did not specify what to change.'
21
- ERROR_CHANGE_PARAM_INVALID = 'You cannot change that...yet.'
22
- ERROR_LIST_PARAM_INVALID = 'You cannot list that...yet.'
23
- ERROR_GO_PARAM_MISSING = 'Just wander aimlessly? A direction would be nice.'
24
- ERROR_GO_PARAM_INVALID = 'The place in that direction is far, far, FAR too dangerous. You should try a different way.'
25
- ERROR_ATTACK_PARAM_MISSING = 'You cannot just "attack". You gotta choose something to attack.'
26
- ERROR_ATTACK_PARAM_INVALID = 'That monster does not exist here or can\'t be attacked.'
27
- ERROR_TAKE_PARAM_MISSING = 'You cannot just "take". You gotta choose something to take.'
28
- ERROR_DROP_PARAM_MISSING = 'You cannot just "drop". You gotta choose something to drop.'
29
- ERROR_EQUIP_PARAM_MISSING = 'You cannot just "equip". You gotta choose something to equip.'
30
- ERROR_UNEQUIP_PARAM_MISSING = 'You cannot just "unequip". You gotta choose something to unequip.'
31
- ERROR_DEBUG_PARAM_MISSING = 'You cannot just "debug". You gotta choose a debug command.'
32
- ERROR_DEBUG_PARAM_INVALID = 'You cannot debug that...yet.'
20
+ ERROR_COMMAND_INVALID = 'That is not something the game yet understands.'
21
+
22
+ ERROR_GO_PARAM_MISSING = 'Just wander aimlessly? A direction would be nice.'
23
+ ERROR_GO_PARAM_INVALID = 'The place in that direction is far, far, FAR too dangerous. You should try a different way.'
24
+ ERROR_ATTACK_PARAM_MISSING = 'You cannot just "attack". You gotta choose something to attack.'
25
+ ERROR_ATTACK_PARAM_INVALID = 'That monster does not exist here or can\'t be attacked.'
26
+ ERROR_TAKE_PARAM_MISSING = 'You cannot just "take". You gotta choose something to take.'
27
+ ERROR_DROP_PARAM_MISSING = 'You cannot just "drop". You gotta choose something to drop.'
28
+ ERROR_EQUIP_PARAM_MISSING = 'You cannot just "equip". You gotta choose something to equip.'
29
+ ERROR_UNEQUIP_PARAM_MISSING = 'You cannot just "unequip". You gotta choose something to unequip.'
30
+ ERROR_CHANGE_PARAM_MISSING = 'You cannot just "change". You gotta choose something to change.'
31
+ ERROR_CHANGE_PARAM_INVALID = 'You cannot change that...yet.'
32
+ ERROR_LIST_PARAM_MISSING = 'You cannot just "list". You gotta choose something to list.'
33
+ ERROR_LIST_PARAM_INVALID = 'You cannot list that...yet.'
34
+ ERROR_DEBUG_PARAM_MISSING = 'You cannot just "debug". You gotta choose a debug command.'
35
+ ERROR_DEBUG_PARAM_INVALID = 'You cannot debug that...yet.'
36
+ ERROR_DEBUG_STAT_PARAM_MISSING = 'You cannot just "change stats". You gotta choose a stat to change.'
37
+ ERROR_DEBUG_STAT_PARAM_INVALID = 'You cannot change that stat...yet.'
33
38
 
34
39
  attr_accessor :world, :commands, :aliases, :descriptions, :devcmds, :devaliases
35
40
 
@@ -72,21 +77,73 @@ module Gemwarrior
72
77
  end
73
78
 
74
79
  command = tokens.first.downcase
75
- param = tokens[1]
80
+ param1 = tokens[1]
81
+ param2 = tokens[2]
82
+ param3 = tokens[3]
76
83
 
77
84
  case command
78
85
  # dev commands
79
86
  when 'debug', 'db'
80
- if param.nil?
81
- ERROR_DEBUG_PARAM_MISSING
87
+ if param1.nil?
88
+ puts ERROR_DEBUG_PARAM_MISSING
89
+ puts DEBUG_PARAMS
82
90
  else
83
- case param
91
+ case param1
84
92
  when 'vars', 'v'
85
93
  world.print_all_vars
86
94
  when 'godmode', 'iddqd', 'god', 'g'
87
95
  world.player.god_mode = !world.player.god_mode
96
+ when 'beastmode', 'beast', 'b'
97
+ world.player.beast_mode = !world.player.beast_mode
88
98
  when 'map', 'm'
89
99
  world.print_map
100
+ when 'stat'
101
+ if param2.nil?
102
+ puts ERROR_DEBUG_STAT_PARAM_MISSING
103
+ puts DEBUG_STAT_PARAMS
104
+ else
105
+ case param2
106
+ when 'atk_lo'
107
+ unless param3.nil?
108
+ param3 = param3.to_i
109
+ if param3.is_a? Numeric
110
+ if param3 >= 0
111
+ world.player.atk_lo = param3
112
+ end
113
+ end
114
+ end
115
+ when 'atk_hi'
116
+ unless param3.nil?
117
+ param3 = param3.to_i
118
+ if param3.is_a? Numeric
119
+ if param3 >= 0
120
+ world.player.atk_hi = param3
121
+ end
122
+ end
123
+ end
124
+ when 'strength', 'str', 'st'
125
+ unless param3.nil?
126
+ param3 = param3.to_i
127
+ if param3.is_a? Numeric
128
+ if param3 >= 0
129
+ world.player.atk_lo = param3
130
+ world.player.atk_hi = param3
131
+ end
132
+ end
133
+ end
134
+ when 'dexterity', 'dex', 'd'
135
+ unless param3.nil?
136
+ param3 = param3.to_i
137
+ if param3.is_a? Numeric
138
+ if param3 >= 0
139
+ world.player.dexterity = param3
140
+ end
141
+ end
142
+ end
143
+ else
144
+ ERROR_DEBUG_STAT_PARAM_INVALID
145
+ end
146
+ end
90
147
  else
91
148
  ERROR_DEBUG_PARAM_INVALID
92
149
  end
@@ -95,62 +152,57 @@ module Gemwarrior
95
152
  when 'character', 'c'
96
153
  world.player.check_self
97
154
  when 'inventory', 'i'
98
- if param
99
- world.player.inventory.describe_item(param)
155
+ if param1
156
+ world.player.inventory.describe_item(param1)
100
157
  else
101
158
  world.player.list_inventory
102
159
  end
103
160
  when 'list', 'ls'
104
- if param.nil?
161
+ if param1.nil?
105
162
  puts ERROR_LIST_PARAM_MISSING
106
163
  puts LIST_PARAMS
107
164
  else
108
- case param
109
- when 'monsters', 'items', 'locations'
110
- world.list(param)
111
- else
112
- ERROR_LIST_PARAM_INVALID
113
- end
165
+ world.list(param1)
114
166
  end
115
167
  when 'rest', 'r'
116
168
  world.player.rest
117
169
  when 'look', 'l'
118
- if param
119
- world.describe_entity(param)
170
+ if param1
171
+ world.describe_entity(world.location_by_coords(world.player.cur_coords), param1)
120
172
  else
121
173
  world.describe(world.location_by_coords(world.player.cur_coords))
122
174
  end
123
175
  when 'take', 't'
124
- if param.nil?
176
+ if param1.nil?
125
177
  ERROR_TAKE_PARAM_MISSING
126
178
  else
127
- world.player.inventory.add_item(world.location_by_coords(world.player.cur_coords), param)
179
+ world.player.inventory.add_item(world.location_by_coords(world.player.cur_coords), param1)
128
180
  end
129
181
  when 'drop', 'd'
130
- if param.nil?
182
+ if param1.nil?
131
183
  ERROR_DROP_PARAM_MISSING
132
184
  else
133
- world.player.inventory.remove_item(param)
185
+ world.player.inventory.remove_item(param1)
134
186
  end
135
187
  when 'equip', 'e'
136
- if param.nil?
188
+ if param1.nil?
137
189
  ERROR_EQUIP_PARAM_MISSING
138
190
  else
139
- world.player.inventory.equip_item(param)
191
+ world.player.inventory.equip_item(param1)
140
192
  end
141
193
  when 'unequip', 'ue'
142
- if param.nil?
194
+ if param1.nil?
143
195
  ERROR_UNEQUIP_PARAM_MISSING
144
196
  else
145
- world.player.inventory.unequip_item(param)
197
+ world.player.inventory.unequip_item(param1)
146
198
  end
147
199
  when 'go', 'g'
148
- if param.nil?
200
+ if param1.nil?
149
201
  ERROR_GO_PARAM_MISSING
150
202
  else
151
- direction = param
203
+ direction = param1
152
204
  if world.can_move?(direction)
153
- world.player.go(world.locations, param)
205
+ world.player.go(world.locations, param1)
154
206
  world.location_by_coords(world.player.cur_coords).checked_for_monsters = false
155
207
  world.describe(world.location_by_coords(world.player.cur_coords))
156
208
  else
@@ -158,10 +210,10 @@ module Gemwarrior
158
210
  end
159
211
  end
160
212
  when 'attack', 'a'
161
- if param.nil?
213
+ if param1.nil?
162
214
  ERROR_ATTACK_PARAM_MISSING
163
215
  else
164
- monster_name = param
216
+ monster_name = param1
165
217
  if world.has_monster_to_attack?(monster_name)
166
218
  monster = world.location_by_coords(world.player.cur_coords).monster_by_name(monster_name)
167
219
  world.player.attack(world, monster)
@@ -170,11 +222,11 @@ module Gemwarrior
170
222
  end
171
223
  end
172
224
  when 'change', 'ch'
173
- if param.nil?
225
+ if param1.nil?
174
226
  puts ERROR_CHANGE_PARAM_MISSING
175
227
  puts CHANGE_PARAMS
176
228
  else
177
- case param
229
+ case param1
178
230
  when 'name'
179
231
  world.player.modify_name
180
232
  else
@@ -222,7 +274,7 @@ module Gemwarrior
222
274
  commands_and_aliases = commands | aliases | devcmds | devaliases
223
275
 
224
276
  if commands_and_aliases.include?(command.downcase)
225
- if tokens.size.between?(1,2)
277
+ if tokens.size.between?(1,4)
226
278
  return true
227
279
  end
228
280
  elsif tokens.empty?
@@ -49,7 +49,8 @@ module Gemwarrior
49
49
  :inventory => PLAYER_INVENTORY_DEFAULT,
50
50
  :rox => PLAYER_ROX_DEFAULT,
51
51
  :cur_coords => world.location_coords_by_name('Home'),
52
- :god_mode => options.fetch(:god_mode)
52
+ :god_mode => options.fetch(:god_mode),
53
+ :beast_mode => options.fetch(:beast_mode)
53
54
  })
54
55
 
55
56
  # create the console
@@ -14,24 +14,24 @@ module Gemwarrior
14
14
  ERROR_ITEM_UNEQUIP_INVALID = 'You do not have anything called that to unequip.'
15
15
  ERROR_ITEM_UNEQUIP_NONWEAPON = 'That cannot be unequipped.'
16
16
 
17
- attr_accessor :inventory, :weapon
17
+ attr_accessor :items, :weapon
18
18
 
19
- def initialize(inventory = [], weapon = nil)
20
- self.inventory = inventory
19
+ def initialize(items = [], weapon = nil)
20
+ self.items = items
21
21
  self.weapon = weapon
22
22
  end
23
23
 
24
24
  def list_contents
25
- if inventory.empty?
25
+ if items.empty?
26
26
  return contents_text = '[empty]'
27
27
  else
28
- return contents_text = "Inventory contains: #{inventory.map(&:name).join ', '}\n"
28
+ return contents_text = "#{items.map(&:name).join ', '}"
29
29
  end
30
30
  end
31
31
 
32
32
  def describe_item(item_name)
33
- if inventory.map(&:name).include?(item_name)
34
- inventory.each do |i|
33
+ if items.map(&:name).include?(item_name)
34
+ items.each do |i|
35
35
  if i.name.eql?(item_name)
36
36
  return i.description
37
37
  end
@@ -42,8 +42,8 @@ module Gemwarrior
42
42
  end
43
43
 
44
44
  def equip_item(item_name)
45
- if inventory.map(&:name).include?(item_name)
46
- inventory.each do |i|
45
+ if items.map(&:name).include?(item_name)
46
+ items.each do |i|
47
47
  if i.name.eql?(item_name)
48
48
  if i.equippable
49
49
  i.equipped = true
@@ -60,8 +60,8 @@ module Gemwarrior
60
60
  end
61
61
 
62
62
  def unequip_item(item_name)
63
- if inventory.map(&:name).include?(item_name)
64
- inventory.each do |i|
63
+ if items.map(&:name).include?(item_name)
64
+ items.each do |i|
65
65
  if i.name.eql?(item_name)
66
66
  if i.equippable
67
67
  i.equipped = false
@@ -81,7 +81,7 @@ module Gemwarrior
81
81
  cur_loc.items.each do |i|
82
82
  if i.name.eql?(item_name)
83
83
  if i.takeable
84
- inventory.push(i)
84
+ items.push(i)
85
85
  cur_loc.remove_item(item_name)
86
86
  return "Added #{item_name} to your increasing collection of bits of tid."
87
87
  else
@@ -93,8 +93,8 @@ module Gemwarrior
93
93
  end
94
94
 
95
95
  def remove_item(item_name)
96
- if inventory.map(&:name).include?(item_name)
97
- inventory.reject! { |item| item.name == item_name }
96
+ if items.map(&:name).include?(item_name)
97
+ items.reject! { |item| item.name == item_name }
98
98
  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."
99
99
  else
100
100
  ERROR_ITEM_REMOVE_INVALID
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = "0.5.2"
5
+ VERSION = "0.6.0"
6
6
  end
@@ -79,7 +79,7 @@ module Gemwarrior
79
79
  end
80
80
 
81
81
  def prompt
82
- prompt_template = "\n[LV:%3s][XP:%3s][ROX:%3s] -- [HP:%3s|%-3s][STM:%2s|%-2s] -- [%s @ %s]"
82
+ prompt_template = "\n[LV:%3s][XP:%3s][ROX:%3s] -- [HP:%3s/%-3s][STM:%2s/%-2s] -- [%s @ %s]"
83
83
  prompt_vars_arr = [
84
84
  world.player.level,
85
85
  world.player.xp,
@@ -13,6 +13,7 @@ module Gemwarrior
13
13
 
14
14
  ## ERRORS
15
15
  ERROR_LIST_PARAM_INVALID = 'That is not something that can be listed.'
16
+ ERROR_LOCATION_DESCRIBE_ENTITY_INVALID = 'You do not see that here.'
16
17
 
17
18
  attr_accessor :monsters, :locations, :player
18
19
 
@@ -72,10 +73,11 @@ module Gemwarrior
72
73
  when 'monsters'
73
74
  puts '[MONSTERS]'
74
75
  if details
75
- monsters.map { |m| print m.describe }
76
+ monsters.map { |m| print m.describe unless m.is_boss}
77
+ monsters.map { |m| print m.describe if m.is_boss }
76
78
  return
77
79
  else
78
- ">> #{monsters.map(&:name).join(', ')}"
80
+ monster_text = ">> monsters: #{monsters.map(&:name).join(', ')}"
79
81
  end
80
82
  when 'items'
81
83
  puts '[ITEMS]'
@@ -126,15 +128,12 @@ module Gemwarrior
126
128
  desc_text = ""
127
129
  desc_text << "[ #{point.name} ]\n"
128
130
  desc_text << point.description
129
- unless point.checked_for_monsters?
130
- point.populate_monsters
131
- end
132
- unless point.list_items.nil?
133
- desc_text << point.list_items
134
- end
135
- unless point.list_monsters.nil?
136
- desc_text << point.list_monsters
137
- end
131
+
132
+ point.populate_monsters(self.monsters) unless point.checked_for_monsters?
133
+
134
+ desc_text << point.list_items unless point.list_items.nil?
135
+ desc_text << point.list_monsters unless point.list_monsters.nil?
136
+ desc_text << point.list_bosses unless point.list_bosses.nil?
138
137
  desc_text << point.list_paths
139
138
  end
140
139
 
@@ -153,6 +152,14 @@ module Gemwarrior
153
152
  end
154
153
  end
155
154
  end
155
+ elsif
156
+ if point.bosses_abounding.map(&:name).include?(entity_name)
157
+ point.bosses_abounding.each do |b|
158
+ if b.name.eql?(entity_name)
159
+ return "#{b.description}"
160
+ end
161
+ end
162
+ end
156
163
  else
157
164
  ERROR_LOCATION_DESCRIBE_ENTITY_INVALID
158
165
  end
@@ -163,7 +170,15 @@ module Gemwarrior
163
170
  end
164
171
 
165
172
  def has_monster_to_attack?(monster_name)
166
- location_by_coords(player.cur_coords).monsters_abounding.map(&:name).include?(monster_name.downcase)
173
+ possible_combatants = location_by_coords(player.cur_coords).monsters_abounding.map(&:name) | location_by_coords(player.cur_coords).bosses_abounding.map(&:name)
174
+
175
+ possible_combatants.each do |combatant|
176
+ if combatant.downcase.eql?(monster_name.downcase)
177
+ return true
178
+ end
179
+ end
180
+
181
+ return false
167
182
  end
168
183
 
169
184
  private
@@ -179,6 +194,7 @@ module Gemwarrior
179
194
  require_relative 'entities/monsters/coraliz'
180
195
  require_relative 'entities/monsters/cubicat'
181
196
  require_relative 'entities/monsters/diaman'
197
+ require_relative 'entities/monsters/bosses/emerald'
182
198
 
183
199
  self.monsters = [
184
200
  Alexandrat.new,
@@ -190,7 +206,8 @@ module Gemwarrior
190
206
  Citrinaga.new,
191
207
  Coraliz.new,
192
208
  Cubicat.new,
193
- Diaman.new
209
+ Diaman.new,
210
+ Emerald.new
194
211
  ]
195
212
  end
196
213
 
@@ -201,6 +218,7 @@ module Gemwarrior
201
218
  require_relative 'entities/items/stalactite'
202
219
  require_relative 'entities/items/stonemite'
203
220
  require_relative 'entities/items/stone'
221
+ require_relative 'entities/items/throne'
204
222
  require_relative 'entities/items/tree'
205
223
 
206
224
  locations = []
@@ -212,7 +230,7 @@ module Gemwarrior
212
230
  :locs_connected => {:north => true, :east => true, :south => false, :west => true},
213
231
  :danger_level => :none,
214
232
  :items => [Bed.new, Stone.new],
215
- :monsters_available => monsters
233
+ :bosses_abounding => []
216
234
  })
217
235
  )
218
236
  locations.push(Location.new({
@@ -222,17 +240,17 @@ module Gemwarrior
222
240
  :locs_connected => {:north => false, :east => true, :south => false, :west => true},
223
241
  :danger_level => :low,
224
242
  :items => [],
225
- :monsters_available => monsters
243
+ :bosses_abounding => []
226
244
  })
227
245
  )
228
246
  locations.push(Location.new({
229
- :name => 'Cave (Foyer)',
247
+ :name => 'Cave (Antechamber)',
230
248
  :description => 'Now inside the entrance to the cavern, you confirm that there are stacktites, stonemites, rocksites, and even one or two pebblejites.',
231
249
  :coords => {:x => 7, :y => 0},
232
250
  :locs_connected => {:north => true, :east => true, :south => false, :west => true},
233
251
  :danger_level => :moderate,
234
252
  :items => [Stalactite.new, Stonemite.new],
235
- :monsters_available => monsters
253
+ :bosses_abounding => []
236
254
  })
237
255
  )
238
256
  locations.push(Location.new({
@@ -242,7 +260,7 @@ module Gemwarrior
242
260
  :locs_connected => {:north => false, :east => true, :south => true, :west => false},
243
261
  :danger_level => :moderate,
244
262
  :items => [],
245
- :monsters_available => monsters
263
+ :bosses_abounding => []
246
264
  })
247
265
  )
248
266
  locations.push(Location.new({
@@ -252,7 +270,7 @@ module Gemwarrior
252
270
  :locs_connected => {:north => false, :east => false, :south => true, :west => true},
253
271
  :danger_level => :moderate,
254
272
  :items => [],
255
- :monsters_available => monsters
273
+ :bosses_abounding => []
256
274
  })
257
275
  )
258
276
  locations.push(Location.new({
@@ -262,7 +280,7 @@ module Gemwarrior
262
280
  :locs_connected => {:north => true, :east => false, :south => false, :west => true},
263
281
  :danger_level => :moderate,
264
282
  :items => [],
265
- :monsters_available => monsters
283
+ :bosses_abounding => []
266
284
  })
267
285
  )
268
286
  locations.push(Location.new({
@@ -272,7 +290,7 @@ module Gemwarrior
272
290
  :locs_connected => {:north => false, :east => true, :south => false, :west => false},
273
291
  :danger_level => :low,
274
292
  :items => [Feather.new, Tree.new],
275
- :monsters_available => monsters
293
+ :bosses_abounding => []
276
294
  })
277
295
  )
278
296
  locations.push(Location.new({
@@ -282,17 +300,37 @@ module Gemwarrior
282
300
  :locs_connected => {:north => true, :east => false, :south => true, :west => false},
283
301
  :danger_level => :low,
284
302
  :items => [],
285
- :monsters_available => monsters
303
+ :bosses_abounding => []
286
304
  })
287
305
  )
288
306
  locations.push(Location.new({
289
- :name => 'Emerald\'s Sky Tower',
290
- :description => 'The craziest guy that ever existed is around here somewhere amongst the cloud floors, snow walls, and ethereal vibe.',
307
+ :name => 'Sky Tower (Entrance)',
308
+ :description => 'The craziest guy that ever existed is inside the towering structure of cloud floors and snow walls standing before you.',
291
309
  :coords => {:x => 5, :y => 2},
292
- :locs_connected => {:north => false, :east => false, :south => true, :west => false},
293
- :danger_level => :assured,
310
+ :locs_connected => {:north => true, :east => false, :south => true, :west => false},
311
+ :danger_level => :high,
294
312
  :items => [Gun.new],
295
- :monsters_available => monsters
313
+ :bosses_abounding => []
314
+ })
315
+ )
316
+ locations.push(Location.new({
317
+ :name => 'Sky Tower (Foyer)',
318
+ :description => 'There appears to be one path forward, towards the throne room.',
319
+ :coords => {:x => 5, :y => 3},
320
+ :locs_connected => {:north => true, :east => false, :south => true, :west => false},
321
+ :danger_level => :high,
322
+ :items => [],
323
+ :bosses_abounding => []
324
+ })
325
+ )
326
+ locations.push(Location.new({
327
+ :name => 'Sky Tower (Throne Room)',
328
+ :description => 'There, on a mighty seat made of broken dreams, sits Emerald himself, staring at you coldly, silently.',
329
+ :coords => {:x => 5, :y => 4},
330
+ :locs_connected => {:north => false, :east => false, :south => true, :west => false},
331
+ :danger_level => :high,
332
+ :items => [Throne.new],
333
+ :bosses_abounding => [Emerald.new]
296
334
  })
297
335
  )
298
336
  end
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.5.2
4
+ version: 0.6.0
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-09 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.2'
39
+ version: 0.4.7
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.2'
46
+ version: 0.4.7
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: http
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -173,15 +173,18 @@ files:
173
173
  - bin/gemwarrior
174
174
  - gemwarrior.gemspec
175
175
  - lib/gemwarrior/battle.rb
176
+ - lib/gemwarrior/entities/boss.rb
176
177
  - lib/gemwarrior/entities/creature.rb
177
178
  - lib/gemwarrior/entities/entity.rb
178
179
  - lib/gemwarrior/entities/item.rb
179
180
  - lib/gemwarrior/entities/items/bed.rb
180
181
  - lib/gemwarrior/entities/items/feather.rb
181
182
  - lib/gemwarrior/entities/items/gun.rb
183
+ - lib/gemwarrior/entities/items/sparklything.rb
182
184
  - lib/gemwarrior/entities/items/stalactite.rb
183
185
  - lib/gemwarrior/entities/items/stone.rb
184
186
  - lib/gemwarrior/entities/items/stonemite.rb
187
+ - lib/gemwarrior/entities/items/throne.rb
185
188
  - lib/gemwarrior/entities/items/tree.rb
186
189
  - lib/gemwarrior/entities/location.rb
187
190
  - lib/gemwarrior/entities/monster.rb
@@ -191,6 +194,7 @@ files:
191
194
  - lib/gemwarrior/entities/monsters/apatiger.rb
192
195
  - lib/gemwarrior/entities/monsters/aquamarine.rb
193
196
  - lib/gemwarrior/entities/monsters/bloodstorm.rb
197
+ - lib/gemwarrior/entities/monsters/bosses/emerald.rb
194
198
  - lib/gemwarrior/entities/monsters/citrinaga.rb
195
199
  - lib/gemwarrior/entities/monsters/coraliz.rb
196
200
  - lib/gemwarrior/entities/monsters/cubicat.rb