Class: RubyWarrior::Units::Captive
- Defined in:
- lib/ruby_warrior/units/captive.rb
Instance Attribute Summary collapse
-
#bomb_time ⇒ Object
Returns the value of attribute bomb_time.
Attributes inherited from Base
Instance Method Summary collapse
- #character ⇒ Object
-
#initialize ⇒ Captive
constructor
A new instance of Captive.
- #max_health ⇒ Object
- #play_turn(turn) ⇒ Object
Methods inherited from Base
#abilities, #add_abilities, #alive?, #attack_power, #bind, #bound?, #earn_points, #name, #next_turn, #perform_turn, #prepare_turn, #say, #take_damage, #unbind
Constructor Details
#initialize ⇒ Captive
Returns a new instance of Captive.
6 7 8 9 |
# File 'lib/ruby_warrior/units/captive.rb', line 6 def initialize add_abilities :explode! bind end |
Instance Attribute Details
#bomb_time ⇒ Object
Returns the value of attribute bomb_time.
4 5 6 |
# File 'lib/ruby_warrior/units/captive.rb', line 4 def bomb_time @bomb_time end |
Instance Method Details
#character ⇒ Object
15 16 17 |
# File 'lib/ruby_warrior/units/captive.rb', line 15 def character "C" end |
#max_health ⇒ Object
11 12 13 |
# File 'lib/ruby_warrior/units/captive.rb', line 11 def max_health 1 end |
#play_turn(turn) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/ruby_warrior/units/captive.rb', line 19 def play_turn(turn) if @bomb_time @bomb_time -= 1 if @bomb_time.zero? @bound = false # unbind so it can perform an action turn.explode! end end end |