Class: Lich::DragonRealms::DRCH::Wound
- Inherits:
-
Object
- Object
- Lich::DragonRealms::DRCH::Wound
- Defined in:
- documented/dragonrealms/commons/common-healing.rb
Overview
Represents a wound on a character’s body. This class encapsulates details about the wound such as body part, severity, and bleeding rate.
Instance Attribute Summary collapse
-
#bleeding_rate ⇒ Object
Returns the value of attribute bleeding_rate.
-
#body_part ⇒ Object
Returns the value of attribute body_part.
-
#severity ⇒ Object
Returns the value of attribute severity.
Instance Method Summary collapse
-
#bleeding? ⇒ Boolean
Checks if the wound is currently bleeding.
-
#initialize(body_part: nil, severity: nil, bleeding_rate: nil, is_internal: false, is_scar: false, is_parasite: false, is_lodged_item: false) ⇒ Wound
constructor
The part of the body that’s wounded, like ‘left hand’ or ‘abdomen’.
-
#internal? ⇒ Boolean
Checks if the wound is internal.
-
#location ⇒ String
Returns the location type of the wound.
-
#lodged? ⇒ Boolean
Checks if the wound is caused by a lodged item.
-
#parasite? ⇒ Boolean
Checks if the wound is caused by a parasite.
-
#scar? ⇒ Boolean
Checks if the wound is a scar.
-
#tendable? ⇒ Boolean
Checks if the wound can be tended to.
-
#type ⇒ String
Returns the type of the wound.
Constructor Details
#initialize(body_part: nil, severity: nil, bleeding_rate: nil, is_internal: false, is_scar: false, is_parasite: false, is_lodged_item: false) ⇒ Wound
The part of the body that’s wounded, like ‘left hand’ or ‘abdomen’. At this time, at what rate is the wound bleeding, like ‘light’ or ‘moderate(tended)’. Initializes a new Wound object.
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 476 def initialize( body_part: nil, severity: nil, bleeding_rate: nil, is_internal: false, is_scar: false, is_parasite: false, is_lodged_item: false ) @body_part = body_part.nil? ? nil : body_part.downcase @severity = severity @bleeding_rate = bleeding_rate.nil? ? nil : bleeding_rate.downcase @is_internal = !!is_internal @is_scar = !!is_scar @is_parasite = !!is_parasite @is_lodged_item = !!is_lodged_item end |
Instance Attribute Details
#bleeding_rate ⇒ Object
Returns the value of attribute bleeding_rate.
461 462 463 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 461 def bleeding_rate @bleeding_rate end |
#body_part ⇒ Object
Returns the value of attribute body_part.
461 462 463 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 461 def body_part @body_part end |
#severity ⇒ Object
Returns the value of attribute severity.
461 462 463 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 461 def severity @severity end |
Instance Method Details
#bleeding? ⇒ Boolean
Checks if the wound is currently bleeding.
497 498 499 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 497 def bleeding? return !@bleeding_rate.nil? && !@bleeding_rate.empty? && @bleeding_rate != '(tended)' end |
#internal? ⇒ Boolean
Checks if the wound is internal.
503 504 505 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 503 def internal? return @is_internal end |
#location ⇒ String
Returns the location type of the wound.
539 540 541 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 539 def location internal? ? 'internal' : 'external' end |
#lodged? ⇒ Boolean
Checks if the wound is caused by a lodged item.
521 522 523 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 521 def lodged? return @is_lodged_item end |
#parasite? ⇒ Boolean
Checks if the wound is caused by a parasite.
515 516 517 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 515 def parasite? return @is_parasite end |
#scar? ⇒ Boolean
Checks if the wound is a scar.
509 510 511 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 509 def scar? return @is_scar end |
#tendable? ⇒ Boolean
Checks if the wound can be tended to.
527 528 529 530 531 532 533 534 535 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 527 def tendable? return true if parasite? return true if lodged? return false if @body_part =~ /skin/ return false if !bleeding? return false if @bleeding_rate =~ /tended|clotted/ return DRCH.skilled_to_tend_wound?(@bleeding_rate, internal?) end |
#type ⇒ String
Returns the type of the wound.
545 546 547 |
# File 'documented/dragonrealms/commons/common-healing.rb', line 545 def type scar? ? 'scar' : 'wound' end |