Sha256: bb7d163c3ac2c211e72e161c307a9b561461cc6d5325e3f546e242a2a7744fb0

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

# lib/gemwarrior/entities/item.rb
# Item base class

require_relative 'entity'

module Gemwarrior
  class Item < Entity
    attr_accessor :atk_lo, :atk_hi, :takeable, :useable, :equippable, :equipped,
                  :consumable, :use, :used, :number_of_uses

    def initialize
      self.equipped       = false
      self.consumable     = false
      self.used           = false
      self.number_of_uses = nil
    end

    def use(inventory = nil)
      'That item does not do anything...yet.'
    end

    def describe
      status_text =  name.upcase.colorize(:green)
      status_text << "\n#{description} \n".colorize(:white)
      status_text << "ATTACK: #{atk_lo}-#{atk_hi} \n".colorize(:white) unless atk_lo.nil?
      status_text << "TAKEABLE? #{takeable}\n".colorize(:white)
      status_text << "USEABLE? #{useable}\n".colorize(:white)
      status_text << "EQUIPPABLE? #{equippable}\n".colorize(:white)
      status_text << "CONSUMABLE? #{consumable}\n".colorize(:white)
      status_text << "NUMBER OF USES? #{number_of_uses}\n".colorize(:white) unless number_of_uses.nil?
      status_text << "\n"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gemwarrior-0.10.4 lib/gemwarrior/entities/item.rb
gemwarrior-0.10.2 lib/gemwarrior/entities/item.rb
gemwarrior-0.10.1 lib/gemwarrior/entities/item.rb
gemwarrior-0.10.0 lib/gemwarrior/entities/item.rb
gemwarrior-0.9.39 lib/gemwarrior/entities/item.rb