gemwarrior 0.15.5 → 0.15.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -22,7 +22,7 @@ module Gemwarrior
22
22
  end
23
23
 
24
24
  def use(world)
25
- 'Save the brrandishing of your weapon for battle.'
25
+ 'Save the brandishing of your weapon for battle.'
26
26
  end
27
27
 
28
28
  def describe_detailed
@@ -80,8 +80,8 @@ module Gemwarrior
80
80
  'Rest, but ensure battle for testing'
81
81
  ]
82
82
 
83
- self.commands = %w(character look rest take talk inventory use drop equip unequip go north east south west attack breakthru change version checkupdate help quit quit!)
84
- self.aliases = %w(c l r t tk i u d eq ue g n e s w a br ch v cu h q qq)
83
+ self.commands = %w(character look rest take talk inventory use open drop equip unequip go north east south west attack breakthru change version checkupdate help quit quit!)
84
+ self.aliases = %w(c l r t tk i u o d eq ue g n e s w a br ch v cu h q qq)
85
85
  self.extras = %w(exit exit! x xx fight f ? ?? ???)
86
86
  self.cmd_descriptions = [
87
87
  'Display character information',
@@ -91,6 +91,7 @@ module Gemwarrior
91
91
  'Talk to person',
92
92
  'Look in your inventory',
93
93
  'Use item (in inventory or environment)',
94
+ 'Open item (in inventory or environment)',
94
95
  'Drop item',
95
96
  'Equip item',
96
97
  'Unequip item',
@@ -463,7 +464,7 @@ module Gemwarrior
463
464
  end
464
465
  end
465
466
  end
466
- when 'use', 'u'
467
+ when 'use', 'u', 'open', 'o'
467
468
  if param1.nil?
468
469
  ERROR_USE_PARAM_MISSING
469
470
  else
@@ -26,6 +26,14 @@ module Gemwarrior
26
26
  self.armor = armor
27
27
  end
28
28
 
29
+ def an_words
30
+ ['herb']
31
+ end
32
+
33
+ def article_chooser(word)
34
+ (VOWELS.include?(word.to_s[0]) or an_words.include?(word.to_s)) ? 'an' : 'a'
35
+ end
36
+
29
37
  def is_empty?
30
38
  self.items.nil? || self.items.empty?
31
39
  end
@@ -89,8 +97,7 @@ module Gemwarrior
89
97
  if q > 1
90
98
  return "You have #{q} #{i.to_s.colorize(:yellow)}#{'s'.colorize(:yellow)}."
91
99
  else
92
- article = VOWELS.include?(i[0]) ? 'an' : 'a'
93
- return "You have #{article} #{i.to_s.colorize(:yellow)}."
100
+ return "You have #{self.article_chooser(i)} #{i.to_s.colorize(:yellow)}."
94
101
  end
95
102
  # multiple items? return array of strings to mush together
96
103
  else
@@ -100,8 +107,7 @@ module Gemwarrior
100
107
  if q > 1
101
108
  item_arr.push("#{q} #{i.to_s.colorize(:yellow)}#{'s'.colorize(:yellow)}")
102
109
  else
103
- article = VOWELS.include?(i[0]) ? 'an' : 'a'
104
- item_arr.push("#{article} #{i.to_s.colorize(:yellow)}")
110
+ item_arr.push("#{self.article_chooser(i)} #{i.to_s.colorize(:yellow)}")
105
111
  end
106
112
  end
107
113
 
@@ -159,7 +165,7 @@ module Gemwarrior
159
165
  return "The #{i.name.colorize(:yellow)} has taken charge, and been equipped."
160
166
  elsif i.is_armor
161
167
  self.armor = i
162
- return "The #{i.name.colorize(:yellow)} has fortified, and has been equipped."
168
+ return "The #{i.name.colorize(:yellow)} has fortified you, and been equipped."
163
169
  end
164
170
  else
165
171
  return ERROR_ITEM_EQUIP_NONARMAMENT
@@ -7,25 +7,43 @@ require_relative '../game_options'
7
7
 
8
8
  module Gemwarrior
9
9
  module Audio
10
+ # CONSTANTS
11
+ ERROR_SOUND_NOT_ENABLED = 'Sound is disabled! Enable in main options to hear sound.'
12
+
10
13
  def self.init
11
14
  if GameOptions.data['sound_system'].eql?('win32-sound')
12
15
  begin
13
16
  require 'win32/sound'
14
- rescue LoadError => e
17
+ rescue
15
18
  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
19
  end
17
20
  elsif GameOptions.data['sound_system'].eql?('feep')
18
21
  begin
19
22
  require 'feep'
20
- rescue LoadError => e
23
+ rescue
21
24
  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
25
  end
23
26
  elsif GameOptions.data['sound_system'].eql?('bloops')
24
27
  begin
25
28
  require 'bloops'
26
- rescue LoadError => e
29
+ rescue
27
30
  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
31
  end
32
+ else
33
+ GameOptions.data['errors'] = "'#{GameOptions.data['sound_system']}' is not a valid sound system. Audio subsystem load failed."
34
+ end
35
+ end
36
+
37
+ def self.get_cues
38
+ if GameOptions.data['sound_enabled']
39
+ case GameOptions.data['sound_system']
40
+ when 'win32-sound', 'feep'
41
+ require_relative 'audio_cues'
42
+ AudioCues.cues
43
+ when 'bloops'
44
+ require_relative 'bloops_cues'
45
+ BloopsCues.cues
46
+ end
29
47
  end
30
48
  end
31
49
 
@@ -35,19 +53,23 @@ module Gemwarrior
35
53
  when 'win32-sound'
36
54
  require_relative 'audio_cues'
37
55
  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'])
56
+
57
+ if AudioCues.cues[audio_cue_symbol]
58
+ Thread.start do
59
+ AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
60
+ threads = []
61
+ seq[:frequencies].split(',').each do |note|
62
+ threads << Thread.new do
63
+ Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], GameOptions.data['sound_volume'])
64
+ end
44
65
  end
66
+ threads.each { |th| th.join }
45
67
  end
46
- threads.each { |th| th.join }
47
68
  end
48
69
  end
49
70
  when 'feep'
50
71
  require_relative 'audio_cues'
72
+
51
73
  feep_defaults = {
52
74
  frequencies: '440',
53
75
  waveform: 'sine',
@@ -56,43 +78,50 @@ module Gemwarrior
56
78
  notext: true
57
79
  }
58
80
 
59
- Thread.start do
60
- AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
61
- seq = feep_defaults.merge(seq)
81
+ if AudioCues.cues[audio_cue_symbol]
82
+ Thread.start do
83
+ AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
84
+ seq = feep_defaults.merge(seq)
62
85
 
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
- })
86
+ Feep::Base.new({
87
+ freq_or_note: seq[:frequencies],
88
+ waveform: seq[:waveform],
89
+ volume: seq[:volume],
90
+ duration: seq[:duration],
91
+ notext: seq[:notext]
92
+ })
93
+ end
70
94
  end
71
95
  end
72
96
  when 'bloops'
73
97
  require_relative 'bloops_cues'
74
- Thread.start do
75
- BloopsCues.cues[audio_cue_symbol][:synth].each do |seq|
76
- threads = []
77
98
 
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?
99
+ if BloopsCues.cues[audio_cue_symbol]
100
+ Thread.start do
101
+ BloopsCues.cues[audio_cue_symbol][:synth].each do |seq|
102
+ threads = []
103
+
104
+ seq.each do |note|
105
+ threads << Thread.new do
106
+ b = Bloops.new
107
+ b.tempo = 240
108
+ snd = b.sound Bloops::SQUARE
109
+ snd.punch = GameOptions.data['sound_volume']/2
110
+ snd.sustain = 0.7
111
+ snd.decay = 0.2
112
+ b.tune snd, note[1]
113
+ b.play
114
+ sleep 0.1 while !b.stopped?
115
+ end
89
116
  end
90
- end
91
117
 
92
- threads.each { |th| th.join }
118
+ threads.each { |th| th.join }
119
+ end
93
120
  end
94
121
  end
95
122
  end
123
+ else
124
+ GameOptions.data['errors'] = ERROR_SOUND_NOT_ENABLED
96
125
  end
97
126
  end
98
127
 
@@ -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,68 @@ 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 :resume_game, {
171
+ synth: [
172
+ { frequencies: 'C4', duration: 75 },
173
+ { frequencies: 'D4', duration: 75 },
174
+ { frequencies: 'E4', duration: 75 },
175
+ { frequencies: 'F#4', duration: 75 },
176
+ { frequencies: 'G#4', duration: 75 },
177
+ { frequencies: 'A#4', duration: 75 },
178
+ { frequencies: 'C5', duration: 75 },
179
+ { frequencies: 'D5', duration: 75 },
180
+ { frequencies: 'E5', duration: 75 },
181
+ { frequencies: 'F#5', duration: 75 }
182
+ ],
183
+ sample: 'test.wav'
184
+ }
185
+
186
+ self.add :test, {
187
+ synth: [
188
+ { frequencies: 'F4', duration: 75 },
189
+ { frequencies: 'E5', duration: 75 },
190
+ { frequencies: 'C5', duration: 75 },
191
+ { frequencies: 'E5', duration: 75 }
192
+ ],
193
+ sample: 'test.wav'
194
+ }
195
+
132
196
  self.add :uncover_secret, {
133
197
  synth: [
134
198
  { 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,62 @@ 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 :resume_game, {
171
+ synth: [
172
+ { s1: '16:C4' },
173
+ { s1: '16:D4' },
174
+ { s1: '16:E4' },
175
+ { s1: '8:F#4' }
176
+ ],
177
+ sample: 'test.wav'
178
+ }
179
+
180
+ self.add :test, {
181
+ synth: [
182
+ { s1: '4:F4' },
183
+ { s1: '4:E5' },
184
+ { s1: '4:C5' },
185
+ { s1: '4:E5' }
186
+ ],
187
+ sample: 'test.wav'
188
+ }
189
+
132
190
  self.add :uncover_secret, {
133
191
  synth: [
134
192
  { s1: '8:F5' },