Permalink
Browse files

there is now a z axis attribute for each location; added underground …

…metal tunnel leading to snow fields, and one-way items to get there and back
  • Loading branch information...
michaelchadwick committed Jun 24, 2015
1 parent cd318e0 commit 8e210c24dd2249bcf88cd9395460d1923c431ff6
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -72,6 +72,7 @@ def start
puts 'What do you do?'
puts "[Fight/Attack][Look][Run]".colorize(:color => :yellow)
binding.pry
cmd = gets.chomp.downcase
@@ -11,13 +11,21 @@ def initialize
self.atk_lo = nil
self.atk_hi = nil
self.takeable = false
self.useable = false
self.useable = true
self.equippable = false
self.equipped = false
end
def use(inventory = nil)
{:type => 'nil', :data => 'nil'}
puts 'You grab onto the shaky, rough-hewn, wooden ladder with all your might and start to descend, being extra careful not to loose your grip, which with every moment becomes shakier and shakier.'
puts
Animation::run({ :phrase => '*** THUMP ***' })
puts 'The last couple of steps are more slippery than you anticipated, so you end up fumbling them, falling a few feet onto the hard ground below. When you regain your composure, you notice your conveyance for descending is now far above you and it is, unfortunately, your closest known exit.'
puts
{:type => 'move_dangerous', :data => 'Metal Tunnel (South Entrance)'}
end
end
end
@@ -0,0 +1,29 @@
# lib/gemwarrior/entities/items/rope.rb
# Item::Rope
require_relative '../item'
module Gemwarrior
class Rope < Item
def initialize
self.name = 'rope'
self.description = 'For some reason, a sturdy rope hangs down from a small opening in the metal tunnel\'s ceiling. It appears to hold your weight when taut.'
self.atk_lo = nil
self.atk_hi = nil
self.takeable = false
self.useable = true
self.equippable = false
self.equipped = false
end
def use(inventory = nil)
puts 'You hold on to the rope with both hands and begin to climb upwards towards the small opening in the ceiling.'
puts
puts 'After a few minutes you pull yourself up onto a field of pure driven snow. Without warning, the rope and opening in the floor vanish.'
puts
{:type => 'move', :data => 'Snow Fields (Southeast)'}
end
end
end
@@ -0,0 +1,28 @@
# lib/gemwarrior/entities/items/snowman.rb
# Item::Snowman
require_relative '../item'
module Gemwarrior
class Snowman < Item
def initialize
self.name = 'snowman'
self.description = 'Standing solemnly in the snow, a man of snow solemnly stands.'
self.atk_lo = nil
self.atk_hi = nil
self.takeable = false
self.useable = true
self.equippable = false
self.equipped = false
end
def use(inventory = nil)
puts 'You go to touch the snowy softness of the snowman when it magically comes to life! The frozen homunculus grabs you by the wrist and tosses you to the ground, only to follow this up by jumping onto you with its full, freezing, force. Your body, and mind, go numb.'
puts
Animation::run({ :phrase => '*** FOOOOSH ***' })
{:type => 'move_dangerous', :data => 'Home'}
end
end
end
@@ -145,16 +145,32 @@ def list_inventory
def go(locations, direction)
case direction
when 'north', 'n'
self.cur_coords = {:x => cur_coords[:x], :y => cur_coords[:y]+1}
self.cur_coords = {
:x => cur_coords[:x],
:y => cur_coords[:y]+1,
:z => cur_coords[:z]
}
direction_text = '^^^'
when 'east', 'e'
self.cur_coords = {:x => cur_coords[:x]+1, :y => cur_coords[:y]}
self.cur_coords = {
:x => cur_coords[:x]+1,
:y => cur_coords[:y],
:z => cur_coords[:z]
}
direction_text = '>>>'
when 'south', 's'
self.cur_coords = {:x => cur_coords[:x], :y => cur_coords[:y]-1}
self.cur_coords = {
:x => cur_coords[:x],
:y => cur_coords[:y]-1,
:z => cur_coords[:z]
}
direction_text = 'vvv'
when 'west', 'w'
self.cur_coords = {:x => cur_coords[:x]-1, :y => cur_coords[:y]}
self.cur_coords = {
:x => cur_coords[:x]-1,
:y => cur_coords[:y],
:z => cur_coords[:z]
}
direction_text = '<<<'
end
print_traveling_text(direction_text)
@@ -97,6 +97,7 @@ def evaluate(input)
command = tokens.first.downcase
param1 = tokens[1]
param2 = tokens[2]
param3 = tokens[3]
# dev commands
if world.debug_mode
@@ -177,7 +178,7 @@ def evaluate(input)
return ERROR_DEBUG_TELEPORT_PARAMS_MISSING
else
if (param1.to_i.to_s == param1) && (param2.to_i.to_s == param2)
world.player.cur_coords = {:x => param1.to_i, :y => param2.to_i}
world.player.cur_coords = {:x => param1.to_i, :y => param2.to_i, :z => param3.to_i}
else
locations = []
world.locations.each do |l|
@@ -259,6 +260,10 @@ def evaluate(input)
when 'move'
world.player.cur_coords = world.location_coords_by_name(result[:data])
world.describe(world.location_by_coords(world.player.cur_coords))
when 'move_dangerous'
world.player.take_damage(rand(0..2))
world.player.cur_coords = world.location_coords_by_name(result[:data])
world.describe(world.location_by_coords(world.player.cur_coords))
when 'dmg'
world.player.take_damage(result[:data])
return
View
@@ -44,7 +44,7 @@ def print_map
print "\n"
print "#{(WORLD_DIM_HEIGHT-1) - count_y} "
0.upto(WORLD_DIM_WIDTH-1) do |count_x|
cur_map_coords = {:x => count_x, :y => (WORLD_DIM_HEIGHT-1) - count_y}
cur_map_coords = {:x => count_x, :y => (WORLD_DIM_HEIGHT-1) - count_y, :z => self.player.cur_coords[:z]}
if self.player.cur_coords.eql?(cur_map_coords)
print '|O|'
elsif location_by_coords(cur_map_coords)
@@ -277,7 +277,8 @@ def init_locations
:monster_level_range => l["monster_level_range"].nil? ? nil : l["monster_level_range"]["lo"]..l["monster_level_range"]["hi"],
:coords => {
:x => l["coords"]["x"],
:y => l["coords"]["y"]
:y => l["coords"]["y"],
:z => l["coords"]["z"]
},
:locs_connected => {
:north => l["locs_connected"]["north"],

0 comments on commit 8e210c2

Please sign in to comment.