Skip to content

Commit a1705f5

Browse files
author
Ian Gonzalez Hermosillo
committed
fix location variable used in splash attacks
1 parent 11ba78d commit a1705f5

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,16 @@ public void splasherAttack(MapLocation loc, boolean useSecondaryColor) {
375375
this.gameWorld.getMatchMaker().addDamageAction(tower.ID, UnitType.SPLASHER.aoeAttackStrength);
376376
this.gameWorld.getMatchMaker().addAttackAction(tower.ID);
377377
}
378-
} else { // otherwise, maybe paint
379-
// If the tile is empty or same team paint, paint it
380-
if (!this.gameWorld.isPaintable(loc)) continue;
381-
if(this.gameWorld.getPaint(loc) == 0 || this.gameWorld.teamFromPaint(paintType) == this.gameWorld.teamFromPaint(this.gameWorld.getPaint(loc))) {
382-
this.gameWorld.setPaint(loc, paintType);
383-
this.gameWorld.getMatchMaker().addPaintAction(loc, useSecondaryColor);
384-
} else { // If the tile has opposite enemy team, paint only if within sqrt(2) radius
385-
if(loc.isWithinDistanceSquared(newLoc, 2)){
386-
this.gameWorld.setPaint(loc, paintType);
387-
this.gameWorld.getMatchMaker().addPaintAction(loc, useSecondaryColor);
388-
}
378+
}
379+
// If the tile is empty or same team paint, paint it
380+
if (!this.gameWorld.isPaintable(newLoc)) continue;
381+
if(this.gameWorld.getPaint(newLoc) == 0 || getTeam() == this.gameWorld.teamFromPaint(this.gameWorld.getPaint(newLoc))) {
382+
this.gameWorld.setPaint(newLoc, paintType);
383+
this.gameWorld.getMatchMaker().addPaintAction(newLoc, useSecondaryColor);
384+
} else { // If the tile has opposite enemy team, paint only if within sqrt(2) radius
385+
if(loc.isWithinDistanceSquared(newLoc, 2)){
386+
this.gameWorld.setPaint(newLoc, paintType);
387+
this.gameWorld.getMatchMaker().addPaintAction(newLoc, useSecondaryColor);
389388
}
390389
}
391390
}

0 commit comments

Comments
 (0)