gemwarrior 0.9.34 → 0.9.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +10 -1
- data/bin/gemwarrior +27 -22
- data/gemwarrior.gemspec +10 -2
- data/lib/gemwarrior/battle.rb +25 -42
- data/lib/gemwarrior/entities/location.rb +4 -3
- data/lib/gemwarrior/entities/player.rb +26 -41
- data/lib/gemwarrior/evaluator.rb +15 -7
- data/lib/gemwarrior/game.rb +21 -29
- data/lib/gemwarrior/game_options.rb +15 -0
- data/lib/gemwarrior/misc/music.rb +37 -33
- data/lib/gemwarrior/misc/wordlist.rb +5 -4
- data/lib/gemwarrior/repl.rb +39 -28
- data/lib/gemwarrior/version.rb +2 -2
- data/lib/gemwarrior/world.rb +9 -9
- data/spec/gemwarrior_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -1
- metadata +107 -20
- data/spec/rubywarrior_spec.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc7bbe78afbe9851724a0e8407e87531e6bde82b
|
4
|
+
data.tar.gz: d7e658ba14076615e4bb4f17cfce0845a3373a5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29f39b6e22047dbe11d9bcb90fa7c8ac71799fa76dc972e3be9302d615f9e861767571083392991e4aae7fbc33a47be01d8cfc4109423ee5d93dce825ea9dd7a
|
7
|
+
data.tar.gz: 51c9317fc21bb2363c990862d591ae649d0037271ff2286efa3f310226f869e4aced2396f0ee45a3074bfea811b66213bcd5095ac80634f536ea0391e9c6fb2a
|
data/Rakefile
CHANGED
@@ -1 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
|
4
|
+
# Default directory to look in is `/specs`
|
5
|
+
# Run with `rake spec`
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
7
|
+
task.rspec_opts = ['--color', '--format', 'nested']
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :spec
|
data/bin/gemwarrior
CHANGED
@@ -3,29 +3,35 @@
|
|
3
3
|
require 'optparse'
|
4
4
|
|
5
5
|
require_relative '../lib/gemwarrior/game'
|
6
|
+
require_relative '../lib/gemwarrior/game_options'
|
6
7
|
require_relative '../lib/gemwarrior/version'
|
7
8
|
|
9
|
+
include Gemwarrior
|
10
|
+
|
8
11
|
GAME_NAME = 'Gem Warrior'
|
9
12
|
|
10
13
|
def parse_options_cli
|
11
14
|
options = {
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
15
|
+
beast_mode: false,
|
16
|
+
debug_mode: false,
|
17
|
+
god_mode: false,
|
18
|
+
new_game: false,
|
19
|
+
sound_enabled: false,
|
20
|
+
sound_volume: 0.3,
|
21
|
+
use_wordnik: false,
|
22
|
+
extra_command: nil
|
19
23
|
}
|
20
|
-
|
24
|
+
|
21
25
|
options_file = read_options_file
|
22
26
|
|
23
27
|
unless options_file.nil?
|
24
|
-
|
25
|
-
|
28
|
+
sound_enabled_option = options_file[0][1].eql?('false') ? false : true
|
29
|
+
sound_volume_option = options_file[1][1].to_f
|
30
|
+
use_wordnik_option = options_file[2][1].eql?('false') ? false : true
|
26
31
|
|
27
|
-
options[:
|
28
|
-
options[:
|
32
|
+
options[:sound_enabled] = sound_enabled_option
|
33
|
+
options[:sound_volume] = sound_volume_option
|
34
|
+
options[:use_wordnik] = use_wordnik_option
|
29
35
|
end
|
30
36
|
|
31
37
|
optparse = OptionParser.new do |opts|
|
@@ -46,7 +52,7 @@ def parse_options_cli
|
|
46
52
|
end
|
47
53
|
|
48
54
|
opts.on('-s', '--sound', 'Enable sound (experimental)') do
|
49
|
-
options[:
|
55
|
+
options[:sound_enabled] = true
|
50
56
|
end
|
51
57
|
|
52
58
|
opts.on('-v', '--version', 'Display version number and exit') do
|
@@ -71,21 +77,17 @@ end
|
|
71
77
|
def print_error(error)
|
72
78
|
case error
|
73
79
|
when OptionParser::InvalidOption
|
74
|
-
puts "#{
|
80
|
+
puts "#{GAME_NAME}: illegal option #{error.args.join(' ')}"
|
75
81
|
else
|
76
|
-
puts "An unexpected error occurred while running #{
|
82
|
+
puts "An unexpected error occurred while running #{GAME_NAME}:"
|
77
83
|
puts " #{error}\n"
|
78
84
|
end
|
79
85
|
end
|
80
86
|
|
81
|
-
def get_options_file_path
|
82
|
-
"#{Dir.home}/.gemwarrior_options"
|
83
|
-
end
|
84
|
-
|
85
87
|
def read_options_file
|
86
|
-
|
87
|
-
|
88
|
-
File.open(
|
88
|
+
if File.exist?(GameOptions.data['options_file_path'])
|
89
|
+
options = []
|
90
|
+
File.open(GameOptions.data['options_file_path']).readlines.each do |line|
|
89
91
|
options << line.chomp.split(':')
|
90
92
|
end
|
91
93
|
return options
|
@@ -94,6 +96,9 @@ def read_options_file
|
|
94
96
|
end
|
95
97
|
|
96
98
|
begin
|
99
|
+
GameOptions.add 'log_file_path', "#{Dir.home}/.gemwarrior_log"
|
100
|
+
GameOptions.add 'options_file_path', "#{Dir.home}/.gemwarrior_options"
|
101
|
+
|
97
102
|
options = parse_options_cli
|
98
103
|
|
99
104
|
Gemwarrior::Game.new(options)
|
data/gemwarrior.gemspec
CHANGED
@@ -32,9 +32,17 @@ Gem::Specification.new do |spec|
|
|
32
32
|
# gems for future features
|
33
33
|
# spec.add_runtime_dependency 'hr', '~> 0.0.2'
|
34
34
|
|
35
|
-
spec.add_development_dependency 'pry-byebug', '~> 3.0'
|
36
35
|
spec.add_development_dependency 'bundler', '~> 1.8'
|
37
36
|
spec.add_development_dependency 'rake', '~> 10.0'
|
38
|
-
|
37
|
+
|
39
38
|
spec.add_development_dependency 'rubocop', '~> 0.29'
|
39
|
+
|
40
|
+
spec.add_development_dependency 'rspec'
|
41
|
+
spec.add_development_dependency 'rspec-nc'
|
42
|
+
spec.add_development_dependency 'guard'
|
43
|
+
spec.add_development_dependency 'guard-rspec'
|
44
|
+
spec.add_development_dependency 'pry'
|
45
|
+
spec.add_development_dependency 'pry-remote'
|
46
|
+
spec.add_development_dependency 'pry-nav'
|
47
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.0'
|
40
48
|
end
|
data/lib/gemwarrior/battle.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# Monster battle
|
3
3
|
|
4
4
|
require_relative 'misc/player_levels'
|
5
|
+
require_relative 'game_options'
|
5
6
|
|
6
7
|
module Gemwarrior
|
7
8
|
class Battle
|
@@ -23,16 +24,14 @@ module Gemwarrior
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def start(is_arena = nil, is_event = nil)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
])
|
35
|
-
end
|
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 }
|
34
|
+
])
|
36
35
|
|
37
36
|
print_battle_line
|
38
37
|
|
@@ -77,21 +76,17 @@ module Gemwarrior
|
|
77
76
|
|
78
77
|
# print health info
|
79
78
|
print "#{player.name.upcase.ljust(12)} :: #{player.hp_cur.to_s.rjust(3)} HP"
|
80
|
-
if
|
81
|
-
print " (LVL: #{player.level})"
|
82
|
-
end
|
79
|
+
print " (LVL: #{player.level})" if GameOptions.data['debug_mode']
|
83
80
|
print "\n"
|
84
81
|
|
85
82
|
print "#{monster.name.upcase.ljust(12)} :: "
|
86
|
-
if
|
83
|
+
if GameOptions.data['debug_mode'] || player.special_abilities.include?(:rocking_vision)
|
87
84
|
print "#{monster.hp_cur.to_s.rjust(3)}"
|
88
85
|
else
|
89
86
|
print '???'
|
90
87
|
end
|
91
88
|
print ' HP'
|
92
|
-
if
|
93
|
-
print " (LVL: #{monster.level})"
|
94
|
-
end
|
89
|
+
print " (LVL: #{monster.level})" if GameOptions.data['debug_mode']
|
95
90
|
print "\n"
|
96
91
|
puts
|
97
92
|
|
@@ -122,18 +117,16 @@ module Gemwarrior
|
|
122
117
|
puts "You attack #{monster.name}#{player.cur_weapon_name}!"
|
123
118
|
dmg = calculate_damage_to(monster)
|
124
119
|
if dmg > 0
|
125
|
-
|
126
|
-
|
127
|
-
end
|
120
|
+
Music::cue([{ frequencies: 'A4,E4,B5', duration: 75 }])
|
121
|
+
|
128
122
|
take_damage(monster, dmg)
|
129
123
|
if monster_dead?
|
130
124
|
result = monster_death
|
131
125
|
return result
|
132
126
|
end
|
133
127
|
else
|
134
|
-
|
135
|
-
|
136
|
-
end
|
128
|
+
Music::cue([{ frequencies: 'A4', duration: 75 }])
|
129
|
+
|
137
130
|
puts 'You miss entirely!'.colorize(:yellow)
|
138
131
|
end
|
139
132
|
when 'defend', 'd'
|
@@ -145,7 +138,7 @@ module Gemwarrior
|
|
145
138
|
print "#{monster.name}".colorize(:white)
|
146
139
|
print " (#{monster.hp_cur}/#{monster.hp_max} HP): #{monster.description}\n"
|
147
140
|
puts "It has some distinguishing features, too: face is #{monster.face}, hands are #{monster.hands}, and general mood is #{monster.mood}."
|
148
|
-
if
|
141
|
+
if GameOptions.data['debug_mode']
|
149
142
|
puts 'If defeated, will receive:'
|
150
143
|
puts " >> XP : #{monster.xp}"
|
151
144
|
puts " >> ROX : #{monster.rox}"
|
@@ -192,7 +185,7 @@ module Gemwarrior
|
|
192
185
|
atk_range = base_atk_lo..base_atk_hi
|
193
186
|
|
194
187
|
# beast mode modifier
|
195
|
-
if
|
188
|
+
if GameOptions.data['beast_mode']
|
196
189
|
atk_range = BEAST_MODE_ATTACK..BEAST_MODE_ATTACK
|
197
190
|
# level 3 ability modifier
|
198
191
|
elsif player.special_abilities.include?(:rock_slide)
|
@@ -250,14 +243,12 @@ module Gemwarrior
|
|
250
243
|
|
251
244
|
dmg = calculate_damage_to(player)
|
252
245
|
if dmg > 0
|
253
|
-
|
254
|
-
|
255
|
-
end
|
246
|
+
Music::cue([{ frequencies: 'B4,E#5,A5', duration: 75 }])
|
247
|
+
|
256
248
|
take_damage(player, dmg)
|
257
249
|
else
|
258
|
-
|
259
|
-
|
260
|
-
end
|
250
|
+
Music::cue([{ frequencies: 'B4', duration: 75 }])
|
251
|
+
|
261
252
|
puts "#{monster.name} misses entirely!".colorize(:yellow)
|
262
253
|
end
|
263
254
|
end
|
@@ -296,6 +287,7 @@ module Gemwarrior
|
|
296
287
|
{ frequencies: 'F#5', duration: 50 },
|
297
288
|
{ frequencies: 'G5', duration: 1000 }
|
298
289
|
])
|
290
|
+
|
299
291
|
puts monster.defeated_text
|
300
292
|
gets
|
301
293
|
return 'exit'
|
@@ -322,23 +314,14 @@ module Gemwarrior
|
|
322
314
|
|
323
315
|
# PLAYER
|
324
316
|
def player_near_death?
|
325
|
-
((player.hp_cur.to_f / player.hp_max.to_f) < 0.10 && !
|
317
|
+
((player.hp_cur.to_f / player.hp_max.to_f) < 0.10 && !GameOptions.data['god_mode'])
|
326
318
|
end
|
327
319
|
|
328
320
|
def player_dead?
|
329
|
-
(player.hp_cur <= 0 && !
|
321
|
+
(player.hp_cur <= 0 && !GameOptions.data['god_mode'])
|
330
322
|
end
|
331
323
|
|
332
324
|
def player_death
|
333
|
-
if world.sound
|
334
|
-
Music::cue([
|
335
|
-
{ frequencies: 'D#5', duration: 100 },
|
336
|
-
{ frequencies: 'A4', duration: 150 },
|
337
|
-
{ frequencies: 'F#4', duration: 200 },
|
338
|
-
{ frequencies: 'F4', duration: 1000 }
|
339
|
-
])
|
340
|
-
end
|
341
|
-
|
342
325
|
puts "You are dead, slain by the #{monster.name}!".colorize(:red)
|
343
326
|
print_battle_line
|
344
327
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# Place in the game
|
3
3
|
|
4
4
|
require_relative 'entity'
|
5
|
+
require_relative '../game_options'
|
5
6
|
|
6
7
|
module Gemwarrior
|
7
8
|
class Location < Entity
|
@@ -28,11 +29,11 @@ module Gemwarrior
|
|
28
29
|
self.checked_for_monsters = false
|
29
30
|
end
|
30
31
|
|
31
|
-
def status
|
32
|
+
def status
|
32
33
|
status_text = name.ljust(30).upcase.colorize(:green)
|
33
34
|
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
|
35
|
+
status_text << " DL[#{danger_level.to_s.ljust(8)}] ".colorize(:white) if GameOptions.data['debug_mode']
|
36
|
+
status_text << " MLR[#{monster_level_range.to_s.ljust(6)}] ".colorize(:white) if GameOptions.data['debug_mode']
|
36
37
|
status_text << "\n#{description}\n".colorize(:white)
|
37
38
|
end
|
38
39
|
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require_relative 'creature'
|
5
5
|
require_relative '../battle'
|
6
|
+
require_relative '../game_options'
|
6
7
|
require_relative '../misc/formatting'
|
7
8
|
require_relative '../misc/name_generator'
|
8
9
|
require_relative '../misc/player_levels'
|
@@ -18,18 +19,16 @@ module Gemwarrior
|
|
18
19
|
include PlayerLevels
|
19
20
|
include Formatting
|
20
21
|
|
21
|
-
attr_accessor :stam_cur, :stam_max, :cur_coords,
|
22
|
-
:god_mode, :beast_mode, :use_wordnik, :special_abilities,
|
22
|
+
attr_accessor :stam_cur, :stam_max, :cur_coords, :special_abilities,
|
23
23
|
:monsters_killed, :items_taken, :movements_made, :rests_taken, :deaths
|
24
24
|
|
25
25
|
def initialize(options)
|
26
26
|
self.name = generate_name
|
27
27
|
self.description = options.fetch(:description)
|
28
|
-
self.use_wordnik = options.fetch(:use_wordnik)
|
29
28
|
|
30
|
-
self.face = generate_face
|
31
|
-
self.hands = generate_hands
|
32
|
-
self.mood = generate_mood
|
29
|
+
self.face = generate_face
|
30
|
+
self.hands = generate_hands
|
31
|
+
self.mood = generate_mood
|
33
32
|
|
34
33
|
self.level = options.fetch(:level)
|
35
34
|
self.xp = options.fetch(:xp)
|
@@ -47,10 +46,6 @@ module Gemwarrior
|
|
47
46
|
self.stam_cur = options.fetch(:stam_cur)
|
48
47
|
self.stam_max = options.fetch(:stam_max)
|
49
48
|
self.cur_coords = options.fetch(:cur_coords)
|
50
|
-
|
51
|
-
self.god_mode = options.fetch(:god_mode)
|
52
|
-
self.beast_mode = options.fetch(:beast_mode)
|
53
|
-
|
54
49
|
self.special_abilities = []
|
55
50
|
|
56
51
|
self.monsters_killed = 0
|
@@ -60,7 +55,7 @@ module Gemwarrior
|
|
60
55
|
self.deaths = 0
|
61
56
|
end
|
62
57
|
|
63
|
-
def check_self(
|
58
|
+
def check_self(show_pic = true)
|
64
59
|
unless show_pic == false
|
65
60
|
print_char_pic
|
66
61
|
end
|
@@ -83,7 +78,7 @@ module Gemwarrior
|
|
83
78
|
abilities = Formatting::upstyle(special_abilities.collect { |x| x.to_s }).join(', ')
|
84
79
|
end
|
85
80
|
self_text = "NAME : #{self.name}\n"
|
86
|
-
self_text << "POSITION : #{self.cur_coords.values.to_a}\n" if debug_mode
|
81
|
+
self_text << "POSITION : #{self.cur_coords.values.to_a}\n" if GameOptions.data['debug_mode']
|
87
82
|
self_text << "WEAPON : #{weapon_slot}\n"
|
88
83
|
self_text << "LEVEL : #{self.level}\n"
|
89
84
|
self_text << "EXPERIENCE: #{self.xp}\n"
|
@@ -92,9 +87,10 @@ module Gemwarrior
|
|
92
87
|
self_text << "DEXTERITY : #{self.dexterity}\n"
|
93
88
|
self_text << "DEFENSE : #{self.defense}\n"
|
94
89
|
self_text << "ABILITIES : #{abilities}\n"
|
95
|
-
|
96
|
-
|
97
|
-
self_text << "
|
90
|
+
|
91
|
+
if GameOptions.data['debug_mode']
|
92
|
+
self_text << "GOD_MODE : #{GameOptions.data['god_mode']}\n"
|
93
|
+
self_text << "BEAST_MODE: #{GameOptions.data['beast_mode']}\n"
|
98
94
|
end
|
99
95
|
|
100
96
|
self_text << "\n"
|
@@ -162,7 +158,7 @@ module Gemwarrior
|
|
162
158
|
self.hp_cur = self.hp_cur.to_i + rand(10..15)
|
163
159
|
self.hp_cur = self.hp_max if self.hp_cur > self.hp_max
|
164
160
|
|
165
|
-
status_text = "You lie down somewhere quasi-flat and after a few moments, due to extreme exhaustion, you fall into a deep, yet troubled, slumber. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up with a start. Upon getting to your feet you look around, notice you feel somewhat better, and wonder why you dreamt about #{WordList.new(
|
161
|
+
status_text = "You lie down somewhere quasi-flat and after a few moments, due to extreme exhaustion, you fall into a deep, yet troubled, slumber. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up with a start. Upon getting to your feet you look around, notice you feel somewhat better, and wonder why you dreamt about #{WordList.new('noun-plural').get_random_value}."
|
166
162
|
status_text << "\n>> You regain a few hit points."
|
167
163
|
|
168
164
|
return status_text
|
@@ -193,7 +189,7 @@ module Gemwarrior
|
|
193
189
|
inventory.list_contents
|
194
190
|
end
|
195
191
|
|
196
|
-
def go(locations, direction
|
192
|
+
def go(locations, direction)
|
197
193
|
case direction
|
198
194
|
when 'north', 'n'
|
199
195
|
self.cur_coords = {
|
@@ -224,7 +220,7 @@ module Gemwarrior
|
|
224
220
|
}
|
225
221
|
direction_text = '<<<'
|
226
222
|
end
|
227
|
-
print_traveling_text(direction_text
|
223
|
+
print_traveling_text(direction_text)
|
228
224
|
|
229
225
|
# stats
|
230
226
|
self.movements_made += 1
|
@@ -324,29 +320,18 @@ module Gemwarrior
|
|
324
320
|
private
|
325
321
|
|
326
322
|
def player_death
|
327
|
-
if world.sound
|
328
|
-
Music::cue([
|
329
|
-
{ frequencies: 'D#5', duration: 100 },
|
330
|
-
{ frequencies: 'A4', duration: 150 },
|
331
|
-
{ frequencies: 'F#4', duration: 200 },
|
332
|
-
{ frequencies: 'F4', duration: 1000 }
|
333
|
-
])
|
334
|
-
end
|
335
|
-
|
336
323
|
puts 'Your actions have reduced you to death.'.colorize(:red)
|
337
324
|
puts 'Somehow, however, your adventure does not end here. Instead, you are whisked back home via some magical force, a bit worse for the weary and somewhat poorer, but ALIVE!'.colorize(:yellow)
|
338
325
|
return 'death'
|
339
326
|
end
|
340
327
|
|
341
328
|
# TRAVEL
|
342
|
-
def print_traveling_text(direction_text
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
])
|
349
|
-
end
|
329
|
+
def print_traveling_text(direction_text)
|
330
|
+
Music::cue([
|
331
|
+
{ frequencies: 'C4', duration: 75 },
|
332
|
+
{ frequencies: 'D4', duration: 75 },
|
333
|
+
{ frequencies: 'E4', duration: 75 }
|
334
|
+
])
|
350
335
|
Animation::run(phrase: "* #{direction_text} *", oneline: false)
|
351
336
|
end
|
352
337
|
|
@@ -372,18 +357,18 @@ module Gemwarrior
|
|
372
357
|
NameGenerator.new('fantasy').generate_name
|
373
358
|
end
|
374
359
|
|
375
|
-
def generate_face
|
376
|
-
face_descriptors = WordList.new(
|
360
|
+
def generate_face
|
361
|
+
face_descriptors = WordList.new('adjective')
|
377
362
|
face_descriptors.get_random_value
|
378
363
|
end
|
379
364
|
|
380
|
-
def generate_hands
|
381
|
-
hand_descriptors = WordList.new(
|
365
|
+
def generate_hands
|
366
|
+
hand_descriptors = WordList.new('adjective')
|
382
367
|
hand_descriptors.get_random_value
|
383
368
|
end
|
384
369
|
|
385
|
-
def generate_mood
|
386
|
-
mood_descriptors = WordList.new(
|
370
|
+
def generate_mood
|
371
|
+
mood_descriptors = WordList.new('adjective')
|
387
372
|
mood_descriptors.get_random_value
|
388
373
|
end
|
389
374
|
end
|
data/lib/gemwarrior/evaluator.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# Evaluates prompt input
|
3
3
|
|
4
4
|
require_relative 'arena'
|
5
|
+
require_relative 'game_options'
|
5
6
|
|
6
7
|
module Gemwarrior
|
7
8
|
class Evaluator
|
@@ -110,12 +111,12 @@ module Gemwarrior
|
|
110
111
|
param3 = tokens[3]
|
111
112
|
|
112
113
|
# dev commands
|
113
|
-
if
|
114
|
+
if GameOptions.data['debug_mode']
|
114
115
|
case command
|
115
116
|
when 'god', 'gd'
|
116
|
-
return
|
117
|
+
return GameOptions.data['god_mode'] = !GameOptions.data['god_mode']
|
117
118
|
when 'beast', 'bs'
|
118
|
-
return
|
119
|
+
return GameOptions.data['beast_mode'] = !GameOptions.data['beast_mode']
|
119
120
|
when 'vars', 'v'
|
120
121
|
world.print_vars
|
121
122
|
when 'list', 'ls'
|
@@ -267,7 +268,7 @@ module Gemwarrior
|
|
267
268
|
case command
|
268
269
|
when 'character', 'c'
|
269
270
|
# bypass puts so it prints out with newlines properly
|
270
|
-
print world.player.check_self(
|
271
|
+
print world.player.check_self(GameOptions.data['debug_mode'])
|
271
272
|
when 'inventory', 'i'
|
272
273
|
if param1
|
273
274
|
world.player.inventory.describe_item(param1)
|
@@ -541,7 +542,7 @@ module Gemwarrior
|
|
541
542
|
|
542
543
|
def try_to_move_player(direction)
|
543
544
|
if world.can_move?(direction)
|
544
|
-
world.player.go(world.locations, direction,
|
545
|
+
world.player.go(world.locations, direction, GameOptions.data['sound_enabled'], GameOptions.data['sound_volume'])
|
545
546
|
world.location_by_coords(world.player.cur_coords).checked_for_monsters = false
|
546
547
|
world.describe(world.location_by_coords(world.player.cur_coords))
|
547
548
|
else
|
@@ -550,6 +551,13 @@ module Gemwarrior
|
|
550
551
|
end
|
551
552
|
|
552
553
|
def player_death_resurrection
|
554
|
+
Music::cue([
|
555
|
+
{ frequencies: 'D#5', duration: 100 },
|
556
|
+
{ frequencies: 'A4', duration: 150 },
|
557
|
+
{ frequencies: 'F#4', duration: 200 },
|
558
|
+
{ frequencies: 'F4', duration: 1000 }
|
559
|
+
])
|
560
|
+
|
553
561
|
puts 'Somehow, though, your adventure does not end here!'.colorize(:yellow)
|
554
562
|
puts 'Instead, you are whisked back home via some magical force.'.colorize(:yellow)
|
555
563
|
puts 'A bit worse for the weary and somewhat poorer, but you are ALIVE!'.colorize(:yellow)
|
@@ -577,7 +585,7 @@ module Gemwarrior
|
|
577
585
|
end
|
578
586
|
print_separator
|
579
587
|
|
580
|
-
if
|
588
|
+
if GameOptions.data['debug_mode']
|
581
589
|
puts ' DEBUG COMMANDS'
|
582
590
|
print_separator
|
583
591
|
i = 0
|
@@ -594,7 +602,7 @@ module Gemwarrior
|
|
594
602
|
command = tokens[0]
|
595
603
|
commands_and_aliases = commands | aliases | extras
|
596
604
|
|
597
|
-
if
|
605
|
+
if GameOptions.data['debug_mode']
|
598
606
|
commands_and_aliases = commands_and_aliases | devcommands | devaliases | devextras
|
599
607
|
end
|
600
608
|
|
data/lib/gemwarrior/game.rb
CHANGED
@@ -13,6 +13,7 @@ require_relative 'world'
|
|
13
13
|
require_relative 'evaluator'
|
14
14
|
require_relative 'repl'
|
15
15
|
require_relative 'inventory'
|
16
|
+
require_relative 'game_options'
|
16
17
|
|
17
18
|
module Gemwarrior
|
18
19
|
class Game
|
@@ -29,16 +30,18 @@ module Gemwarrior
|
|
29
30
|
attr_accessor :world, :evaluator, :repl
|
30
31
|
|
31
32
|
def initialize(options)
|
33
|
+
# set game options
|
34
|
+
GameOptions.add 'beast_mode', options.fetch(:beast_mode)
|
35
|
+
GameOptions.add 'debug_mode', options.fetch(:debug_mode)
|
36
|
+
GameOptions.add 'god_mode', options.fetch(:god_mode)
|
37
|
+
GameOptions.add 'sound_enabled', options.fetch(:sound_enabled)
|
38
|
+
GameOptions.add 'sound_volume', options.fetch(:sound_volume)
|
39
|
+
GameOptions.add 'use_wordnik', options.fetch(:use_wordnik)
|
40
|
+
|
32
41
|
# create new world and player
|
33
|
-
|
34
|
-
|
35
|
-
start_stats = PlayerLevels::get_level_stats(1)
|
42
|
+
start_stats = PlayerLevels::get_level_stats(1)
|
36
43
|
|
37
|
-
world
|
38
|
-
world.use_wordnik = options.fetch(:use_wordnik)
|
39
|
-
world.sound = options.fetch(:sound)
|
40
|
-
world.new_game = options.fetch(:new_game)
|
41
|
-
world.extra_command = options.fetch(:extra_command)
|
44
|
+
self.world = World.new
|
42
45
|
|
43
46
|
world.player = Player.new({
|
44
47
|
description: PLAYER_DESC_DEFAULT,
|
@@ -52,38 +55,27 @@ module Gemwarrior
|
|
52
55
|
atk_hi: start_stats[:atk_hi],
|
53
56
|
defense: start_stats[:defense],
|
54
57
|
dexterity: start_stats[:dexterity],
|
55
|
-
inventory:
|
56
|
-
rox:
|
57
|
-
cur_coords: world.location_coords_by_name('Home')
|
58
|
-
|
59
|
-
god_mode: options.fetch(:god_mode),
|
60
|
-
beast_mode: options.fetch(:beast_mode),
|
61
|
-
use_wordnik: options.fetch(:use_wordnik)
|
58
|
+
inventory: GameOptions.data['debug_mode'] ? PLAYER_INVENTORY_DEBUG : PLAYER_INVENTORY_DEFAULT,
|
59
|
+
rox: GameOptions.data['debug_mode'] ? PLAYER_ROX_DEBUG : PLAYER_ROX_DEFAULT,
|
60
|
+
cur_coords: world.location_coords_by_name('Home')
|
62
61
|
})
|
63
62
|
|
64
63
|
# create options file if not existing
|
65
|
-
update_options_file
|
64
|
+
update_options_file
|
66
65
|
|
67
66
|
# create the console
|
68
67
|
self.evaluator = Evaluator.new(world)
|
69
68
|
self.repl = Repl.new(self, world, evaluator)
|
70
69
|
|
71
70
|
# enter Jool!
|
72
|
-
repl.start('look',
|
73
|
-
end
|
74
|
-
|
75
|
-
def get_log_file_path
|
76
|
-
"#{Dir.home}/.gemwarrior_log"
|
77
|
-
end
|
78
|
-
|
79
|
-
def get_options_file_path
|
80
|
-
"#{Dir.home}/.gemwarrior_options"
|
71
|
+
repl.start('look', options.fetch(:extra_command), options.fetch(:new_game))
|
81
72
|
end
|
82
73
|
|
83
|
-
def update_options_file
|
84
|
-
File.open(
|
85
|
-
f.puts "
|
86
|
-
f.puts "
|
74
|
+
def update_options_file
|
75
|
+
File.open(GameOptions.data['options_file_path'], 'w') do |f|
|
76
|
+
f.puts "sound_enabled:#{GameOptions.data['sound_enabled']}"
|
77
|
+
f.puts "sound_volume:#{GameOptions.data['sound_volume']}"
|
78
|
+
f.puts "use_wordnik:#{GameOptions.data['use_wordnik']}"
|
87
79
|
end
|
88
80
|
end
|
89
81
|
end
|
@@ -1,48 +1,52 @@
|
|
1
1
|
# lib/gemwarrior/misc/music.rb
|
2
|
-
# Music cues using win32-sound
|
2
|
+
# Music cues using win32-sound or feep, depending on platform
|
3
|
+
|
4
|
+
require_relative '../game_options'
|
3
5
|
|
4
6
|
module Gemwarrior
|
5
7
|
module Music
|
6
8
|
def self.cue(sequence)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
if GameOptions.data['sound_enabled']
|
10
|
+
# if Windows, use superior win32-sound library
|
11
|
+
if OS.windows?
|
12
|
+
require 'win32/sound'
|
13
|
+
require_relative 'musical_notes'
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
Thread.start do
|
16
|
+
sequence.each do |seq|
|
17
|
+
threads = []
|
18
|
+
seq[:frequencies].split(',').each do |note|
|
19
|
+
threads << Thread.new do
|
20
|
+
Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], GameOptions.data['sound_volume'])
|
21
|
+
end
|
18
22
|
end
|
23
|
+
threads.each { |th| th.join }
|
19
24
|
end
|
20
|
-
threads.each { |th| th.join }
|
21
25
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
require 'feep'
|
26
|
+
# otherwise, use inferior feep library
|
27
|
+
else
|
28
|
+
require 'feep'
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
feep_defaults = {
|
31
|
+
frequencies: '440',
|
32
|
+
waveform: 'sine',
|
33
|
+
volume: GameOptions.data['sound_volume'],
|
34
|
+
duration: 500,
|
35
|
+
notext: true
|
36
|
+
}
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
+
Thread.start do
|
39
|
+
sequence.each do |seq|
|
40
|
+
seq = feep_defaults.merge(seq)
|
38
41
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
Feep::Base.new({
|
43
|
+
freq_or_note: seq[:frequencies],
|
44
|
+
waveform: seq[:waveform],
|
45
|
+
volume: seq[:volume],
|
46
|
+
duration: seq[:duration],
|
47
|
+
notext: seq[:notext]
|
48
|
+
})
|
49
|
+
end
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
@@ -4,6 +4,8 @@
|
|
4
4
|
require 'http'
|
5
5
|
require 'json'
|
6
6
|
|
7
|
+
require_relative '../game_options'
|
8
|
+
|
7
9
|
module Gemwarrior
|
8
10
|
class WordList
|
9
11
|
STATIC_ADJECTIVE_VALUES = [
|
@@ -19,10 +21,9 @@ module Gemwarrior
|
|
19
21
|
'accentuate', 'accompany', 'blatter', 'bully', 'collide', 'crusade', 'disallow', 'entitle', 'infest', 'lateral', 'micturate', 'mourn', 'munge', 'numb', 'outdraw', 'overstep', 'plummet', 'refill', 'refurnish', 'reroute', 'rumple', 'scupper', 'smoosh', 'spifflicate', 'straighten', 'synthesize', 'terrorize', 'unshift', 'vociferate'
|
20
22
|
]
|
21
23
|
|
22
|
-
attr_accessor :
|
24
|
+
attr_accessor :type, :limit, :words, :error
|
23
25
|
|
24
|
-
def initialize(
|
25
|
-
self.use_wordnik = use_wordnik
|
26
|
+
def initialize(type = 'noun', limit = 10)
|
26
27
|
self.type = type
|
27
28
|
self.limit = limit
|
28
29
|
self.words = populate_words(type, limit)
|
@@ -45,7 +46,7 @@ module Gemwarrior
|
|
45
46
|
url = 'http://api.wordnik.com:80/v4/words.json/randomWords'
|
46
47
|
api_key = ENV['WORDNIK_API_KEY']
|
47
48
|
|
48
|
-
unless api_key.nil? || use_wordnik == false
|
49
|
+
unless api_key.nil? || GameOptions.data['use_wordnik'] == false
|
49
50
|
case type
|
50
51
|
when 'noun', 'noun-plural', 'adjective', 'verb'
|
51
52
|
else
|
data/lib/gemwarrior/repl.rb
CHANGED
@@ -10,6 +10,7 @@ require 'github_api'
|
|
10
10
|
require_relative 'misc/timer'
|
11
11
|
require_relative 'misc/wordlist'
|
12
12
|
require_relative 'evaluator'
|
13
|
+
require_relative 'game_options'
|
13
14
|
require_relative 'version'
|
14
15
|
|
15
16
|
module Gemwarrior
|
@@ -31,15 +32,15 @@ module Gemwarrior
|
|
31
32
|
self.evaluator = evaluator
|
32
33
|
end
|
33
34
|
|
34
|
-
def start(initial_command
|
35
|
-
setup_screen(initial_command, extra_command)
|
35
|
+
def start(initial_command, extra_command, new_game)
|
36
|
+
setup_screen(initial_command, extra_command, new_game)
|
36
37
|
|
37
38
|
clocker = Clocker.new
|
38
39
|
|
39
40
|
at_exit do
|
40
41
|
pl = world.player
|
41
42
|
duration = clocker.stop
|
42
|
-
game.update_options_file
|
43
|
+
game.update_options_file
|
43
44
|
log_stats(duration, pl)
|
44
45
|
end
|
45
46
|
|
@@ -71,7 +72,7 @@ module Gemwarrior
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def read_line
|
74
|
-
prompt_text =
|
75
|
+
prompt_text = GameOptions.data['debug_mode'] ? ' GW[D]> ' : ' GW> '
|
75
76
|
Readline.readline(prompt_text, true).to_s
|
76
77
|
end
|
77
78
|
|
@@ -83,7 +84,7 @@ module Gemwarrior
|
|
83
84
|
puts '/-+-+-+ +-+-+-+-+-+-+-\\'.colorize(:yellow)
|
84
85
|
puts '|G|E|M| |W|A|R|R|I|O|R|'.colorize(:yellow)
|
85
86
|
puts '\\-+-+-+ +-+-+-+-+-+-+-/'.colorize(:yellow)
|
86
|
-
puts '[[[[[[[DEBUGGING]]]]]]]'.colorize(:white) if
|
87
|
+
puts '[[[[[[[DEBUGGING]]]]]]]'.colorize(:white) if GameOptions.data['debug_mode']
|
87
88
|
end
|
88
89
|
|
89
90
|
def print_splash_message
|
@@ -95,9 +96,9 @@ module Gemwarrior
|
|
95
96
|
end
|
96
97
|
|
97
98
|
def print_fortune
|
98
|
-
noun1_values = WordList.new(
|
99
|
-
noun2_values = WordList.new(
|
100
|
-
noun3_values = WordList.new(
|
99
|
+
noun1_values = WordList.new('noun-plural')
|
100
|
+
noun2_values = WordList.new('noun-plural')
|
101
|
+
noun3_values = WordList.new('noun-plural')
|
101
102
|
|
102
103
|
puts "* Remember: #{noun1_values.get_random_value} and #{noun2_values.get_random_value} are the key to #{noun3_values.get_random_value} *\n\n"
|
103
104
|
puts
|
@@ -123,25 +124,37 @@ module Gemwarrior
|
|
123
124
|
puts
|
124
125
|
puts 'Gem Warrior Options'.colorize(:yellow)
|
125
126
|
puts '======================='.colorize(:yellow)
|
126
|
-
puts 'Toggle whether sound is played,
|
127
|
+
puts 'Toggle whether sound is played, what the game\'s volume is, or whether Wordnik is used to generate more dynamic descriptors of entities (valid WORDNIK_API_KEY environment variable must be set)'
|
127
128
|
puts
|
128
|
-
puts " (1) SOUND ENABLED: #{
|
129
|
-
puts " (2)
|
129
|
+
puts " (1) SOUND ENABLED : #{GameOptions.data['sound_enabled']}"
|
130
|
+
puts " (2) SOUND VOLUME : #{GameOptions.data['sound_volume']}"
|
131
|
+
puts " (3) USE WORDNIK : #{GameOptions.data['use_wordnik']}"
|
130
132
|
puts
|
131
133
|
puts '======================='
|
132
134
|
puts
|
133
|
-
puts 'Enter option number to
|
135
|
+
puts 'Enter option number to change value, or any other key to return to main menu.'
|
134
136
|
print 'Option? '
|
135
137
|
answer = STDIN.getch
|
136
138
|
|
137
139
|
case answer
|
138
140
|
when '1'
|
139
141
|
print answer
|
140
|
-
|
142
|
+
GameOptions.data['sound_enabled'] = !GameOptions.data['sound_enabled']
|
141
143
|
print_options
|
142
144
|
when '2'
|
143
145
|
print answer
|
144
|
-
|
146
|
+
print "\n"
|
147
|
+
print 'Enter a volume from 0.0 to 1.0: '
|
148
|
+
new_vol = gets.chomp.to_f.abs
|
149
|
+
if new_vol >= 0.0 and new_vol <= 1.0
|
150
|
+
GameOptions.data['sound_volume'] = new_vol
|
151
|
+
else
|
152
|
+
puts 'Not a valid volume.'
|
153
|
+
end
|
154
|
+
print_options
|
155
|
+
when '3'
|
156
|
+
print answer
|
157
|
+
GameOptions.data['use_wordnik']= !GameOptions.data['use_wordnik']
|
145
158
|
print_options
|
146
159
|
else
|
147
160
|
print answer
|
@@ -150,8 +163,8 @@ module Gemwarrior
|
|
150
163
|
end
|
151
164
|
|
152
165
|
def display_log
|
153
|
-
if File.exist?(
|
154
|
-
File.open(
|
166
|
+
if File.exist?(GameOptions.data['log_file_path'])
|
167
|
+
File.open(GameOptions.data['log_file_path']).readlines.each do |line|
|
155
168
|
print "#{line}"
|
156
169
|
end
|
157
170
|
puts
|
@@ -232,7 +245,7 @@ module Gemwarrior
|
|
232
245
|
when 'e', 'x'
|
233
246
|
puts choice
|
234
247
|
puts MAIN_MENU_QUIT_MESSAGE
|
235
|
-
game.update_options_file
|
248
|
+
game.update_options_file
|
236
249
|
exit
|
237
250
|
else
|
238
251
|
run_main_menu(show_choices = false)
|
@@ -258,27 +271,25 @@ module Gemwarrior
|
|
258
271
|
puts '######################################################################'
|
259
272
|
|
260
273
|
# log stats to file in home directory
|
261
|
-
File.open(
|
274
|
+
File.open(GameOptions.data['log_file_path'], 'a') do |f|
|
262
275
|
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"
|
263
276
|
end
|
264
277
|
end
|
265
278
|
|
266
279
|
def play_intro_tune
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
])
|
272
|
-
end
|
280
|
+
Music::cue([
|
281
|
+
{ frequencies: 'A3,E4,C#5,E5', duration: 300 },
|
282
|
+
{ frequencies: 'A3,E4,C#5,F#5', duration: 600 }
|
283
|
+
])
|
273
284
|
end
|
274
285
|
|
275
|
-
def setup_screen(initial_command = nil, extra_command = nil)
|
286
|
+
def setup_screen(initial_command = nil, extra_command = nil, new_game = false)
|
276
287
|
# welcome player to game
|
277
288
|
clear_screen
|
278
289
|
print_logo
|
279
290
|
|
280
291
|
# main menu loop until new game or exit
|
281
|
-
if
|
292
|
+
if new_game
|
282
293
|
play_intro_tune
|
283
294
|
print_splash_message
|
284
295
|
print_fortune
|
@@ -293,7 +304,7 @@ module Gemwarrior
|
|
293
304
|
|
294
305
|
def prompt
|
295
306
|
prompt_template = "\n[LV:%2s][XP:%3s][ROX:%3s] [HP:%3s/%-3s][STM:%2s/%-2s] [%s @ %s]"
|
296
|
-
if
|
307
|
+
if GameOptions.data['debug_mode']
|
297
308
|
prompt_template += "[%s, %s, %s]"
|
298
309
|
end
|
299
310
|
prompt_vars_arr = [
|
@@ -307,7 +318,7 @@ module Gemwarrior
|
|
307
318
|
world.player.name,
|
308
319
|
world.location_by_coords(world.player.cur_coords).name
|
309
320
|
]
|
310
|
-
if
|
321
|
+
if GameOptions.data['debug_mode']
|
311
322
|
prompt_vars_arr.push(world.player.cur_coords[:x], world.player.cur_coords[:y], world.player.cur_coords[:z])
|
312
323
|
end
|
313
324
|
print (prompt_template % prompt_vars_arr).colorize(:yellow)
|
data/lib/gemwarrior/version.rb
CHANGED
data/lib/gemwarrior/world.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'yaml'
|
5
5
|
|
6
|
+
require_relative 'game_options'
|
6
7
|
require_relative 'entities/item'
|
7
8
|
require_relative 'entities/location'
|
8
9
|
|
@@ -17,8 +18,7 @@ module Gemwarrior
|
|
17
18
|
ERROR_LIST_PARAM_INVALID = 'That is not something that can be listed.'
|
18
19
|
ERROR_LOCATION_DESCRIBE_ENTITY_INVALID = 'You do not see that here.'
|
19
20
|
|
20
|
-
attr_accessor :monsters, :locations, :player
|
21
|
-
:debug_mode, :use_wordnik, :sound, :new_game, :extra_command
|
21
|
+
attr_accessor :monsters, :locations, :player
|
22
22
|
|
23
23
|
def initialize
|
24
24
|
self.monsters = init_monsters
|
@@ -69,7 +69,7 @@ module Gemwarrior
|
|
69
69
|
0.upto(WORLD_DIM_WIDTH - 1) do |count_x|
|
70
70
|
print "#{count_x} "
|
71
71
|
end
|
72
|
-
if debug_mode
|
72
|
+
if GameOptions.data['debug_mode']
|
73
73
|
puts
|
74
74
|
puts
|
75
75
|
puts "Current level: #{player.cur_coords[:z]}"
|
@@ -116,7 +116,7 @@ module Gemwarrior
|
|
116
116
|
when 'locations'
|
117
117
|
puts "[LOCATIONS](#{locations.length})".colorize(:yellow)
|
118
118
|
if details
|
119
|
-
locations.map { |l| print l.status
|
119
|
+
locations.map { |l| print l.status }
|
120
120
|
return
|
121
121
|
else
|
122
122
|
">> #{locations.map(&:name).join(', ')}"
|
@@ -148,7 +148,7 @@ module Gemwarrior
|
|
148
148
|
desc_text = ''
|
149
149
|
desc_text << "[>>> #{point.name.upcase} <<<]".colorize(:cyan)
|
150
150
|
|
151
|
-
if debug_mode
|
151
|
+
if GameOptions.data['debug_mode']
|
152
152
|
desc_text << " DL[#{point.danger_level.to_s}] MLR[#{point.monster_level_range.to_s}]".colorize(:yellow)
|
153
153
|
end
|
154
154
|
|
@@ -162,7 +162,7 @@ module Gemwarrior
|
|
162
162
|
desc_text << "\n >> Thing(s): #{point.list_items.join(', ')}".colorize(:white) unless point.list_items.empty?
|
163
163
|
desc_text << "\n >> Path(s): #{point.list_paths.join(', ')}".colorize(:white)
|
164
164
|
|
165
|
-
if debug_mode
|
165
|
+
if GameOptions.data['debug_mode']
|
166
166
|
desc_text << "\n >>> Actionable words: "
|
167
167
|
desc_text << point.list_actionable_words.colorize(:white)
|
168
168
|
end
|
@@ -176,7 +176,7 @@ module Gemwarrior
|
|
176
176
|
if point.has_item?(entity_name)
|
177
177
|
point.items.each do |i|
|
178
178
|
if i.name.downcase.eql?(entity_name)
|
179
|
-
if debug_mode
|
179
|
+
if GameOptions.data['debug_mode']
|
180
180
|
return i.describe
|
181
181
|
else
|
182
182
|
return i.description
|
@@ -186,7 +186,7 @@ module Gemwarrior
|
|
186
186
|
elsif point.has_monster?(entity_name)
|
187
187
|
point.monsters_abounding.each do |m|
|
188
188
|
if m.name.downcase.eql?(entity_name)
|
189
|
-
if debug_mode
|
189
|
+
if GameOptions.data['debug_mode']
|
190
190
|
return m.describe
|
191
191
|
else
|
192
192
|
return m.description
|
@@ -196,7 +196,7 @@ module Gemwarrior
|
|
196
196
|
elsif point.has_boss?(entity_name)
|
197
197
|
point.bosses_abounding.each do |b|
|
198
198
|
if b.name.downcase.eql?(entity_name)
|
199
|
-
if debug_mode
|
199
|
+
if GameOptions.data['debug_mode']
|
200
200
|
return b.describe
|
201
201
|
else
|
202
202
|
return b.description
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemwarrior
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.35
|
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
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|
@@ -143,75 +143,159 @@ dependencies:
|
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: 0.12.4
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
146
|
+
name: bundler
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
151
|
+
version: '1.8'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
158
|
+
version: '1.8'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
160
|
+
name: rake
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
165
|
+
version: '10.0'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
172
|
+
version: '10.0'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
174
|
+
name: rubocop
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
179
|
+
version: '0.29'
|
180
180
|
type: :development
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: '
|
186
|
+
version: '0.29'
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
188
|
name: rspec
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
|
-
- - "
|
191
|
+
- - ">="
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: '
|
193
|
+
version: '0'
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
|
-
- - "
|
198
|
+
- - ">="
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: '
|
200
|
+
version: '0'
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
|
-
name:
|
202
|
+
name: rspec-nc
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
type: :development
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '0'
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: guard
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
type: :development
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: guard-rspec
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0'
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: pry
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0'
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: '0'
|
257
|
+
- !ruby/object:Gem::Dependency
|
258
|
+
name: pry-remote
|
259
|
+
requirement: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - ">="
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: '0'
|
264
|
+
type: :development
|
265
|
+
prerelease: false
|
266
|
+
version_requirements: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - ">="
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '0'
|
271
|
+
- !ruby/object:Gem::Dependency
|
272
|
+
name: pry-nav
|
273
|
+
requirement: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - ">="
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '0'
|
278
|
+
type: :development
|
279
|
+
prerelease: false
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - ">="
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: '0'
|
285
|
+
- !ruby/object:Gem::Dependency
|
286
|
+
name: pry-byebug
|
203
287
|
requirement: !ruby/object:Gem::Requirement
|
204
288
|
requirements:
|
205
289
|
- - "~>"
|
206
290
|
- !ruby/object:Gem::Version
|
207
|
-
version: '0
|
291
|
+
version: '3.0'
|
208
292
|
type: :development
|
209
293
|
prerelease: false
|
210
294
|
version_requirements: !ruby/object:Gem::Requirement
|
211
295
|
requirements:
|
212
296
|
- - "~>"
|
213
297
|
- !ruby/object:Gem::Version
|
214
|
-
version: '0
|
298
|
+
version: '3.0'
|
215
299
|
description: A fun text adventure in the form of a RubyGem!
|
216
300
|
email: mike@codana.me
|
217
301
|
executables:
|
@@ -288,6 +372,7 @@ files:
|
|
288
372
|
- lib/gemwarrior/entities/player.rb
|
289
373
|
- lib/gemwarrior/evaluator.rb
|
290
374
|
- lib/gemwarrior/game.rb
|
375
|
+
- lib/gemwarrior/game_options.rb
|
291
376
|
- lib/gemwarrior/inventory.rb
|
292
377
|
- lib/gemwarrior/misc/animation.rb
|
293
378
|
- lib/gemwarrior/misc/formatting.rb
|
@@ -300,7 +385,7 @@ files:
|
|
300
385
|
- lib/gemwarrior/repl.rb
|
301
386
|
- lib/gemwarrior/version.rb
|
302
387
|
- lib/gemwarrior/world.rb
|
303
|
-
- spec/
|
388
|
+
- spec/gemwarrior_spec.rb
|
304
389
|
- spec/spec_helper.rb
|
305
390
|
homepage: http://rubygems.org/gems/gemwarrior
|
306
391
|
licenses:
|
@@ -326,4 +411,6 @@ rubygems_version: 2.4.8
|
|
326
411
|
signing_key:
|
327
412
|
specification_version: 4
|
328
413
|
summary: RubyGem text adventure
|
329
|
-
test_files:
|
414
|
+
test_files:
|
415
|
+
- spec/gemwarrior_spec.rb
|
416
|
+
- spec/spec_helper.rb
|