Team#isEnemy is pointless

This commit is contained in:
Anuken 2023-05-21 03:59:08 -04:00
parent dc63112915
commit 564e81e734
4 changed files with 4 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 523 B

View File

@ -600,7 +600,7 @@ public class Damage{
for(int dx = -trad; dx <= trad; dx++){ for(int dx = -trad; dx <= trad; dx++){
for(int dy = -trad; dy <= trad; dy++){ for(int dy = -trad; dy <= trad; dy++){
Tile tile = world.tile(Math.round(x / tilesize) + dx, Math.round(y / tilesize) + dy); Tile tile = world.tile(Math.round(x / tilesize) + dx, Math.round(y / tilesize) + dy);
if(tile != null && tile.build != null && (team == null ||team.isEnemy(tile.team())) && dx*dx + dy*dy <= trad*trad){ if(tile != null && tile.build != null && (team == null || team != tile.team()) && dx*dx + dy*dy <= trad*trad){
tile.build.damage(team, damage); tile.build.damage(team, damage);
} }
} }

View File

@ -121,6 +121,8 @@ public class Team implements Comparable<Team>{
return isAI() && !rules().rtsAi; return isAI() && !rules().rtsAi;
} }
/** @deprecated There is absolutely no reason to use this. */
@Deprecated
public boolean isEnemy(Team other){ public boolean isEnemy(Team other){
return this != other; return this != other;
} }

View File

@ -96,7 +96,7 @@ public class MobileInput extends InputHandler implements GestureListener{
}else{ }else{
Building tile = world.buildWorld(x, y); Building tile = world.buildWorld(x, y);
if((tile != null && player.team().isEnemy(tile.team) && (tile.team != Team.derelict || state.rules.coreCapture)) || (tile != null && player.unit().type.canHeal && tile.team == player.team() && tile.damaged())){ if((tile != null && player.team() != tile.team && (tile.team != Team.derelict || state.rules.coreCapture)) || (tile != null && player.unit().type.canHeal && tile.team == player.team() && tile.damaged())){
player.unit().mineTile = null; player.unit().mineTile = null;
target = tile; target = tile;
} }