We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e8dce7 commit eec67bfCopy full SHA for eec67bf
1 file changed
engine/src/main/battlecode/world/RobotControllerImpl.java
@@ -983,6 +983,12 @@ private void assertCanAttackCat(MapLocation loc) throws GameActionException {
983
if (!this.gameWorld.isPassable(loc)) {
984
throw new GameActionException(CANT_DO_THAT, "Cats cannot attack squares with walls or dirt on them!");
985
}
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
992
993
994
private void assertCanAttack(MapLocation loc, int cheeseConsumed) throws GameActionException {
0 commit comments