Class: Lich::Gemstone::Scars
- Inherits:
-
Gemstone::CharacterStatus
- Object
- Gemstone::CharacterStatus
- Lich::Gemstone::Scars
- Defined in:
- lib/gemstone/scars.rb,
lib/games.rb
Overview
Scars class for tracking character scars
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
-
.abdomen ⇒ Scar
Returns the scar status of the abdomen.
-
.abs ⇒ Scar
Alias for abdomen.
-
.all_scars ⇒ Hash
Helper method to get all scar levels for all body parts.
-
.arms ⇒ Integer?
Retrieves the maximum scar level for arms (left arm, right arm, left hand, right hand).
-
.back ⇒ Scar
Returns the scar status of the back.
-
.chest ⇒ Scar
Returns the scar status of the chest.
-
.head ⇒ Scar
Returns the scar status of the head.
-
.larm ⇒ Scar
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 ⇒ Scar
Returns the scar status of the left arm.
-
.leftEye ⇒ Scar
Returns the scar status of the left eye.
-
.leftFoot ⇒ Scar
Returns the scar status of the left foot.
-
.leftHand ⇒ Scar
Returns the scar status of the left hand.
-
.leftLeg ⇒ Scar
Returns the scar status of the left leg.
-
.leye ⇒ Scar
Alias for leftEye.
-
.lhand ⇒ Scar
Alias for leftHand.
-
.limbs ⇒ Integer?
Retrieves the maximum scar level for limbs (arms and legs).
-
.lleg ⇒ Scar
Alias for leftLeg.
-
.method_missing(_arg = nil) ⇒ nil
Handles calls to undefined methods for the Scars class.
-
.neck ⇒ Scar
Returns the scar status of the neck.
-
.nerves ⇒ Integer
Retrieves the scar value for the nerves area after fixing the injury mode.
-
.nsys ⇒ Integer
Retrieves the scar value for the nsys area after fixing the injury mode.
-
.part ⇒ Hash?
Define methods for each body part and its aliases Retrieves the scar information for the body part.
-
.rarm ⇒ Scar
Alias for rightArm.
-
.reye ⇒ Scar
Alias for rightEye.
-
.rhand ⇒ Scar
Alias for rightHand.
- .right_arm ⇒ Object
- .right_eye ⇒ Object
- .right_foot ⇒ Object
- .right_hand ⇒ Object
- .right_leg ⇒ Object
-
.rightArm ⇒ Scar
Returns the scar status of the right arm.
-
.rightEye ⇒ Scar
Returns the scar status of the right eye.
-
.rightFoot ⇒ Scar
Returns the scar status of the right foot.
-
.rightHand ⇒ Scar
Returns the scar status of the right hand.
-
.rightLeg ⇒ Scar
Returns the scar status of the right leg.
-
.rleg ⇒ Scar
Alias for rightLeg.
-
.scar_level(part) ⇒ Integer?
Helper method to get scar level for any body part.
-
.torso ⇒ Integer?
Retrieves the maximum scar level for the torso (chest, abdomen, back, eyes).
Class Method Details
.abdomen ⇒ Scar
Returns the scar status of the abdomen.
867 |
# File 'lib/games.rb', line 867 def Scars.abdomen; fix_injury_mode; XMLData.injuries['abdomen']['scar']; end |
.abs ⇒ Scar
Alias for abdomen.
874 |
# File 'lib/games.rb', line 874 def Scars.abs; fix_injury_mode; XMLData.injuries['abdomen']['scar']; end |
.all_scars ⇒ Hash
Helper method to get all scar levels for all body parts.
126 127 128 129 130 131 132 133 134 |
# File 'lib/gemstone/scars.rb', line 126 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?
Continues to use ‘both’ (_injury2) for now.
Retrieves the maximum scar level for arms (left arm, right arm, left hand, right hand).
993 994 995 996 |
# File 'lib/games.rb', line 993 def Scars.arms fix_injury_mode [XMLData.injuries['leftArm']['scar'], XMLData.injuries['rightArm']['scar'], XMLData.injuries['leftHand']['scar'], XMLData.injuries['rightHand']['scar']].max end |
.back ⇒ Scar
Returns the scar status of the back.
853 |
# File 'lib/games.rb', line 853 def Scars.back; fix_injury_mode; XMLData.injuries['back']['scar']; end |
.chest ⇒ Scar
Returns the scar status of the chest.
860 |
# File 'lib/games.rb', line 860 def Scars.chest; fix_injury_mode; XMLData.injuries['chest']['scar']; end |
.head ⇒ Scar
Returns the scar status of the head.
839 |
# File 'lib/games.rb', line 839 def Scars.head; fix_injury_mode; XMLData.injuries['head']['scar']; end |
.larm ⇒ Scar
Alias for leftArm.
888 |
# File 'lib/games.rb', line 888 def Scars.larm; fix_injury_mode; XMLData.injuries['leftArm']['scar']; end |
.left_arm ⇒ Object
53 |
# File 'lib/gemstone/scars.rb', line 53 def left_arm; leftArm; end |
.left_eye ⇒ Object
Alias snake_case methods for overachievers
51 |
# File 'lib/gemstone/scars.rb', line 51 def left_eye; leftEye; end |
.left_foot ⇒ Object
59 |
# File 'lib/gemstone/scars.rb', line 59 def left_foot; leftFoot; end |
.left_hand ⇒ Object
55 |
# File 'lib/gemstone/scars.rb', line 55 def left_hand; leftHand; end |
.left_leg ⇒ Object
57 |
# File 'lib/gemstone/scars.rb', line 57 def left_leg; leftLeg; end |
.leftArm ⇒ Scar
Returns the scar status of the left arm.
881 |
# File 'lib/games.rb', line 881 def Scars.leftArm; fix_injury_mode; XMLData.injuries['leftArm']['scar']; end |
.leftEye ⇒ Scar
Returns the scar status of the left eye.
811 |
# File 'lib/games.rb', line 811 def Scars.leftEye; fix_injury_mode; XMLData.injuries['leftEye']['scar']; end |
.leftFoot ⇒ Scar
Returns the scar status of the left foot.
965 |
# File 'lib/games.rb', line 965 def Scars.leftFoot; fix_injury_mode; XMLData.injuries['leftFoot']['scar']; end |
.leftHand ⇒ Scar
Returns the scar status of the left hand.
923 |
# File 'lib/games.rb', line 923 def Scars.leftHand; fix_injury_mode; XMLData.injuries['leftHand']['scar']; end |
.leftLeg ⇒ Scar
Returns the scar status of the left leg.
937 |
# File 'lib/games.rb', line 937 def Scars.leftLeg; fix_injury_mode; XMLData.injuries['leftLeg']['scar']; end |
.leye ⇒ Scar
Alias for leftEye.
818 |
# File 'lib/games.rb', line 818 def Scars.leye; fix_injury_mode; XMLData.injuries['leftEye']['scar']; end |
.lhand ⇒ Scar
Alias for leftHand.
930 |
# File 'lib/games.rb', line 930 def Scars.lhand; fix_injury_mode; XMLData.injuries['leftHand']['scar']; end |
.limbs ⇒ Integer?
Continues to use ‘both’ (_injury2) for now.
Retrieves the maximum scar level for limbs (arms and legs).
1003 1004 1005 1006 |
# File 'lib/games.rb', line 1003 def Scars.limbs fix_injury_mode [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 |
.lleg ⇒ Scar
Alias for leftLeg.
944 |
# File 'lib/games.rb', line 944 def Scars.lleg; fix_injury_mode; XMLData.injuries['leftLeg']['scar']; end |
.method_missing(_arg = nil) ⇒ nil
This method provides feedback on valid areas to check for scars.
Handles calls to undefined methods for the Scars class.
1025 1026 1027 1028 |
# File 'lib/games.rb', line 1025 def Scars.method_missing(_arg = nil) echo "Scars: Invalid area, try one of these: arms, limbs, torso, #{XMLData.injuries.keys.join(', ')}" nil end |
.neck ⇒ Scar
Returns the scar status of the neck.
846 |
# File 'lib/games.rb', line 846 def Scars.neck; fix_injury_mode; XMLData.injuries['neck']['scar']; end |
.nerves ⇒ Integer
Retrieves the scar value for the nerves area after fixing the injury mode.
986 |
# File 'lib/games.rb', line 986 def Scars.nerves; fix_injury_mode; XMLData.injuries['nsys']['scar']; end |
.nsys ⇒ Integer
Retrieves the scar value for the nsys area after fixing the injury mode.
979 |
# File 'lib/games.rb', line 979 def Scars.nsys; fix_injury_mode; XMLData.injuries['nsys']['scar']; end |
.part ⇒ Hash?
Continues to use ‘both’ (_injury2) for now.
Define methods for each body part and its aliases Retrieves the scar information for the body part.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gemstone/scars.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]['scar'] end # Define shorthand alias methods aliases.each do |ali| alias_method ali, part end end |
.rarm ⇒ Scar
Alias for rightArm.
902 |
# File 'lib/games.rb', line 902 def Scars.rarm; fix_injury_mode; XMLData.injuries['rightArm']['scar']; end |
.reye ⇒ Scar
Alias for rightEye.
832 |
# File 'lib/games.rb', line 832 def Scars.reye; fix_injury_mode; XMLData.injuries['rightEye']['scar']; end |
.rhand ⇒ Scar
Alias for rightHand.
916 |
# File 'lib/games.rb', line 916 def Scars.rhand; fix_injury_mode; XMLData.injuries['rightHand']['scar']; end |
.right_arm ⇒ Object
54 |
# File 'lib/gemstone/scars.rb', line 54 def right_arm; rightArm; end |
.right_eye ⇒ Object
52 |
# File 'lib/gemstone/scars.rb', line 52 def right_eye; rightEye; end |
.right_foot ⇒ Object
60 |
# File 'lib/gemstone/scars.rb', line 60 def right_foot; rightFoot; end |
.right_hand ⇒ Object
56 |
# File 'lib/gemstone/scars.rb', line 56 def right_hand; rightHand; end |
.right_leg ⇒ Object
58 |
# File 'lib/gemstone/scars.rb', line 58 def right_leg; rightLeg; end |
.rightArm ⇒ Scar
Returns the scar status of the right arm.
895 |
# File 'lib/games.rb', line 895 def Scars.rightArm; fix_injury_mode; XMLData.injuries['rightArm']['scar']; end |
.rightEye ⇒ Scar
Returns the scar status of the right eye.
825 |
# File 'lib/games.rb', line 825 def Scars.rightEye; fix_injury_mode; XMLData.injuries['rightEye']['scar']; end |
.rightFoot ⇒ Scar
Returns the scar status of the right foot.
972 |
# File 'lib/games.rb', line 972 def Scars.rightFoot; fix_injury_mode; XMLData.injuries['rightFoot']['scar']; end |
.rightHand ⇒ Scar
Returns the scar status of the right hand.
909 |
# File 'lib/games.rb', line 909 def Scars.rightHand; fix_injury_mode; XMLData.injuries['rightHand']['scar']; end |
.rightLeg ⇒ Scar
Returns the scar status of the right leg.
951 |
# File 'lib/games.rb', line 951 def Scars.rightLeg; fix_injury_mode; XMLData.injuries['rightLeg']['scar']; end |
.rleg ⇒ Scar
Alias for rightLeg.
958 |
# File 'lib/games.rb', line 958 def Scars.rleg; fix_injury_mode; XMLData.injuries['rightLeg']['scar']; end |
.scar_level(part) ⇒ Integer?
Continues to use ‘both’ (_injury2) for now.
Helper method to get scar level for any body part.
116 117 118 119 |
# File 'lib/gemstone/scars.rb', line 116 def scar_level(part) fix_injury_mode('both') XMLData.injuries[part.to_s] && XMLData.injuries[part.to_s]['scar'] end |
.torso ⇒ Integer?
Continues to use ‘both’ (_injury2) for now.
Retrieves the maximum scar level for the torso (chest, abdomen, back, eyes).
1013 1014 1015 1016 |
# File 'lib/games.rb', line 1013 def Scars.torso fix_injury_mode [XMLData.injuries['rightEye']['scar'], XMLData.injuries['leftEye']['scar'], XMLData.injuries['chest']['scar'], XMLData.injuries['abdomen']['scar'], XMLData.injuries['back']['scar']].max end |