Class: RubyWarrior::Abilities::Bind

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_warrior/abilities/bind.rb

Constant Summary

Constants inherited from Base

RubyWarrior::Abilities::Base::DIRECTIONS

Instance Method Summary collapse

Methods inherited from Base

#damage, #initialize, #offset, #space, #unit

Constructor Details

This class inherits a constructor from RubyWarrior::Abilities::Base

Instance Method Details

#descriptionObject



4
5
6
# File 'lib/ruby_warrior/abilities/bind.rb', line 4

def description
  "Bind unit in given direction to keep him from moving (forward by default)."
end

#perform(direction = :forward) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/ruby_warrior/abilities/bind.rb', line 8

def perform(direction = :forward)
  receiver = unit(direction)
  if receiver
    @unit.say "binds #{receiver}"
    receiver.bind
  else
    @unit.say "binds nothing"
  end
end