Skip to content

Commit 786a5fa

Browse files
committed
don't consider a golem an enemy
1 parent 88911c9 commit 786a5fa

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/ruby_warrior/space.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ def warrior?
1212
unit.kind_of? Units::Warrior
1313
end
1414

15+
def golem?
16+
unit.kind_of? Units::Golem
17+
end
18+
1519
def enemy?
16-
unit && !warrior? && !captive?
20+
unit && !warrior? && !captive? && !golem?
1721
end
1822

1923
def captive?

spec/ruby_warrior/space_spec.rb

+16
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,22 @@
149149
end
150150
end
151151

152+
describe "with golem" do
153+
before(:each) do
154+
@golem = RubyWarrior::Units::Golem.new
155+
@floor.add(@golem, 0, 0)
156+
@space = @floor.space(0, 0)
157+
end
158+
159+
it "should be golem" do
160+
@space.should be_golem
161+
end
162+
163+
it "should not be enemy" do
164+
@space.should_not be_enemy
165+
end
166+
end
167+
152168
describe "at stairs" do
153169
before(:each) do
154170
@floor.place_stairs(0, 0)

0 commit comments

Comments
 (0)