Class: Lich::Gemstone::Wounds
- Inherits:
-
Gemstone::CharacterStatus
- Object
- Gemstone::CharacterStatus
- Lich::Gemstone::Wounds
- Defined in:
- lib/gemstone/wounds.rb,
lib/games.rb
Overview
Wounds class for tracking character wounds
Constant Summary collapse
- BODY_PARTS =
Body part accessor methods XML from Simutronics drives the structure of the wound naming (eg. leftEye) The following is a hash of the body parts and shorthand aliases created for more idiomatic Ruby
{ leftEye: ['leye'], rightEye: ['reye'], head: [], neck: [], back: [], chest: [], abdomen: ['abs'], leftArm: ['larm'], rightArm: ['rarm'], rightHand: ['rhand'], leftHand: ['lhand'], leftLeg: ['lleg'], rightLeg: ['rleg'], leftFoot: ['lfoot'], rightFoot: ['rfoot'], nsys: ['nerves'] }.freeze
Class Method Summary collapse
-
.abdomen ⇒ Wound
Returns the wound status of the abdomen.
-
.abs ⇒ Wound
Alias for abdomen.
-
.all_wounds ⇒ Hash
Helper method to get all wound levels.
-
.arms ⇒ String?
Composite wound methods Retrieves the maximum wound level for both arms and hands.
-
.back ⇒ Wound
Returns the wound status of the back.
-
.chest ⇒ Wound
Returns the wound status of the chest.
-
.head ⇒ Wound
Returns the wound status of the head.
-
.larm ⇒ Wound
Alias for leftArm.
- .left_arm ⇒ Object
-
.left_eye ⇒ Object
Alias snake_case methods for overachievers.
- .left_foot ⇒ Object
- .left_hand ⇒ Object
- .left_leg ⇒ Object
-
.leftArm ⇒ Wound
Returns the wound status of the left arm.
-
.leftEye ⇒ Wound
Returns the wound status of the left eye.
-
.leftFoot ⇒ Wound
Returns the wound status of the left foot.
-
.leftHand ⇒ Wound
Returns the wound status of the left hand.
-
.leftLeg ⇒ Wound
Returns the wound status of the left leg.
-
.leye ⇒ Wound
Alias for leftEye.
-
.lhand ⇒ Wound
Alias for leftHand.
-
.limbs ⇒ String?
Retrieves the maximum wound level for all limbs.
-
.lleg ⇒ Wound
Alias for leftLeg.
-
.method_missing(_arg = nil) ⇒ nil
Handles invalid area requests for wounds.
-
.neck ⇒ Wound
Returns the wound status of the neck.
-
.nerves ⇒ Wound
Returns the wound status of the nerves.
-
.nsys ⇒ Wound
Returns the wound status of the nervous system.
-
.part ⇒ String?
Define methods for each body part and its aliases Retrieves the wound for the body part.
-
.rarm ⇒ Wound
Alias for rightArm.
-
.reye ⇒ Wound
Alias for rightEye.
-
.rhand ⇒ Wound
Alias for rightHand.
- .right_arm ⇒ Object
- .right_eye ⇒ Object
- .right_foot ⇒ Object
- .right_hand ⇒ Object
- .right_leg ⇒ Object
-
.rightArm ⇒ Wound
Returns the wound status of the right arm.
-
.rightEye ⇒ Wound
Returns the wound status of the right eye.
-
.rightFoot ⇒ Wound
Returns the wound status of the right foot.
-
.rightHand ⇒ Wound
Returns the wound status of the right hand.
-
.rightLeg ⇒ Wound
Returns the wound status of the right leg.
-
.rleg ⇒ Wound
Alias for rightLeg.
-
.torso ⇒ String?
Retrieves the maximum wound level for the torso.
-
.wound_level(part) ⇒ String?
Helper method to get wound level for any body part.
Class Method Details
.abdomen ⇒ Wound
Returns the wound status of the abdomen.
644 |
# File 'lib/games.rb', line 644 def Wounds.abdomen; fix_injury_mode; XMLData.injuries['abdomen']['wound']; end |
.abs ⇒ Wound
Alias for abdomen.
651 |
# File 'lib/games.rb', line 651 def Wounds.abs; fix_injury_mode; XMLData.injuries['abdomen']['wound']; end |
.all_wounds ⇒ Hash
Helper method to get all wound levels
127 128 129 130 |
# File 'lib/gemstone/wounds.rb', line 127 def all_wounds fix_injury_mode('both') XMLData.injuries.transform_values { |v| v['wound'] } end |
.arms ⇒ String?
Composite wound methods Retrieves the maximum wound level for both arms and hands.
770 771 772 773 |
# File 'lib/games.rb', line 770 def Wounds.arms fix_injury_mode [XMLData.injuries['leftArm']['wound'], XMLData.injuries['rightArm']['wound'], XMLData.injuries['leftHand']['wound'], XMLData.injuries['rightHand']['wound']].max end |
.back ⇒ Wound
Returns the wound status of the back.
630 |
# File 'lib/games.rb', line 630 def Wounds.back; fix_injury_mode; XMLData.injuries['back']['wound']; end |
.chest ⇒ Wound
Returns the wound status of the chest.
637 |
# File 'lib/games.rb', line 637 def Wounds.chest; fix_injury_mode; XMLData.injuries['chest']['wound']; end |
.head ⇒ Wound
Returns the wound status of the head.
616 |
# File 'lib/games.rb', line 616 def Wounds.head; fix_injury_mode; XMLData.injuries['head']['wound']; end |
.larm ⇒ Wound
Alias for leftArm.
665 |
# File 'lib/games.rb', line 665 def Wounds.larm; fix_injury_mode; XMLData.injuries['leftArm']['wound']; end |
.left_arm ⇒ Object
53 |
# File 'lib/gemstone/wounds.rb', line 53 def left_arm; leftArm; end |
.left_eye ⇒ Object
Alias snake_case methods for overachievers
51 |
# File 'lib/gemstone/wounds.rb', line 51 def left_eye; leftEye; end |
.left_foot ⇒ Object
59 |
# File 'lib/gemstone/wounds.rb', line 59 def left_foot; leftFoot; end |
.left_hand ⇒ Object
55 |
# File 'lib/gemstone/wounds.rb', line 55 def left_hand; leftHand; end |
.left_leg ⇒ Object
57 |
# File 'lib/gemstone/wounds.rb', line 57 def left_leg; leftLeg; end |
.leftArm ⇒ Wound
Returns the wound status of the left arm.
658 |
# File 'lib/games.rb', line 658 def Wounds.leftArm; fix_injury_mode; XMLData.injuries['leftArm']['wound']; end |
.leftEye ⇒ Wound
Returns the wound status of the left eye.
588 |
# File 'lib/games.rb', line 588 def Wounds.leftEye; fix_injury_mode; XMLData.injuries['leftEye']['wound']; end |
.leftFoot ⇒ Wound
Returns the wound status of the left foot.
742 |
# File 'lib/games.rb', line 742 def Wounds.leftFoot; fix_injury_mode; XMLData.injuries['leftFoot']['wound']; end |
.leftHand ⇒ Wound
Returns the wound status of the left hand.
700 |
# File 'lib/games.rb', line 700 def Wounds.leftHand; fix_injury_mode; XMLData.injuries['leftHand']['wound']; end |
.leftLeg ⇒ Wound
Returns the wound status of the left leg.
714 |
# File 'lib/games.rb', line 714 def Wounds.leftLeg; fix_injury_mode; XMLData.injuries['leftLeg']['wound']; end |
.leye ⇒ Wound
Alias for leftEye.
595 |
# File 'lib/games.rb', line 595 def Wounds.leye; fix_injury_mode; XMLData.injuries['leftEye']['wound']; end |
.lhand ⇒ Wound
Alias for leftHand.
707 |
# File 'lib/games.rb', line 707 def Wounds.lhand; fix_injury_mode; XMLData.injuries['leftHand']['wound']; end |
.limbs ⇒ String?
Retrieves the maximum wound level for all limbs.
780 781 782 783 |
# File 'lib/games.rb', line 780 def Wounds.limbs fix_injury_mode [XMLData.injuries['leftArm']['wound'], XMLData.injuries['rightArm']['wound'], XMLData.injuries['leftHand']['wound'], XMLData.injuries['rightHand']['wound'], XMLData.injuries['leftLeg']['wound'], XMLData.injuries['rightLeg']['wound']].max end |
.lleg ⇒ Wound
Alias for leftLeg.
721 |
# File 'lib/games.rb', line 721 def Wounds.lleg; fix_injury_mode; XMLData.injuries['leftLeg']['wound']; end |
.method_missing(_arg = nil) ⇒ nil
Handles invalid area requests for wounds.
799 800 801 802 |
# File 'lib/games.rb', line 799 def Wounds.method_missing(_arg = nil) echo "Wounds: Invalid area, try one of these: arms, limbs, torso, #{XMLData.injuries.keys.join(', ')}" nil end |
.neck ⇒ Wound
Returns the wound status of the neck.
623 |
# File 'lib/games.rb', line 623 def Wounds.neck; fix_injury_mode; XMLData.injuries['neck']['wound']; end |
.nerves ⇒ Wound
Returns the wound status of the nerves.
763 |
# File 'lib/games.rb', line 763 def Wounds.nerves; fix_injury_mode; XMLData.injuries['nsys']['wound']; end |
.nsys ⇒ Wound
Returns the wound status of the nervous system.
756 |
# File 'lib/games.rb', line 756 def Wounds.nsys; fix_injury_mode; XMLData.injuries['nsys']['wound']; end |
.part ⇒ String?
Define methods for each body part and its aliases Retrieves the wound for the body part.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gemstone/wounds.rb', line 36 BODY_PARTS.each do |part, aliases| # Define the primary method define_method(part) do fix_injury_mode('both') # continue to use 'both' (_injury2) for now XMLData.injuries[part.to_s] && XMLData.injuries[part.to_s]['wound'] end # Define alias methods aliases.each do |ali| alias_method ali, part end end |
.rarm ⇒ Wound
Alias for rightArm.
679 |
# File 'lib/games.rb', line 679 def Wounds.rarm; fix_injury_mode; XMLData.injuries['rightArm']['wound']; end |
.reye ⇒ Wound
Alias for rightEye.
609 |
# File 'lib/games.rb', line 609 def Wounds.reye; fix_injury_mode; XMLData.injuries['rightEye']['wound']; end |
.rhand ⇒ Wound
Alias for rightHand.
693 |
# File 'lib/games.rb', line 693 def Wounds.rhand; fix_injury_mode; XMLData.injuries['rightHand']['wound']; end |
.right_arm ⇒ Object
54 |
# File 'lib/gemstone/wounds.rb', line 54 def right_arm; rightArm; end |
.right_eye ⇒ Object
52 |
# File 'lib/gemstone/wounds.rb', line 52 def right_eye; rightEye; end |
.right_foot ⇒ Object
60 |
# File 'lib/gemstone/wounds.rb', line 60 def right_foot; rightFoot; end |
.right_hand ⇒ Object
56 |
# File 'lib/gemstone/wounds.rb', line 56 def right_hand; rightHand; end |
.right_leg ⇒ Object
58 |
# File 'lib/gemstone/wounds.rb', line 58 def right_leg; rightLeg; end |
.rightArm ⇒ Wound
Returns the wound status of the right arm.
672 |
# File 'lib/games.rb', line 672 def Wounds.rightArm; fix_injury_mode; XMLData.injuries['rightArm']['wound']; end |
.rightEye ⇒ Wound
Returns the wound status of the right eye.
602 |
# File 'lib/games.rb', line 602 def Wounds.rightEye; fix_injury_mode; XMLData.injuries['rightEye']['wound']; end |
.rightFoot ⇒ Wound
Returns the wound status of the right foot.
749 |
# File 'lib/games.rb', line 749 def Wounds.rightFoot; fix_injury_mode; XMLData.injuries['rightFoot']['wound']; end |
.rightHand ⇒ Wound
Returns the wound status of the right hand.
686 |
# File 'lib/games.rb', line 686 def Wounds.rightHand; fix_injury_mode; XMLData.injuries['rightHand']['wound']; end |
.rightLeg ⇒ Wound
Returns the wound status of the right leg.
728 |
# File 'lib/games.rb', line 728 def Wounds.rightLeg; fix_injury_mode; XMLData.injuries['rightLeg']['wound']; end |
.rleg ⇒ Wound
Alias for rightLeg.
735 |
# File 'lib/games.rb', line 735 def Wounds.rleg; fix_injury_mode; XMLData.injuries['rightLeg']['wound']; end |
.torso ⇒ String?
Retrieves the maximum wound level for the torso.
790 791 792 793 |
# File 'lib/games.rb', line 790 def Wounds.torso fix_injury_mode [XMLData.injuries['rightEye']['wound'], XMLData.injuries['leftEye']['wound'], XMLData.injuries['chest']['wound'], XMLData.injuries['abdomen']['wound'], XMLData.injuries['back']['wound']].max end |
.wound_level(part) ⇒ String?
Helper method to get wound level for any body part
117 118 119 120 |
# File 'lib/gemstone/wounds.rb', line 117 def wound_level(part) fix_injury_mode('both') XMLData.injuries[part.to_s] && XMLData.injuries[part.to_s]['wound'] end |