Fixed attack mode gamover check

This commit is contained in:
Anuken 2020-10-22 20:44:18 -04:00
parent 23673f0b11
commit 436a020c3e
2 changed files with 9 additions and 14 deletions

View File

@ -199,19 +199,13 @@ public class Logic implements ApplicationListener{
state.gameOver = true;
Events.fire(new GameOverEvent(state.rules.waveTeam));
}else if(state.rules.attackMode){
Team alive = null;
//count # of teams alive
int countAlive = state.teams.getActive().count(TeamData::hasCore);
for(TeamData team : state.teams.getActive()){
if(team.hasCore()){
if(alive != null){
return;
}
alive = team.team;
}
}
if(alive != null && !state.gameOver){
Events.fire(new GameOverEvent(alive));
if((countAlive <= 1 || (!state.rules.pvp && state.rules.defaultTeam.core() == null)) && !state.gameOver){
//find team that won
TeamData left = state.teams.getActive().find(TeamData::hasCore);
Events.fire(new GameOverEvent(left == null ? Team.derelict : left.team));
state.gameOver = true;
}
}

View File

@ -113,8 +113,9 @@ public class MinimapFragment extends Fragment{
public void toggle(){
float size = baseSize * zoom * world.width();
float ratio = (float)renderer.minimap.getTexture().height / renderer.minimap.getTexture().width;
panx = (size/2f - player.x() / (world.width() * tilesize) * size) / zoom;
pany = (size*ratio/2f - player.y() / (world.height() * tilesize) * size*ratio) / zoom;
float px = player.dead() ? Core.camera.position.x : player.x, py = player.dead() ? Core.camera.position.y : player.y;
panx = (size/2f - px / (world.width() * tilesize) * size) / zoom;
pany = (size*ratio/2f - py / (world.height() * tilesize) * size*ratio) / zoom;
shown = !shown;
}
}