Class: RubyWarrior::Units::Sludge
- Inherits:
-
Base
- Object
- Base
- RubyWarrior::Units::Sludge
show all
- Defined in:
- lib/ruby_warrior/units/sludge.rb
Instance Attribute Summary
Attributes inherited from Base
#health, #position
Instance Method Summary
collapse
Methods inherited from Base
#abilities, #add_abilities, #alive?, #bind, #bound?, #earn_points, #name, #next_turn, #perform_turn, #prepare_turn, #say, #take_damage, #unbind
Constructor Details
#initialize ⇒ Sludge
Returns a new instance of Sludge.
4
5
6
|
# File 'lib/ruby_warrior/units/sludge.rb', line 4
def initialize
add_abilities :attack!, :feel
end
|
Instance Method Details
#attack_power ⇒ Object
17
18
19
|
# File 'lib/ruby_warrior/units/sludge.rb', line 17
def attack_power
3
end
|
#character ⇒ Object
25
26
27
|
# File 'lib/ruby_warrior/units/sludge.rb', line 25
def character
"s"
end
|
#max_health ⇒ Object
21
22
23
|
# File 'lib/ruby_warrior/units/sludge.rb', line 21
def max_health
12
end
|
#play_turn(turn) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/ruby_warrior/units/sludge.rb', line 8
def play_turn(turn)
[:forward, :left, :right, :backward].each do |direction|
if turn.feel(direction).player?
turn.attack!(direction)
return
end
end
end
|