gemwarrior 0.9.26 → 0.9.27

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: 107f1e7b40ef5dee781180e7ffbb1add6696bf29
4
- data.tar.gz: 3915864403a1d5969daecc7da9e89b691acfe9bf
3
+ metadata.gz: 7a8d128428751086aeb493bdabeb39ffc4250095
4
+ data.tar.gz: d08b1a49df6a91d88b9e0fe17b3ef2ae95c1757e
5
5
  SHA512:
6
- metadata.gz: 2aa48bb8109a9264b5472d311a8fddd3666da3c5f9f2d4181e9ea2201fa5e4501378121f3b70d4b069766da968ca79f9a2cabd83da330f544ccc486df9a65a11
7
- data.tar.gz: 5be06f477fe64a1ba59940c3bac72cb84baa0a96763e39ccf8bcdec585842d74bacec7f3f2fca09b4fa956da749432261dbcfa1c1233ce36573a6b3aaab9c977
6
+ metadata.gz: 61bdfaffb94b06c7c8021054057de148c0f6c22854ba44b1af672a66d7964aea8669aac02e1c7895e7b108424a31dad155fc1d4bae9aa2d29b6ab45f49e5f4a7
7
+ data.tar.gz: f8c4e19799b4874c776bf2cad890671fcdb74209d073d6a1c7d6a6fe3b582822f3fc5d20a0cf844cdda3ec834b111e88d548b6dd4d7dea3ce952e7213fd7ec6f
File without changes
@@ -28,9 +28,9 @@ Gem::Specification.new do |spec|
28
28
  spec.add_runtime_dependency 'win32-sound', '~> 0.6.0'
29
29
  spec.add_runtime_dependency 'feep', '~> 0.1.3'
30
30
  spec.add_runtime_dependency 'github_api', '~> 0.12.4'
31
-
31
+
32
32
  # gems for future features
33
- #spec.add_runtime_dependency 'hr', '~> 0.0.2'
33
+ # spec.add_runtime_dependency 'hr', '~> 0.0.2'
34
34
 
35
35
  spec.add_development_dependency 'pry-byebug', '~> 3.0'
36
36
  spec.add_development_dependency 'bundler', '~> 1.8'
@@ -20,9 +20,9 @@ module Gemwarrior
20
20
 
21
21
  loop do
22
22
  monster = generate_monster
23
- battle = Battle.new({:world => self.world, :player => self.player, :monster => monster})
23
+ battle = Battle.new(world: world, player: player, monster: monster)
24
24
  result = battle.start(is_arena = true)
25
-
25
+
26
26
  if result.eql?('death')
27
27
  return 'death'
28
28
  end
@@ -56,7 +56,7 @@ module Gemwarrior
56
56
  random_monster = nil
57
57
 
58
58
  loop do
59
- random_monster = world.monsters[rand(0..world.monsters.length-1)].clone
59
+ random_monster = world.monsters[rand(0..world.monsters.length - 1)].clone
60
60
 
61
61
  unless random_monster.is_boss
62
62
  break
@@ -25,20 +25,20 @@ module Gemwarrior
25
25
  def start(is_arena = nil, is_event = nil)
26
26
  if world.sound
27
27
  Music::cue([
28
- {:frequencies => 'G4', :duration => 50},
29
- {:frequencies => 'G#4', :duration => 50},
30
- {:frequencies => 'G4', :duration => 50},
31
- {:frequencies => 'G#4', :duration => 50},
32
- {:frequencies => 'G4', :duration => 50},
33
- {:frequencies => 'G#4', :duration => 50}
28
+ { frequencies: 'G4', duration: 50 },
29
+ { frequencies: 'G#4', duration: 50 },
30
+ { frequencies: 'G4', duration: 50 },
31
+ { frequencies: 'G#4', duration: 50 },
32
+ { frequencies: 'G4', duration: 50 },
33
+ { frequencies: 'G#4', duration: 50 }
34
34
  ])
35
35
  end
36
-
36
+
37
37
  print_battle_line
38
38
 
39
39
  if is_arena
40
40
  print 'Your opponent is now...'
41
- Animation::run({:phrase => "#{monster.name.upcase}!", :speed => :slow})
41
+ Animation::run(phrase: "#{monster.name.upcase}!", speed: slow)
42
42
  elsif is_event
43
43
  puts "You are attacked by #{monster.name}!"
44
44
  else
@@ -74,7 +74,7 @@ module Gemwarrior
74
74
  end
75
75
 
76
76
  puts
77
-
77
+
78
78
  # print health info
79
79
  print "#{player.name.upcase.ljust(12)} :: #{player.hp_cur.to_s.rjust(3)} HP"
80
80
  if world.debug_mode
@@ -123,7 +123,7 @@ module Gemwarrior
123
123
  dmg = calculate_damage_to(monster)
124
124
  if dmg > 0
125
125
  if world.sound
126
- Music::cue([{:frequencies => 'A4,E4,B5', :duration => 75}])
126
+ Music::cue([{ frequencies: 'A4,E4,B5', duration: 75 }])
127
127
  end
128
128
  take_damage(monster, dmg)
129
129
  if monster_dead?
@@ -132,7 +132,7 @@ module Gemwarrior
132
132
  end
133
133
  else
134
134
  if world.sound
135
- Music::cue([{:frequencies => 'A4', :duration => 75}])
135
+ Music::cue([{ frequencies: 'A4', duration: 75 }])
136
136
  end
137
137
  puts 'You miss entirely!'.colorize(:yellow)
138
138
  end
@@ -173,16 +173,16 @@ module Gemwarrior
173
173
 
174
174
  private
175
175
 
176
- # NEUTRAL
176
+ # NEUTRAL
177
177
  def calculate_damage_to(entity)
178
178
  miss = rand(0..(100 + entity.defense))
179
- if (miss < 15)
179
+ if miss < 15
180
180
  0
181
181
  else
182
182
  if entity.eql?(monster)
183
183
  # base attack range
184
184
  atk_range = player.atk_lo..player.atk_hi
185
-
185
+
186
186
  # beast mode modifier
187
187
  if player.beast_mode
188
188
  atk_range = BEAST_MODE_ATTACK..BEAST_MODE_ATTACK
@@ -201,7 +201,7 @@ module Gemwarrior
201
201
  return rand(atk_range)
202
202
  else
203
203
  dmg = rand(monster.atk_lo..monster.atk_hi)
204
- dmg = dmg - (entity.defense / 2) if player_is_defending
204
+ dmg -= (entity.defense / 2) if player_is_defending
205
205
  return dmg
206
206
  end
207
207
  end
@@ -218,7 +218,7 @@ module Gemwarrior
218
218
  end
219
219
 
220
220
  print who_gets_wounded
221
- Animation::run({ :phrase => dmg.to_s, :speed => :slow, :oneline => true, :alpha => false, :random => false })
221
+ Animation::run({ phrase: dmg.to_s, speed: slow, oneline: true, alpha: false, random: false })
222
222
  print " point(s)!\n"
223
223
  end
224
224
 
@@ -239,16 +239,16 @@ module Gemwarrior
239
239
 
240
240
  def monster_attacks_player
241
241
  puts "#{monster.name} attacks you!"
242
-
242
+
243
243
  dmg = calculate_damage_to(player)
244
244
  if dmg > 0
245
245
  if world.sound
246
- Music::cue([{:frequencies => 'B4,E#5,A5', :duration => 75}])
246
+ Music::cue([{ frequencies: 'B4,E#5,A5', duration: 75 }])
247
247
  end
248
248
  take_damage(player, dmg)
249
249
  else
250
250
  if world.sound
251
- Music::cue([{:frequencies => 'B4', :duration => 75}])
251
+ Music::cue([{ frequencies: 'B4', duration: 75 }])
252
252
  end
253
253
  puts "#{monster.name} misses entirely!".colorize(:yellow)
254
254
  end
@@ -272,21 +272,21 @@ module Gemwarrior
272
272
  # end game boss!
273
273
  if monster.name.eql?('Emerald')
274
274
  Music::cue([
275
- {:frequencies => 'G3', :duration => 250},
276
- {:frequencies => 'A3', :duration => 50},
277
- {:frequencies => 'B3', :duration => 50},
278
- {:frequencies => 'C4', :duration => 50},
279
- {:frequencies => 'D4', :duration => 250},
280
- {:frequencies => 'E4', :duration => 50},
281
- {:frequencies => 'F#4', :duration => 50},
282
- {:frequencies => 'G4', :duration => 50},
283
- {:frequencies => 'A4', :duration => 250},
284
- {:frequencies => 'B4', :duration => 50},
285
- {:frequencies => 'C5', :duration => 50},
286
- {:frequencies => 'D5', :duration => 50},
287
- {:frequencies => 'E5', :duration => 50},
288
- {:frequencies => 'F#5', :duration => 50},
289
- {:frequencies => 'G5', :duration => 1000}
275
+ { frequencies: 'G3', duration: 250 },
276
+ { frequencies: 'A3', duration: 50 },
277
+ { frequencies: 'B3', duration: 50 },
278
+ { frequencies: 'C4', duration: 50 },
279
+ { frequencies: 'D4', duration: 250 },
280
+ { frequencies: 'E4', duration: 50 },
281
+ { frequencies: 'F#4', duration: 50 },
282
+ { frequencies: 'G4', duration: 50 },
283
+ { frequencies: 'A4', duration: 250 },
284
+ { frequencies: 'B4', duration: 50 },
285
+ { frequencies: 'C5', duration: 50 },
286
+ { frequencies: 'D5', duration: 50 },
287
+ { frequencies: 'E5', duration: 50 },
288
+ { frequencies: 'F#5', duration: 50 },
289
+ { frequencies: 'G5', duration: 1000 }
290
290
  ])
291
291
  puts monster.defeated_text
292
292
  gets
@@ -296,7 +296,7 @@ module Gemwarrior
296
296
  puts " XP : #{monster.xp}".colorize(:green)
297
297
  puts " ROX: #{monster.rox}".colorize(:green)
298
298
  print_battle_line
299
- player.update_stats({:reason => :monster, :value => monster})
299
+ player.update_stats(reason: monster, value: monster)
300
300
  world.location_by_coords(player.cur_coords).remove_monster(monster.name)
301
301
  end
302
302
  else
@@ -307,7 +307,7 @@ module Gemwarrior
307
307
  puts " ITEMS: #{monster.inventory.list_contents}".colorize(:green) unless monster.inventory.items.empty?
308
308
  end
309
309
  print_battle_line
310
- player.update_stats({:reason => :monster, :value => monster})
310
+ player.update_stats(reason: monster, value: monster)
311
311
  world.location_by_coords(player.cur_coords).remove_monster(monster.name)
312
312
  end
313
313
  end
@@ -324,20 +324,20 @@ module Gemwarrior
324
324
  def player_death
325
325
  if world.sound
326
326
  Music::cue([
327
- {:frequencies => 'D#5', :duration => 100},
328
- {:frequencies => 'A4', :duration => 150},
329
- {:frequencies => 'F#4', :duration => 200},
330
- {:frequencies => 'F4', :duration => 1000}
327
+ { frequencies: 'D#5', duration: 100 },
328
+ { frequencies: 'A4', duration: 150 },
329
+ { frequencies: 'F#4', duration: 200 },
330
+ { frequencies: 'F4', duration: 1000 }
331
331
  ])
332
332
  end
333
-
333
+
334
334
  puts "You are dead, slain by the #{monster.name}!".colorize(:red)
335
335
  print_battle_line
336
336
  end
337
337
 
338
338
  def player_escape?(is_arena)
339
339
  unless is_arena
340
- if (player.dexterity > monster.dexterity)
340
+ if player.dexterity > monster.dexterity
341
341
  return true
342
342
  else
343
343
  dex_diff = monster.dexterity - player.dexterity
@@ -355,7 +355,7 @@ module Gemwarrior
355
355
  # STATUS TEXT
356
356
 
357
357
  def print_escape_text
358
- Animation::run({ :phrase => '** POOF **', :oneline => true })
358
+ Animation::run(phrase: '** POOF **', oneline: true)
359
359
  end
360
360
 
361
361
  def print_battle_line
@@ -3,7 +3,7 @@
3
3
 
4
4
  require_relative 'arena'
5
5
 
6
- module Gemwarrior
6
+ module Gemwarrior
7
7
  class Evaluator
8
8
  # CONSTANTS
9
9
  ## MESSAGES
@@ -42,8 +42,8 @@ module Gemwarrior
42
42
  ERROR_DEBUG_TELEPORT_PARAMS_NEEDED = 'You cannot just "teleport" to an x coordinate without a y coordinate.'
43
43
  ERROR_DEBUG_TELEPORT_PARAMS_INVALID = 'You cannot teleport there...yet.'
44
44
 
45
- attr_accessor :world,
46
- :commands, :aliases, :extras, :cmd_descriptions,
45
+ attr_accessor :world,
46
+ :commands, :aliases, :extras, :cmd_descriptions,
47
47
  :devcommands, :devaliases, :devextras, :devcmd_descriptions
48
48
 
49
49
  def initialize(world)
@@ -223,8 +223,8 @@ module Gemwarrior
223
223
  z_coord = param3.to_i.to_s == param3 ? param3.to_i : world.player.cur_coords[:z]
224
224
 
225
225
  # check to make sure new location exists
226
- if world.location_by_coords({:x => x_coord, :y => y_coord, :z => z_coord})
227
- world.player.cur_coords = {:x => x_coord, :y => y_coord, :z => z_coord}
226
+ if world.location_by_coords(x: x_coord, y: y_coord, z: z_coord)
227
+ world.player.cur_coords = {x: x_coord, y: y_coord, z: z_coord}
228
228
  else
229
229
  return ERROR_DEBUG_TELEPORT_PARAMS_INVALID
230
230
  end
@@ -248,15 +248,15 @@ module Gemwarrior
248
248
 
249
249
  # stats
250
250
  world.player.movements_made += 1
251
-
252
- Animation::run({:phrase => '** TELEPORT! **', :speed => :insane})
251
+
252
+ Animation::run(phrase: '** TELEPORT! **', speed: :insane)
253
253
  return world.describe(world.location_by_coords(world.player.cur_coords))
254
254
  end
255
255
  when 'levelbump', 'lb'
256
- world.player.update_stats({:reason => :level_bump, :value => 1})
256
+ world.player.update_stats(reason: :level_bump, value: 1)
257
257
  when 'restfight', 'rf'
258
258
  result = world.player.rest(world, nil, true)
259
-
259
+
260
260
  if result.eql?('death')
261
261
  player_death_resurrection
262
262
  end
@@ -278,7 +278,7 @@ module Gemwarrior
278
278
  tent_uses = 0
279
279
  player_inventory = world.player.inventory.items
280
280
  location_inventory = world.location_by_coords(world.player.cur_coords).items
281
-
281
+
282
282
  if player_inventory.map(&:name).include?('tent')
283
283
  player_inventory.each do |i|
284
284
  if i.name.eql?('tent')
@@ -286,7 +286,7 @@ module Gemwarrior
286
286
  result = i.use(world.player)
287
287
  tent_uses = i.number_of_uses
288
288
  i.number_of_uses -= 1
289
-
289
+
290
290
  puts "The tent can be used when resting #{i.number_of_uses} more time(s)."
291
291
  end
292
292
  end
@@ -298,15 +298,15 @@ module Gemwarrior
298
298
  result = i.use(world.player)
299
299
  tent_uses = i.number_of_uses
300
300
  i.number_of_uses -= 1
301
-
301
+
302
302
  puts "The tent can be used when resting #{i.number_of_uses} more time(s)."
303
303
  end
304
304
  end
305
305
  end
306
306
  end
307
-
307
+
308
308
  result = world.player.rest(world, tent_uses)
309
-
309
+
310
310
  if result.eql?('death')
311
311
  player_death_resurrection
312
312
  end
@@ -405,7 +405,7 @@ module Gemwarrior
405
405
  world.player.heal_damage(result[:data])
406
406
  return
407
407
  when 'xp'
408
- world.player.update_stats({:reason => :xp, :value => result[:data]})
408
+ world.player.update_stats(reason: :xp, value: result[:data])
409
409
  return
410
410
  when 'tent'
411
411
  world.player.rest(world, result[:data])
@@ -417,9 +417,9 @@ module Gemwarrior
417
417
  world.print_map(world.player.cur_coords[:z])
418
418
  end
419
419
  when 'arena'
420
- arena = Arena.new({:world => world, :player => world.player})
420
+ arena = Arena.new(world: world, player: world.player)
421
421
  result = arena.start
422
-
422
+
423
423
  if result.eql?('death')
424
424
  player_death_resurrection
425
425
  end
@@ -440,7 +440,7 @@ module Gemwarrior
440
440
  ERROR_DROP_PARAM_MISSING
441
441
  else
442
442
  world.player.inventory.drop_item(param1)
443
- end
443
+ end
444
444
  when 'equip', 'eq'
445
445
  if param1.nil?
446
446
  ERROR_EQUIP_PARAM_MISSING
@@ -493,7 +493,7 @@ module Gemwarrior
493
493
  if world.has_monster_to_attack?(monster_name)
494
494
  monster = world.location_by_coords(world.player.cur_coords).monster_by_name(monster_name)
495
495
  result = world.player.attack(world, monster)
496
-
496
+
497
497
  if result.eql?('death')
498
498
  player_death_resurrection
499
499
  elsif result.eql?('exit')
@@ -518,9 +518,9 @@ module Gemwarrior
518
518
  when 'help', 'h'
519
519
  list_commands
520
520
  when 'quit', 'exit', 'q', 'x'
521
- puts "You sure you want to quit? (y/n): "
521
+ puts 'You sure you want to quit? (y/n): '
522
522
  response = gets.chomp.downcase
523
- if (response.eql?("y") || response.eql?("yes"))
523
+ if (response.eql?('y') || response.eql?('yes'))
524
524
  puts QUIT_MESSAGE
525
525
  return 'exit'
526
526
  else
@@ -570,7 +570,7 @@ module Gemwarrior
570
570
  print_separator
571
571
  commands.each do |cmd|
572
572
  puts " #{cmd.ljust(9)}, #{aliases[i].ljust(2)} -- #{cmd_descriptions[i]}"
573
- i = i + 1
573
+ i += 1
574
574
  end
575
575
  print_separator
576
576
 
@@ -580,7 +580,7 @@ module Gemwarrior
580
580
  i = 0
581
581
  devcommands.each do |cmd|
582
582
  puts " #{cmd.ljust(9)}, #{devaliases[i].ljust(2)} -- #{devcmd_descriptions[i]}"
583
- i = i + 1
583
+ i += 1
584
584
  end
585
585
  print_separator
586
586
  end
@@ -596,7 +596,7 @@ module Gemwarrior
596
596
  end
597
597
 
598
598
  if commands_and_aliases.include?(command.downcase)
599
- if tokens.size.between?(1,4)
599
+ if tokens.size.between?(1, 4)
600
600
  return true
601
601
  end
602
602
  elsif tokens.empty?
@@ -26,7 +26,7 @@ module Gemwarrior
26
26
  PLAYER_ROX_DEFAULT = 0
27
27
  PLAYER_ROX_DEBUG = 300
28
28
 
29
- attr_accessor :world, :eval, :repl
29
+ attr_accessor :world, :evaluator, :repl
30
30
 
31
31
  def initialize(options)
32
32
  # create new world and player
@@ -65,8 +65,8 @@ module Gemwarrior
65
65
  update_options_file(world)
66
66
 
67
67
  # create the console
68
- self.eval = Evaluator.new(world)
69
- self.repl = Repl.new(self, world, eval)
68
+ self.evaluator = Evaluator.new(world)
69
+ self.repl = Repl.new(self, world, evaluator)
70
70
 
71
71
  # enter Jool!
72
72
  repl.start('look', world.extra_command)
@@ -22,9 +22,9 @@ module Gemwarrior
22
22
 
23
23
  def list_contents
24
24
  if items.nil? || items.empty?
25
- return contents_text = '[empty]'
25
+ return '[empty]'
26
26
  else
27
- return contents_text = "#{items.map(&:name).join ', '}"
27
+ return "#{items.map(&:name).join ', '}"
28
28
  end
29
29
  end
30
30
 
@@ -110,10 +110,10 @@ module Gemwarrior
110
110
  if contains_item?(item_name)
111
111
  puts "Are you sure you want to permanently throw away #{item_name}? (Y/N)"
112
112
  answer = gets.downcase.chomp!
113
-
113
+
114
114
  if answer.eql?('y')
115
115
  remove_item(item_name)
116
-
116
+
117
117
  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."
118
118
  else
119
119
  return "You decide to keep #{item_name} for now."
@@ -1,16 +1,12 @@
1
1
  # lib/gemwarrior/misc/music.rb
2
2
  # Music cues using win32-sound
3
3
 
4
- require 'feep'
5
- require 'win32/sound'
6
-
7
- require_relative 'musical_notes'
8
-
9
4
  module Gemwarrior
10
5
  module Music
11
6
  def self.cue(sequence)
12
7
  # if Windows, use superior win32-sound library
13
8
  if OS.windows?
9
+ require 'win32/sound'
14
10
  threads = []
15
11
 
16
12
  Thread.start {
@@ -25,10 +21,13 @@ module Gemwarrior
25
21
  }
26
22
  # otherwise, use inferior feep library
27
23
  else
24
+ require 'feep'
25
+ require_relative 'musical_notes'
26
+
28
27
  feep_defaults = {
29
- :frequencies => '440',
30
- :waveform => 'sine',
31
- :volume => 0.3,
28
+ :frequencies => '440',
29
+ :waveform => 'sine',
30
+ :volume => 0.3,
32
31
  :duration => 500,
33
32
  :notext => true
34
33
  }
@@ -38,9 +37,9 @@ module Gemwarrior
38
37
  seq = feep_defaults.merge(seq)
39
38
 
40
39
  Feep::Base.new({
41
- :freq_or_note => seq[:frequencies],
42
- :waveform => seq[:waveform],
43
- :volume => seq[:volume],
40
+ :freq_or_note => seq[:frequencies],
41
+ :waveform => seq[:waveform],
42
+ :volume => seq[:volume],
44
43
  :duration => seq[:duration],
45
44
  :notext => seq[:notext]
46
45
  })
@@ -12,7 +12,7 @@ require_relative 'misc/wordlist'
12
12
  require_relative 'evaluator'
13
13
  require_relative 'version'
14
14
 
15
- module Gemwarrior
15
+ module Gemwarrior
16
16
  class Repl
17
17
  # CONSTANTS
18
18
  ## MESSAGES
@@ -23,12 +23,12 @@ module Gemwarrior
23
23
  GITHUB_NAME = 'michaelchadwick'
24
24
  GITHUB_PROJECT = 'gemwarrior'
25
25
 
26
- attr_accessor :game, :world, :eval
26
+ attr_accessor :game, :world, :evaluator
27
27
 
28
28
  def initialize(game, world, evaluator)
29
- self.game = game
30
- self.world = world
31
- self.eval = evaluator
29
+ self.game = game
30
+ self.world = world
31
+ self.evaluator = evaluator
32
32
  end
33
33
 
34
34
  def start(initial_command = nil, extra_command = nil)
@@ -43,13 +43,13 @@ module Gemwarrior
43
43
  log_stats(duration, pl)
44
44
  end
45
45
 
46
- clocker.clock {
46
+ clocker.clock do
47
47
  # main loop
48
48
  loop do
49
49
  prompt
50
50
  begin
51
51
  input = read_line
52
- result = eval.evaluate(input)
52
+ result = evaluator.evaluate(input)
53
53
  if result.eql?('exit')
54
54
  exit
55
55
  else
@@ -61,7 +61,7 @@ module Gemwarrior
61
61
  exit
62
62
  end
63
63
  end
64
- }
64
+ end
65
65
  end
66
66
 
67
67
  private
@@ -75,7 +75,7 @@ module Gemwarrior
75
75
  Readline.readline(prompt_text, true).to_s
76
76
  end
77
77
 
78
- def puts(s='', width=WRAP_WIDTH)
78
+ def puts(s = '', width = WRAP_WIDTH)
79
79
  super s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") unless s.nil?
80
80
  end
81
81
 
@@ -87,10 +87,10 @@ module Gemwarrior
87
87
  end
88
88
 
89
89
  def print_splash_message
90
- SPLASH_MESSAGE.length.times do print '=' end
90
+ SPLASH_MESSAGE.length.times { print '=' }
91
91
  puts
92
92
  puts SPLASH_MESSAGE
93
- SPLASH_MESSAGE.length.times do print '=' end
93
+ SPLASH_MESSAGE.length.times { print '=' }
94
94
  puts
95
95
  end
96
96
 
@@ -110,7 +110,7 @@ module Gemwarrior
110
110
  puts
111
111
  puts 'Explore the land of Jool with the power of text, fighting enemies to improve your station, grabbing curious items that may or may not come in handy, and finally defeating Mr. Emerald himself to win the game.'
112
112
  end
113
-
113
+
114
114
  def print_help_text
115
115
  puts 'Gem Warrior - Some Basic Help Commands'
116
116
  puts '======================================'
@@ -123,8 +123,8 @@ module Gemwarrior
123
123
  options = read_options_file
124
124
 
125
125
  puts
126
- puts 'Gem Warrior Options'
127
- puts '======================='
126
+ puts 'Gem Warrior Options'
127
+ puts '======================='
128
128
  if options.nil?
129
129
  puts 'No options set yet.'
130
130
  else
@@ -134,17 +134,17 @@ module Gemwarrior
134
134
  options.each do |op|
135
135
  option = op[0]
136
136
  value = op[1].eql?('true') ? 'ON' : 'OFF'
137
-
137
+
138
138
  print " #{count} #{option.ljust(12).upcase} : #{value}\n"
139
139
  count += 1
140
140
  end
141
141
  end
142
- puts '======================='
142
+ puts '======================='
143
143
  puts
144
- puts 'Enter option number to toggle value, or any other key to return to main menu.'
144
+ puts 'Enter option number to toggle value, or any other key to return to main menu.'
145
145
  print 'Option? '
146
146
  answer = STDIN.getch
147
-
147
+
148
148
  case answer
149
149
  when '1'
150
150
  print answer
@@ -163,7 +163,7 @@ module Gemwarrior
163
163
  end
164
164
 
165
165
  def display_log
166
- if File.exists?(game.get_log_file_path)
166
+ if File.exist?(game.get_log_file_path)
167
167
  File.open(game.get_log_file_path).readlines.each do |line|
168
168
  print "#{line}"
169
169
  end
@@ -258,44 +258,43 @@ module Gemwarrior
258
258
  options << line.chomp.split('|')
259
259
  end
260
260
  return options
261
- else
262
- nil
263
261
  end
262
+ nil
264
263
  end
265
264
 
266
265
  def log_stats(duration, pl)
267
- puts '######################################################################'
268
- print 'Gem Warrior'.colorize(:color => :white, :background => :black)
266
+ puts '######################################################################'
267
+ print 'Gem Warrior'.colorize(color: :white, background: :black)
269
268
  print " v#{Gemwarrior::VERSION}".colorize(:yellow)
270
- print " played for #{duration[:mins].to_s.colorize(:color => :white, :background => :black)} mins, #{duration[:secs].to_s.colorize(:color => :white, :background => :black)} secs, and #{duration[:ms].to_s.colorize(:color => :white, :background => :black)} ms\n"
269
+ print " played for #{duration[:mins].to_s.colorize(color: :white, background: :black)} mins, #{duration[:secs].to_s.colorize(color: :white, background: :black)} secs, and #{duration[:ms].to_s.colorize(color: :white, background: :black)} ms\n"
271
270
  puts '----------------------------------------------------------------------'
272
- print "Player killed #{pl.monsters_killed.to_s.colorize(:color => :white, :background => :black)} monster(s)"
271
+ print "Player killed #{pl.monsters_killed.to_s.colorize(color: :white, background: :black)} monster(s)"
273
272
  print "\n".ljust(8)
274
- print "picked up #{pl.items_taken.to_s.colorize(:color => :white, :background => :black)} item(s)"
273
+ print "picked up #{pl.items_taken.to_s.colorize(color: :white, background: :black)} item(s)"
275
274
  print "\n".ljust(8)
276
- print "traveled #{pl.movements_made.to_s.colorize(:color => :white, :background => :black)} time(s)"
275
+ print "traveled #{pl.movements_made.to_s.colorize(color: :white, background: :black)} time(s)"
277
276
  print "\n".ljust(8)
278
- print "rested #{pl.rests_taken.to_s.colorize(:color => :white, :background => :black)} time(s)"
277
+ print "rested #{pl.rests_taken.to_s.colorize(color: :white, background: :black)} time(s)"
279
278
  print "\n".ljust(8)
280
- print "died #{pl.deaths.to_s.colorize(:color => :white, :background => :black)} time(s)"
279
+ print "died #{pl.deaths.to_s.colorize(color: :white, background: :black)} time(s)"
281
280
  print "\n"
282
281
  puts '######################################################################'
283
-
282
+
284
283
  # log stats to file in home directory
285
284
  File.open(game.get_log_file_path, 'a') do |f|
286
285
  f.write "#{Time.now} #{pl.name.rjust(10)} - V:#{Gemwarrior::VERSION} LV:#{pl.level} XP:#{pl.xp} $:#{pl.rox} KIL:#{pl.monsters_killed} ITM:#{pl.items_taken} MOV:#{pl.movements_made} RST:#{pl.rests_taken} DTH:#{pl.deaths}\n"
287
286
  end
288
287
  end
289
-
288
+
290
289
  def play_intro_tune
291
290
  if world.sound
292
291
  Music::cue([
293
- {:frequencies => 'A3,E4,C#5,E5', :duration => 300},
294
- {:frequencies => 'A3,E4,C#5,F#5', :duration => 600}
292
+ { frequencies: 'A3,E4,C#5,E5', duration: 300},
293
+ { frequencies: 'A3,E4,C#5,F#5', duration: 600}
295
294
  ])
296
295
  end
297
296
  end
298
-
297
+
299
298
  def setup_screen(initial_command = nil, extra_command = nil)
300
299
  # welcome player to game
301
300
  clear_screen
@@ -311,8 +310,8 @@ module Gemwarrior
311
310
  end
312
311
 
313
312
  # hook to do something right off the bat
314
- puts eval.evaluate(initial_command) unless initial_command.nil?
315
- puts eval.evaluate(extra_command) unless extra_command.nil?
313
+ puts evaluator.evaluate(initial_command) unless initial_command.nil?
314
+ puts evaluator.evaluate(extra_command) unless extra_command.nil?
316
315
  end
317
316
 
318
317
  def prompt
@@ -324,7 +323,7 @@ module Gemwarrior
324
323
  world.player.level,
325
324
  world.player.xp,
326
325
  world.player.rox,
327
- world.player.hp_cur,
326
+ world.player.hp_cur,
328
327
  world.player.hp_max,
329
328
  world.player.stam_cur,
330
329
  world.player.stam_max,
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.9.26'
5
+ VERSION = '0.9.27'
6
6
  end
@@ -17,7 +17,7 @@ module Gemwarrior
17
17
  ERROR_LIST_PARAM_INVALID = 'That is not something that can be listed.'
18
18
  ERROR_LOCATION_DESCRIBE_ENTITY_INVALID = 'You do not see that here.'
19
19
 
20
- attr_accessor :monsters, :locations, :player,
20
+ attr_accessor :monsters, :locations, :player,
21
21
  :debug_mode, :use_wordnik, :sound, :new_game, :extra_command
22
22
 
23
23
  def initialize
@@ -37,18 +37,18 @@ module Gemwarrior
37
37
  end
38
38
 
39
39
  def print_map(floor)
40
- 0.upto(WORLD_DIM_HEIGHT-1) do |count_y|
40
+ 0.upto(WORLD_DIM_HEIGHT - 1) do |count_y|
41
41
  print ' '
42
- 0.upto(WORLD_DIM_WIDTH-1) do
42
+ 0.upto(WORLD_DIM_WIDTH - 1) do
43
43
  print '---'
44
44
  end
45
45
  print "\n"
46
- print "#{(WORLD_DIM_HEIGHT-1) - count_y} "
47
- 0.upto(WORLD_DIM_WIDTH-1) do |count_x|
46
+ print "#{(WORLD_DIM_HEIGHT - 1) - count_y} "
47
+ 0.upto(WORLD_DIM_WIDTH - 1) do |count_x|
48
48
  cur_map_coords = {
49
- :x => count_x,
50
- :y => (WORLD_DIM_HEIGHT-1) - count_y,
51
- :z => floor.nil? ? self.player.cur_coords[:z] : floor.to_i
49
+ x: count_x,
50
+ y: (WORLD_DIM_HEIGHT - 1) - count_y,
51
+ z: floor.nil? ? self.player.cur_coords[:z] : floor.to_i
52
52
  }
53
53
  if self.player.cur_coords.eql?(cur_map_coords)
54
54
  print '|O|'
@@ -61,12 +61,12 @@ module Gemwarrior
61
61
  print "\n"
62
62
  end
63
63
  print ' '
64
- 0.upto(WORLD_DIM_WIDTH-1) do
64
+ 0.upto(WORLD_DIM_WIDTH - 1) do
65
65
  print '---'
66
66
  end
67
67
  puts
68
68
  print ' '
69
- 0.upto(WORLD_DIM_WIDTH-1) do |count_x|
69
+ 0.upto(WORLD_DIM_WIDTH - 1) do |count_x|
70
70
  print "#{count_x} "
71
71
  end
72
72
  if debug_mode
@@ -91,13 +91,13 @@ module Gemwarrior
91
91
  monsters.map { |m| print m.describe }
92
92
  return
93
93
  else
94
- monster_text = ">> monsters: #{monsters.map(&:name).join(', ')}"
94
+ ">> monsters: #{monsters.map(&:name).join(', ')}"
95
95
  end
96
96
  when 'items'
97
97
  item_count = 0
98
98
  locations.each do |l|
99
- l.items.each do |i|
100
- item_count = item_count + 1
99
+ l.items.each do
100
+ item_count += 1
101
101
  end
102
102
  end
103
103
  puts "[ITEMS](#{item_count})".colorize(:yellow)
@@ -172,7 +172,7 @@ module Gemwarrior
172
172
 
173
173
  def describe_entity(point, entity_name)
174
174
  entity_name.downcase!
175
-
175
+
176
176
  if point.has_item?(entity_name)
177
177
  point.items.each do |i|
178
178
  if i.name.downcase.eql?(entity_name)
@@ -257,15 +257,15 @@ module Gemwarrior
257
257
  end
258
258
 
259
259
  self.monsters = [
260
- Alexandrat.new,
261
- Amberoo.new,
262
- Amethystle.new,
263
- Apatiger.new,
264
- Aquamarine.new,
265
- Bloodstorm.new,
266
- Citrinaga.new,
267
- Coraliz.new,
268
- Cubicat.new,
260
+ Alexandrat.new,
261
+ Amberoo.new,
262
+ Amethystle.new,
263
+ Apatiger.new,
264
+ Aquamarine.new,
265
+ Bloodstorm.new,
266
+ Citrinaga.new,
267
+ Coraliz.new,
268
+ Cubicat.new,
269
269
  Diaman.new,
270
270
  Emerald.new,
271
271
  Garynetty.new
@@ -281,27 +281,27 @@ module Gemwarrior
281
281
 
282
282
  location_data = YAML.load_file(LOCATION_DATA_FILE)
283
283
 
284
- location_data.each {|l|
284
+ location_data.each do |l|
285
285
  locations.push(Location.new({
286
- :name => l['name'],
287
- :description => l['description'],
288
- :danger_level => l['danger_level'],
289
- :monster_level_range => l['monster_level_range'].nil? ? nil : l['monster_level_range']['lo']..l['monster_level_range']['hi'],
290
- :coords => {
291
- :x => l['coords']['x'],
292
- :y => l['coords']['y'],
293
- :z => l['coords']['z']
294
- },
295
- :locs_connected => {
296
- :north => l['locs_connected']['north'],
297
- :east => l['locs_connected']['east'],
298
- :south => l['locs_connected']['south'],
299
- :west => l['locs_connected']['west']
300
- },
301
- :items => create_item_objects(l['items']),
302
- :bosses_abounding => create_boss_objects(l['bosses_abounding'])
286
+ name: l['name'],
287
+ description: l['description'],
288
+ danger_level: l['danger_level'],
289
+ monster_level_range: l['monster_level_range'].nil? ? nil : l['monster_level_range']['lo']..l['monster_level_range']['hi'],
290
+ coords: {
291
+ x: l['coords']['x'],
292
+ y: l['coords']['y'],
293
+ z: l['coords']['z']
294
+ },
295
+ locs_connected: {
296
+ north: l['locs_connected']['north'],
297
+ east: l['locs_connected']['east'],
298
+ south: l['locs_connected']['south'],
299
+ west: l['locs_connected']['west']
300
+ },
301
+ items: create_item_objects(l['items']),
302
+ bosses_abounding: create_boss_objects(l['bosses_abounding'])
303
303
  }))
304
- }
304
+ end
305
305
 
306
306
  return locations
307
307
  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.9.26
4
+ version: 0.9.27
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-08-11 00:00:00.000000000 Z
11
+ date: 2015-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -323,4 +323,6 @@ rubygems_version: 2.4.8
323
323
  signing_key:
324
324
  specification_version: 4
325
325
  summary: RubyGem text adventure
326
- test_files: []
326
+ test_files:
327
+ - spec/rubywarrior_spec.rb
328
+ - spec/spec_helper.rb