Skip to content

Commit 41886cb

Browse files
authored
Merge pull request #88 from battlecode/master
Fix cat damage counter
2 parents a46669a + f51d62d commit 41886cb

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ public void triggerTrap(Trap trap, InternalRobot robot) {
602602

603603
robot.setMovementCooldownTurns(type.stunTime);
604604
if (type == TrapType.CAT_TRAP && robot.getType().isCatType()) {
605-
this.teamInfo.addDamageToCats(trap.getTeam(), type.damage);
605+
this.teamInfo.addDamageToCats(trap.getTeam(), Math.min(type.damage, robot.getHealth()));
606606
}
607607

608608
if (trap.getType() != TrapType.CAT_TRAP) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,12 @@ public void bite(MapLocation loc, int cheeseConsumed) {
614614

615615
this.gameWorld.getMatchMaker().addBiteAction(targetRobot.ID);
616616

617-
targetRobot.addHealth(-damage);
618617
if (targetRobot.getType() == UnitType.CAT) {
619-
this.gameWorld.getTeamInfo().addDamageToCats(team, damage);
618+
this.gameWorld.getTeamInfo().addDamageToCats(team, Math.min(damage, targetRobot.getHealth()));
620619
}
621620

621+
targetRobot.addHealth(-damage);
622+
622623
if (targetRobot.getType() != UnitType.CAT) {
623624
this.gameWorld.isCooperation = false;
624625
}

specs/specs.pdf

926 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)