Class: RubyWarrior::Abilities::Rest
- Defined in:
- lib/ruby_warrior/abilities/rest.rb
Instance Method Summary collapse
Methods inherited from Base
#damage, #initialize, #offset, #pass_turn, #space, #unit, #verify_direction
Constructor Details
This class inherits a constructor from RubyWarrior::Abilities::Base
Instance Method Details
#description ⇒ Object
4 5 6 |
# File 'lib/ruby_warrior/abilities/rest.rb', line 4 def description "Gain 10% of max health back, but do nothing more." end |
#perform ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ruby_warrior/abilities/rest.rb', line 8 def perform if @unit.health < @unit.max_health amount = (@unit.max_health*0.1).round amount = @unit.max_health-@unit.health if (@unit.health + amount) > @unit.max_health @unit.health += amount @unit.say "receives #{amount} health from resting, up to #{@unit.health} health" else @unit.say "is already fit as a fiddle" end end |