gemwarrior 0.9.24 → 0.9.26

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: e9a1b18616466767287b7ffa529ea5601c8fc44b
4
- data.tar.gz: 18b96dfb87948ec1aae7b6dcc689ca61473ccf7d
3
+ metadata.gz: 107f1e7b40ef5dee781180e7ffbb1add6696bf29
4
+ data.tar.gz: 3915864403a1d5969daecc7da9e89b691acfe9bf
5
5
  SHA512:
6
- metadata.gz: 76d1391273ec80e83ed990557c69f7906a25b94a258a0d30ccc5f017dfb293ecb88ac37400ab9e59e34e0fdf9cb3ca57ca4163a950dfffa0b1f9493a2d3bdab5
7
- data.tar.gz: e36826f4e67b5e6c171d9456429f95d7b8b98d6d562cb1f76e887dddacda65dcfba9dfda7fe35091a283a9fe945273c1cb14bcd42b79fe8d78f9552bf7a2bd1f
6
+ metadata.gz: 2aa48bb8109a9264b5472d311a8fddd3666da3c5f9f2d4181e9ea2201fa5e4501378121f3b70d4b069766da968ca79f9a2cabd83da330f544ccc486df9a65a11
7
+ data.tar.gz: 5be06f477fe64a1ba59940c3bac72cb84baa0a96763e39ccf8bcdec585842d74bacec7f3f2fca09b4fa956da749432261dbcfa1c1233ce36573a6b3aaab9c977
data/data/locations.yml CHANGED
@@ -1002,7 +1002,7 @@
1002
1002
  -
1003
1003
  name: 'Sky Tower (Lounge)'
1004
1004
  description: 'Nothing but a simple couch, which looks very comfortable, exists in this corner of the tower.'
1005
- danger_level: :moderate,
1005
+ danger_level: :moderate
1006
1006
  coords:
1007
1007
  x: 9
1008
1008
  y: 8
data/gemwarrior.gemspec CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_runtime_dependency 'matrext', '~> 0.4.8'
27
27
  spec.add_runtime_dependency 'clocker', '~> 0.1.2'
28
28
  spec.add_runtime_dependency 'win32-sound', '~> 0.6.0'
29
+ spec.add_runtime_dependency 'feep', '~> 0.1.3'
29
30
  spec.add_runtime_dependency 'github_api', '~> 0.12.4'
30
31
 
31
32
  # gems for future features
@@ -17,9 +17,13 @@ module Gemwarrior
17
17
  end
18
18
 
19
19
  def use(player = nil)
20
- puts 'Your body comes to rest somewhere below the surface of the cloudy apparatus, almost as if it were floating *amongst* the couch. The feeling is heavenly, and you actually feel somewhat better after getting back up.'
21
- puts '>> You regain a hit point.'
22
- {:type => 'rest', :data => 1}
20
+ if player.at_full_hp?
21
+ puts 'You come to rest on the impossibly soft surface of the furniture, but even after a few minutes of this seemingly heavenly hedonism you don\'t feel significantly better and decide to get up again.'
22
+ else
23
+ puts 'Your body comes to rest somewhere below the surface of the cloudy apparatus, almost as if it were floating *amongst* the couch. The feeling is heavenly, and you actually feel somewhat better after getting back up.'
24
+ puts '>> You regain a hit point.'
25
+ {:type => 'rest', :data => 1}
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -1,14 +1,15 @@
1
1
  # lib/gemwarrior/misc/music.rb
2
- # Music cue
2
+ # Music cues using win32-sound
3
3
 
4
+ require 'feep'
4
5
  require 'win32/sound'
5
- include Win32
6
6
 
7
7
  require_relative 'musical_notes'
8
8
 
9
9
  module Gemwarrior
10
- module Music
10
+ module Music
11
11
  def self.cue(sequence)
12
+ # if Windows, use superior win32-sound library
12
13
  if OS.windows?
13
14
  threads = []
14
15
 
@@ -16,12 +17,35 @@ module Gemwarrior
16
17
  sequence.each do |seq|
17
18
  seq[:frequencies].split(',').each do |note|
18
19
  threads << Thread.new {
19
- Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], 0.1)
20
+ Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], 0.5)
20
21
  }
21
22
  end
22
23
  threads.each { |th| th.join }
23
24
  end
24
25
  }
26
+ # otherwise, use inferior feep library
27
+ else
28
+ feep_defaults = {
29
+ :frequencies => '440',
30
+ :waveform => 'sine',
31
+ :volume => 0.3,
32
+ :duration => 500,
33
+ :notext => true
34
+ }
35
+
36
+ Thread.start {
37
+ sequence.each do |seq|
38
+ seq = feep_defaults.merge(seq)
39
+
40
+ Feep::Base.new({
41
+ :freq_or_note => seq[:frequencies],
42
+ :waveform => seq[:waveform],
43
+ :volume => seq[:volume],
44
+ :duration => seq[:duration],
45
+ :notext => seq[:notext]
46
+ })
47
+ end
48
+ }
25
49
  end
26
50
  end
27
51
  end
@@ -218,12 +218,7 @@ module Gemwarrior
218
218
  case choice
219
219
  when 'n'
220
220
  clear_screen
221
- if world.sound
222
- Music::cue([
223
- {:frequencies => 'A3,E4,C#5,E5', :duration => 300},
224
- {:frequencies => 'A3,E4,C#5,F#5', :duration => 600}
225
- ])
226
- end
221
+ play_intro_tune
227
222
  print_splash_message
228
223
  print_fortune
229
224
  return
@@ -291,7 +286,16 @@ module Gemwarrior
291
286
  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"
292
287
  end
293
288
  end
294
-
289
+
290
+ def play_intro_tune
291
+ if world.sound
292
+ Music::cue([
293
+ {:frequencies => 'A3,E4,C#5,E5', :duration => 300},
294
+ {:frequencies => 'A3,E4,C#5,F#5', :duration => 600}
295
+ ])
296
+ end
297
+ end
298
+
295
299
  def setup_screen(initial_command = nil, extra_command = nil)
296
300
  # welcome player to game
297
301
  clear_screen
@@ -299,6 +303,7 @@ module Gemwarrior
299
303
 
300
304
  # main menu loop until new game or exit
301
305
  if world.new_game
306
+ play_intro_tune
302
307
  print_splash_message
303
308
  print_fortune
304
309
  else
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.9.24'
5
+ VERSION = '0.9.26'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.24
4
+ version: 0.9.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
@@ -114,6 +114,20 @@ dependencies:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: 0.6.0
117
+ - !ruby/object:Gem::Dependency
118
+ name: feep
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 0.1.3
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 0.1.3
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: github_api
119
133
  requirement: !ruby/object:Gem::Requirement
@@ -275,7 +289,6 @@ files:
275
289
  - lib/gemwarrior/misc/animation.rb
276
290
  - lib/gemwarrior/misc/formatting.rb
277
291
  - lib/gemwarrior/misc/music.rb
278
- - lib/gemwarrior/misc/music_exp.rb
279
292
  - lib/gemwarrior/misc/musical_notes.rb
280
293
  - lib/gemwarrior/misc/name_generator.rb
281
294
  - lib/gemwarrior/misc/player_levels.rb
@@ -1,34 +0,0 @@
1
- # lib/gemwarrior/misc/music.rb
2
- # Music cue
3
-
4
- module Gemwarrior
5
- module Music
6
- def self.cue(sequence)
7
- defaults = {
8
- :freq_or_note => 440,
9
- :waveform => 'saw',
10
- :volume => 0.3,
11
- :duration => 500,
12
- :notext => true
13
- }
14
-
15
- Thread.start {
16
- sequence.each do |note|
17
- note_to_play = note[:freq_or_note]
18
- waveform = note[:waveform].nil? ? defaults[:waveform] : note[:waveform]
19
- volume = note[:volume].nil? ? defaults[:volume] : note[:volume]
20
- duration = note[:duration].nil? ? defaults[:duration] : note[:duration]
21
- notext = note[:notext].nil? ? defaults[:notext] : note[:notext]
22
-
23
- Feep::Base.new({
24
- :freq_or_note => note_to_play,
25
- :waveform => waveform,
26
- :volume => volume,
27
- :duration => duration,
28
- :notext => notext
29
- })
30
- end
31
- }
32
- end
33
- end
34
- end