Class: RubyWarrior::Abilities::Form
- Defined in:
- lib/ruby_warrior/abilities/form.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/form.rb', line 4 def description "#{R18n.t.form.description}" end |
#perform(direction = :forward, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ruby_warrior/abilities/form.rb', line 8 def perform(direction = :forward, &block) verify_direction(direction) if space(direction).empty? x, y = @unit.position.translate_offset(*offset(direction)) health = (@unit.health/2.0).floor golem = @unit.base_golem golem.max_health = health golem.turn = block @unit.health -= health @unit.position.floor.add(golem, x, y, @unit.position.direction) @unit.say "#{R18n.t.form.golem_gives_health(R18n.t.direction[direction], health)}" else @unit.say "#{R18n.t.form.fails}" end end |