Sha256: 595d6e8a7598700ce372088d12cba8e7c121ec64d3982e5129045c4bef09b8f6

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

# lib/gemwarrior/entities/items/herb.rb
# Item::Herb

require_relative '../item'

module Gemwarrior
  class Herb < Item
    def initialize
      super

      self.name         = 'herb'
      self.description  = 'Green and leafy, this wild herb looks edible.'
      self.atk_lo       = nil
      self.atk_hi       = nil
      self.takeable     = true
      self.useable      = true
      self.consumable   = true
      self.equippable   = false
    end

    def use(player = nil)
      puts 'You place the entire, smallish plant in your mouth, testing its texture. The mysterious herb is easily chewable, and you are able to swallow it without much effort. Slight tingles travel up and down your spine.'
      if player.at_full_hp?
        puts '>> The herb has no medicinal effect, as you already feel perfectly healthy, but it was kind of tasty.'
        { type: nil, data: nil }
      else
        puts '>> You regain a few hit points.'
        { type: 'health', data: rand(3..5) }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gemwarrior-0.10.8 lib/gemwarrior/entities/items/herb.rb
gemwarrior-0.10.7 lib/gemwarrior/entities/items/herb.rb
gemwarrior-0.10.6 lib/gemwarrior/entities/items/herb.rb
gemwarrior-0.10.5 lib/gemwarrior/entities/items/herb.rb
gemwarrior-0.10.4 lib/gemwarrior/entities/items/herb.rb
gemwarrior-0.10.2 lib/gemwarrior/entities/items/herb.rb
gemwarrior-0.10.1 lib/gemwarrior/entities/items/herb.rb
gemwarrior-0.10.0 lib/gemwarrior/entities/items/herb.rb
gemwarrior-0.9.39 lib/gemwarrior/entities/items/herb.rb