Skip to content

Commit

Permalink
rockney can now be used again
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchadwick committed Sep 14, 2015
1 parent 56a0fa5 commit 5b1e957
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions lib/gemwarrior/entities/people/rockney.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require_relative '../weapons/dagger'

module Gemwarrior
class Rockney < Item
class Rockney < Person
# CONSTANTS
PRICE_HERB = 10
PRICE_DAGGER = 150
Expand All @@ -29,13 +29,13 @@ def use(world)
puts
end

rat_shop(player)
rat_shop(world)
end

private

def rat_shop(player)
player_rox_remaining = player.rox
def rat_shop(world)
player_rox_remaining = world.player.rox
amount_spent = 0
items_purchased = []

Expand All @@ -52,7 +52,7 @@ def rat_shop(player)
puts " #{herb.description}"
puts "(2) #{'Dagger'.colorize(:yellow)} - #{PRICE_DAGGER} rox"
puts " #{dagger.description}"
puts " Attack: +#{dagger.atk_lo}-#{dagger.atk_hi} (current: #{player.atk_lo}-#{player.atk_hi})"
puts " Attack: +#{dagger.atk_lo}-#{dagger.atk_hi} (current: #{world.player.atk_lo}-#{world.player.atk_hi})"
puts
speak('What are you in need of?')

Expand Down Expand Up @@ -89,8 +89,8 @@ def rat_shop(player)
next
end
when '2'
if player.rox >= PRICE_DAGGER
player.rox -= PRICE_DAGGER
if world.player.rox >= PRICE_DAGGER
world.player.rox -= PRICE_DAGGER
items_purchased.push(Dagger.new)
amount_spent += PRICE_DAGGER

Expand All @@ -103,6 +103,7 @@ def rat_shop(player)
next
end
when 'x'
return_type = { type: nil, data: nil }
if items_purchased.length > 0
display_shopping_cart(items_purchased)
speak('Are you certain you wish to buy these things? (y/n)')
Expand All @@ -113,7 +114,7 @@ def rat_shop(player)
return_type = nil
case answer
when 'y', 'yes'
player.rox -= amount_spent
world.player.rox -= amount_spent
speak('Enjoy!')
return_type = { type: 'purchase', data: items_purchased }
else
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Version of Gem Warrior

module Gemwarrior
VERSION = '0.11.4'
VERSION = '0.11.5'
end

0 comments on commit 5b1e957

Please sign in to comment.