Class: RubyWarrior::Abilities::Detonate
- Inherits:
-
Base
- Object
- Base
- RubyWarrior::Abilities::Detonate
show all
- Defined in:
- lib/ruby_warrior/abilities/detonate.rb
Instance Method Summary
collapse
Methods inherited from Base
#damage, #initialize, #offset, #pass_turn, #space, #unit, #verify_direction
Instance Method Details
#bomb(direction, x, y, damage_amount) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/ruby_warrior/abilities/detonate.rb', line 19
def bomb(direction, x, y, damage_amount)
if @unit.position
receiver = space(direction, x, y).unit
if receiver
if receiver.abilities[:explode!]
receiver.say "#{R18n.t.detonate.ticking_explosive}"
receiver.abilities[:explode!].perform
else
damage(receiver, damage_amount)
end
end
end
end
|
#description ⇒ Object
4
5
6
|
# File 'lib/ruby_warrior/abilities/detonate.rb', line 4
def description
"#{R18n.t.detonate.description}"
end
|
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/ruby_warrior/abilities/detonate.rb', line 8
def perform(direction = :forward)
verify_direction(direction)
if @unit.position
@unit.say "#{R18n.t.detonate.bomb_deadly_explosion(R18n.t.direction[direction])}"
bomb(direction, 1, 0, 8)
[[1, 1], [1, -1], [2, 0], [0, 0]].each do |x, y|
bomb(direction, x, y, 4)
end
end
end
|