gemwarrior 0.10.8 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gemwarrior +0 -0
- data/data/default_world.yaml +282 -436
- data/gemwarrior.gemspec +1 -1
- data/lib/gemwarrior/arena.rb +17 -17
- data/lib/gemwarrior/battle.rb +146 -77
- data/lib/gemwarrior/entities/armor.rb +34 -0
- data/lib/gemwarrior/entities/armor/iron_helmet.rb +17 -0
- data/lib/gemwarrior/entities/creature.rb +81 -4
- data/lib/gemwarrior/entities/creatures/cow.rb +24 -0
- data/lib/gemwarrior/entities/{items → creatures}/goat.rb +9 -11
- data/lib/gemwarrior/entities/creatures/pig.rb +24 -0
- data/lib/gemwarrior/entities/entity.rb +59 -5
- data/lib/gemwarrior/entities/item.rb +10 -22
- data/lib/gemwarrior/entities/items/apple.rb +2 -5
- data/lib/gemwarrior/entities/items/arena_door.rb +2 -6
- data/lib/gemwarrior/entities/items/bed.rb +7 -11
- data/lib/gemwarrior/entities/items/bookcase.rb +57 -0
- data/lib/gemwarrior/entities/items/bullet.rb +25 -0
- data/lib/gemwarrior/entities/items/couch.rb +6 -10
- data/lib/gemwarrior/entities/items/cup.rb +2 -5
- data/lib/gemwarrior/entities/items/dehumidifier.rb +3 -6
- data/lib/gemwarrior/entities/items/feather.rb +2 -5
- data/lib/gemwarrior/entities/items/floor_tile.rb +6 -10
- data/lib/gemwarrior/entities/items/flower.rb +1 -4
- data/lib/gemwarrior/entities/items/herb.rb +12 -13
- data/lib/gemwarrior/entities/items/keystone.rb +2 -5
- data/lib/gemwarrior/entities/items/ladder.rb +7 -11
- data/lib/gemwarrior/entities/items/letter.rb +20 -23
- data/lib/gemwarrior/entities/items/map.rb +3 -6
- data/lib/gemwarrior/entities/items/massive_door.rb +3 -7
- data/lib/gemwarrior/entities/items/pedestal.rb +6 -10
- data/lib/gemwarrior/entities/items/pond.rb +4 -8
- data/lib/gemwarrior/entities/items/rope.rb +4 -8
- data/lib/gemwarrior/entities/items/small_hole.rb +15 -77
- data/lib/gemwarrior/entities/items/snowman.rb +5 -9
- data/lib/gemwarrior/entities/items/sparkly_thing.rb +3 -7
- data/lib/gemwarrior/entities/items/stonemite.rb +2 -6
- data/lib/gemwarrior/entities/items/tent.rb +3 -6
- data/lib/gemwarrior/entities/items/throne.rb +7 -6
- data/lib/gemwarrior/entities/items/tree.rb +2 -6
- data/lib/gemwarrior/entities/items/waterfall.rb +9 -8
- data/lib/gemwarrior/entities/location.rb +49 -43
- data/lib/gemwarrior/entities/monster.rb +34 -28
- data/lib/gemwarrior/entities/monsters/alexandrat.rb +3 -3
- data/lib/gemwarrior/entities/monsters/amberoo.rb +3 -3
- data/lib/gemwarrior/entities/monsters/amethystle.rb +3 -3
- data/lib/gemwarrior/entities/monsters/apatiger.rb +3 -3
- data/lib/gemwarrior/entities/monsters/aquamarine.rb +3 -3
- data/lib/gemwarrior/entities/monsters/bloodstorm.rb +3 -3
- data/lib/gemwarrior/entities/monsters/bosses/emerald.rb +12 -27
- data/lib/gemwarrior/entities/monsters/bosses/garynetty.rb +17 -5
- data/lib/gemwarrior/entities/monsters/bosses/jaspern.rb +66 -0
- data/lib/gemwarrior/entities/monsters/citrinaga.rb +3 -3
- data/lib/gemwarrior/entities/monsters/coraliz.rb +3 -3
- data/lib/gemwarrior/entities/monsters/cubicat.rb +3 -3
- data/lib/gemwarrior/entities/monsters/diaman.rb +3 -3
- data/lib/gemwarrior/entities/{items → people}/arena_master.rb +8 -13
- data/lib/gemwarrior/entities/{items → people}/drunk_man.rb +14 -35
- data/lib/gemwarrior/entities/people/queen_ruby.rb +71 -0
- data/lib/gemwarrior/entities/people/rockney.rb +132 -0
- data/lib/gemwarrior/entities/{items → people}/shifty_woman.rb +7 -12
- data/lib/gemwarrior/entities/{items → people}/thin_man.rb +9 -14
- data/lib/gemwarrior/entities/people/ware_hawker.rb +153 -0
- data/lib/gemwarrior/entities/person.rb +20 -0
- data/lib/gemwarrior/entities/player.rb +102 -60
- data/lib/gemwarrior/entities/weapon.rb +38 -0
- data/lib/gemwarrior/entities/{items → weapons}/dagger.rb +5 -7
- data/lib/gemwarrior/entities/{items → weapons}/gun.rb +8 -10
- data/lib/gemwarrior/entities/{items → weapons}/mace.rb +6 -9
- data/lib/gemwarrior/entities/{items → weapons}/opalaser.rb +5 -7
- data/lib/gemwarrior/entities/weapons/spear.rb +23 -0
- data/lib/gemwarrior/entities/{items → weapons}/stalactite.rb +5 -7
- data/lib/gemwarrior/entities/weapons/stone.rb +23 -0
- data/lib/gemwarrior/evaluator.rb +111 -107
- data/lib/gemwarrior/game.rb +61 -29
- data/lib/gemwarrior/game_assets.rb +76 -0
- data/lib/gemwarrior/inventory.rb +77 -43
- data/lib/gemwarrior/misc/animation.rb +17 -13
- data/lib/gemwarrior/misc/{music.rb → audio.rb} +15 -7
- data/lib/gemwarrior/misc/audio_cues.rb +133 -0
- data/lib/gemwarrior/misc/formatting.rb +9 -9
- data/lib/gemwarrior/misc/player_levels.rb +21 -0
- data/lib/gemwarrior/repl.rb +32 -31
- data/lib/gemwarrior/version.rb +1 -1
- data/lib/gemwarrior/world.rb +155 -134
- metadata +34 -22
- data/lib/gemwarrior/entities/items/cow.rb +0 -26
- data/lib/gemwarrior/entities/items/pig.rb +0 -26
- data/lib/gemwarrior/entities/items/queen_ruby.rb +0 -62
- data/lib/gemwarrior/entities/items/spear.rb +0 -26
- data/lib/gemwarrior/entities/items/stone.rb +0 -25
- data/lib/gemwarrior/entities/items/ware_hawker.rb +0 -93
@@ -1,19 +1,27 @@
|
|
1
|
-
# lib/gemwarrior/misc/
|
2
|
-
#
|
1
|
+
# lib/gemwarrior/misc/audio.rb
|
2
|
+
# Audio cues using either synth or samples
|
3
|
+
# Synth: win32-sound or feep, depending on platform
|
4
|
+
# Samples: small wav files
|
3
5
|
|
4
6
|
require_relative '../game_options'
|
7
|
+
require_relative 'audio_cues'
|
8
|
+
require_relative 'musical_notes'
|
5
9
|
|
6
10
|
module Gemwarrior
|
7
|
-
module
|
8
|
-
def self.
|
11
|
+
module Audio
|
12
|
+
def self.play_sample(audio_cue_symbol)
|
13
|
+
# future use
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.play_synth(audio_cue_symbol)
|
9
17
|
if GameOptions.data['sound_enabled']
|
10
18
|
# if Windows, use superior win32-sound library
|
11
19
|
if GameOptions.data['sound_system'].eql?('win32-sound')
|
12
20
|
require 'win32/sound'
|
13
21
|
require_relative 'musical_notes'
|
14
|
-
|
22
|
+
|
15
23
|
Thread.start do
|
16
|
-
|
24
|
+
AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
|
17
25
|
threads = []
|
18
26
|
seq[:frequencies].split(',').each do |note|
|
19
27
|
threads << Thread.new do
|
@@ -36,7 +44,7 @@ module Gemwarrior
|
|
36
44
|
}
|
37
45
|
|
38
46
|
Thread.start do
|
39
|
-
|
47
|
+
AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
|
40
48
|
seq = feep_defaults.merge(seq)
|
41
49
|
|
42
50
|
Feep::Base.new({
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# lib/gemwarrior/misc/audio_cues.rb
|
2
|
+
# Audio cue symbol -> notes/wav_file
|
3
|
+
|
4
|
+
module Gemwarrior
|
5
|
+
module AudioCues
|
6
|
+
def self.add key, val
|
7
|
+
@@cues ||= {}
|
8
|
+
@@cues[key] = val
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.cues
|
12
|
+
@@cues ||= {}
|
13
|
+
end
|
14
|
+
|
15
|
+
self.add :battle_start, {
|
16
|
+
synth: [
|
17
|
+
{ frequencies: 'G4', duration: 50 },
|
18
|
+
{ frequencies: 'G#4', duration: 50 },
|
19
|
+
{ frequencies: 'G4', duration: 50 },
|
20
|
+
{ frequencies: 'G#4', duration: 50 },
|
21
|
+
{ frequencies: 'G4', duration: 50 },
|
22
|
+
{ frequencies: 'G#4', duration: 50 }
|
23
|
+
],
|
24
|
+
sample: 'battle_start.wav'
|
25
|
+
}
|
26
|
+
|
27
|
+
self.add :battle_player_attack, {
|
28
|
+
synth: [{ frequencies: 'A4,E4,B5', duration: 75 }],
|
29
|
+
sample: 'battle_player_attack.wav'
|
30
|
+
}
|
31
|
+
|
32
|
+
self.add :battle_player_miss, {
|
33
|
+
synth: [{ frequencies: 'A4', duration: 75 }],
|
34
|
+
sample: 'battle_player_miss.wav'
|
35
|
+
}
|
36
|
+
|
37
|
+
self.add :battle_monster_attack, {
|
38
|
+
synth: [{ frequencies: 'B4,E#5,A5', duration: 75 }],
|
39
|
+
sample: 'battle_monster_attack.wav'
|
40
|
+
}
|
41
|
+
|
42
|
+
self.add :battle_monster_miss, {
|
43
|
+
synth: [{ frequencies: 'B4', duration: 75 }],
|
44
|
+
sample: 'battle_monster_miss.wav'
|
45
|
+
}
|
46
|
+
|
47
|
+
self.add :battle_win_boss, {
|
48
|
+
synth: [
|
49
|
+
{ frequencies: 'E5', duration: 50 },
|
50
|
+
{ frequencies: 'F5', duration: 50 },
|
51
|
+
{ frequencies: 'E5', duration: 100 },
|
52
|
+
{ frequencies: 'E5', duration: 50 },
|
53
|
+
{ frequencies: 'F5', duration: 50 },
|
54
|
+
{ frequencies: 'E5', duration: 100 },
|
55
|
+
{ frequencies: 'E4,A4', duration: 50 },
|
56
|
+
{ frequencies: 'E4,A4', duration: 200 }
|
57
|
+
],
|
58
|
+
sample: 'battle_win_boss.wav'
|
59
|
+
}
|
60
|
+
|
61
|
+
self.add :battle_win_monster, {
|
62
|
+
synth: [
|
63
|
+
{ frequencies: 'D5', duration: 50 },
|
64
|
+
{ frequencies: 'E5', duration: 50 },
|
65
|
+
{ frequencies: 'D5', duration: 100 },
|
66
|
+
{ frequencies: 'D4', duration: 50 },
|
67
|
+
{ frequencies: 'D4', duration: 200 }
|
68
|
+
],
|
69
|
+
sample: 'battle_win_monster.wav'
|
70
|
+
}
|
71
|
+
|
72
|
+
self.add :intro, {
|
73
|
+
synth: [
|
74
|
+
{ frequencies: 'A3,E5', duration: 50 },
|
75
|
+
{ frequencies: 'B3,F5', duration: 50 },
|
76
|
+
{ frequencies: 'C4,G5', duration: 50 },
|
77
|
+
{ frequencies: 'D4,A5', duration: 50 },
|
78
|
+
{ frequencies: 'E4,B5', duration: 50 },
|
79
|
+
{ frequencies: 'F4,C6', duration: 50 },
|
80
|
+
{ frequencies: 'G4,B5,D6', duration: 500 }
|
81
|
+
],
|
82
|
+
sample: 'intro.wav'
|
83
|
+
}
|
84
|
+
|
85
|
+
self.add :player_level_up, {
|
86
|
+
synth: [
|
87
|
+
{ frequencies: 'D4,A4,D5,A5,D6', duration: 100 },
|
88
|
+
{ frequencies: 'D4,A4,D5,A5,D6', duration: 350 },
|
89
|
+
{ frequencies: 'E4,B4,E5,B5,E6', duration: 500 }
|
90
|
+
]
|
91
|
+
}
|
92
|
+
|
93
|
+
self.add :player_resurrection, {
|
94
|
+
synth: [
|
95
|
+
{ frequencies: 'D#5', duration: 100 },
|
96
|
+
{ frequencies: 'A4', duration: 150 },
|
97
|
+
{ frequencies: 'F#4', duration: 200 },
|
98
|
+
{ frequencies: 'F4', duration: 1000 }
|
99
|
+
],
|
100
|
+
sample: 'player_resurrection.wav'
|
101
|
+
}
|
102
|
+
|
103
|
+
self.add :player_travel, {
|
104
|
+
synth: [
|
105
|
+
{ frequencies: 'C4', duration: 75 },
|
106
|
+
{ frequencies: 'D4', duration: 75 },
|
107
|
+
{ frequencies: 'E4', duration: 75 }
|
108
|
+
],
|
109
|
+
sample: 'player_travel.wav'
|
110
|
+
}
|
111
|
+
|
112
|
+
self.add :win_game, {
|
113
|
+
synth: [
|
114
|
+
{ frequencies: 'G3', duration: 250 },
|
115
|
+
{ frequencies: 'A3', duration: 50 },
|
116
|
+
{ frequencies: 'B3', duration: 50 },
|
117
|
+
{ frequencies: 'C4', duration: 50 },
|
118
|
+
{ frequencies: 'D4', duration: 250 },
|
119
|
+
{ frequencies: 'E4', duration: 50 },
|
120
|
+
{ frequencies: 'F#4', duration: 50 },
|
121
|
+
{ frequencies: 'G4', duration: 50 },
|
122
|
+
{ frequencies: 'A4', duration: 250 },
|
123
|
+
{ frequencies: 'B4', duration: 50 },
|
124
|
+
{ frequencies: 'C5', duration: 50 },
|
125
|
+
{ frequencies: 'D5', duration: 50 },
|
126
|
+
{ frequencies: 'E5', duration: 50 },
|
127
|
+
{ frequencies: 'F#5', duration: 50 },
|
128
|
+
{ frequencies: 'G5', duration: 1000 }
|
129
|
+
],
|
130
|
+
sample: 'win_game.wav'
|
131
|
+
}
|
132
|
+
end
|
133
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module Gemwarrior
|
5
5
|
module Formatting
|
6
|
-
def self.upstyle(str_arr)
|
6
|
+
def self.upstyle(str_arr, no_space = false)
|
7
7
|
if str_arr.is_a? Array
|
8
8
|
str_arr_upstyled = []
|
9
9
|
|
@@ -11,15 +11,15 @@ module Gemwarrior
|
|
11
11
|
str_arr_item_upstyled = []
|
12
12
|
|
13
13
|
str_arr_item.split(' ').each do |s|
|
14
|
-
str_arr_item_upstyled << upstyle_string(s)
|
14
|
+
str_arr_item_upstyled << upstyle_string(s, no_space)
|
15
15
|
end
|
16
16
|
|
17
17
|
str_arr_upstyled << str_arr_item_upstyled.join(' ')
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
str_arr_upstyled
|
21
21
|
else
|
22
|
-
|
22
|
+
upstyle_string(str_arr, no_space)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -35,24 +35,24 @@ module Gemwarrior
|
|
35
35
|
end
|
36
36
|
words_hooched << w
|
37
37
|
end
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
words_hooched.join(' ')
|
40
40
|
end
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
|
-
def self.upstyle_string(s)
|
44
|
+
def self.upstyle_string(s, no_space)
|
45
45
|
s_upstyle = ''
|
46
46
|
s_upstyle << s[0].upcase
|
47
47
|
1.upto(s.length-1) do |i|
|
48
48
|
if s[i-1].eql?('_')
|
49
|
-
s_upstyle[i-1] = ' '
|
49
|
+
s_upstyle[i-1] = no_space ? '' : ' '
|
50
50
|
s_upstyle << s[i].upcase
|
51
51
|
else
|
52
52
|
s_upstyle << s[i].downcase
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
s_upstyle
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -61,6 +61,14 @@ module Gemwarrior
|
|
61
61
|
defense: 15, dexterity: 16,
|
62
62
|
special_abilities: :break_through
|
63
63
|
}
|
64
|
+
else
|
65
|
+
{
|
66
|
+
level: 8, xp_start: 10000,
|
67
|
+
hp_max: 200, stam_max: 200,
|
68
|
+
atk_lo: 50, atk_hi: 100,
|
69
|
+
defense: 50, dexterity: 100,
|
70
|
+
special_abilities: nil
|
71
|
+
}
|
64
72
|
end
|
65
73
|
end
|
66
74
|
|
@@ -79,6 +87,19 @@ module Gemwarrior
|
|
79
87
|
6
|
80
88
|
elsif xp < 10000
|
81
89
|
7
|
90
|
+
else
|
91
|
+
8
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.get_ability_description(ability)
|
96
|
+
case ability
|
97
|
+
when :rocking_vision
|
98
|
+
'Allows you to see the enemy hit points while in battle.'
|
99
|
+
when :rock_slide
|
100
|
+
'Adds a random boost to the player\'s attack in battle.'
|
101
|
+
else
|
102
|
+
'Unsure, but it\'s probably cool!'
|
82
103
|
end
|
83
104
|
end
|
84
105
|
end
|
data/lib/gemwarrior/repl.rb
CHANGED
@@ -17,7 +17,7 @@ module Gemwarrior
|
|
17
17
|
class Repl
|
18
18
|
# CONSTANTS
|
19
19
|
QUIT_MESSAGE = 'Temporal flux detected. Shutting down...'.colorize(:red)
|
20
|
-
MAIN_MENU_QUIT_MESSAGE = 'Giving up so soon? Jool will be waiting...'.colorize(:
|
20
|
+
MAIN_MENU_QUIT_MESSAGE = 'Giving up so soon? Jool will be waiting...'.colorize(:red)
|
21
21
|
SPLASH_MESSAGE = 'Welcome to *Jool*, where randomized fortune is just as likely as mayhem.'
|
22
22
|
GITHUB_NAME = 'michaelchadwick'
|
23
23
|
GITHUB_PROJECT = 'gemwarrior'
|
@@ -48,7 +48,7 @@ module Gemwarrior
|
|
48
48
|
prompt
|
49
49
|
begin
|
50
50
|
input = read_line
|
51
|
-
result = evaluator.
|
51
|
+
result = evaluator.parse(input)
|
52
52
|
if result.eql?('exit')
|
53
53
|
exit
|
54
54
|
elsif result.eql?('checkupdate')
|
@@ -161,7 +161,7 @@ module Gemwarrior
|
|
161
161
|
print_options
|
162
162
|
when '4'
|
163
163
|
print answer
|
164
|
-
GameOptions.data['use_wordnik']= !GameOptions.data['use_wordnik']
|
164
|
+
GameOptions.data['use_wordnik'] = !GameOptions.data['use_wordnik']
|
165
165
|
print_options
|
166
166
|
else
|
167
167
|
print answer
|
@@ -180,7 +180,7 @@ module Gemwarrior
|
|
180
180
|
print ' (2) FEEP '
|
181
181
|
print '(SELECTED)'.colorize(:yellow) if GameOptions.data['sound_system'].eql?('feep')
|
182
182
|
print "\n"
|
183
|
-
puts
|
183
|
+
puts
|
184
184
|
puts 'Enter option number to select sound system, or any other key to exit.'
|
185
185
|
puts 'Note: win32-sound only works on Windows and will break the game is sound is enabled on non-Windows machines. Feep is cross-platform, but very slow and buggy, so use at your discretion!'
|
186
186
|
puts
|
@@ -198,7 +198,7 @@ module Gemwarrior
|
|
198
198
|
return
|
199
199
|
end
|
200
200
|
end
|
201
|
-
|
201
|
+
|
202
202
|
def display_log_of_attempts
|
203
203
|
if File.exist?(GameOptions.data['log_file_path']) and !File.zero?(GameOptions.data['log_file_path'])
|
204
204
|
File.open(GameOptions.data['log_file_path']).readlines.each do |line|
|
@@ -284,7 +284,7 @@ module Gemwarrior
|
|
284
284
|
result = resume_game
|
285
285
|
if result.nil?
|
286
286
|
run_main_menu
|
287
|
-
|
287
|
+
else
|
288
288
|
self.world = result
|
289
289
|
self.evaluator = Evaluator.new(self.world)
|
290
290
|
return
|
@@ -316,7 +316,7 @@ module Gemwarrior
|
|
316
316
|
game.update_options_file
|
317
317
|
exit
|
318
318
|
else
|
319
|
-
run_main_menu(show_choices
|
319
|
+
run_main_menu(show_choices: false)
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
@@ -345,7 +345,7 @@ module Gemwarrior
|
|
345
345
|
|
346
346
|
# log stats to file in home directory
|
347
347
|
File.open(GameOptions.data['log_file_path'], 'a') do |f|
|
348
|
-
f.write "#{Time.now} #{pl.name.rjust(
|
348
|
+
f.write "#{Time.now} #{pl.name.rjust(13)} - V:#{Gemwarrior::VERSION} LV:#{pl.level} XP:#{pl.xp} $:#{pl.rox} MK:#{pl.monsters_killed} BK:#{pl.bosses_killed} ITM:#{pl.items_taken} MOV:#{pl.movements_made} RST:#{pl.rests_taken} DTH:#{pl.deaths}\n"
|
349
349
|
end
|
350
350
|
end
|
351
351
|
|
@@ -355,11 +355,11 @@ module Gemwarrior
|
|
355
355
|
|
356
356
|
if mode.eql? 'Y'
|
357
357
|
File.open(GameOptions.data['save_file_yaml_path'], 'w') do |f|
|
358
|
-
f.write YAML
|
358
|
+
f.write YAML.dump(world)
|
359
359
|
end
|
360
360
|
elsif mode.eql? 'M'
|
361
361
|
File.open(GameOptions.data['save_file_bin_path'], 'w') do |f|
|
362
|
-
f.write Marshal
|
362
|
+
f.write Marshal.dump(world)
|
363
363
|
end
|
364
364
|
else
|
365
365
|
puts 'Error: Save file mode not set. Game not saved.'
|
@@ -378,7 +378,7 @@ module Gemwarrior
|
|
378
378
|
false
|
379
379
|
end
|
380
380
|
end
|
381
|
-
|
381
|
+
|
382
382
|
def resume_game
|
383
383
|
mode = GameOptions.data['save_file_mode']
|
384
384
|
puts 'Resuming game...'
|
@@ -386,7 +386,7 @@ module Gemwarrior
|
|
386
386
|
if mode.eql? 'Y'
|
387
387
|
if File.exist?(GameOptions.data['save_file_yaml_path'])
|
388
388
|
File.open(GameOptions.data['save_file_yaml_path'], 'r') do |f|
|
389
|
-
return YAML
|
389
|
+
return YAML.load(f)
|
390
390
|
end
|
391
391
|
else
|
392
392
|
puts 'No save file exists.'
|
@@ -395,7 +395,7 @@ module Gemwarrior
|
|
395
395
|
elsif mode.eql? 'M'
|
396
396
|
if File.exist?(GameOptions.data['save_file_marshal_path'])
|
397
397
|
File.open(GameOptions.data['save_file_marshal_path'], 'r') do |f|
|
398
|
-
return Marshal
|
398
|
+
return Marshal.load(f)
|
399
399
|
end
|
400
400
|
else
|
401
401
|
puts 'No save file exists.'
|
@@ -407,17 +407,17 @@ module Gemwarrior
|
|
407
407
|
def overwrite_save?
|
408
408
|
mode = GameOptions.data['save_file_mode']
|
409
409
|
save_file_path = ''
|
410
|
-
|
410
|
+
|
411
411
|
if mode.eql? 'Y'
|
412
412
|
save_file_path = GameOptions.data['save_file_yaml_path']
|
413
413
|
elsif mode.eql? 'M'
|
414
414
|
save_file_path = GameOptions.data['save_file_marshal_path']
|
415
415
|
end
|
416
|
-
|
416
|
+
|
417
417
|
if File.exist?(save_file_path)
|
418
418
|
print 'Overwrite existing save file? (y/n) '
|
419
419
|
answer = gets.chomp.downcase
|
420
|
-
|
420
|
+
|
421
421
|
case answer
|
422
422
|
when 'y', 'yes'
|
423
423
|
puts 'New game started! Press any key to continue.'
|
@@ -452,10 +452,7 @@ module Gemwarrior
|
|
452
452
|
end
|
453
453
|
|
454
454
|
def play_intro_tune
|
455
|
-
|
456
|
-
{ frequencies: 'A3,E4,C#5,E5', duration: 300 },
|
457
|
-
{ frequencies: 'A3,E4,C#5,F#5', duration: 600 }
|
458
|
-
])
|
455
|
+
Audio.play_synth(:intro)
|
459
456
|
end
|
460
457
|
|
461
458
|
def setup_screen(initial_command = nil, extra_command = nil, new_skip = false, resume_skip = false)
|
@@ -472,7 +469,7 @@ module Gemwarrior
|
|
472
469
|
result = resume_game
|
473
470
|
if result.nil?
|
474
471
|
run_main_menu
|
475
|
-
|
472
|
+
else
|
476
473
|
self.world = result
|
477
474
|
self.evaluator = Evaluator.new(self.world)
|
478
475
|
end
|
@@ -481,15 +478,19 @@ module Gemwarrior
|
|
481
478
|
end
|
482
479
|
|
483
480
|
# hook to do something right off the bat
|
484
|
-
puts evaluator.
|
485
|
-
puts evaluator.
|
481
|
+
puts evaluator.parse(initial_command) unless initial_command.nil?
|
482
|
+
puts evaluator.parse(extra_command) unless extra_command.nil?
|
486
483
|
end
|
487
484
|
|
488
485
|
def prompt
|
489
|
-
prompt_template =
|
490
|
-
|
491
|
-
|
492
|
-
|
486
|
+
prompt_template = "\n"
|
487
|
+
prompt_template += "[LV:%2s][XP:%3s][ROX:%3s] [HP:%3s/%-3s][STM:%2s/%-2s] [".colorize(:yellow)
|
488
|
+
prompt_template += "%s".colorize(:green)
|
489
|
+
prompt_template += " @ ".colorize(:yellow)
|
490
|
+
prompt_template += "%s".colorize(:cyan)
|
491
|
+
prompt_template += "]".colorize(:yellow)
|
492
|
+
prompt_template += "[%s, %s, %s]".colorize(:yellow) if GameOptions.data['debug_mode']
|
493
|
+
|
493
494
|
prompt_vars_arr = [
|
494
495
|
world.player.level,
|
495
496
|
world.player.xp,
|
@@ -499,18 +500,18 @@ module Gemwarrior
|
|
499
500
|
world.player.stam_cur,
|
500
501
|
world.player.stam_max,
|
501
502
|
world.player.name,
|
502
|
-
world.location_by_coords(world.player.cur_coords).
|
503
|
+
world.location_by_coords(world.player.cur_coords).name_display
|
503
504
|
]
|
504
505
|
if GameOptions.data['debug_mode']
|
505
506
|
prompt_vars_arr.push(world.player.cur_coords[:x], world.player.cur_coords[:y], world.player.cur_coords[:z])
|
506
507
|
end
|
507
|
-
print (prompt_template % prompt_vars_arr)
|
508
|
+
print (prompt_template % prompt_vars_arr)
|
508
509
|
print "\n"
|
509
510
|
end
|
510
511
|
|
511
512
|
def command_exists?(cmd)
|
512
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).collect { |d|
|
513
|
-
Dir.entries d if Dir.exist? d
|
513
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).collect { |d|
|
514
|
+
Dir.entries d if Dir.exist? d
|
514
515
|
}.flatten.include?(cmd)
|
515
516
|
end
|
516
517
|
end
|