@@ -44,7 +44,7 @@ public class InternalRobot implements Comparable<InternalRobot> {
4444 private int movementCooldownTurns ;
4545 private int turningCooldownTurns ;
4646
47- private InternalRobot carryingRobot ; // robot being carried by this robot, if any
47+ private InternalRobot robotBeingCarried ; // robot being carried by this robot, if any
4848 private InternalRobot grabbedByRobot ; // robot that is carrying this robot, if any
4949 private Direction thrownDir ;
5050 private int remainingThrowDuration ; // how much longer robot should be thrown for
@@ -105,7 +105,7 @@ public InternalRobot(GameWorld gw, int id, Team team, UnitType type, MapLocation
105105 this .movementCooldownTurns = GameConstants .COOLDOWN_LIMIT ;
106106 this .turningCooldownTurns = GameConstants .COOLDOWN_LIMIT ;
107107
108- this .carryingRobot = null ;
108+ this .robotBeingCarried = null ;
109109 this .grabbedByRobot = null ;
110110 this .thrownDir = null ;
111111 this .remainingThrowDuration = 0 ;
@@ -281,12 +281,12 @@ public int getTurningCooldownTurns() {
281281 return turningCooldownTurns ;
282282 }
283283
284- public InternalRobot getCarryingRobot () {
285- return carryingRobot ;
284+ public InternalRobot getRobotBeingCarried () {
285+ return robotBeingCarried ;
286286 }
287287
288288 public void clearCarryingRobot () {
289- this .carryingRobot = null ;
289+ this .robotBeingCarried = null ;
290290 }
291291
292292 public int getRemainingCarriedDuration () {
@@ -317,14 +317,14 @@ public RobotInfo getRobotInfo() {
317317 && cachedRobotInfo .cheeseAmount == cheeseAmount
318318 && cachedRobotInfo .chirality == chirality
319319 && cachedRobotInfo .direction == dir
320- && ((cachedRobotInfo .carryingRobot == null && carryingRobot == null )
321- || (carryingRobot != null && cachedRobotInfo .carryingRobot == carryingRobot .getRobotInfo ()))
320+ && ((cachedRobotInfo .carryingRobot == null && robotBeingCarried == null )
321+ || (robotBeingCarried != null && cachedRobotInfo .carryingRobot == robotBeingCarried .getRobotInfo ()))
322322 && cachedRobotInfo .location .equals (location )) {
323323 return cachedRobotInfo ;
324324 }
325325
326326 this .cachedRobotInfo = new RobotInfo (ID , team , type , health , location , dir , chirality , cheeseAmount ,
327- carryingRobot != null ? carryingRobot .getRobotInfo () : null );
327+ robotBeingCarried != null ? robotBeingCarried .getRobotInfo () : null );
328328 return this .cachedRobotInfo ;
329329 }
330330
@@ -357,7 +357,7 @@ public boolean canTurnCooldown() {
357357 * Returns whether the robot is currently carrying another robot.
358358 */
359359 public boolean isCarryingRobot () {
360- return this .carryingRobot != null ;
360+ return this .robotBeingCarried != null ;
361361 }
362362
363363 /**
@@ -444,7 +444,7 @@ public void translateLocation(int dx, int dy) {
444444 this .location = this .location .translate (dx , dy );
445445
446446 if (!this .type .isCatType () && this .isCarryingRobot ()){
447- this .carryingRobot .setInternalLocationOnly (this .location );
447+ this .robotBeingCarried .setInternalLocationOnly (this .location );
448448 }
449449 }
450450
@@ -486,7 +486,7 @@ public void becomeRatKing(int health) {
486486 */
487487 public void addActionCooldownTurns (int numActionCooldownToAdd ) {
488488 int cooldownUp = numActionCooldownToAdd
489- * (int ) (this .carryingRobot != null ? GameConstants .CARRY_COOLDOWN_MULTIPLIER : 1 ); // TODO add support
489+ * (int ) (this .robotBeingCarried != null ? GameConstants .CARRY_COOLDOWN_MULTIPLIER : 1 ); // TODO add support
490490 // for rat towers???
491491 if (getType () == UnitType .BABY_RAT ) {
492492 cooldownUp = (int ) (((double )cooldownUp )*(1.0 + this .cheeseAmount *GameConstants .CHEESE_COOLDOWN_PENALTY ));
@@ -502,7 +502,7 @@ public void addMovementCooldownTurns(Direction d) {
502502 if (getType () == UnitType .BABY_RAT && this .dir != d ) {
503503 movementCooldown = GameConstants .MOVE_STRAFE_COOLDOWN ;
504504 }
505- movementCooldown *= (int ) (this .carryingRobot != null ? GameConstants .CARRY_COOLDOWN_MULTIPLIER : 1 ); // TODO
505+ movementCooldown *= (int ) (this .robotBeingCarried != null ? GameConstants .CARRY_COOLDOWN_MULTIPLIER : 1 ); // TODO
506506 // add
507507 // support
508508 // for rat
@@ -518,7 +518,7 @@ public void addMovementCooldownTurns(Direction d) {
518518 */
519519 public void addTurningCooldownTurns () {
520520 int turningCooldown = GameConstants .TURNING_COOLDOWN
521- * (int ) (this .carryingRobot != null ? GameConstants .CARRY_COOLDOWN_MULTIPLIER : 1 ); // TODO add support
521+ * (int ) (this .robotBeingCarried != null ? GameConstants .CARRY_COOLDOWN_MULTIPLIER : 1 ); // TODO add support
522522 // for rat towers???
523523 this .setTurningCooldownTurns (this .turningCooldownTurns + turningCooldown );
524524 }
@@ -622,8 +622,9 @@ public void bite(MapLocation loc, int cheeseConsumed) {
622622 }
623623 this .gameWorld .getMatchMaker ().addBiteAction (this .getID ());
624624
625- if (targetRobot .getType () != UnitType .CAT )
625+ if (targetRobot .getType () != UnitType .CAT ) {
626626 this .gameWorld .isCooperation = false ;
627+ }
627628 }
628629 }
629630 }
@@ -643,11 +644,13 @@ public void scratch(MapLocation loc) {
643644
644645 public void grabRobot (MapLocation loc ) {
645646
646- this .carryingRobot = this .gameWorld .getRobot (loc );
647- this .carryingRobot .getGrabbed (this ); // Notify the grabbed robot that it has been picked up
647+ this .robotBeingCarried = this .gameWorld .getRobot (loc );
648+ this .robotBeingCarried .getGrabbed (this ); // Notify the grabbed robot that it has been picked up
648649 this .gameWorld .getMatchMaker ().addRatNapAction (this .getID ());
649650
650- this .gameWorld .isCooperation = false ;
651+ if (this .robotBeingCarried .getTeam () != this .getTeam ()) {
652+ this .gameWorld .isCooperation = false ;
653+ }
651654 // TODO: make any changes that need to happen with switch to cooperation
652655 }
653656
@@ -667,8 +670,8 @@ public void dropRobot(Direction dir) {
667670 }
668671
669672 // Drop the robot
670- this .carryingRobot .getDropped (dropLoc );
671- this .carryingRobot = null ;
673+ this .robotBeingCarried .getDropped (dropLoc );
674+ this .robotBeingCarried = null ;
672675 }
673676
674677 private void swapGrabber () {
@@ -678,11 +681,11 @@ private void swapGrabber() {
678681 InternalRobot grabber = this .getGrabbedByRobot ();
679682 MapLocation dropLoc = grabber .getLocation ();
680683
681- this .carryingRobot = grabber ;
684+ this .robotBeingCarried = grabber ;
682685 grabber .grabbedByRobot = this ;
683686
684687 this .grabbedByRobot = null ;
685- grabber .carryingRobot = null ;
688+ grabber .robotBeingCarried = null ;
686689
687690 grabber .setInternalLocationOnly (dropLoc );
688691 this .setInternalLocationOnly (dropLoc );
@@ -699,8 +702,8 @@ private void getGrabbed(InternalRobot grabber) {
699702 this .grabbedByRobot = grabber ;
700703 this .gameWorld .removeRobot (getLocation ());
701704 if (this .isCarryingRobot ()) { // If we were carrying a robot, drop it
702- this .carryingRobot .getDropped (getLocation ()); // TODO rat tower???
703- this .carryingRobot = null ;
705+ this .robotBeingCarried .getDropped (getLocation ()); // TODO rat tower???
706+ this .robotBeingCarried = null ;
704707 }
705708 this .setInternalLocationOnly (grabber .getLocation ());
706709
@@ -724,10 +727,10 @@ public void throwRobot() {
724727 }
725728
726729 // Throw the robot
727- this .carryingRobot .getThrown (this .dir );
728- this .gameWorld .getMatchMaker ().addThrowAction (this .carryingRobot .getID (),
730+ this .robotBeingCarried .getThrown (this .dir );
731+ this .gameWorld .getMatchMaker ().addThrowAction (this .robotBeingCarried .getID (),
729732 this .getLocation ().add (this .dir ));
730- this .carryingRobot = null ;
733+ this .robotBeingCarried = null ;
731734 }
732735
733736 private void getThrown (Direction dir ) {
@@ -1116,7 +1119,7 @@ public void processBeginningOfTurn() {
11161119 // Wriggle free!
11171120 InternalRobot grabber = this .getGrabbedByRobot ();
11181121 this .getDropped (dropLoc );
1119- grabber .carryingRobot = null ;
1122+ grabber .robotBeingCarried = null ;
11201123 } else {
11211124 swapGrabber ();
11221125
@@ -1443,9 +1446,9 @@ else if (this.controller.canAttack(nextLoc)) {
14431446
14441447 this .gameWorld .getMatchMaker ().endTurn (this .ID , this .health , this .cheeseAmount , this .movementCooldownTurns ,
14451448 this .actionCooldownTurns , this .turningCooldownTurns , this .bytecodesUsed , this .location , this .dir , this .gameWorld .isCooperation );
1446- if (this .isCarryingRobot () && this .carryingRobot .getHealth () > 0 )
1447- this .gameWorld .getMatchMaker ().endTurn (this .carryingRobot .ID , this .carryingRobot .health , this .carryingRobot .cheeseAmount , this .carryingRobot .movementCooldownTurns ,
1448- this .carryingRobot .actionCooldownTurns , this .carryingRobot .turningCooldownTurns , this .carryingRobot .bytecodesUsed , this .location , this .carryingRobot .dir , this .gameWorld .isCooperation );
1449+ if (this .isCarryingRobot () && this .robotBeingCarried .getHealth () > 0 )
1450+ this .gameWorld .getMatchMaker ().endTurn (this .robotBeingCarried .ID , this .robotBeingCarried .health , this .robotBeingCarried .cheeseAmount , this .robotBeingCarried .movementCooldownTurns ,
1451+ this .robotBeingCarried .actionCooldownTurns , this .robotBeingCarried .turningCooldownTurns , this .robotBeingCarried .bytecodesUsed , this .location , this .robotBeingCarried .dir , this .gameWorld .isCooperation );
14491452 this .roundsAlive ++;
14501453 }
14511454
0 commit comments