Class: Core::Game::Wound

Inherits:
Object show all
Defined in:
lib/game/constitution.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#locationObject (readonly)

Returns the value of attribute location.



5
6
7
# File 'lib/game/constitution.rb', line 5

def location
  @location
end

#severityObject (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_factorObject



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