Sha256: cc0b13513251c3cba5561425649b8f1ee577d3429da7fc46858b1abeda13a38e

Contents?: true

Size: 1.38 KB

Versions: 9

Compression:

Stored size: 1.38 KB

Contents

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

require_relative 'entity'

module Gemwarrior
  class Item < Entity
    attr_accessor :is_armor,
                  :is_weapon
  
    attr_reader   :use

    def initialize
      super
      
      self.is_armor   = false
      self.is_weapon  = false
    end

    def use(world)
      'That item does not do anything...yet.'
    end
    
    def describe_detailed(world)
      desc_text =  "\"#{name_display}\"\n".colorize(:yellow)
      desc_text << "(#{name})\n".colorize(:green)
      desc_text << "#{description}\n".colorize(:white)
      desc_text << "ARMOR?      #{is_armor}\n".colorize(:white)
      desc_text << "WEAPON?     #{is_weapon}\n".colorize(:white)
      desc_text << "TAKEABLE?   #{takeable}\n".colorize(:white)
      desc_text << "USEABLE?    #{useable}\n".colorize(:white)
      desc_text << "TALKABLE?   #{talkable}\n".colorize(:white)
      desc_text << "CONSUMABLE? #{consumable}\n".colorize(:white)
      desc_text << "EQUIPPABLE? #{equippable}\n".colorize(:white)
      desc_text << "EQUIPPED?   #{equipped}\n".colorize(:white)
      desc_text << "USED?       #{used}\n".colorize(:white)
      desc_text << "USED AGAIN? #{used_again}\n".colorize(:white)
      desc_text << "USES LEFT?  #{number_of_uses}\n".colorize(:white) unless number_of_uses.nil?
      desc_text
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gemwarrior-0.15.8 lib/gemwarrior/entities/item.rb
gemwarrior-0.15.7 lib/gemwarrior/entities/item.rb
gemwarrior-0.15.6 lib/gemwarrior/entities/item.rb
gemwarrior-0.15.5 lib/gemwarrior/entities/item.rb
gemwarrior-0.15.4 lib/gemwarrior/entities/item.rb
gemwarrior-0.15.3 lib/gemwarrior/entities/item.rb
gemwarrior-0.15.2 lib/gemwarrior/entities/item.rb
gemwarrior-0.15.1 lib/gemwarrior/entities/item.rb
gemwarrior-0.15.0 lib/gemwarrior/entities/item.rb