Class: Lich::Gemstone::Treasure

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

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.

Parameters:

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

    template treasure data; keys are :coins, :gems, :boxes, :skin, :magic_items, :other, :blunt_required



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.

Returns:

  • (Boolean)


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

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

#has_boxes?Boolean

Returns whether this creature may carry boxes.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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_hHash

Returns the raw treasure data hash.

Returns:



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

def to_h = @data