lib/gemwarrior/world.rb in gemwarrior-0.5.2 vs lib/gemwarrior/world.rb in gemwarrior-0.6.0
- old
+ new
@@ -11,10 +11,11 @@
WORLD_DIM_WIDTH = 10
WORLD_DIM_HEIGHT = 10
## ERRORS
ERROR_LIST_PARAM_INVALID = 'That is not something that can be listed.'
+ ERROR_LOCATION_DESCRIBE_ENTITY_INVALID = 'You do not see that here.'
attr_accessor :monsters, :locations, :player
def initialize
self.monsters = init_monsters
@@ -70,14 +71,15 @@
puts '[PLAYERS]'
player.check_self(false)
when 'monsters'
puts '[MONSTERS]'
if details
- monsters.map { |m| print m.describe }
+ monsters.map { |m| print m.describe unless m.is_boss}
+ monsters.map { |m| print m.describe if m.is_boss }
return
else
- ">> #{monsters.map(&:name).join(', ')}"
+ monster_text = ">> monsters: #{monsters.map(&:name).join(', ')}"
end
when 'items'
puts '[ITEMS]'
if details
locations.each do |l|
@@ -124,19 +126,16 @@
def describe(point)
desc_text = ""
desc_text << "[ #{point.name} ]\n"
desc_text << point.description
- unless point.checked_for_monsters?
- point.populate_monsters
- end
- unless point.list_items.nil?
- desc_text << point.list_items
- end
- unless point.list_monsters.nil?
- desc_text << point.list_monsters
- end
+
+ point.populate_monsters(self.monsters) unless point.checked_for_monsters?
+
+ desc_text << point.list_items unless point.list_items.nil?
+ desc_text << point.list_monsters unless point.list_monsters.nil?
+ desc_text << point.list_bosses unless point.list_bosses.nil?
desc_text << point.list_paths
end
def describe_entity(point, entity_name)
if point.items.map(&:name).include?(entity_name)
@@ -151,21 +150,37 @@
if m.name.eql?(entity_name)
return "#{m.description}"
end
end
end
+ elsif
+ if point.bosses_abounding.map(&:name).include?(entity_name)
+ point.bosses_abounding.each do |b|
+ if b.name.eql?(entity_name)
+ return "#{b.description}"
+ end
+ end
+ end
else
ERROR_LOCATION_DESCRIBE_ENTITY_INVALID
end
end
def can_move?(direction)
location_by_coords(player.cur_coords).has_loc_to_the?(direction)
end
def has_monster_to_attack?(monster_name)
- location_by_coords(player.cur_coords).monsters_abounding.map(&:name).include?(monster_name.downcase)
+ possible_combatants = location_by_coords(player.cur_coords).monsters_abounding.map(&:name) | location_by_coords(player.cur_coords).bosses_abounding.map(&:name)
+
+ possible_combatants.each do |combatant|
+ if combatant.downcase.eql?(monster_name.downcase)
+ return true
+ end
+ end
+
+ return false
end
private
def init_monsters
@@ -177,10 +192,11 @@
require_relative 'entities/monsters/bloodstorm'
require_relative 'entities/monsters/citrinaga'
require_relative 'entities/monsters/coraliz'
require_relative 'entities/monsters/cubicat'
require_relative 'entities/monsters/diaman'
+ require_relative 'entities/monsters/bosses/emerald'
self.monsters = [
Alexandrat.new,
Amberoo.new,
Amethystle.new,
@@ -188,21 +204,23 @@
Aquamarine.new,
Bloodstorm.new,
Citrinaga.new,
Coraliz.new,
Cubicat.new,
- Diaman.new
+ Diaman.new,
+ Emerald.new
]
end
def init_locations
require_relative 'entities/items/bed'
require_relative 'entities/items/feather'
require_relative 'entities/items/gun'
require_relative 'entities/items/stalactite'
require_relative 'entities/items/stonemite'
require_relative 'entities/items/stone'
+ require_relative 'entities/items/throne'
require_relative 'entities/items/tree'
locations = []
locations.push(Location.new({
@@ -210,90 +228,110 @@
:description => 'The little, unimportant, decrepit hut that you live in.',
:coords => {:x => 5, :y => 0},
:locs_connected => {:north => true, :east => true, :south => false, :west => true},
:danger_level => :none,
:items => [Bed.new, Stone.new],
- :monsters_available => monsters
+ :bosses_abounding => []
})
)
locations.push(Location.new({
:name => 'Cave (Entrance)',
:description => 'A nearby, dank entrance to a cavern, surely filled with stacktites, stonemites, and rocksites.',
:coords => {:x => 6, :y => 0},
:locs_connected => {:north => false, :east => true, :south => false, :west => true},
:danger_level => :low,
:items => [],
- :monsters_available => monsters
+ :bosses_abounding => []
})
)
locations.push(Location.new({
- :name => 'Cave (Foyer)',
+ :name => 'Cave (Antechamber)',
:description => 'Now inside the entrance to the cavern, you confirm that there are stacktites, stonemites, rocksites, and even one or two pebblejites.',
:coords => {:x => 7, :y => 0},
:locs_connected => {:north => true, :east => true, :south => false, :west => true},
:danger_level => :moderate,
:items => [Stalactite.new, Stonemite.new],
- :monsters_available => monsters
+ :bosses_abounding => []
})
)
locations.push(Location.new({
:name => 'Cave (Nook)',
:description => 'A depression in the cave wall casts a shadow over a small rock shelf.',
:coords => {:x => 7, :y => 1},
:locs_connected => {:north => false, :east => true, :south => true, :west => false},
:danger_level => :moderate,
:items => [],
- :monsters_available => monsters
+ :bosses_abounding => []
})
)
locations.push(Location.new({
:name => 'Cave (Dropoff)',
:description => 'Caves do not usually feature sudden chasms spilling down into an unknowable void, but this one does.',
:coords => {:x => 8, :y => 1},
:locs_connected => {:north => false, :east => false, :south => true, :west => true},
:danger_level => :moderate,
:items => [],
- :monsters_available => monsters
+ :bosses_abounding => []
})
)
locations.push(Location.new({
:name => 'Cave (Causeway)',
:description => 'Paths lead north and west, but nothing of interest is in this causeway.',
:coords => {:x => 8, :y => 0},
:locs_connected => {:north => true, :east => false, :south => false, :west => true},
:danger_level => :moderate,
:items => [],
- :monsters_available => monsters
+ :bosses_abounding => []
})
)
locations.push(Location.new({
:name => 'Forest',
:description => 'Trees exist here, in droves.',
:coords => {:x => 4, :y => 0},
:locs_connected => {:north => false, :east => true, :south => false, :west => false},
:danger_level => :low,
:items => [Feather.new, Tree.new],
- :monsters_available => monsters
+ :bosses_abounding => []
})
)
locations.push(Location.new({
:name => 'Plains',
:description => 'A lot of grass and nothing, but you see a mysterious tower further north, and your home to the south.',
:coords => {:x => 5, :y => 1},
:locs_connected => {:north => true, :east => false, :south => true, :west => false},
:danger_level => :low,
:items => [],
- :monsters_available => monsters
+ :bosses_abounding => []
})
)
locations.push(Location.new({
- :name => 'Emerald\'s Sky Tower',
- :description => 'The craziest guy that ever existed is around here somewhere amongst the cloud floors, snow walls, and ethereal vibe.',
+ :name => 'Sky Tower (Entrance)',
+ :description => 'The craziest guy that ever existed is inside the towering structure of cloud floors and snow walls standing before you.',
:coords => {:x => 5, :y => 2},
- :locs_connected => {:north => false, :east => false, :south => true, :west => false},
- :danger_level => :assured,
+ :locs_connected => {:north => true, :east => false, :south => true, :west => false},
+ :danger_level => :high,
:items => [Gun.new],
- :monsters_available => monsters
+ :bosses_abounding => []
+ })
+ )
+ locations.push(Location.new({
+ :name => 'Sky Tower (Foyer)',
+ :description => 'There appears to be one path forward, towards the throne room.',
+ :coords => {:x => 5, :y => 3},
+ :locs_connected => {:north => true, :east => false, :south => true, :west => false},
+ :danger_level => :high,
+ :items => [],
+ :bosses_abounding => []
+ })
+ )
+ locations.push(Location.new({
+ :name => 'Sky Tower (Throne Room)',
+ :description => 'There, on a mighty seat made of broken dreams, sits Emerald himself, staring at you coldly, silently.',
+ :coords => {:x => 5, :y => 4},
+ :locs_connected => {:north => false, :east => false, :south => true, :west => false},
+ :danger_level => :high,
+ :items => [Throne.new],
+ :bosses_abounding => [Emerald.new]
})
)
end
end
end