@@ -254,10 +254,13 @@ private void assertCanPlaceDirt(MapLocation loc) throws GameActionException {
254254 }
255255
256256 private void assertCanRemoveDirt (MapLocation loc ) throws GameActionException {
257- assertIsRobotType (this .robot .getType ());
258- assertIsActionReady ();
259- assertCanActLocation (loc , GameConstants .BUILD_DISTANCE_SQUARED );
257+ UnitType myType = this .robot .getType ();
258+
260259 assertIsActionReady ();
260+ assertIsRobotType (myType );
261+ assertCanActLocation (loc , myType == UnitType .RAT_KING
262+ ? GameConstants .RAT_KING_BUILD_DISTANCE_SQUARED
263+ : GameConstants .BUILD_DISTANCE_SQUARED );
261264
262265 if ((this .robot .getType ().isBabyRatType ()
263266 || this .robot .getType ().isRatKingType ()) && (this .getAllCheese () < GameConstants .DIG_DIRT_CHEESE_COST ))
@@ -300,8 +303,12 @@ public boolean canRemoveDirt(MapLocation loc) {
300303 }
301304
302305 private void assertCanRemoveRatTrap (MapLocation loc ) throws GameActionException {
303- assertIsRobotType (this .robot .getType ());
304- assertCanActLocation (loc , GameConstants .BUILD_DISTANCE_SQUARED );
306+ UnitType myType = this .robot .getType ();
307+
308+ assertIsRobotType (myType );
309+ assertCanActLocation (loc , myType == UnitType .RAT_KING
310+ ? GameConstants .RAT_KING_BUILD_DISTANCE_SQUARED
311+ : GameConstants .BUILD_DISTANCE_SQUARED );
305312
306313 if (!this .gameWorld .hasRatTrap (loc ))
307314 throw new GameActionException (CANT_DO_THAT , "No rat trap to remove at that location!" );
@@ -1430,8 +1437,8 @@ public void assertCanCarryRat(MapLocation loc) throws GameActionException {
14301437 throw new GameActionException (CANT_DO_THAT , "Robots cannot grab themselves" );
14311438 }
14321439
1433- if (targetRobot .getLastGrabberId () == this .robot .getID () && targetRobot .getTurnsSinceThrownOrDropped () < GameConstants .SAME_ROBOT_CARRY_COOLDOWN_TURNS ) {
1434- throw new GameActionException (CANT_DO_THAT , "Target robot was recently carried by this robot" );
1440+ if (targetRobot .getTeam () != this . robot . getTeam () && targetRobot . getLastGrabberId () == this .robot .getID () && targetRobot .getTurnsSinceThrownOrDropped () < GameConstants .SAME_ROBOT_CARRY_COOLDOWN_TURNS ) {
1441+ throw new GameActionException (CANT_DO_THAT , "Target robot (on the enemy team) was recently carried by this robot" );
14351442 }
14361443
14371444 // Allow grabbing if the target is facing away (cannot sense this robot), or
0 commit comments