Skip to content

Commit 0dd2d36

Browse files
committed
fix action cooldown bug
1 parent 38877d9 commit 0dd2d36

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

engine/src/main/battlecode/common/RobotController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public interface RobotController {
130130
*
131131
* @battlecode.doc.costlymethod
132132
*/
133-
public int getGlobalCheese();
133+
int getGlobalCheese();
134134

135135
/**
136136
* Returns the amount of cheese the robot has access to.
@@ -139,7 +139,7 @@ public interface RobotController {
139139
*
140140
* @battlecode.doc.costlymethod
141141
*/
142-
public int getAllCheese();
142+
int getAllCheese();
143143

144144
/**
145145
* Returns the amount of dirt that this robot's team has.
@@ -1035,4 +1035,4 @@ void setIndicatorLine(MapLocation startLoc, MapLocation endLoc, int red, int gre
10351035
void setTimelineMarker(String label, int red, int green, int blue);
10361036
}
10371037
// TODO: update bytecode costs, particularly for new methods + methods that got
1038-
// renamed from last year
1038+
// renamed from last year

engine/src/main/battlecode/common/UnitType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public MapLocation[] getAllTypeLocations(MapLocation center) {
7474
return locs;
7575
}
7676

77-
UnitType(int health, int size, int visionConeRadius, int visionConeAngle, int actionCooldown,
77+
UnitType(int health, int size, int visionConeRadiusSquared, int visionConeAngle, int actionCooldown,
7878
int movementCooldown, int bytecodeLimit) {
7979
this.health = health;
8080
this.size = size;
81-
this.visionConeRadiusSquared = visionConeRadius;
81+
this.visionConeRadiusSquared = visionConeRadiusSquared;
8282
this.visionConeAngle = visionConeAngle;
8383
this.actionCooldown = actionCooldown;
8484
this.movementCooldown = movementCooldown;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ private void assertCanPlaceDirt(MapLocation loc) throws GameActionException {
238238
assertIsRobotType(this.robot.getType());
239239
// Use unit action radius as the allowed range for the action
240240
assertCanActLocation(loc, GameConstants.BUILD_DISTANCE_SQUARED);
241+
assertIsActionReady();
241242

242243
// state checks :
243244
if (this.gameWorld.getTeamInfo().getDirt(this.robot.getTeam()) <= 0)
@@ -257,6 +258,7 @@ private void assertCanPlaceDirt(MapLocation loc) throws GameActionException {
257258
private void assertCanRemoveDirt(MapLocation loc) throws GameActionException {
258259
assertIsRobotType(this.robot.getType());
259260
assertCanActLocation(loc, GameConstants.BUILD_DISTANCE_SQUARED);
261+
assertIsActionReady();
260262

261263
if ((this.robot.getType().isBabyRatType()
262264
|| this.robot.getType().isRatKingType()) && (this.getAllCheese() < GameConstants.DIG_DIRT_CHEESE_COST))
@@ -310,6 +312,7 @@ private void assertCanRemoveRatTrap(MapLocation loc) throws GameActionException
310312
private void assertCanPlaceTrap(MapLocation loc, TrapType trapType) throws GameActionException {
311313
assertIsRobotType(this.robot.getType());
312314
assertCanActLocation(loc, GameConstants.BUILD_DISTANCE_SQUARED);
315+
assertIsActionReady();
313316

314317
if (trapType == TrapType.CAT_TRAP && !this.gameWorld.isCooperation)
315318
throw new GameActionException(CANT_DO_THAT, "Can't place new cat traps in backstabbing mode!");

0 commit comments

Comments
 (0)