class Degica::Actor

Attributes

focus[RW]
inventory[R]
location[RW]

Public Class Methods

new(location) click to toggle source
# File lib/degica/actor.rb, line 8
def initialize(location)
  @location = location
  @inventory = InventoryCollection.new
  @focus = nil
  @points = 0
end

Public Instance Methods

actions() click to toggle source
# File lib/degica/actor.rb, line 30
def actions
  [Action.new(:describe, self), Action.new(:inventory, self)] + @location.actions
end
award(points) click to toggle source
# File lib/degica/actor.rb, line 21
def award(points)
  @points += points
  puts "You've gained #{ANSI.highlight('10 points', :white)} 💕"
end
describe() click to toggle source
# File lib/degica/actor.rb, line 34
def describe
  @focus&.describe || @location.describe
end
has_item?(item) click to toggle source
# File lib/degica/actor.rb, line 26
def has_item?(item)
  @inventory.include?(item)
end
pickup(item) click to toggle source
# File lib/degica/actor.rb, line 15
def pickup(item)
  puts "You picked up a (#{item.name}).".highlight
  @inventory << item.collection.delete(item)
  award(10)
end