|
1 | 1 | require File.dirname(__FILE__) + '/../../spec_helper'
|
2 | 2 |
|
3 |
| -describe RubyWarrior::Abilities::Throw do |
| 3 | +describe RubyWarrior::Abilities::Detonate do |
4 | 4 | before(:each) do
|
5 | 5 | @floor = RubyWarrior::Floor.new
|
6 | 6 | @floor.width = 3
|
7 | 7 | @floor.height = 3
|
8 | 8 | @warrior = RubyWarrior::Units::Warrior.new
|
9 | 9 | @floor.add(@warrior, 0, 0, :south)
|
10 |
| - @throw = RubyWarrior::Abilities::Throw.new(@warrior) |
| 10 | + @detonate = RubyWarrior::Abilities::Detonate.new(@warrior) |
11 | 11 | end
|
12 | 12 |
|
13 |
| - it "should subtract 4 from unit two spaces forward and 2 from units surrounding that space" do |
| 13 | + it "should subtract 8 from forward unit and 4 from surrounding units" do |
14 | 14 | target_unit = RubyWarrior::Units::Base.new
|
15 | 15 | target_unit.health = 15
|
16 | 16 | second_unit = RubyWarrior::Units::Base.new
|
17 | 17 | second_unit.health = 15
|
18 |
| - @floor.add(target_unit, 0, 2) |
19 |
| - @floor.add(second_unit, 1, 2) |
20 |
| - @throw.perform |
21 |
| - target_unit.health.should == 11 |
22 |
| - second_unit.health.should == 13 |
| 18 | + @floor.add(target_unit, 0, 1) |
| 19 | + @floor.add(second_unit, 1, 1) |
| 20 | + @detonate.perform |
| 21 | + target_unit.health.should == 7 |
| 22 | + second_unit.health.should == 11 |
23 | 23 | end
|
24 | 24 |
|
25 |
| - it "should subtract 4 from unit two spaces left and 2 from units surrounding that space" do |
| 25 | + it "should subtract 8 from left unit and 4 from surrounding units" do |
26 | 26 | target_unit = RubyWarrior::Units::Base.new
|
27 | 27 | target_unit.health = 15
|
28 | 28 | second_unit = RubyWarrior::Units::Base.new
|
29 | 29 | second_unit.health = 15
|
30 |
| - @floor.add(target_unit, 2, 0) |
31 |
| - @floor.add(second_unit, 2, 1) |
32 |
| - @throw.perform(:left) |
33 |
| - target_unit.health.should == 11 |
34 |
| - second_unit.health.should == 13 |
| 30 | + @floor.add(target_unit, 1, 0) |
| 31 | + @floor.add(second_unit, 1, 1) |
| 32 | + @detonate.perform(:left) |
| 33 | + target_unit.health.should == 7 |
| 34 | + second_unit.health.should == 11 |
35 | 35 | end
|
36 | 36 |
|
37 | 37 | it "should detonate an explosive if any unit has one" do
|
38 | 38 | captive = RubyWarrior::Units::Captive.new
|
39 | 39 | captive.health = 1
|
40 | 40 | captive.add_abilities :explode!
|
41 |
| - @floor.add(captive, 1, 2) |
42 |
| - @throw.perform |
| 41 | + @floor.add(captive, 1, 1) |
| 42 | + @detonate.perform |
43 | 43 | captive.health.should == -99
|
44 | 44 | @warrior.health.should == -80
|
45 | 45 | end
|
|
0 commit comments