Sha256: 2179415b201690b471396a73430c799ecf0e2de22bcead7d168c0007dad14a5f

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 KB

Contents

# lib/gemwarrior/entities/items/bed.rb
# Item::Bed

require_relative '../item'

module Gemwarrior
  class Bed < Item
    # CONSTANTS
    USE_TEXT = '** ZZZZZ **'

    def initialize
      self.name         = 'bed'
      self.description  = 'The place where you sleep when you are not adventuring.'
      self.atk_lo       = nil
      self.atk_hi       = nil
      self.takeable     = false
      self.useable      = true
      self.equippable   = false
      self.equipped     = false
    end

    def use(player = nil)
      if player.at_full_hp?
        puts 'You feel perfectly healthy and decide not to actually use the bed. Besides, the trail of fire ants currently leading up to and around the furniture seem somehow uninviting.'
        { type: nil, data: nil }
      else
        Animation::run(phrase: USE_TEXT)
        puts 'You unmake the bed, get under the covers, close your eyes, and begin to think about all the things you need to do today. You realize sleep is not one of them and quickly get back up, remake the bed, and get on about your day.'
        puts '>> You regain a few hit points.'
        { type: 'rest', data: 5 }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gemwarrior-0.9.37 lib/gemwarrior/entities/items/bed.rb
gemwarrior-0.9.36 lib/gemwarrior/entities/items/bed.rb
gemwarrior-0.9.35 lib/gemwarrior/entities/items/bed.rb
gemwarrior-0.9.34 lib/gemwarrior/entities/items/bed.rb
gemwarrior-0.9.33 lib/gemwarrior/entities/items/bed.rb
gemwarrior-0.9.32 lib/gemwarrior/entities/items/bed.rb
gemwarrior-0.9.31 lib/gemwarrior/entities/items/bed.rb
gemwarrior-0.9.30 lib/gemwarrior/entities/items/bed.rb
gemwarrior-0.9.28 lib/gemwarrior/entities/items/bed.rb