Class: RubyWarrior::Units::Sludge

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_warrior/units/sludge.rb

Direct Known Subclasses

ThickSludge

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

#initializeSludge

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_powerObject



17
18
19
# File 'lib/ruby_warrior/units/sludge.rb', line 17

def attack_power
  3
end

#characterObject



25
26
27
# File 'lib/ruby_warrior/units/sludge.rb', line 25

def character
  "s"
end

#max_healthObject



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