Class: Lich::DragonRealms::DRCH::HealthResult

Inherits:
Object
  • Object
show all
Defined in:
documented/dragonrealms/commons/common-healing.rb

Overview

Represents the result of a health check, containing various health attributes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wounds: {}, bleeders: {}, parasites: {}, lodged: {}, poisoned: false, diseased: false, score: 0, dead: false, vitality: 100) ⇒ HealthResult

Returns a new instance of HealthResult.



447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'documented/dragonrealms/commons/common-healing.rb', line 447

def initialize(wounds: {}, bleeders: {}, parasites: {}, lodged: {},
               poisoned: false, diseased: false, score: 0, dead: false,
               vitality: 100)
  @wounds = wounds
  @bleeders = bleeders
  @parasites = parasites
  @lodged = lodged
  @poisoned = poisoned
  @diseased = diseased
  @score = score
  @dead = dead
  @vitality = vitality
end

Instance Attribute Details

#bleedersObject (readonly)

Returns the value of attribute bleeders.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def bleeders
  @bleeders
end

#deadObject (readonly)

Returns the value of attribute dead.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def dead
  @dead
end

#diseasedObject (readonly)

Returns the value of attribute diseased.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def diseased
  @diseased
end

#lodgedObject (readonly)

Returns the value of attribute lodged.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def lodged
  @lodged
end

#parasitesObject (readonly)

Returns the value of attribute parasites.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def parasites
  @parasites
end

#poisonedObject (readonly)

Returns the value of attribute poisoned.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def poisoned
  @poisoned
end

#scoreObject (readonly)

Returns the value of attribute score.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def score
  @score
end

#vitalityObject (readonly)

Returns the value of attribute vitality.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def vitality
  @vitality
end

#woundsObject (readonly)

Returns the value of attribute wounds.



444
445
446
# File 'documented/dragonrealms/commons/common-healing.rb', line 444

def wounds
  @wounds
end

Instance Method Details

#[](key) ⇒ Object



461
462
463
# File 'documented/dragonrealms/commons/common-healing.rb', line 461

def [](key)
  send(key.to_sym)
end

#bleeding?Boolean

Returns:

  • (Boolean)


469
470
471
# File 'documented/dragonrealms/commons/common-healing.rb', line 469

def bleeding?
  bleeders.values.flatten.any?(&:bleeding?)
end

#has_tendable_bleeders?Boolean

Returns:

  • (Boolean)


473
474
475
# File 'documented/dragonrealms/commons/common-healing.rb', line 473

def has_tendable_bleeders?
  bleeders.values.flatten.any?(&:tendable?)
end

#injured?Boolean

Returns:

  • (Boolean)


465
466
467
# File 'documented/dragonrealms/commons/common-healing.rb', line 465

def injured?
  score > 0
end