gemwarrior 0.15.6 → 0.15.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,43 +1,44 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'gemwarrior/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'gemwarrior'
8
- spec.version = Gemwarrior::VERSION
9
- spec.platform = Gem::Platform::RUBY
10
- spec.authors = ['Michael Chadwick']
11
- spec.email = 'mike@codana.me'
12
- spec.homepage = 'http://rubygems.org/gems/gemwarrior'
13
- spec.summary = 'RubyGem text adventure'
14
- spec.description = 'A fun text adventure in the form of a RubyGem!'
15
-
16
- spec.files = `git ls-files`.split("\n")
17
- spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
- spec.require_paths = ['lib']
20
- spec.license = 'MIT'
21
-
22
- spec.add_runtime_dependency 'os', '~> 0.9', '>= 0.9.6'
23
- spec.add_runtime_dependency 'http', '~> 0.8.10'
24
- spec.add_runtime_dependency 'json', '~> 1.8.2'
25
- spec.add_runtime_dependency 'colorize', '~> 0.8'
26
- spec.add_runtime_dependency 'matrext', '~> 1'
27
- spec.add_runtime_dependency 'clocker', '~> 0.1.6'
28
- spec.add_runtime_dependency 'gems', '~> 0.8.3'
29
-
30
- # sound systems
31
- #spec.add_runtime_dependency 'feep', '~> 0.1.3'
32
- #spec.add_runtime_dependency 'win32-sound', '~> 0.6.0'
33
- #spec.add_runtime_dependency 'bloopsaphone', '>= 0.4'
34
-
35
- spec.add_development_dependency 'bundler', '~> 2.1'
36
- spec.add_development_dependency 'rake', '~> 12.3.3'
37
- spec.add_development_dependency 'rubocop', '~> 0.52.1'
38
- spec.add_development_dependency 'rspec', '~> 3.9.0'
39
- spec.add_development_dependency 'rspec-nc', '~> 0.3'
40
- spec.add_development_dependency 'guard', '~> 2.16'
41
- spec.add_development_dependency 'guard-rspec', '~> 4.7'
42
- spec.add_development_dependency 'pry-byebug', '~> 3.9'
43
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gemwarrior/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'gemwarrior'
8
+ spec.version = Gemwarrior::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.authors = ['Michael Chadwick']
11
+ spec.email = 'mike@codana.me'
12
+ spec.homepage = 'http://rubygems.org/gems/gemwarrior'
13
+ spec.summary = 'RubyGem text adventure'
14
+ spec.description = 'A fun text adventure in the form of a RubyGem!'
15
+
16
+ spec.files = `git ls-files`.split("\n")
17
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+ spec.license = 'MIT'
21
+
22
+ spec.add_runtime_dependency 'os', '~> 0.9', '>= 0.9.6'
23
+ spec.add_runtime_dependency 'http', '~> 0.8.10'
24
+ spec.add_runtime_dependency 'json', '~> 1.8.2'
25
+ spec.add_runtime_dependency 'colorize', '~> 0.8'
26
+ spec.add_runtime_dependency 'matrext', '~> 1'
27
+ spec.add_runtime_dependency 'clocker', '~> 0.1.6'
28
+ spec.add_runtime_dependency 'gems', '~> 0.8.3'
29
+
30
+ # sound systems
31
+ #spec.add_runtime_dependency 'feep', '~> 0.1.3'
32
+ #spec.add_runtime_dependency 'win32-sound', '~> 0.6.0'
33
+ #spec.add_runtime_dependency 'bloopsaphone', '>= 0.4'
34
+
35
+ spec.add_development_dependency 'bundler', '~> 2.1'
36
+ spec.add_development_dependency 'rake', '~> 12.3.3'
37
+ spec.add_development_dependency 'rubocop', '~> 0.52.1'
38
+ spec.add_development_dependency 'rspec', '~> 3.9.0'
39
+ spec.add_development_dependency 'rspec-nc', '~> 0.3'
40
+ spec.add_development_dependency 'guard', '~> 2.16'
41
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
42
+ spec.add_development_dependency 'pry-byebug', '~> 3.9'
43
+ spec.add_development_dependency 'awesome_print', '~> 1.8'
44
+ end
@@ -47,6 +47,7 @@ module Gemwarrior
47
47
 
48
48
  def describe(world)
49
49
  desc_text = "#{description}".colorize(:white)
50
+ desc_text
50
51
  end
51
52
 
52
53
  def describe_detailed(world)
@@ -66,7 +66,7 @@ module Gemwarrior
66
66
  weapon_slot = self.inventory.weapon.name
67
67
  net_atk_lo = base_atk_lo + self.inventory.weapon.atk_lo
68
68
  net_atk_hi = base_atk_hi + self.inventory.weapon.atk_hi
69
- net_dexterity = self.dexterity + self.inventory.weapon.dex_mod
69
+ net_dexterity = base_dexterity + self.inventory.weapon.dex_mod
70
70
  end
71
71
 
72
72
  # juice the armor display
@@ -104,7 +104,7 @@ module Gemwarrior
104
104
  self_text << "ABILITIES :"
105
105
  self_text << "#{abilities}"
106
106
  self_text << "INVENTORY : #{self.inventory.contents}\n"
107
-
107
+
108
108
  if GameOptions.data['debug_mode']
109
109
  self_text << "\n"
110
110
  self_text << "[DEBUG STUFF]\n"
@@ -126,7 +126,7 @@ module Gemwarrior
126
126
  self_text << "\n\n"
127
127
 
128
128
  self_text << "[#{"Current Status".colorize(:yellow)}]\nBreathing, non-naked, with a #{self.face.colorize(:yellow)} face, #{self.hands.colorize(:yellow)} hands, and feeling, generally, #{self.mood.colorize(:yellow)}."
129
-
129
+
130
130
  self_text << "\n"
131
131
  end
132
132
 
@@ -210,41 +210,45 @@ module Gemwarrior
210
210
 
211
211
  def list_inventory
212
212
  inventory.list_contents
213
- end
213
+ end
214
214
 
215
215
  def go(world, direction)
216
216
  case direction
217
217
  when 'north', 'n'
218
218
  self.cur_coords = {
219
- x: cur_coords[:x],
219
+ x: cur_coords[:x],
220
220
  y: cur_coords[:y]+1,
221
221
  z: cur_coords[:z]
222
222
  }
223
+ direction_cue = :player_travel_north
223
224
  direction_text = '^^^'
224
225
  when 'east', 'e'
225
226
  self.cur_coords = {
226
- x: cur_coords[:x]+1,
227
+ x: cur_coords[:x]+1,
227
228
  y: cur_coords[:y],
228
229
  z: cur_coords[:z]
229
230
  }
231
+ direction_cue = :player_travel_east
230
232
  direction_text = '>>>'
231
233
  when 'south', 's'
232
234
  self.cur_coords = {
233
- x: cur_coords[:x],
235
+ x: cur_coords[:x],
234
236
  y: cur_coords[:y]-1,
235
237
  z: cur_coords[:z]
236
238
  }
239
+ direction_cue = :player_travel_south
237
240
  direction_text = 'vvv'
238
241
  when 'west', 'w'
239
242
  self.cur_coords = {
240
- x: cur_coords[:x]-1,
243
+ x: cur_coords[:x]-1,
241
244
  y: cur_coords[:y],
242
245
  z: cur_coords[:z]
243
246
  }
247
+ direction_cue = :player_travel_west
244
248
  direction_text = '<<<'
245
249
  end
246
250
  world.location_by_coords(self.cur_coords).visited = true
247
- print_traveling_text(direction_text)
251
+ print_traveling_text(direction_cue, direction_text)
248
252
 
249
253
  # stats
250
254
  self.movements_made += 1
@@ -365,8 +369,8 @@ module Gemwarrior
365
369
  return 'death'
366
370
  end
367
371
 
368
- def print_traveling_text(direction_text)
369
- Audio.play_synth(:player_travel)
372
+ def print_traveling_text(direction_cue, direction_text)
373
+ Audio.play_synth(direction_cue)
370
374
  Animation.run(phrase: "* #{direction_text} *", oneline: false)
371
375
  end
372
376
 
@@ -11,21 +11,36 @@ module Gemwarrior
11
11
  if GameOptions.data['sound_system'].eql?('win32-sound')
12
12
  begin
13
13
  require 'win32/sound'
14
- rescue LoadError => e
14
+ rescue
15
15
  GameOptions.data['errors'] = "#{GameOptions.data['sound_system']} could not be loaded. You may need to run 'gem install #{GameOptions.data['sound_system']}'. Silence for now."
16
16
  end
17
17
  elsif GameOptions.data['sound_system'].eql?('feep')
18
18
  begin
19
19
  require 'feep'
20
- rescue LoadError => e
20
+ rescue
21
21
  GameOptions.data['errors'] = "#{GameOptions.data['sound_system']} could not be loaded. You may need to run 'gem install #{GameOptions.data['sound_system']}'. Silence for now."
22
22
  end
23
23
  elsif GameOptions.data['sound_system'].eql?('bloops')
24
24
  begin
25
25
  require 'bloops'
26
- rescue LoadError => e
26
+ rescue
27
27
  GameOptions.data['errors'] = "#{GameOptions.data['sound_system']} could not be loaded. You may need to run 'gem install #{GameOptions.data['sound_system']}aphone'. Silence for now."
28
28
  end
29
+ else
30
+ GameOptions.data['errors'] = "'#{GameOptions.data['sound_system']}' is not a valid sound system. Audio subsystem load failed."
31
+ end
32
+ end
33
+
34
+ def self.get_cues
35
+ if GameOptions.data['sound_enabled']
36
+ case GameOptions.data['sound_system']
37
+ when 'win32-sound', 'feep'
38
+ require_relative 'audio_cues'
39
+ AudioCues.cues
40
+ when 'bloops'
41
+ require_relative 'bloops_cues'
42
+ BloopsCues.cues
43
+ end
29
44
  end
30
45
  end
31
46
 
@@ -35,19 +50,23 @@ module Gemwarrior
35
50
  when 'win32-sound'
36
51
  require_relative 'audio_cues'
37
52
  require_relative 'musical_notes'
38
- Thread.start do
39
- AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
40
- threads = []
41
- seq[:frequencies].split(',').each do |note|
42
- threads << Thread.new do
43
- Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], GameOptions.data['sound_volume'])
53
+
54
+ if AudioCues.cues[audio_cue_symbol]
55
+ Thread.start do
56
+ AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
57
+ threads = []
58
+ seq[:frequencies].split(',').each do |note|
59
+ threads << Thread.new do
60
+ Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], GameOptions.data['sound_volume'])
61
+ end
44
62
  end
63
+ threads.each { |th| th.join }
45
64
  end
46
- threads.each { |th| th.join }
47
65
  end
48
66
  end
49
67
  when 'feep'
50
68
  require_relative 'audio_cues'
69
+
51
70
  feep_defaults = {
52
71
  frequencies: '440',
53
72
  waveform: 'sine',
@@ -56,40 +75,45 @@ module Gemwarrior
56
75
  notext: true
57
76
  }
58
77
 
59
- Thread.start do
60
- AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
61
- seq = feep_defaults.merge(seq)
78
+ if AudioCues.cues[audio_cue_symbol]
79
+ Thread.start do
80
+ AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
81
+ seq = feep_defaults.merge(seq)
62
82
 
63
- Feep::Base.new({
64
- freq_or_note: seq[:frequencies],
65
- waveform: seq[:waveform],
66
- volume: seq[:volume],
67
- duration: seq[:duration],
68
- notext: seq[:notext]
69
- })
83
+ Feep::Base.new({
84
+ freq_or_note: seq[:frequencies],
85
+ waveform: seq[:waveform],
86
+ volume: seq[:volume],
87
+ duration: seq[:duration],
88
+ notext: seq[:notext]
89
+ })
90
+ end
70
91
  end
71
92
  end
72
93
  when 'bloops'
73
94
  require_relative 'bloops_cues'
74
- Thread.start do
75
- BloopsCues.cues[audio_cue_symbol][:synth].each do |seq|
76
- threads = []
77
95
 
78
- seq.each do |note|
79
- threads << Thread.new do
80
- b = Bloops.new
81
- b.tempo = 240
82
- snd = b.sound Bloops::SQUARE
83
- snd.punch = GameOptions.data['sound_volume']/2
84
- snd.sustain = 0.7
85
- snd.decay = 0.2
86
- b.tune snd, note[1]
87
- b.play
88
- sleep 0.1 while !b.stopped?
96
+ if BloopsCues.cues[audio_cue_symbol]
97
+ Thread.start do
98
+ BloopsCues.cues[audio_cue_symbol][:synth].each do |seq|
99
+ threads = []
100
+
101
+ seq.each do |note|
102
+ threads << Thread.new do
103
+ b = Bloops.new
104
+ b.tempo = 240
105
+ snd = b.sound Bloops::SQUARE
106
+ snd.punch = GameOptions.data['sound_volume']/2
107
+ snd.sustain = 0.7
108
+ snd.decay = 0.2
109
+ b.tune snd, note[1]
110
+ b.play
111
+ sleep 0.1 while !b.stopped?
112
+ end
89
113
  end
90
- end
91
114
 
92
- threads.each { |th| th.join }
115
+ threads.each { |th| th.join }
116
+ end
93
117
  end
94
118
  end
95
119
  end
@@ -7,7 +7,7 @@ module Gemwarrior
7
7
  @@cues ||= {}
8
8
  @@cues[key] = val
9
9
  end
10
-
10
+
11
11
  def self.cues
12
12
  @@cues ||= {}
13
13
  end
@@ -33,7 +33,7 @@ module Gemwarrior
33
33
  ],
34
34
  sample: 'bg1.wav'
35
35
  }
36
-
36
+
37
37
  self.add :battle_start, {
38
38
  synth: [
39
39
  { frequencies: 'G4', duration: 50 },
@@ -93,15 +93,17 @@ module Gemwarrior
93
93
 
94
94
  self.add :intro, {
95
95
  synth: [
96
- { frequencies: 'C3,G4', duration: 50 },
97
- { frequencies: 'D3,A4', duration: 50 },
98
- { frequencies: 'E3,B4', duration: 50 },
99
- { frequencies: 'F3,C5', duration: 50 },
96
+ { frequencies: 'C4,G4', duration: 350 },
97
+ { frequencies: 'D3,A4', duration: 85 },
98
+ { frequencies: 'E3,B4', duration: 85 },
99
+ { frequencies: 'F3,C5', duration: 170 },
100
+ { frequencies: 'F3,C5', duration: 170 },
101
+ { frequencies: 'F3,C5', duration: 170 },
100
102
  { frequencies: 'G3,B4,D5', duration: 350 }
101
103
  ],
102
104
  sample: 'intro.wav'
103
105
  }
104
-
106
+
105
107
  self.add :player_level_up, {
106
108
  synth: [
107
109
  { frequencies: 'D4,A4,D5,A5,D6', duration: 100 },
@@ -129,6 +131,52 @@ module Gemwarrior
129
131
  sample: 'player_travel.wav'
130
132
  }
131
133
 
134
+ self.add :player_travel_east, {
135
+ synth: [
136
+ { frequencies: 'E4', duration: 75 },
137
+ { frequencies: 'G4', duration: 75 },
138
+ { frequencies: 'E4', duration: 75 }
139
+ ],
140
+ sample: 'player_travel_east.wav'
141
+ }
142
+
143
+ self.add :player_travel_north, {
144
+ synth: [
145
+ { frequencies: 'C4', duration: 75 },
146
+ { frequencies: 'D4', duration: 75 },
147
+ { frequencies: 'E4', duration: 75 }
148
+ ],
149
+ sample: 'player_travel_north.wav'
150
+ }
151
+
152
+ self.add :player_travel_south, {
153
+ synth: [
154
+ { frequencies: 'E4', duration: 75 },
155
+ { frequencies: 'D4', duration: 75 },
156
+ { frequencies: 'C4', duration: 75 }
157
+ ],
158
+ sample: 'player_travel_south.wav'
159
+ }
160
+
161
+ self.add :player_travel_west, {
162
+ synth: [
163
+ { frequencies: 'C4', duration: 75 },
164
+ { frequencies: 'A3', duration: 75 },
165
+ { frequencies: 'C4', duration: 75 }
166
+ ],
167
+ sample: 'player_travel_west.wav'
168
+ }
169
+
170
+ self.add :test, {
171
+ synth: [
172
+ { frequencies: 'F4', duration: 75 },
173
+ { frequencies: 'E5', duration: 75 },
174
+ { frequencies: 'C5', duration: 75 },
175
+ { frequencies: 'E5', duration: 75 }
176
+ ],
177
+ sample: 'test.wav'
178
+ }
179
+
132
180
  self.add :uncover_secret, {
133
181
  synth: [
134
182
  { frequencies: 'F5', duration: 150 },
@@ -7,7 +7,7 @@ module Gemwarrior
7
7
  @@cues ||= {}
8
8
  @@cues[key] = val
9
9
  end
10
-
10
+
11
11
  def self.cues
12
12
  @@cues ||= {}
13
13
  end
@@ -33,7 +33,7 @@ module Gemwarrior
33
33
  ],
34
34
  sample: 'bg1.wav'
35
35
  }
36
-
36
+
37
37
  self.add :battle_start, {
38
38
  synth: [
39
39
  { s1: '16:G4' },
@@ -93,15 +93,17 @@ module Gemwarrior
93
93
 
94
94
  self.add :intro, {
95
95
  synth: [
96
- { s1: '16:C3', s2: '16:G4' },
96
+ { s1: '4:C4', s2: '4:G4' },
97
97
  { s1: '16:D3', s2: '16:A4' },
98
98
  { s1: '16:E3', s2: '16:B4' },
99
- { s1: '16:F3', s2: '16:C5' },
99
+ { s1: '8:F3', s2: '8:C5' },
100
+ { s1: '8:F3', s2: '8:C5' },
101
+ { s1: '8:F3', s2: '8:C5' },
100
102
  { s1: '4:G3', s2: '4:B4', s3: '4:D5' }
101
103
  ],
102
104
  sample: 'intro.wav'
103
105
  }
104
-
106
+
105
107
  self.add :player_level_up, {
106
108
  synth: [
107
109
  { s1: '8:D4', s2: '8:A4', s3: '8:D5', s4: '8:A5', s5: '8:D6' },
@@ -129,6 +131,52 @@ module Gemwarrior
129
131
  sample: 'player_travel.wav'
130
132
  }
131
133
 
134
+ self.add :player_travel_east, {
135
+ synth: [
136
+ { s1: '16:E4' },
137
+ { s1: '16:G4' },
138
+ { s1: '16:E4' }
139
+ ],
140
+ sample: 'player_travel_east.wav'
141
+ }
142
+
143
+ self.add :player_travel_north, {
144
+ synth: [
145
+ { s1: '16:C4' },
146
+ { s1: '16:D4' },
147
+ { s1: '16:E4' }
148
+ ],
149
+ sample: 'player_travel_north.wav'
150
+ }
151
+
152
+ self.add :player_travel_south, {
153
+ synth: [
154
+ { s1: '16:E4' },
155
+ { s1: '16:D4' },
156
+ { s1: '16:C4' }
157
+ ],
158
+ sample: 'player_travel_south.wav'
159
+ }
160
+
161
+ self.add :player_travel_west, {
162
+ synth: [
163
+ { s1: '16:C4' },
164
+ { s1: '16:A4' },
165
+ { s1: '16:C4' }
166
+ ],
167
+ sample: 'player_travel_west.wav'
168
+ }
169
+
170
+ self.add :test, {
171
+ synth: [
172
+ { s1: '4:F4' },
173
+ { s1: '4:E5' },
174
+ { s1: '4:C5' },
175
+ { s1: '4:E5' }
176
+ ],
177
+ sample: 'test.wav'
178
+ }
179
+
132
180
  self.add :uncover_secret, {
133
181
  synth: [
134
182
  { s1: '8:F5' },