Class: Lich::DragonRealms::DRCH::HealthResult
- Inherits:
-
Object
- Object
- Lich::DragonRealms::DRCH::HealthResult
- Defined in:
- documented/dragonrealms/commons/common-healing.rb
Overview
Structured result from check_health or perceive_health. Supports backward-compatible string-key access via [] for dr-scripts callers.
Instance Attribute Summary collapse
-
#bleeders ⇒ Object
readonly
Returns the value of attribute bleeders.
-
#dead ⇒ Object
readonly
Returns the value of attribute dead.
-
#diseased ⇒ Object
readonly
Returns the value of attribute diseased.
-
#lodged ⇒ Object
readonly
Returns the value of attribute lodged.
-
#parasites ⇒ Object
readonly
Returns the value of attribute parasites.
-
#poisoned ⇒ Object
readonly
Returns the value of attribute poisoned.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#vitality ⇒ Object
readonly
Returns the value of attribute vitality.
-
#wounds ⇒ Object
readonly
Returns the value of attribute wounds.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Backward compatibility for dr-scripts callers using health_data etc.
- #bleeding? ⇒ Boolean
-
#has_tendable_bleeders? ⇒ Boolean
Checks whether the character has bleeders that can be tended.
-
#initialize(wounds: {}, bleeders: {}, parasites: {}, lodged: {}, poisoned: false, diseased: false, score: 0, dead: false, vitality: 100) ⇒ void
constructor
Initializes a HealthResult with health diagnostic data.
-
#injured? ⇒ Boolean
Checks whether the character has any injuries.
Constructor Details
#initialize(wounds: {}, bleeders: {}, parasites: {}, lodged: {}, poisoned: false, diseased: false, score: 0, dead: false, vitality: 100) ⇒ void
Initializes a HealthResult with health diagnostic data.
466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 466 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
#bleeders ⇒ Object (readonly)
Returns the value of attribute bleeders.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def bleeders @bleeders end |
#dead ⇒ Object (readonly)
Returns the value of attribute dead.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def dead @dead end |
#diseased ⇒ Object (readonly)
Returns the value of attribute diseased.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def diseased @diseased end |
#lodged ⇒ Object (readonly)
Returns the value of attribute lodged.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def lodged @lodged end |
#parasites ⇒ Object (readonly)
Returns the value of attribute parasites.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def parasites @parasites end |
#poisoned ⇒ Object (readonly)
Returns the value of attribute poisoned.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def poisoned @poisoned end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def score @score end |
#vitality ⇒ Object (readonly)
Returns the value of attribute vitality.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def vitality @vitality end |
#wounds ⇒ Object (readonly)
Returns the value of attribute wounds.
451 452 453 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 451 def wounds @wounds end |
Instance Method Details
#[](key) ⇒ Object
Backward compatibility for dr-scripts callers using health_data etc.
481 482 483 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 481 def [](key) send(key.to_sym) end |
#bleeding? ⇒ Boolean
492 493 494 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 492 def bleeding? bleeders.values.flatten.any?(&:bleeding?) end |
#has_tendable_bleeders? ⇒ Boolean
Checks whether the character has bleeders that can be tended.
A bleeder is tendable if the character has sufficient First Aid skill or if it is a parasite or lodged item.
502 503 504 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 502 def has_tendable_bleeders? bleeders.values.flatten.any?(&:tendable?) end |
#injured? ⇒ Boolean
Checks whether the character has any injuries.
488 489 490 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 488 def injured? score > 0 end |