gemwarrior 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,8 +13,8 @@ module Gemwarrior
13
13
  :equipped,
14
14
  :use
15
15
 
16
- def use
17
- 'That items does not do anything...yet'
16
+ def use(inventory = nil)
17
+ 'That item does not do anything...yet.'
18
18
  end
19
19
  end
20
20
  end
@@ -16,9 +16,10 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use
19
+ def use(inventory = nil)
20
+ Animation::run({:phrase => '** ZZZZZ **'})
20
21
  puts 'You unmake the bed, get under the covers, close your eyes, and begin to think about all the things you need to do today. You realize sleep is not one of them and quickly get back up, remake the bed, and get on about your day.'
21
- puts 'You regain a few hit points.'
22
+ puts '>> You regain a few hit points.'
22
23
  {:type => 'rest', :data => 5}
23
24
  end
24
25
  end
@@ -16,9 +16,9 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use
19
+ def use(inventory = nil)
20
20
  puts 'Your body comes to rest somewhere below the surface of the cloudy apparatus, almost as if it were floating *amongst* the couch. The feeling is heavenly, and you actually feel somewhat better after getting back up.'
21
- puts 'You regain a hit point.'
21
+ puts '>> You regain a hit point.'
22
22
  {:type => 'rest', :data => 1}
23
23
  end
24
24
  end
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use
19
+ def use(inventory = nil)
20
20
  puts 'You slowly lower your foot onto the tile, and then gently depress it, through the floor. Your whole body begins to feel light, lifeless. You black out.'
21
21
  puts
22
22
 
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use
19
+ def use(inventory = nil)
20
20
  puts 'You pull the trigger on the gun, but realize there are no bullets in it. So, it does not do much except cause a barely audible *click* sound.'
21
21
  {:type => nil, :data => nil}
22
22
  end
@@ -16,9 +16,9 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use
19
+ def use(inventory = nil)
20
20
  puts 'You place the herb in your mouth, testing its texture. The mysterious herb is easily chewable, and you are able to swallow it without much effort. Slight tingles travel up and down your spine.'
21
- puts 'You regain a few hit points.'
21
+ puts '>> You regain a few hit points.'
22
22
  {:type => 'health', :data => rand(3..5)}
23
23
  end
24
24
  end
@@ -20,11 +20,9 @@ module Gemwarrior
20
20
  puts 'You attempt to open the seriously massive door that separates you from Emerald himself.'
21
21
  if inventory.has_item?('keystone')
22
22
  puts 'The keystone in your inventory glows as you approach the incredibly titanic-sized door, so you naturally pull it out and thrust it into the stone-shaped depression within the cloudy obstruction. The door "opens" in a way and you can now pass through.'
23
- puts
24
23
  {:type => 'move', :data => 'Sky Tower (Throne Room)'}
25
24
  else
26
25
  puts 'Your hand just goes right through the astonishingly gigantic door, but the rest of your body does not. A moment later, your hand is shoved backwards by some unknown force, and you remain where you were before your unsuccessful attempt.'
27
- puts
28
26
  {:type => nil, :data => nil}
29
27
  end
30
28
  end
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use
19
+ def use(inventory = nil)
20
20
  puts 'Everything, and I mean *everything*, begins to sparkle. Huh.'
21
21
  puts
22
22
  {:type => nil, :data => nil}
@@ -0,0 +1,19 @@
1
+ # lib/gemwarrior/entities/items/tent.rb
2
+ # Item::Tent
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class Tent < Item
8
+ def initialize
9
+ self.name = 'tent'
10
+ self.description = 'A magical, two-room suite pops up when you flick this otherwise folded piece of canvas just right, perfect for a night\'s rest.'
11
+ self.atk_lo = nil
12
+ self.atk_hi = nil
13
+ self.takeable = true
14
+ self.useable = true
15
+ self.equippable = false
16
+ self.equipped = false
17
+ end
18
+ end
19
+ end
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use
19
+ def use(inventory = nil)
20
20
  puts 'You move the switch from "No" to "Yes". Suddenly, a great wind picks up and you are gently lifted up by it. The ground moves away and your whole body begins to gently drift towards Emerald\'s compound high in the stratosphere.'
21
21
  puts
22
22
 
@@ -16,9 +16,8 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use
19
+ def use(inventory = nil)
20
20
  puts 'You stretch out your hand and touch the waterfall. It stings you with its cold and forceful gushing. Your hand is now wet and rougher than before. In time, it will dry.'
21
- puts
22
21
  {:type => 'dmg', :data => rand(0..1)}
23
22
  end
24
23
  end
@@ -4,6 +4,7 @@
4
4
  require_relative 'creature'
5
5
  require_relative '../battle'
6
6
  require_relative '../misc/player_levels'
7
+ require_relative '../misc/wordlist'
7
8
 
8
9
  module Gemwarrior
9
10
  class Player < Creature
@@ -84,18 +85,38 @@ module Gemwarrior
84
85
  self_text << "Current status - breathing, wearing clothing, and with a few other specific characteristics: face is #{self.face}, hands are #{self.hands}, and general mood is #{self.mood}.\n"
85
86
  end
86
87
 
87
- def rest
88
+ def rest(world)
89
+ cur_loc = world.location_by_coords(cur_coords)
90
+
91
+ if cur_loc.has_monster?
92
+ chance_of_ambush = rand(0..100)
93
+
94
+ if chance_of_ambush < 25
95
+ battle = Battle.new({:world => world, :player => self, :monster => cur_loc.monsters_abounding[rand(0..cur_loc.monsters_abounding.length-1)]})
96
+ return battle.start
97
+ end
98
+ end
99
+
88
100
  hours = rand(1..23)
89
101
  minutes = rand(1..59)
90
102
  seconds = rand(1..59)
91
-
103
+
92
104
  hours_text = hours == 1 ? "hour" : "hours"
93
105
  mins_text = minutes == 1 ? "minute" : "minutes"
94
106
  secs_text = seconds == 1 ? "second" : "seconds"
95
-
96
- self.hp_cur = hp_max
97
-
98
- return "You lie down somewhere quasi-flat and after a few moments, due to extreme exhaustion, you fall into a deep slumber. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up with a start, look around you, notice nothing in particular, and get back up, ready to go again."
107
+
108
+ Animation::run({:phrase => '** Zzzzz **'})
109
+
110
+ if self.inventory.has_item?('tent')
111
+ self.hp_cur = self.hp_max
112
+
113
+ return "You pull out your trusty magical canvas, and with a flick of the wrist your home for the evening is set up. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up, fully rested, ready for adventure."
114
+ else
115
+ self.hp_cur = self.hp_cur.to_i + rand(10..15)
116
+ self.hp_cur = self.hp_max if self.hp_cur > self.hp_max
117
+
118
+ return "You lie down somewhere quasi-flat and after a few moments, due to extreme exhaustion, you fall into a deep, yet troubled, slumber. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up with a start. Upon getting to your feet you look around, notice you feel somewhat better, and wonder why you dreamt about #{WordList.new(world.use_wordnik, 'noun-plural').get_random_value}."
119
+ end
99
120
  end
100
121
 
101
122
  def stamina_dec
@@ -203,14 +224,14 @@ module Gemwarrior
203
224
 
204
225
  # INIT
205
226
  def generate_name
206
- name = []
227
+ default_name = []
207
228
  letter_max = rand(5..10)
208
- name[0] = CHAR_UPPER_POOL[rand(0..25)]
209
- name[1] = CHAR_LOWER_VOWEL_POOL[rand(0..5)]
229
+ default_name[0] = CHAR_UPPER_POOL[rand(0..25)]
230
+ default_name[1] = CHAR_LOWER_VOWEL_POOL[rand(0..5)]
210
231
  2.upto(letter_max) do |i|
211
- name[i] = CHAR_LOWER_POOL[rand(0..25)]
232
+ default_name[i] = CHAR_LOWER_POOL[rand(0..25)]
212
233
  end
213
- return name.join
234
+ return default_name.join
214
235
  end
215
236
 
216
237
  def generate_face
@@ -10,7 +10,6 @@ module Gemwarrior
10
10
  PROGRAM_NAME = 'Gem Warrior'
11
11
  QUIT_MESSAGE = 'Thanks for playing the game. Until next time...'.colorize(:yellow)
12
12
  RESUME_MESSAGE = 'Back to adventuring!'.colorize(:green)
13
- SEPARATOR = '=========================================================================='
14
13
 
15
14
  GO_PARAMS = 'Options: north, east, south, west'
16
15
  CHANGE_PARAMS = 'Options: name'
@@ -42,13 +41,14 @@ module Gemwarrior
42
41
 
43
42
  attr_accessor :world,
44
43
  :commands, :aliases, :extras, :cmd_descriptions,
45
- :devcommands, :devaliases, :devcmd_descriptions
44
+ :devcommands, :devaliases, :devextras, :devcmd_descriptions
46
45
 
47
46
  def initialize(world)
48
47
  self.world = world
49
48
 
50
49
  self.devcommands = %w(god beast list vars map stat teleport)
51
50
  self.devaliases = %w(gd bs ls v m s tp)
51
+ self.devextras = %w(st)
52
52
  self.devcmd_descriptions = [
53
53
  'Toggle god mode (i.e. invincible)',
54
54
  'Toggle beast mode (i.e. super strength)',
@@ -122,6 +122,15 @@ module Gemwarrior
122
122
  return DEBUG_STAT_PARAMS
123
123
  else
124
124
  case param1
125
+ when 'hp_cur'
126
+ unless param2.nil?
127
+ param2 = param2.to_i
128
+ if param2.is_a? Numeric
129
+ if param2 > 0
130
+ world.player.hp_cur = param2
131
+ end
132
+ end
133
+ end
125
134
  when 'atk_lo'
126
135
  unless param2.nil?
127
136
  param2 = param2.to_i
@@ -197,7 +206,7 @@ module Gemwarrior
197
206
  world.player.list_inventory
198
207
  end
199
208
  when 'rest', 'r'
200
- world.player.rest
209
+ world.player.rest(world)
201
210
  when 'look', 'l'
202
211
  if param1
203
212
  world.describe_entity(world.location_by_coords(world.player.cur_coords), param1)
@@ -339,7 +348,7 @@ module Gemwarrior
339
348
  private
340
349
 
341
350
  def print_separator
342
- puts SEPARATOR
351
+ puts "=============================="
343
352
  end
344
353
 
345
354
  def list_commands
@@ -369,7 +378,7 @@ module Gemwarrior
369
378
  commands_and_aliases = commands | aliases | extras
370
379
 
371
380
  if world.debug_mode
372
- commands_and_aliases = commands_and_aliases | devcommands | devaliases
381
+ commands_and_aliases = commands_and_aliases | devcommands | devaliases | devextras
373
382
  end
374
383
 
375
384
  if commands_and_aliases.include?(command.downcase)
@@ -32,7 +32,7 @@ module Gemwarrior
32
32
 
33
33
  world.debug_mode = options.fetch(:debug_mode)
34
34
  world.use_wordnik = options.fetch(:use_wordnik)
35
-
35
+
36
36
  world.player = Player.new({
37
37
  :description => PLAYER_DESC_DEFAULT,
38
38
  :level => start_stats[:level],
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = "0.7.4"
5
+ VERSION = "0.7.5"
6
6
  end
@@ -1,15 +1,17 @@
1
1
  # lib/gemwarrior/world.rb
2
2
  # World where the locations, monsters, items, etc. exist
3
3
 
4
+ require 'yaml'
5
+
4
6
  require_relative 'entities/item'
5
7
  require_relative 'entities/location'
6
8
 
7
9
  module Gemwarrior
8
10
  class World
9
11
  # CONSTANTS
10
- ## WORLD DIMENSIONS
11
- WORLD_DIM_WIDTH = 10
12
- WORLD_DIM_HEIGHT = 10
12
+ LOCATION_DATA_FILE = "data/locations.yml"
13
+ WORLD_DIM_WIDTH = 10
14
+ WORLD_DIM_HEIGHT = 10
13
15
 
14
16
  ## ERRORS
15
17
  ERROR_LIST_PARAM_INVALID = 'That is not something that can be listed.'
@@ -213,6 +215,26 @@ module Gemwarrior
213
215
  end
214
216
 
215
217
  private
218
+
219
+ def create_item_objects(item_names)
220
+ items = []
221
+ unless item_names.nil?
222
+ item_names.each do |name|
223
+ items.push(eval(name).new)
224
+ end
225
+ end
226
+ return items
227
+ end
228
+
229
+ def create_boss_objects(bosses_names)
230
+ bosses = []
231
+ unless bosses_names.nil?
232
+ bosses_names.each do |name|
233
+ bosses.push(eval(name).new)
234
+ end
235
+ end
236
+ return bosses
237
+ end
216
238
 
217
239
  def init_monsters
218
240
  Dir.glob('lib/gemwarrior/entities/monsters/*.rb').each do |item|
@@ -245,391 +267,30 @@ module Gemwarrior
245
267
 
246
268
  locations = []
247
269
 
248
- locations.push(Location.new({
249
- :name => 'Home',
250
- :description => 'The little, unimportant, decrepit hut that you live in.',
251
- :coords => {:x => 5, :y => 0},
252
- :locs_connected => {:north => true, :east => true, :south => false, :west => true},
253
- :danger_level => :none,
254
- :monster_level_range => nil,
255
- :items => [Bed.new, Stone.new],
256
- :bosses_abounding => []
257
- })
258
- )
259
- locations.push(Location.new({
260
- :name => 'Cave (Entrance)',
261
- :description => 'A nearby, dank entrance to a cavern, surely filled with stacktites, stonemites, and rocksites.',
262
- :coords => {:x => 6, :y => 0},
263
- :locs_connected => {:north => false, :east => true, :south => false, :west => true},
264
- :danger_level => :low,
265
- :monster_level_range => 1..2,
266
- :items => [],
267
- :bosses_abounding => []
268
- })
269
- )
270
- locations.push(Location.new({
271
- :name => 'Cave (Antechamber)',
272
- :description => 'Now inside the cavern, you confirm there are stacktites, stonemites, rocksites, and even some pebblejites.',
273
- :coords => {:x => 7, :y => 0},
274
- :locs_connected => {:north => true, :east => true, :south => false, :west => true},
275
- :danger_level => :moderate,
276
- :monster_level_range => 2..3,
277
- :items => [Stalactite.new, Stonemite.new],
278
- :bosses_abounding => []
279
- })
280
- )
281
- locations.push(Location.new({
282
- :name => 'Cave (Nook)',
283
- :description => 'A depression in the cave wall casts a shadow over a small rock shelf.',
284
- :coords => {:x => 7, :y => 1},
285
- :locs_connected => {:north => false, :east => true, :south => true, :west => false},
286
- :danger_level => :moderate,
287
- :monster_level_range => 2..3,
288
- :items => [],
289
- :bosses_abounding => []
290
- })
291
- )
292
- locations.push(Location.new({
293
- :name => 'Cave (Dropoff)',
294
- :description => 'Caves do not usually feature sudden chasms spilling down into an unknowable void, but this one does.',
295
- :coords => {:x => 8, :y => 1},
296
- :locs_connected => {:north => false, :east => false, :south => true, :west => true},
297
- :danger_level => :moderate,
298
- :monster_level_range => 2..4,
299
- :items => [],
300
- :bosses_abounding => []
301
- })
302
- )
303
- locations.push(Location.new({
304
- :name => 'Cave (Causeway)',
305
- :description => 'Paths lead north and west, but nothing of interest is in this causeway.',
306
- :coords => {:x => 8, :y => 0},
307
- :locs_connected => {:north => true, :east => false, :south => false, :west => true},
308
- :danger_level => :moderate,
309
- :monster_level_range => 2..3,
310
- :items => [],
311
- :bosses_abounding => []
312
- })
313
- )
314
- locations.push(Location.new({
315
- :name => 'Forest (Southeast)',
316
- :description => 'Trees exist here, in droves.',
317
- :coords => {:x => 4, :y => 0},
318
- :locs_connected => {:north => true, :east => true, :south => false, :west => false},
319
- :danger_level => :low,
320
- :monster_level_range => 1..3,
321
- :items => [Tree.new],
322
- :bosses_abounding => []
323
- })
324
- )
325
- locations.push(Location.new({
326
- :name => 'Forest (Northeast)',
327
- :description => 'You see much foliage.',
328
- :coords => {:x => 4, :y => 1},
329
- :locs_connected => {:north => false, :east => false, :south => true, :west => true},
330
- :danger_level => :low,
331
- :monster_level_range => 1..3,
332
- :items => [],
333
- :bosses_abounding => []
334
- })
335
- )
336
- locations.push(Location.new({
337
- :name => 'Forest (Northwest)',
338
- :description => 'The amount of leaves and branches and trunks you can see boggles the mind.',
339
- :coords => {:x => 3, :y => 1},
340
- :locs_connected => {:north => false, :east => true, :south => true, :west => false},
341
- :danger_level => :low,
342
- :monster_level_range => 1..3,
343
- :items => [Feather.new],
344
- :bosses_abounding => []
345
- })
346
- )
347
- locations.push(Location.new({
348
- :name => 'Forest (Southwest)',
349
- :description => 'While you continue to be impressed at the sheer size of this forest, a clearing appears to open up to the west.',
350
- :coords => {:x => 3, :y => 0},
351
- :locs_connected => {:north => true, :east => false, :south => false, :west => true},
352
- :danger_level => :low,
353
- :monster_level_range => 1..3,
354
- :items => [],
355
- :bosses_abounding => []
356
- })
357
- )
358
- locations.push(Location.new({
359
- :name => 'Pain Desert (Southeast)',
360
- :description => 'Horrible terribleness emanates from this desolate land of unkind misery.',
361
- :coords => {:x => 2, :y => 0},
362
- :locs_connected => {:north => true, :east => true, :south => false, :west => true},
363
- :danger_level => :assured,
364
- :monster_level_range => 5..20,
365
- :items => [],
366
- :bosses_abounding => [Garynetty.new]
367
- })
368
- )
369
- locations.push(Location.new({
370
- :name => 'Pain Desert (East)',
371
- :description => 'Horrible terribleness emanates from this desolate land of unkind misery.',
372
- :coords => {:x => 2, :y => 1},
373
- :locs_connected => {:north => false, :east => false, :south => true, :west => true},
374
- :danger_level => :assured,
375
- :monster_level_range => 5..20,
376
- :items => [],
377
- :bosses_abounding => [Garynetty.new]
378
- })
379
- )
380
- locations.push(Location.new({
381
- :name => 'Pain Desert (Central)',
382
- :description => 'Horrible terribleness emanates from this desolate land of unkind misery.',
383
- :coords => {:x => 1, :y => 1},
384
- :locs_connected => {:north => true, :east => true, :south => true, :west => true},
385
- :danger_level => :assured,
386
- :monster_level_range => 5..20,
387
- :items => [],
388
- :bosses_abounding => [Garynetty.new]
389
- })
390
- )
391
- locations.push(Location.new({
392
- :name => 'Pain Desert (South)',
393
- :description => 'Horrible terribleness emanates from this desolate land of unkind misery.',
394
- :coords => {:x => 1, :y => 0},
395
- :locs_connected => {:north => true, :east => true, :south => false, :west => false},
396
- :danger_level => :assured,
397
- :monster_level_range => 5..20,
398
- :items => [],
399
- :bosses_abounding => [Garynetty.new]
400
- })
401
- )
402
- locations.push(Location.new({
403
- :name => 'Pain Desert (West)',
404
- :description => 'Horrible terribleness emanates from this desolate land of unkind misery.',
405
- :coords => {:x => 0, :y => 1},
406
- :locs_connected => {:north => true, :east => true, :south => false, :west => false},
407
- :danger_level => :assured,
408
- :monster_level_range => 5..20,
409
- :items => [],
410
- :bosses_abounding => [Garynetty.new]
411
- })
412
- )
413
- locations.push(Location.new({
414
- :name => 'Pain Desert (Northwest)',
415
- :description => 'Horrible terribleness emanates from this desolate land of unkind misery.',
416
- :coords => {:x => 0, :y => 2},
417
- :locs_connected => {:north => false, :east => true, :south => true, :west => false},
418
- :danger_level => :assured,
419
- :monster_level_range => 5..20,
420
- :items => [],
421
- :bosses_abounding => [Garynetty.new]
422
- })
423
- )
424
- locations.push(Location.new({
425
- :name => 'Pain Desert (North)',
426
- :description => 'Horrible terribleness emanates from this desolate land of unkind misery.',
427
- :coords => {:x => 1, :y => 2},
428
- :locs_connected => {:north => false, :east => false, :south => true, :west => true},
429
- :danger_level => :assured,
430
- :monster_level_range => 5..20,
431
- :items => [],
432
- :bosses_abounding => [Garynetty.new]
433
- })
434
- )
435
- locations.push(Location.new({
436
- :name => 'Plains (Outskirts)',
437
- :description => 'A lot of grass and nothing, stretching out northward.',
438
- :coords => {:x => 5, :y => 1},
439
- :locs_connected => {:north => true, :east => false, :south => true, :west => false},
440
- :danger_level => :low,
441
- :monster_level_range => 2..3,
442
- :items => [],
443
- :bosses_abounding => []
444
- })
445
- )
446
- locations.push(Location.new({
447
- :name => 'Plains (Fields)',
448
- :description => 'Now you\'re plum in the middle of rolling fields.',
449
- :coords => {:x => 5, :y => 2},
450
- :locs_connected => {:north => true, :east => false, :south => true, :west => false},
451
- :danger_level => :low,
452
- :monster_level_range => 2..3,
453
- :items => [],
454
- :bosses_abounding => []
455
- })
456
- )
457
- locations.push(Location.new({
458
- :name => 'Plains (South of River)',
459
- :description => 'A raging river borders the northern side of this bucolic vista.',
460
- :coords => {:x => 5, :y => 3},
461
- :locs_connected => {:north => false, :east => false, :south => true, :west => true},
462
- :danger_level => :low,
463
- :monster_level_range => 2..3,
464
- :items => [],
465
- :bosses_abounding => []
466
- })
467
- )
468
- locations.push(Location.new({
469
- :name => 'Plains (South of Bridge)',
470
- :description => 'To the north of these fields lies a bridge that may be crossable.',
471
- :coords => {:x => 4, :y => 3},
472
- :locs_connected => {:north => true, :east => true, :south => false, :west => true},
473
- :danger_level => :low,
474
- :monster_level_range => 2..3,
475
- :items => [],
476
- :bosses_abounding => []
477
- })
478
- )
479
- locations.push(Location.new({
480
- :name => 'Plains (Hut)',
481
- :description => 'A straw hut sits alone, curiously, in a patch of grass, sticks, and straw.',
482
- :coords => {:x => 3, :y => 3},
483
- :locs_connected => {:north => false, :east => true, :south => false, :west => false},
484
- :danger_level => :none,
485
- :monster_level_range => nil,
486
- :items => [],
487
- :bosses_abounding => []
488
- })
489
- )
490
- locations.push(Location.new({
491
- :name => 'River Bridge',
492
- :description => 'Sturdy and safe, this bridge will get you across the otherwise unpassable river you see below.',
493
- :coords => {:x => 4, :y => 4},
494
- :locs_connected => {:north => true, :east => false, :south => true, :west => false},
495
- :danger_level => :moderate,
496
- :monster_level_range => 3..5,
497
- :items => [],
498
- :bosses_abounding => []
499
- })
500
- )
501
- locations.push(Location.new({
502
- :name => 'Plains (North of Bridge)',
503
- :description => 'North of the river feels similar to south of the river, as you continue to be surrounded by grass and grass and, well, grass.',
504
- :coords => {:x => 4, :y => 5},
505
- :locs_connected => {:north => false, :east => false, :south => true, :west => true},
506
- :danger_level => :low,
507
- :monster_level_range => 2..3,
508
- :items => [],
509
- :bosses_abounding => []
510
- })
511
- )
512
- locations.push(Location.new({
513
- :name => 'Rock Quarry',
514
- :description => 'Piles of rocks, both big and small, are placed here and there, a testament to someone\'s surely back-breaking labor.',
515
- :coords => {:x => 3, :y => 5},
516
- :locs_connected => {:north => false, :east => true, :south => false, :west => false},
517
- :danger_level => :moderate,
518
- :monster_level_range => 3..4,
519
- :items => [Gun.new, TowerSwitch.new],
520
- :bosses_abounding => []
521
- })
522
- )
523
- locations.push(Location.new({
524
- :name => 'Sky Tower (Entryway)',
525
- :description => 'You feel unsettled as you gaze upon the wondrous proportions of Emerald\'s home.',
526
- :coords => {:x => 8, :y => 6},
527
- :locs_connected => {:north => true, :east => true, :south => false, :west => true},
528
- :danger_level => :moderate,
529
- :monster_level_range => 3..4,
530
- :items => [FloorTile.new],
531
- :bosses_abounding => []
532
- })
533
- )
534
- locations.push(Location.new({
535
- :name => 'Sky Tower (Cloud Garden)',
536
- :description => 'A perfectly-maintained array of wispy flowers and other ethereal plantlife contained within a cumulonimbus barrier.',
537
- :coords => {:x => 8, :y => 7},
538
- :locs_connected => {:north => false, :east => false, :south => true, :west => false},
539
- :danger_level => :moderate,
540
- :monster_level_range => 3..4,
541
- :items => [Flower.new, Keystone.new],
542
- :bosses_abounding => []
543
- })
544
- )
545
- locations.push(Location.new({
546
- :name => 'Sky Tower (Armory)',
547
- :description => 'Weapons of all kinds litter the ground and are hung on hooks from the wall. Tower assailants beware/rejoice!',
548
- :coords => {:x => 7, :y => 6},
549
- :locs_connected => {:north => true, :east => true, :south => false, :west => false},
550
- :danger_level => :moderate,
551
- :monster_level_range => 3..4,
552
- :items => [Dehumidifier.new],
553
- :bosses_abounding => []
554
- })
555
- )
556
- locations.push(Location.new({
557
- :name => 'Sky Tower (West Hallway)',
558
- :description => 'The hallway seems to stretch on for days.',
559
- :coords => {:x => 7, :y => 7},
560
- :locs_connected => {:north => true, :east => false, :south => true, :west => false},
561
- :danger_level => :moderate,
562
- :monster_level_range => 3..4,
563
- :items => [Flower.new],
564
- :bosses_abounding => []
565
- })
566
- )
567
- locations.push(Location.new({
568
- :name => 'Sky Tower (Waterfalls)',
569
- :description => 'The seemingly neverending deluge of water causes this room to be quite loud, yet pretty.',
570
- :coords => {:x => 7, :y => 8},
571
- :locs_connected => {:north => true, :east => true, :south => false, :west => false},
572
- :danger_level => :moderate,
573
- :monster_level_range => 3..4,
574
- :items => [Waterfall.new],
575
- :bosses_abounding => []
576
- })
577
- )
578
- locations.push(Location.new({
579
- :name => 'Sky Tower (Massive Door)',
580
- :description => 'Before you lies a massive collection of cumulus clouds that form into a seemingly impenetrable door, beyond which may well be your doom.',
581
- :coords => {:x => 8, :y => 8},
582
- :locs_connected => {:north => false, :east => true, :south => false, :west => true},
583
- :danger_level => :moderate,
584
- :monster_level_range => 4..5,
585
- :items => [MassiveDoor.new],
586
- :bosses_abounding => []
587
- })
588
- )
589
- locations.push(Location.new({
590
- :name => 'Sky Tower (Throne Room)',
591
- :description => 'There, on a mighty seat made of broken dreams, sits Emerald himself, staring at you coldly, silently.',
592
- :coords => {:x => 8, :y => 9},
593
- :locs_connected => {:north => false, :east => false, :south => true, :west => false},
594
- :danger_level => :high,
595
- :monster_level_range => 5..7,
596
- :items => [Throne.new],
597
- :bosses_abounding => [Emerald.new]
598
- })
599
- )
600
- locations.push(Location.new({
601
- :name => 'Sky Tower (Lounge)',
602
- :description => 'Nothing but a simple couch, which looks very comfortable, exists in this corner of the tower.',
603
- :coords => {:x => 9, :y => 8},
604
- :locs_connected => {:north => false, :east => false, :south => true, :west => true},
605
- :danger_level => :moderate,
606
- :monster_level_range => 3..4,
607
- :items => [Couch.new],
608
- :bosses_abounding => []
609
- })
610
- )
611
- locations.push(Location.new({
612
- :name => 'Sky Tower (East Hallway)',
613
- :description => 'Longish and neverending is what you might say about this stretch of the tower.',
614
- :coords => {:x => 9, :y => 7},
615
- :locs_connected => {:north => true, :east => false, :south => true, :west => false},
616
- :danger_level => :moderate,
617
- :monster_level_range => 3..4,
618
- :items => [],
619
- :bosses_abounding => []
620
- })
621
- )
622
- locations.push(Location.new({
623
- :name => 'Sky Tower (Kitchen)',
624
- :description => 'This kitchen looks well-used, as appliances abound, and leftover food sits atop counters.',
625
- :coords => {:x => 9, :y => 6},
626
- :locs_connected => {:north => true, :east => false, :south => false, :west => true},
627
- :danger_level => :moderate,
628
- :monster_level_range => 3..4,
629
- :items => [Apple.new, Cup.new],
630
- :bosses_abounding => []
631
- })
632
- )
270
+ location_data = YAML.load_file(LOCATION_DATA_FILE)
271
+
272
+ location_data.each {|l|
273
+ locations.push(Location.new({
274
+ :name => l["name"],
275
+ :description => l["description"],
276
+ :danger_level => l["danger_level"],
277
+ :monster_level_range => l["monster_level_range"].nil? ? nil : l["monster_level_range"]["lo"]..l["monster_level_range"]["hi"],
278
+ :coords => {
279
+ :x => l["coords"]["x"],
280
+ :y => l["coords"]["y"]
281
+ },
282
+ :locs_connected => {
283
+ :north => l["locs_connected"]["north"],
284
+ :east => l["locs_connected"]["east"],
285
+ :south => l["locs_connected"]["south"],
286
+ :west => l["locs_connected"]["west"]
287
+ },
288
+ :items => create_item_objects(l["items"]),
289
+ :bosses_abounding => create_boss_objects(l["bosses_abounding"])
290
+ }))
291
+ }
292
+
293
+ return locations
633
294
  end
634
295
  end
635
296
  end