Class: Lich::Gemstone::Treasure
- Inherits:
-
Object
- Object
- Lich::Gemstone::Treasure
- Defined in:
- documented/gemstone/creature.rb
Overview
Treasure drop configuration for a creature template.
Tracks what loot a creature may carry: coins, gems, containers, skin, magic items, and other valuables. Also records whether blunt weapons are required to harvest the skin.
Instance Method Summary collapse
-
#blunt_required? ⇒ Boolean
Returns whether blunt weapons are required to harvest the skin.
-
#has_boxes? ⇒ Boolean
Returns whether this creature may carry boxes.
-
#has_coins? ⇒ Boolean
Returns whether this creature may carry coins.
-
#has_gems? ⇒ Boolean
Returns whether this creature may carry gems.
-
#has_skin? ⇒ Boolean
Returns whether this creature has harvestable skin.
-
#initialize(data = {}) ⇒ void
constructor
Initializes treasure configuration from template data.
-
#to_h ⇒ Hash
Returns the raw treasure data hash.
Constructor Details
#initialize(data = {}) ⇒ void
Initializes treasure configuration from template data.
Sets defaults for all treasure types (false/nil) then merges in data from the template.
631 632 633 634 635 636 637 638 639 640 641 |
# File 'documented/gemstone/creature.rb', line 631 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
Returns whether blunt weapons are required to harvest the skin.
662 |
# File 'documented/gemstone/creature.rb', line 662 def blunt_required? = !!@data[:blunt_required] |
#has_boxes? ⇒ Boolean
Returns whether this creature may carry boxes.
654 655 656 657 |
# File 'documented/gemstone/creature.rb', line 654 def has_boxes? = !!@data[:boxes] # Returns whether this creature has harvestable skin. # # @return [Boolean] |
#has_coins? ⇒ Boolean
Returns whether this creature may carry coins.
646 647 648 649 |
# File 'documented/gemstone/creature.rb', line 646 def has_coins? = !!@data[:coins] # Returns whether this creature may carry gems. # # @return [Boolean] |
#has_gems? ⇒ Boolean
Returns whether this creature may carry gems.
650 651 652 653 |
# File 'documented/gemstone/creature.rb', line 650 def has_gems? = !!@data[:gems] # Returns whether this creature may carry boxes. # # @return [Boolean] |
#has_skin? ⇒ Boolean
Returns whether this creature has harvestable skin.
658 659 660 661 |
# File 'documented/gemstone/creature.rb', line 658 def has_skin? = !!@data[:skin] # Returns whether blunt weapons are required to harvest the skin. # # @return [Boolean] |
#to_h ⇒ Hash
Returns the raw treasure data hash.
667 |
# File 'documented/gemstone/creature.rb', line 667 def to_h = @data |