Permalink
Browse files

fix yield bonus

  • Loading branch information...
1 parent c17633b commit 4fe9759913f5173cb18e5623864297a294cef61f @dgulotta dgulotta committed Jan 3, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/battlecode/world/RobotControllerImpl.java
@@ -1,5 +1,6 @@
package battlecode.world;
+import static battlecode.common.GameConstants.BYTECODE_LIMIT_BASE;
import static battlecode.common.GameConstants.NUMBER_OF_INDICATOR_STRINGS;
import static battlecode.common.GameConstants.YIELD_BONUS;
import static battlecode.common.GameActionExceptionType.*;
@@ -172,7 +173,9 @@ public void turnOn(MapLocation loc, RobotLevel height) throws GameActionExceptio
* {@inheritDoc}
*/
public void yield() {
- robot.changeEnergonLevel(YIELD_BONUS * RobotMonitor.getBytecodesUsedPercent() * robot.chassis.upkeep);
+ int bytecodesBelowBase = BYTECODE_LIMIT_BASE - RobotMonitor.getBytecodesUsed();
+ if(bytecodesBelowBase>0)
+ gameWorld.adjustResources(robot.getTeam(),YIELD_BONUS*bytecodesBelowBase/BYTECODE_LIMIT_BASE*robot.chassis.upkeep);
RobotMonitor.endRunner();
}

0 comments on commit 4fe9759

Please sign in to comment.