Fixed incorrect game-overs on zone attack maps

This commit is contained in:
Anuken
2019-06-29 11:02:27 -04:00
parent 04dfda0c55
commit 576f0be4ab
3 changed files with 16 additions and 6 deletions

View File

@ -15,6 +15,7 @@ import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.game.*; import io.anuke.mindustry.game.*;
import io.anuke.mindustry.game.Teams.TeamData; import io.anuke.mindustry.game.Teams.TeamData;
import io.anuke.mindustry.gen.BrokenBlock; import io.anuke.mindustry.gen.BrokenBlock;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@ -130,9 +131,14 @@ public class Logic implements ApplicationListener{
} }
if(alive != null && !state.gameOver){ if(alive != null && !state.gameOver){
state.gameOver = true; if(world.isZone() && alive == defaultTeam){
//in attack maps, a victorious game over is equivalent to a launch
Call.launchZone();
}else{
Events.fire(new GameOverEvent(alive)); Events.fire(new GameOverEvent(alive));
} }
state.gameOver = true;
}
} }
} }
@ -154,6 +160,9 @@ public class Logic implements ApplicationListener{
world.removeBlock(tile); world.removeBlock(tile);
} }
state.launched = true; state.launched = true;
state.gameOver = true;
//manually fire game over event now
Events.fire(new GameOverEvent(defaultTeam));
}); });
} }

View File

@ -121,7 +121,8 @@ public class Zone extends UnlockableContent{
/** Whether this zone has met its condition; if true, the player can leave. */ /** Whether this zone has met its condition; if true, the player can leave. */
public boolean metCondition(){ public boolean metCondition(){
return state.wave >= conditionWave; //players can't leave in attack mode.
return state.wave >= conditionWave && !state.rules.attackMode;
} }
public boolean canConfigure(){ public boolean canConfigure(){