implemented end of games properly

This commit is contained in:
Kjistóf 2016-05-14 21:32:08 +02:00
parent 5acae3c527
commit 5af0bcfd76
2 changed files with 15 additions and 1 deletions

View File

@ -102,6 +102,11 @@ public class Game {
new ImageIcon("Deal_with_iit.png"));
Application.frameInstance.backToMapSelection();
break;
case DRAW:
JOptionPane.showMessageDialog(null, "Draw! While O'Neill and the Jaffa struggled against eachother, Anubis has enslaved the world.",
"Game over",
JOptionPane.INFORMATION_MESSAGE,
new ImageIcon("Anubis.png"));
}
display.stopMusic();
@ -170,6 +175,15 @@ public class Game {
private void checkZPMStatus()
{
if (oneill.getZPMCount() + jaffa.getZPMCount() >= dungeon.getZPMsToWin()) {
if (oneill.getZPMCount() > jaffa.getZPMCount())
stopGame(GameoverCause.ONEILLWON);
else if (oneill.getZPMCount() < jaffa.getZPMCount())
stopGame(GameoverCause.JAFFAWON);
else
stopGame(GameoverCause.DRAW);
}
if (oneill.getZPMCount() >= dungeon.getZPMsToWin())
{
flowoftime.stopTime();

View File

@ -1,5 +1,5 @@
package cicaprojekt;
public enum GameoverCause {
TIMEOUT, ONEILLWON, JAFFAWON
TIMEOUT, ONEILLWON, JAFFAWON, DRAW
}