Fixed game-over state / Recipe balance

This commit is contained in:
Anuken
2018-08-25 15:35:35 -04:00
parent e392c8f0e6
commit 74d7b43d0f
4 changed files with 36 additions and 25 deletions

View File

@ -45,6 +45,7 @@ public class ServerControl extends Module{
private ShuffleMode mode;
private int gameOvers;
private boolean inExtraRound;
private Team winnerTeam;
public ServerControl(String[] args){
Settings.defaultList(
@ -106,7 +107,9 @@ public class ServerControl extends Module{
while(map == previous) map = maps.random();
}
Call.onInfoMessage("[SCARLET]Game over![]\nNext selected map:[accent] "+map.name+"[]"
Call.onInfoMessage((state.mode.isPvp && winnerTeam != null
? "[YELLOW]The " + winnerTeam.name() + " team is victorious![]" : "[SCARLET]Game over![]")
+ "\nNext selected map:[accent] "+map.name+"[]"
+ (map.meta.author() != null ? " by[accent] " + map.meta.author() + "[]" : "") + "."+
"\nNew game begins in " + roundExtraTime + " seconds.");
@ -901,6 +904,25 @@ public class ServerControl extends Module{
}
}
private void checkPvPGameOver(){
Team alive = null;
for(Team team : Team.all){
if(state.teams.get(team).cores.size > 0){
if(alive != null){
return;
}
alive = team;
}
}
if(alive != null && !state.gameOver){
state.gameOver = true;
winnerTeam = alive;
Events.fire(GameOverEvent.class);
}
}
@Override
public void update(){