Class: Lich::Gemstone::Treasure
- Inherits:
-
Object
- Object
- Lich::Gemstone::Treasure
- Defined in:
- documented/gemstone/creature.rb
Overview
Represents the treasure associated with a creature. This class manages the treasure data, including coins, gems, and magic items.
Instance Method Summary collapse
-
#blunt_required? ⇒ Boolean
Checks if a blunt weapon is required to access the treasure.
-
#has_boxes? ⇒ Boolean
Checks if the treasure has boxes.
-
#has_coins? ⇒ Boolean
Checks if the treasure has coins.
-
#has_gems? ⇒ Boolean
Checks if the treasure has gems.
-
#has_skin? ⇒ Boolean
Checks if the treasure has skin.
-
#initialize(data = {}) ⇒ Treasure
constructor
A new instance of Treasure.
-
#to_h ⇒ Hash
Converts the treasure data to a hash.
Constructor Details
#initialize(data = {}) ⇒ Treasure
Returns a new instance of Treasure.
664 665 666 667 668 669 670 671 672 673 674 |
# File 'documented/gemstone/creature.rb', line 664 def initialize(data = {}) @data = { coins: false, gems: false, boxes: false, skin: nil, magic_items: nil, other: nil, blunt_required: false }.merge(data) end |
Instance Method Details
#blunt_required? ⇒ Boolean
Checks if a blunt weapon is required to access the treasure.
690 |
# File 'documented/gemstone/creature.rb', line 690 def blunt_required? = !!@data[:blunt_required] |
#has_boxes? ⇒ Boolean
Checks if the treasure has boxes.
684 685 686 |
# File 'documented/gemstone/creature.rb', line 684 def has_boxes? = !!@data[:boxes] # Checks if the treasure has skin. # @return [Boolean] True if skin is present, otherwise false. |
#has_coins? ⇒ Boolean
Checks if the treasure has coins.
678 679 680 |
# File 'documented/gemstone/creature.rb', line 678 def has_coins? = !!@data[:coins] # Checks if the treasure has gems. # @return [Boolean] True if gems are present, otherwise false. |
#has_gems? ⇒ Boolean
Checks if the treasure has gems.
681 682 683 |
# File 'documented/gemstone/creature.rb', line 681 def has_gems? = !!@data[:gems] # Checks if the treasure has boxes. # @return [Boolean] True if boxes are present, otherwise false. |
#has_skin? ⇒ Boolean
Checks if the treasure has skin.
687 688 689 |
# File 'documented/gemstone/creature.rb', line 687 def has_skin? = !!@data[:skin] # Checks if a blunt weapon is required to access the treasure. # @return [Boolean] True if blunt is required, otherwise false. |
#to_h ⇒ Hash
Converts the treasure data to a hash.
694 |
# File 'documented/gemstone/creature.rb', line 694 def to_h = @data |