Class: Goby::Helmet

Inherits:
Item
  • Object
show all
Includes:
Equippable
Defined in:
lib/goby/item/helmet.rb

Overview

Can be worn in the Player’s outfit.

Constant Summary

Constants inherited from Item

Item::DEFAULT_USE_TEXT

Instance Attribute Summary collapse

Attributes inherited from Item

#consumable, #disposable, #name, #price

Instance Method Summary collapse

Methods included from Equippable

#alter_stats, #equip, #unequip, #use

Methods inherited from Item

#==, #to_s, #use

Constructor Details

#initialize(name: "Helmet", price: 0, consumable: false, disposable: true, stat_change: {}) ⇒ Helmet

Returns a new instance of Helmet.

Parameters:

  • name (String) (defaults to: "Helmet")

    the name.

  • price (Integer) (defaults to: 0)

    the cost in a shop.

  • consumable (Boolean) (defaults to: false)

    upon use, the item is lost when true.

  • disposable (Boolean) (defaults to: true)

    allowed to sell or drop item when true.

  • stat_change (Hash) (defaults to: {})

    the change in stats for when the item is equipped.



14
15
16
17
18
# File 'lib/goby/item/helmet.rb', line 14

def initialize(name: "Helmet", price: 0, consumable: false, disposable: true, stat_change: {})
  super(name: name, price: price, consumable: consumable, disposable: disposable)
  @type = :helmet
  @stat_change = stat_change
end

Instance Attribute Details

#stat_changeObject (readonly)

Returns the value of attribute stat_change.



20
21
22
# File 'lib/goby/item/helmet.rb', line 20

def stat_change
  @stat_change
end

#typeObject (readonly)

Returns the value of attribute type.



20
21
22
# File 'lib/goby/item/helmet.rb', line 20

def type
  @type
end