diff --git a/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java b/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java index aeebdbf..ede9574 100644 --- a/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java +++ b/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java @@ -45,7 +45,7 @@ public class Coordinate { } public boolean shoot() { - if (this.state == Coordinate.SHOT) + if (this.state == Coordinate.SHOT || this.state == Coordinate.HIT) return false; if (this.state == Coordinate.SHIP) { diff --git a/src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java b/src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java index 779e432..1b9a560 100644 --- a/src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java +++ b/src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java @@ -76,6 +76,9 @@ class CoordinateTest { assertTrue(matchfield.getField(0, 0).shoot()); assertFalse(matchfield.getField(0, 0).shoot()); + + matchfield.getField(3, 4).shoot(); + assertFalse(matchfield.getField(3, 4).shoot()); } }