gemwarrior 0.15.14 → 0.15.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -2
- data/lib/gemwarrior/game.rb +61 -53
- data/lib/gemwarrior/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af41531f83649ddfdb29e63eb5dd8dabf1da21c4cae9874a3a531fa4559c3c22
|
4
|
+
data.tar.gz: e1249f0aec95bfabd4a8ef0e69a645bee74da5db6ce9d60aaea2bd0dae556bee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e118be36f9aa2ecbd5c22f79ac098d71f672341652ca0e92e7755ce5ca3a09f45504707607a070eec0632f36b1cfaa553d82f15d98a97b03d9c14ba8ed24874a
|
7
|
+
data.tar.gz: c77c150026e63e7ba0d8d7de76513baf01ccc6f7b5b3bfb6b6a0ccd545e72e33008ff662ea2c56be1c86dda64d1c8adebd71f69ac1dd12d5559d25f17b79c3c6
|
data/Rakefile
CHANGED
@@ -8,10 +8,11 @@ RSpec::Core::RakeTask.new(:spec) do |task|
|
|
8
8
|
end
|
9
9
|
|
10
10
|
task :deploy do |t|
|
11
|
-
file = Dir.glob("pkg/*").max_by {|f| File.mtime(f)}
|
12
|
-
|
13
11
|
sh "git push origin master"
|
14
12
|
sh "rake build"
|
13
|
+
|
14
|
+
file = Dir.glob("pkg/*").max_by {|f| File.mtime(f)}
|
15
|
+
|
15
16
|
sh "gem push #{file}"
|
16
17
|
end
|
17
18
|
|
data/lib/gemwarrior/game.rb
CHANGED
@@ -22,10 +22,10 @@ require_relative 'world'
|
|
22
22
|
module Gemwarrior
|
23
23
|
class Game
|
24
24
|
# CONSTANTS
|
25
|
-
INVENTORY_DEFAULT
|
26
|
-
INVENTORY_DEBUG
|
27
|
-
ROX_DEFAULT
|
28
|
-
ROX_DEBUG
|
25
|
+
INVENTORY_DEFAULT = Inventory.new
|
26
|
+
INVENTORY_DEBUG = Inventory.new([Herb.new, Herb.new, Herb.new])
|
27
|
+
ROX_DEFAULT = 0
|
28
|
+
ROX_DEBUG = 300
|
29
29
|
|
30
30
|
attr_accessor :world,
|
31
31
|
:evaluator,
|
@@ -35,81 +35,58 @@ module Gemwarrior
|
|
35
35
|
|
36
36
|
def initialize(options)
|
37
37
|
# set game options
|
38
|
-
|
39
|
-
GameOptions.add 'debug_mode', options.fetch(:debug_mode)
|
40
|
-
GameOptions.add 'god_mode', options.fetch(:god_mode)
|
41
|
-
GameOptions.add 'sound_enabled', options.fetch(:sound_enabled)
|
42
|
-
GameOptions.add 'sound_system', options.fetch(:sound_system)
|
43
|
-
GameOptions.add 'sound_volume', options.fetch(:sound_volume)
|
44
|
-
GameOptions.add 'use_wordnik', options.fetch(:use_wordnik)
|
45
|
-
GameOptions.add 'fight_completion', options.fetch(:fight_completion)
|
38
|
+
self.init_game_options(options)
|
46
39
|
|
47
40
|
# add classes for creatures, monsters, people, items, weapons, and armor to game
|
48
41
|
# also add them to the global GameAssets
|
49
|
-
init_creatures
|
50
|
-
init_monsters
|
51
|
-
init_people
|
52
|
-
init_items
|
53
|
-
init_weapons
|
54
|
-
init_armor
|
42
|
+
self.init_creatures
|
43
|
+
self.init_monsters
|
44
|
+
self.init_people
|
45
|
+
self.init_items
|
46
|
+
self.init_weapons
|
47
|
+
self.init_armor
|
55
48
|
|
56
49
|
# create new world based on yaml/marshall data
|
57
|
-
self.world
|
50
|
+
self.world = init_world
|
58
51
|
|
59
52
|
# update some player aspects to make more dynamic
|
60
|
-
world.player.name = world.player.generate_name
|
61
|
-
world.player.face = world.player.generate_face
|
62
|
-
world.player.hands = world.player.generate_hands
|
63
|
-
world.player.mood = world.player.generate_mood
|
64
|
-
world.player.inventory = GameOptions.data['debug_mode'] ? INVENTORY_DEBUG : INVENTORY_DEFAULT
|
65
|
-
world.player.rox = GameOptions.data['debug_mode'] ? ROX_DEBUG : ROX_DEFAULT
|
53
|
+
self.world.player.name = world.player.generate_name
|
54
|
+
self.world.player.face = world.player.generate_face
|
55
|
+
self.world.player.hands = world.player.generate_hands
|
56
|
+
self.world.player.mood = world.player.generate_mood
|
57
|
+
self.world.player.inventory = GameOptions.data['debug_mode'] ? INVENTORY_DEBUG : INVENTORY_DEFAULT
|
58
|
+
self.world.player.rox = GameOptions.data['debug_mode'] ? ROX_DEBUG : ROX_DEFAULT
|
66
59
|
|
67
60
|
# set some global variables
|
68
|
-
world.duration = { mins: 0, secs: 0, ms: 0 }
|
69
|
-
world.emerald_beaten = false
|
70
|
-
world.shifty_to_jewel = false
|
71
|
-
world.shifty_has_jeweled = false
|
61
|
+
self.world.duration = { mins: 0, secs: 0, ms: 0 }
|
62
|
+
self.world.emerald_beaten = false
|
63
|
+
self.world.shifty_to_jewel = false
|
64
|
+
self.world.shifty_has_jeweled = false
|
72
65
|
|
73
|
-
# spawn bosses
|
74
|
-
|
75
|
-
world.location_by_name('pain_quarry-southeast').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
76
|
-
world.location_by_name('pain_quarry-east').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
77
|
-
world.location_by_name('pain_quarry-central').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
78
|
-
world.location_by_name('pain_quarry-south').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
79
|
-
world.location_by_name('pain_quarry-west').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
80
|
-
world.location_by_name('pain_quarry-northwest').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
81
|
-
world.location_by_name('pain_quarry-north').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
82
|
-
## River Bridge
|
83
|
-
world.location_by_name('river_bridge').bosses_abounding.push(Gemwarrior.const_get('Jaspern').new)
|
84
|
-
## Throne Room
|
85
|
-
world.location_by_name('sky_tower-throne_room').bosses_abounding.push(Gemwarrior.const_get('Emerald').new)
|
66
|
+
# # spawn bosses
|
67
|
+
self.init_bosses
|
86
68
|
|
87
69
|
# mark home as visited
|
88
|
-
world.location_by_name('home').visited = true
|
70
|
+
self.world.location_by_name('home').visited = true
|
89
71
|
|
90
72
|
# create options file if not existing
|
91
|
-
update_options_file
|
92
|
-
|
93
|
-
# require needed files for selected sound_system if sound_enabled
|
94
|
-
if GameOptions.data['sound_enabled']
|
95
|
-
Audio.init
|
96
|
-
end
|
73
|
+
self.update_options_file
|
97
74
|
|
98
75
|
# create the console
|
99
|
-
self.evaluator
|
100
|
-
self.repl
|
76
|
+
self.evaluator = Evaluator.new(world)
|
77
|
+
self.repl = Repl.new(self, world, evaluator)
|
101
78
|
|
102
79
|
# enter Jool!
|
103
|
-
repl.start('look', options.fetch(:extra_command), options.fetch(:new_skip), options.fetch(:resume_skip))
|
80
|
+
self.repl.start('look', options.fetch(:extra_command), options.fetch(:new_skip), options.fetch(:resume_skip))
|
104
81
|
end
|
105
82
|
|
106
83
|
def update_options_file
|
107
84
|
File.open(GameOptions.data['options_file_path'], 'w') do |f|
|
85
|
+
f.puts "fight_completion:#{GameOptions.data['fight_completion']}"
|
108
86
|
f.puts "sound_enabled:#{GameOptions.data['sound_enabled']}"
|
109
87
|
f.puts "sound_system:#{GameOptions.data['sound_system']}"
|
110
88
|
f.puts "sound_volume:#{GameOptions.data['sound_volume']}"
|
111
89
|
f.puts "use_wordnik:#{GameOptions.data['use_wordnik']}"
|
112
|
-
f.puts "fight_completion:#{GameOptions.data['fight_completion']}"
|
113
90
|
end
|
114
91
|
end
|
115
92
|
|
@@ -121,6 +98,37 @@ module Gemwarrior
|
|
121
98
|
Gemwarrior.const_get(filename_to_string).new
|
122
99
|
end
|
123
100
|
|
101
|
+
def init_game_options(options)
|
102
|
+
GameOptions.add 'beast_mode', options.fetch(:beast_mode)
|
103
|
+
GameOptions.add 'debug_mode', options.fetch(:debug_mode)
|
104
|
+
GameOptions.add 'fight_completion', options.fetch(:fight_completion)
|
105
|
+
GameOptions.add 'god_mode', options.fetch(:god_mode)
|
106
|
+
GameOptions.add 'sound_enabled', options.fetch(:sound_enabled)
|
107
|
+
GameOptions.add 'sound_system', options.fetch(:sound_system)
|
108
|
+
GameOptions.add 'sound_volume', options.fetch(:sound_volume)
|
109
|
+
GameOptions.add 'use_wordnik', options.fetch(:use_wordnik)
|
110
|
+
|
111
|
+
# require needed files for selected sound_system if sound_enabled
|
112
|
+
if GameOptions.data['sound_enabled']
|
113
|
+
Audio.init
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def init_bosses
|
118
|
+
## Pain Quarry
|
119
|
+
world.location_by_name('pain_quarry-southeast').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
120
|
+
world.location_by_name('pain_quarry-east').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
121
|
+
world.location_by_name('pain_quarry-central').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
122
|
+
world.location_by_name('pain_quarry-south').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
123
|
+
world.location_by_name('pain_quarry-west').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
124
|
+
world.location_by_name('pain_quarry-northwest').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
125
|
+
world.location_by_name('pain_quarry-north').bosses_abounding.push(Gemwarrior.const_get('Garynetty').new)
|
126
|
+
## River Bridge
|
127
|
+
world.location_by_name('river_bridge').bosses_abounding.push(Gemwarrior.const_get('Jaspern').new)
|
128
|
+
## Throne Room
|
129
|
+
world.location_by_name('sky_tower-throne_room').bosses_abounding.push(Gemwarrior.const_get('Emerald').new)
|
130
|
+
end
|
131
|
+
|
124
132
|
def init_creatures
|
125
133
|
Dir.glob(File.expand_path('../entities/creatures/*.rb', __FILE__)).each do |creature|
|
126
134
|
require_relative creature
|
data/lib/gemwarrior/version.rb
CHANGED