Skip to content

Commit eec67bf

Browse files
committed
cat can dig again
1 parent 2e8dce7 commit eec67bf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

engine/src/main/battlecode/world/RobotControllerImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,12 @@ private void assertCanAttackCat(MapLocation loc) throws GameActionException {
983983
if (!this.gameWorld.isPassable(loc)) {
984984
throw new GameActionException(CANT_DO_THAT, "Cats cannot attack squares with walls or dirt on them!");
985985
}
986+
if (this.gameWorld.getRobot(loc) == null) {
987+
throw new GameActionException(CANT_DO_THAT, "No robot to attack at the specified location!");
988+
}
989+
if (this.gameWorld.getRobot(loc) != null && this.gameWorld.getRobot(loc).getID() == this.robot.getID()) {
990+
throw new GameActionException(CANT_DO_THAT, "Cannot attack self");
991+
}
986992
}
987993

988994
private void assertCanAttack(MapLocation loc, int cheeseConsumed) throws GameActionException {

0 commit comments

Comments
 (0)