Sha256: 63ad6c0ec0d06041afd5a6032d2a174df473cdff61ff9e19c37a93f75340b27a

Contents?: true

Size: 1.37 KB

Versions: 12

Compression:

Stored size: 1.37 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
      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

12 entries across 12 versions & 1 rubygems

Version Path
gemwarrior-0.14.8 lib/gemwarrior/entities/item.rb
gemwarrior-0.14.7 lib/gemwarrior/entities/item.rb
gemwarrior-0.14.6 lib/gemwarrior/entities/item.rb
gemwarrior-0.14.5 lib/gemwarrior/entities/item.rb
gemwarrior-0.14.4 lib/gemwarrior/entities/item.rb
gemwarrior-0.14.3 lib/gemwarrior/entities/item.rb
gemwarrior-0.14.2 lib/gemwarrior/entities/item.rb
gemwarrior-0.14.1 lib/gemwarrior/entities/item.rb
gemwarrior-0.14.0 lib/gemwarrior/entities/item.rb
gemwarrior-0.13.2 lib/gemwarrior/entities/item.rb
gemwarrior-0.13.1 lib/gemwarrior/entities/item.rb
gemwarrior-0.13.0 lib/gemwarrior/entities/item.rb