Skip to content

Commit e911630

Browse files
committed
Merge branch 'engine-release' of github.com:battlecode/battlecode26 into engine-release
2 parents 375b104 + 34f5be7 commit e911630

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ public void hitGround() {
743743

744744
public void hitTarget(boolean isSecondMove) {
745745
int damage = GameConstants.THROW_DAMAGE
746-
- GameConstants.THROW_DAMAGE_PER_TILE * (2 * this.remainingThrowDuration + (isSecondMove ? 0 : 1));
746+
+ GameConstants.THROW_DAMAGE_PER_TILE * (2 * this.remainingThrowDuration + (isSecondMove ? 0 : 1));
747747

748748
if (this.gameWorld.getRobot(this.getLocation().add(this.thrownDir)) != null) {
749749
InternalRobot robot = this.gameWorld.getRobot(this.getLocation().add(this.thrownDir));

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,16 @@ public void move(Direction d) throws GameActionException {
829829
// kill this rat
830830
crushedRobot.addHealth(-crushedRobot.getHealth());
831831
}
832-
processTrapsAtLocation(newLoc);
832+
// processTrapsAtLocation(newLoc);
833833
}
834834

835835
this.robot.translateLocation(d.dx, d.dy);
836+
837+
for (int i = 0; i < curLocs.length; i++) {
838+
MapLocation newLoc = curLocs[i].add(d);
839+
processTrapsAtLocation(newLoc);
840+
}
841+
836842
this.robot.addMovementCooldownTurns(d);
837843

838844
}
@@ -944,6 +950,10 @@ private void assertCanAttackRat(MapLocation loc, int cheeseConsumed) throws Game
944950
assertIsActionReady();
945951
// Attack is limited to vision radius
946952
assertCanActLocation(loc, this.getType().getVisionRadiusSquared());
953+
if (!this.getLocation().isAdjacentTo(loc)) {
954+
throw new GameActionException(CANT_DO_THAT, "Rats can only attack adjacent squares!");
955+
}
956+
947957
if (!this.gameWorld.isPassable(loc))
948958
throw new GameActionException(CANT_DO_THAT, "Rats cannot attack squares with walls or dirt on them!");
949959

0 commit comments

Comments
 (0)