Class: Lich::Gemstone::Scars
- Inherits:
-
CharacterStatus
- Object
- CharacterStatus
- Lich::Gemstone::Scars
- Defined in:
- documented/gemstone/scars.rb
Overview
Scars class for tracking character scars Scars class for tracking character scars
This class provides methods to access and manage scars on various body parts of a character. It defines both primary and alias methods for body parts, as well as composite methods for groups of body parts.
Constant Summary collapse
- BODY_PARTS =
Body part accessor methods XML from Simutronics drives the structure of the scar naming (eg. leftEye) The following is a hash of the body parts and shorthand aliases created for more idiomatic Ruby A hash of body parts and their shorthand aliases. This constant drives the structure of the scar naming convention.
{ 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
-
.all_scars ⇒ Hash
Helper method to get all scar levels Retrieves the scar levels for all body parts.
-
.arms ⇒ Integer?
Composite scar methods Retrieves the maximum scar level for both arms and hands.
- .left_arm ⇒ Object
-
.left_eye ⇒ Integer?
Alias snake_case methods for overachievers Retrieves the scar level for the left eye using snake_case.
- .left_foot ⇒ Object
- .left_hand ⇒ Object
- .left_leg ⇒ Object
-
.limbs ⇒ Integer?
Retrieves the maximum scar level for all limbs (arms and legs).
- .right_arm ⇒ Object
- .right_eye ⇒ Object
- .right_foot ⇒ Object
- .right_hand ⇒ Object
- .right_leg ⇒ Object
-
.scar_level(part) ⇒ Integer?
Helper method to get scar level for any body part Retrieves the scar level for a specified body part.
-
.torso ⇒ Integer?
Retrieves the maximum scar level for the torso.
Methods inherited from CharacterStatus
fix_injury_mode, method_missing
Class Method Details
.all_scars ⇒ Hash
This method temporarily changes the injury mode to ‘scar’ to retrieve actual scar level data.
Helper method to get all scar levels Retrieves the scar levels for all body parts.
144 145 146 147 148 149 150 151 152 |
# File 'documented/gemstone/scars.rb', line 144 def all_scars begin fix_injury_mode('scar') # for this one call, we want to get actual scar level data result = XMLData.injuries.transform_values { |v| v['scar'] } ensure fix_injury_mode('both') # reset to both end return result end |
.arms ⇒ Integer?
This method uses ‘both’ injury mode for consistency.
Composite scar methods Retrieves the maximum scar level for both arms and hands.
79 80 81 82 83 84 85 86 87 |
# File 'documented/gemstone/scars.rb', line 79 def arms fix_injury_mode('both') [ XMLData.injuries['leftArm']['scar'], XMLData.injuries['rightArm']['scar'], XMLData.injuries['leftHand']['scar'], XMLData.injuries['rightHand']['scar'] ].max end |
.left_arm ⇒ Object
63 |
# File 'documented/gemstone/scars.rb', line 63 def left_arm; leftArm; end |
.left_eye ⇒ Integer?
This method is an alias for leftEye.
Alias snake_case methods for overachievers Retrieves the scar level for the left eye using snake_case.
61 |
# File 'documented/gemstone/scars.rb', line 61 def left_eye; leftEye; end |
.left_foot ⇒ Object
69 |
# File 'documented/gemstone/scars.rb', line 69 def left_foot; leftFoot; end |
.left_hand ⇒ Object
65 |
# File 'documented/gemstone/scars.rb', line 65 def left_hand; leftHand; end |
.left_leg ⇒ Object
67 |
# File 'documented/gemstone/scars.rb', line 67 def left_leg; leftLeg; end |
.limbs ⇒ Integer?
This method uses ‘both’ injury mode for consistency.
Retrieves the maximum scar level for all limbs (arms and legs).
95 96 97 98 99 100 101 102 103 104 105 |
# File 'documented/gemstone/scars.rb', line 95 def limbs fix_injury_mode('both') [ XMLData.injuries['leftArm']['scar'], XMLData.injuries['rightArm']['scar'], XMLData.injuries['leftHand']['scar'], XMLData.injuries['rightHand']['scar'], XMLData.injuries['leftLeg']['scar'], XMLData.injuries['rightLeg']['scar'] ].max end |
.right_arm ⇒ Object
64 |
# File 'documented/gemstone/scars.rb', line 64 def right_arm; rightArm; end |
.right_eye ⇒ Object
62 |
# File 'documented/gemstone/scars.rb', line 62 def right_eye; rightEye; end |
.right_foot ⇒ Object
70 |
# File 'documented/gemstone/scars.rb', line 70 def right_foot; rightFoot; end |
.right_hand ⇒ Object
66 |
# File 'documented/gemstone/scars.rb', line 66 def right_hand; rightHand; end |
.right_leg ⇒ Object
68 |
# File 'documented/gemstone/scars.rb', line 68 def right_leg; rightLeg; end |
.scar_level(part) ⇒ Integer?
This method uses ‘both’ injury mode for consistency.
Helper method to get scar level for any body part Retrieves the scar level for a specified body part.
132 133 134 135 |
# File 'documented/gemstone/scars.rb', line 132 def scar_level(part) fix_injury_mode('both') XMLData.injuries[part.to_s] && XMLData.injuries[part.to_s]['scar'] end |
.torso ⇒ Integer?
This method uses ‘both’ injury mode for consistency.
Retrieves the maximum scar level for the torso.
113 114 115 116 117 118 119 120 121 122 |
# File 'documented/gemstone/scars.rb', line 113 def torso fix_injury_mode('both') [ XMLData.injuries['rightEye']['scar'], XMLData.injuries['leftEye']['scar'], XMLData.injuries['chest']['scar'], XMLData.injuries['abdomen']['scar'], XMLData.injuries['back']['scar'] ].max end |