gemwarrior 0.15.14 → 0.15.15
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.
- checksums.yaml +4 -4
- 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: c996dc01e73e72519d15b88e1501ac75c3e532c0bdba8cac30a3f92fa0f95436
|
4
|
+
data.tar.gz: db73dd1235537fe9bda964205b803ebb6a8c84aaec171cba53f93e25e0342c81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59921e22525ab8b60f00a6c63a02ca916d4d5b38b7ac4d08e41da45ebfbabc1ae2ac6b98c945ba7896a4746c581077ec85d2edfbf8dc8dbc667b966156e7b829
|
7
|
+
data.tar.gz: f11c5b5b659d488a4a6eb3e8ad9115a97723ed38c10547bb906f0809031f8e0e7f2b53a5a3db9241fb94e18648fc17f79f44207997b4b41f6a3e06e65798ab32
|
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