Module: Natural20::FighterClass
- Included in:
- PlayerCharacter
- Defined in:
- lib/natural_20/concerns/fighter_class.rb
Instance Attribute Summary collapse
-
#fighter_level ⇒ Object
Returns the value of attribute fighter_level.
-
#second_wind_count ⇒ Object
Returns the value of attribute second_wind_count.
Instance Method Summary collapse
- #initialize_fighter ⇒ Object
- #second_wind!(amt) ⇒ Object
- #second_wind_die ⇒ Object
-
#short_rest_for_fighter(_battle) ⇒ Object
hooks for the fighter class during a short rest.
- #special_actions_for_fighter(session, battle) ⇒ Object
Instance Attribute Details
#fighter_level ⇒ Object
Returns the value of attribute fighter_level.
5 6 7 |
# File 'lib/natural_20/concerns/fighter_class.rb', line 5 def fighter_level @fighter_level end |
#second_wind_count ⇒ Object
Returns the value of attribute second_wind_count.
5 6 7 |
# File 'lib/natural_20/concerns/fighter_class.rb', line 5 def second_wind_count @second_wind_count end |
Instance Method Details
#initialize_fighter ⇒ Object
7 8 9 |
# File 'lib/natural_20/concerns/fighter_class.rb', line 7 def initialize_fighter @second_wind_count = 1 end |
#second_wind!(amt) ⇒ Object
15 16 17 18 |
# File 'lib/natural_20/concerns/fighter_class.rb', line 15 def second_wind!(amt) @second_wind_count -= 1 heal!(amt) end |
#second_wind_die ⇒ Object
11 12 13 |
# File 'lib/natural_20/concerns/fighter_class.rb', line 11 def second_wind_die "1d10+#{@fighter_level}" end |
#short_rest_for_fighter(_battle) ⇒ Object
hooks for the fighter class during a short rest
32 33 34 |
# File 'lib/natural_20/concerns/fighter_class.rb', line 32 def short_rest_for_fighter(_battle) @second_wind_count = 1 end |
#special_actions_for_fighter(session, battle) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/natural_20/concerns/fighter_class.rb', line 20 def special_actions_for_fighter(session, battle) i[second_wind].map do |type| next unless "#{type.to_s.camelize}Action".constantize.can?(self, battle) case type when :second_wind SecondWindAction.new(session, self, :second_wind) end end.compact end |