Class: Lich::Gemstone::Scars
- Inherits:
-
Gemstone::CharacterStatus
- Object
- Gemstone::CharacterStatus
- Lich::Gemstone::Scars
- Defined in:
- documented/gemstone/scars.rb
Overview
Represents the scars of a character in the game.
This class provides methods to access and manipulate the scar data for various body parts of a character.
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
{ 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
Retrieves the scar levels for all body parts.
- .arms ⇒ Object
- .left_arm ⇒ Object
- .left_eye ⇒ Object
- .left_foot ⇒ Object
- .left_hand ⇒ Object
- .left_leg ⇒ Object
- .limbs ⇒ Object
-
.part ⇒ String?
Define methods for each body part and its aliases Defines methods for each body part and its aliases.
- .right_arm ⇒ Object
- .right_eye ⇒ Object
- .right_foot ⇒ Object
- .right_hand ⇒ Object
- .right_leg ⇒ Object
-
.scar_level(part) ⇒ String?
Retrieves the scar level for a specific body part.
- .torso ⇒ Object
Class Method Details
.all_scars ⇒ Hash
Retrieves the scar levels for all body parts.
109 110 111 112 113 114 115 116 117 |
# File 'documented/gemstone/scars.rb', line 109 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 ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'documented/gemstone/scars.rb', line 64 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
55 |
# File 'documented/gemstone/scars.rb', line 55 def left_arm; leftArm; end |
.left_eye ⇒ Object
53 |
# File 'documented/gemstone/scars.rb', line 53 def left_eye; leftEye; end |
.left_foot ⇒ Object
61 |
# File 'documented/gemstone/scars.rb', line 61 def left_foot; leftFoot; end |
.left_hand ⇒ Object
57 |
# File 'documented/gemstone/scars.rb', line 57 def left_hand; leftHand; end |
.left_leg ⇒ Object
59 |
# File 'documented/gemstone/scars.rb', line 59 def left_leg; leftLeg; end |
.limbs ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'documented/gemstone/scars.rb', line 74 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 |
.part ⇒ String?
Define methods for each body part and its aliases Defines methods for each body part and its aliases. Each method retrieves the scar data for the corresponding body part.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'documented/gemstone/scars.rb', line 39 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]['scar'] end # Define shorthand alias methods aliases.each do |ali| alias_method ali, part end end |
.right_arm ⇒ Object
56 |
# File 'documented/gemstone/scars.rb', line 56 def right_arm; rightArm; end |
.right_eye ⇒ Object
54 |
# File 'documented/gemstone/scars.rb', line 54 def right_eye; rightEye; end |
.right_foot ⇒ Object
62 |
# File 'documented/gemstone/scars.rb', line 62 def right_foot; rightFoot; end |
.right_hand ⇒ Object
58 |
# File 'documented/gemstone/scars.rb', line 58 def right_hand; rightHand; end |
.right_leg ⇒ Object
60 |
# File 'documented/gemstone/scars.rb', line 60 def right_leg; rightLeg; end |
.scar_level(part) ⇒ String?
Retrieves the scar level for a specific body part.
101 102 103 104 |
# File 'documented/gemstone/scars.rb', line 101 def scar_level(part) fix_injury_mode('both') XMLData.injuries[part.to_s] && XMLData.injuries[part.to_s]['scar'] end |
.torso ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'documented/gemstone/scars.rb', line 86 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 |