diff --git a/engine/src/main/battlecode/common/AnomalyType.java b/engine/src/main/battlecode/common/AnomalyType.java index f09085be..8b984671 100644 --- a/engine/src/main/battlecode/common/AnomalyType.java +++ b/engine/src/main/battlecode/common/AnomalyType.java @@ -7,9 +7,8 @@ public enum AnomalyType { ABYSS (true, true, 0.1f, 0.2f), CHARGE (true, true, 0.05f, 0.1f), FURY (true, true, 0.05f, 0.1f), - VORTEX (true, false, 0, 0), - SINGULARITY (true, false, 0, 0); - + VORTEX (true, false, 0, 0); + public final boolean isGlobalAnomaly; public final boolean isSageAnomaly; public final float globalPercentage; diff --git a/engine/src/main/battlecode/common/GameConstants.java b/engine/src/main/battlecode/common/GameConstants.java index c351ed30..6186ae19 100644 --- a/engine/src/main/battlecode/common/GameConstants.java +++ b/engine/src/main/battlecode/common/GameConstants.java @@ -91,7 +91,7 @@ public class GameConstants { // ********************************* /** A blueprint building's health, as a multiplier of max health. */ - public static final float PROTOTYPE_HP_PERCENTAGE = 0.9f; + public static final float PROTOTYPE_HP_PERCENTAGE = 0.6f; /** The multiplier for reclaiming a building's cost. */ public static final float RECLAIM_COST_MULTIPLIER = 0.2f; diff --git a/engine/src/main/battlecode/common/RobotController.java b/engine/src/main/battlecode/common/RobotController.java index 086da698..2590d283 100644 --- a/engine/src/main/battlecode/common/RobotController.java +++ b/engine/src/main/battlecode/common/RobotController.java @@ -185,7 +185,7 @@ public strictfp interface RobotController { boolean canSenseRadiusSquared(int radiusSquared); /** - * Checks whether a robot is at a given location. Assumes the location is valid. + * Checks whether a robot is at a given location. Assumes the location is valid. * * @param loc the location to check * @return true if a robot is at the location @@ -193,7 +193,17 @@ public strictfp interface RobotController { * * @battlecode.doc.costlymethod */ - boolean canSenseRobotAtLocation(MapLocation loc) throws GameActionException; + boolean isLocationOccupied(MapLocation loc) throws GameActionException; + + /** + * Checks whether a robot is at a given location. Assume the location is valid. + * + * @param loc the location to check + * @return true if a robot is at the location, false if there is no robot or the location can not be sensed. + * + * @battlecode.doc.costlymethod + */ + boolean canSenseRobotAtLocation(MapLocation loc); /** * Senses the robot at the given location, or null if there is no robot @@ -374,7 +384,7 @@ public strictfp interface RobotController { * * @battlecode.doc.costlymethod */ - double getActionCooldownTurns(); + int getActionCooldownTurns(); /** * Tests whether the robot can move. @@ -395,7 +405,7 @@ public strictfp interface RobotController { * * @battlecode.doc.costlymethod */ - double getMovementCooldownTurns(); + int getMovementCooldownTurns(); /** * Tests whether the robot can transform. @@ -416,10 +426,11 @@ public strictfp interface RobotController { * GameConstants.COOLDOWNS_PER_TURN every turn. * * @return the number of cooldown turns remaining before this unit can transform again + * @throws GameActionException if the robot's mode is not TURRET or PORTABLE * * @battlecode.doc.costlymethod */ - double getTransformCooldownTurns(); + int getTransformCooldownTurns() throws GameActionException; // *********************************** // ****** MOVEMENT METHODS *********** diff --git a/engine/src/main/battlecode/common/RobotType.java b/engine/src/main/battlecode/common/RobotType.java index e6582108..3e31df1f 100644 --- a/engine/src/main/battlecode/common/RobotType.java +++ b/engine/src/main/battlecode/common/RobotType.java @@ -134,7 +134,8 @@ public boolean canBuild(RobotType builtType) { */ public boolean canAttack() { return (this == WATCHTOWER - || this == SOLDIER); + || this == SOLDIER + || this == SAGE); } /** diff --git a/engine/src/main/battlecode/world/LiveMap.java b/engine/src/main/battlecode/world/LiveMap.java index cd870337..45ed5509 100644 --- a/engine/src/main/battlecode/world/LiveMap.java +++ b/engine/src/main/battlecode/world/LiveMap.java @@ -92,8 +92,7 @@ public LiveMap(int width, Arrays.fill(this.rubbleArray, 1); // default cooldown factor is 1 this.leadArray = new int[width * height]; // TODO: we guarantee there to be lead within vision range of archons - this.anomalySchedule = new AnomalyScheduleEntry[1]; - this.anomalySchedule[0] = new AnomalyScheduleEntry(GameConstants.GAME_MAX_NUMBER_OF_ROUNDS, AnomalyType.SINGULARITY); + this.anomalySchedule = new AnomalyScheduleEntry[0]; this.nextAnomalyIndex = 0; // invariant: bodies is sorted by id diff --git a/engine/src/main/battlecode/world/RobotControllerImpl.java b/engine/src/main/battlecode/world/RobotControllerImpl.java index c1500c7c..f67336fd 100644 --- a/engine/src/main/battlecode/world/RobotControllerImpl.java +++ b/engine/src/main/battlecode/world/RobotControllerImpl.java @@ -203,11 +203,18 @@ public boolean canSenseRadiusSquared(int radiusSquared) { } @Override - public boolean canSenseRobotAtLocation(MapLocation loc) throws GameActionException { + public boolean isLocationOccupied(MapLocation loc) throws GameActionException { assertCanSenseLocation(loc); return this.gameWorld.getRobot(loc) != null; } + @Override + public boolean canSenseRobotAtLocation(MapLocation loc) { + try { + return isLocationOccupied(loc); + } catch (GameActionException e) { return false; } + } + @Override public RobotInfo senseRobotAtLocation(MapLocation loc) throws GameActionException { assertCanSenseLocation(loc); @@ -301,10 +308,6 @@ public MapLocation[] getAllLocationsWithinRadiusSquared(MapLocation center, int // ****** READINESS METHODS ********** // *********************************** - private boolean isLocationOccupied(MapLocation loc) throws GameActionException { - return this.gameWorld.getRobot(loc) != null; - } - private void assertIsActionReady() throws GameActionException { if (!this.robot.getMode().canAct) throw new GameActionException(CANT_DO_THAT, @@ -323,7 +326,7 @@ public boolean isActionReady() { } @Override - public double getActionCooldownTurns() { + public int getActionCooldownTurns() { return this.robot.getActionCooldownTurns(); } @@ -345,7 +348,7 @@ public boolean isMovementReady() { } @Override - public double getMovementCooldownTurns() { + public int getMovementCooldownTurns() { return this.robot.getMovementCooldownTurns(); } @@ -368,7 +371,10 @@ public boolean isTransformReady() { } @Override - public double getTransformCooldownTurns() { + public int getTransformCooldownTurns() throws GameActionException { + if (!this.robot.getMode().canTransform) + throw new GameActionException(CANT_DO_THAT, + "This robot is not in a mode that can transform."); return this.robot.getTransformCooldownTurns(); }