Class: Lich::Gemstone::Wounds

Inherits:
Gemstone::CharacterStatus
  • Object
show all
Defined in:
documented/gemstone/wounds.rb

Overview

Represents the character's wounds and injuries in the game.

This class provides methods to access and manage the wounds of various body parts.

See Also:

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

Class Method Details

.all_woundsHash<Symbol, String, nil>

Returns a hash of all wounds for each body part.

Returns:

  • (Hash<Symbol, String, nil>)

    a hash mapping body parts to their wound descriptions.



112
113
114
115
# File 'documented/gemstone/wounds.rb', line 112

def all_wounds
  fix_injury_mode('both')
  XMLData.injuries.transform_values { |v| v['wound'] }
end

.armsString?

Returns the most severe wound among the arms and hands.

Returns:

  • (String, nil)

    the most severe wound description or nil if no wounds exist.



65
66
67
68
69
70
71
72
73
# File 'documented/gemstone/wounds.rb', line 65

def arms
  fix_injury_mode('both')
  [
    XMLData.injuries['leftArm']['wound'],
    XMLData.injuries['rightArm']['wound'],
    XMLData.injuries['leftHand']['wound'],
    XMLData.injuries['rightHand']['wound']
  ].max
end

.left_armObject



54
# File 'documented/gemstone/wounds.rb', line 54

def left_arm; leftArm; end

.left_eyeString?

Returns the wound for the left eye.

Returns:

  • (String, nil)

    the wound description or nil if no wound exists.



50
# File 'documented/gemstone/wounds.rb', line 50

def left_eye; leftEye; end

.left_footObject



60
# File 'documented/gemstone/wounds.rb', line 60

def left_foot; leftFoot; end

.left_handObject



56
# File 'documented/gemstone/wounds.rb', line 56

def left_hand; leftHand; end

.left_legObject



58
# File 'documented/gemstone/wounds.rb', line 58

def left_leg; leftLeg; end

.limbsString?

Returns the most severe wound among all limbs (arms and legs).

Returns:

  • (String, nil)

    the most severe wound description or nil if no wounds exist.



77
78
79
80
81
82
83
84
85
86
87
# File 'documented/gemstone/wounds.rb', line 77

def limbs
  fix_injury_mode('both')
  [
    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

.right_armObject



55
# File 'documented/gemstone/wounds.rb', line 55

def right_arm; rightArm; end

.right_eyeString?

Returns the wound for the right eye.

Returns:

  • (String, nil)

    the wound description or nil if no wound exists.



53
# File 'documented/gemstone/wounds.rb', line 53

def right_eye; rightEye; end

.right_footObject



61
# File 'documented/gemstone/wounds.rb', line 61

def right_foot; rightFoot; end

.right_handObject



57
# File 'documented/gemstone/wounds.rb', line 57

def right_hand; rightHand; end

.right_legObject



59
# File 'documented/gemstone/wounds.rb', line 59

def right_leg; rightLeg; end

.torsoString?

Returns the most severe wound among the torso and head.

Returns:

  • (String, nil)

    the most severe wound description or nil if no wounds exist.



91
92
93
94
95
96
97
98
99
100
# File 'documented/gemstone/wounds.rb', line 91

def torso
  fix_injury_mode('both')
  [
    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?

Returns the wound level for a specified body part.

Parameters:

  • part (Symbol)

    the body part to check (e.g., :leftArm)

Returns:

  • (String, nil)

    the wound description or nil if no wound exists.



105
106
107
108
# File 'documented/gemstone/wounds.rb', line 105

def wound_level(part)
  fix_injury_mode('both')
  XMLData.injuries[part.to_s] && XMLData.injuries[part.to_s]['wound']
end