Class: Core::Game::Wound
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
Instance Method Summary collapse
-
#initialize(location, severity) ⇒ Wound
constructor
A new instance of Wound.
- #location_factor ⇒ Object
Constructor Details
#initialize(location, severity) ⇒ Wound
Returns a new instance of Wound.
6 7 8 9 10 11 12 |
# File 'lib/game/constitution.rb', line 6 def initialize(location, severity) if !WOUND_LOCATIONS.include?(location) puts("WARNING: Unknown wound location #{location}") end @location = location @severity = severity end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
5 6 7 |
# File 'lib/game/constitution.rb', line 5 def location @location end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
5 6 7 |
# File 'lib/game/constitution.rb', line 5 def severity @severity end |
Instance Method Details
#location_factor ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/game/constitution.rb', line 13 def location_factor case @location when :head return 5 when :neck return 3 when :torso return 2 when :abdomen return 3 when :leg return 1 when :foot return 1 when :arm return 2 else return 1 end end |