gemwarrior 0.15.14 → 0.15.15

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
  SHA256:
3
- metadata.gz: c4b71d7a26b3d881e7451d4f0374a2ff847b08b2781190dc535da4be03216d93
4
- data.tar.gz: 6706573b955217a0f75d5df3eaee248e0e199b8c8586d5f4a8245aa6b7a4d9fe
3
+ metadata.gz: c996dc01e73e72519d15b88e1501ac75c3e532c0bdba8cac30a3f92fa0f95436
4
+ data.tar.gz: db73dd1235537fe9bda964205b803ebb6a8c84aaec171cba53f93e25e0342c81
5
5
  SHA512:
6
- metadata.gz: 9f3e6f2d65f809e9403d3d91f3daebe3c60bde70b017e2c4db6e0cb8367365716f144baf4c9fbb0a565a24503b65eb68da17b5c49b3fcc91ef66e1660c78483e
7
- data.tar.gz: a8b4a0873299d590b9bc389d15e1e28c9594f39e480447b7ffc7ba5812bddeb091cf37ab77bfc92d570902aa849866c9d4bcf0cbab38081aedee33dd2476e2c2
6
+ metadata.gz: 59921e22525ab8b60f00a6c63a02ca916d4d5b38b7ac4d08e41da45ebfbabc1ae2ac6b98c945ba7896a4746c581077ec85d2edfbf8dc8dbc667b966156e7b829
7
+ data.tar.gz: f11c5b5b659d488a4a6eb3e8ad9115a97723ed38c10547bb906f0809031f8e0e7f2b53a5a3db9241fb94e18648fc17f79f44207997b4b41f6a3e06e65798ab32
@@ -22,10 +22,10 @@ require_relative 'world'
22
22
  module Gemwarrior
23
23
  class Game
24
24
  # CONSTANTS
25
- INVENTORY_DEFAULT = Inventory.new
26
- INVENTORY_DEBUG = Inventory.new([Herb.new, Herb.new, Herb.new])
27
- ROX_DEFAULT = 0
28
- ROX_DEBUG = 300
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
- GameOptions.add 'beast_mode', options.fetch(:beast_mode)
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 = init_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
- ## Pain Quarry
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 = Evaluator.new(world)
100
- self.repl = Repl.new(self, world, evaluator)
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
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.15.14'
5
+ VERSION = '0.15.15'
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.15.14
4
+ version: 0.15.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick