Permalink
Browse files

added a merchant and a new dagger weapon

  • Loading branch information...
michaelchadwick committed Jul 6, 2015
1 parent 6b8d964 commit 0bd38440a2ad36513200c9a97c0eb736a20e8d92
View
@@ -225,6 +225,25 @@
lo: 3
hi: 4
-
name: 'Tunnel Alcove'
description: 'A moderately-sized alcove seems to have been blown out of the side of tunnel here, almost as if an actual bomb detonated, the remainder of the wall a mix of rock and wires.'
danger_level: :moderate
coords:
x: 4
y: 5
z: -1
locs_connected:
north: false
east: true
south: false
west: false
monster_level_range:
lo: 3
hi: 4
items:
- SmallHole
-
name: 'Metal Tunnel'
description: 'The walls of this underground tunnel shine, as if some otherworldly light source emanates directly from them. It is cold and narrow and you are not sure you are a huge fan of it.'
@@ -11,7 +11,8 @@ class Item < Entity
:useable,
:equippable,
:equipped,
:use
:use,
:reuse
def use(inventory = nil)
'That item does not do anything...yet.'
@@ -0,0 +1,19 @@
# lib/gemwarrior/entities/items/dagger.rb
# Item::Dagger
require_relative '../item'
module Gemwarrior
class Dagger < Item
def initialize
self.name = 'dagger'
self.description = 'Flint that has been sharpened to a point, attached to a block of smooth granite by thin rope. Truly a work of art.'
self.atk_lo = 2
self.atk_hi = 4
self.takeable = true
self.useable = false
self.equippable = true
self.equipped = false
end
end
end
@@ -0,0 +1,87 @@
# lib/gemwarrior/entities/items/small_hole.rb
# Item::SmallHole
require_relative '../item'
require_relative 'herb'
require_relative 'dagger'
module Gemwarrior
PLAYER_ROX_INSUFFICIENT = 'You do not have enough rox to purchase that item.'
class SmallHole < Item
def initialize
self.name = 'small_hole'
self.description = 'Amongst the rubble of the alcove, a small hole, barely big enough for a rodent, exists in an absently-minded way near the bottom of the wall.'
self.atk_lo = nil
self.atk_hi = nil
self.takeable = false
self.useable = true
self.equippable = false
self.equipped = false
end
def use(player = nil)
puts 'You lower yourself to the ground and attempt to peer in the hole in the wall. Just as you begin to think this is a fruitless endeavor, a pair of bright, beady eyes manifest, and an unexpectedly low voice begins speaking to you:'
rat_shop(player)
end
def reuse(player = nil)
rat_shop(player)
end
def rat_shop(player)
items_purchased = []
puts '>>"Hello, wanderer. Welcome to my establishment, as it were. Are you in need of anything?"'
puts
puts 'The creature gently shoves a small slip of paper out of his hole and towards you. You take a peek and notice it has a list of things with prices on it.'
puts
puts 'Rodney\'s Hole in the Wall'
puts '--------------------------'
puts '(1) Herb - 10 rox'
puts '(2) Dagger - 150 rox'
puts
puts '>>"What are you in need of?"'
loop do
puts " 1 - Herb"
puts " 2 - Dagger"
puts " x - leave"
choice = gets.chomp!
case choice
when '1'
if player.rox >= 10
player.rox -= 10
items_purchased.push(Herb.new)
puts '>>"Excellent choice."'
puts '>>"Anything else?"'
next
else
puts PLAYER_ROX_INSUFFICIENT
next
end
when '2'
if player.rox >= 150
player.rox -= 150
items_purchased.push(Dagger.new)
puts '>>"A fine blade, indeed."'
puts '>>"Anything else?"'
next
else
puts PLAYER_ROX_INSUFFICIENT
next
end
when 'x'
puts '>>"If you need anything further, I\'m always in this hole..."'
return {:type => 'purchase', :data => items_purchased}
else
puts '>>"Huh?"'
next
end
end
end
end
end
@@ -316,10 +316,13 @@ def evaluate(input)
when 'arena'
arena = Arena.new({:world => world, :player => world.player})
arena.start
#return 'You enter the arena and fight some battles. It was cool, but not as cool as if it were actually implemented.'
when 'item'
world.location_by_coords(world.player.cur_coords).add_item(result[:data])
return
when 'purchase'
result[:data].each do |i|
world.player.inventory.items.push(i)
end
else
return
end
@@ -2,5 +2,5 @@
# Version of Gem Warrior
module Gemwarrior
VERSION = "0.8.7"
VERSION = "0.8.8"
end

0 comments on commit 0bd3844

Please sign in to comment.