Class: Lich::Gemstone::Treasure

Inherits:
Object
  • Object
show all
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

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.

Returns:

  • (Boolean)

    True if blunt is required, otherwise false.



690
# File 'documented/gemstone/creature.rb', line 690

def blunt_required? = !!@data[:blunt_required]

#has_boxes?Boolean

Checks if the treasure has boxes.

Returns:

  • (Boolean)

    True if boxes are present, otherwise false.



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.

Returns:

  • (Boolean)

    True if coins are present, otherwise false.



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.

Returns:

  • (Boolean)

    True if gems are present, otherwise false.



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.

Returns:

  • (Boolean)

    True if skin is present, otherwise false.



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_hHash

Converts the treasure data to a hash.

Returns:

  • (Hash)

    The treasure data as a hash.



694
# File 'documented/gemstone/creature.rb', line 694

def to_h = @data