implemented end of games properly
This commit is contained in:
parent
5acae3c527
commit
5af0bcfd76
@ -102,6 +102,11 @@ public class Game {
|
|||||||
new ImageIcon("Deal_with_iit.png"));
|
new ImageIcon("Deal_with_iit.png"));
|
||||||
Application.frameInstance.backToMapSelection();
|
Application.frameInstance.backToMapSelection();
|
||||||
break;
|
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();
|
display.stopMusic();
|
||||||
@ -170,6 +175,15 @@ public class Game {
|
|||||||
|
|
||||||
private void checkZPMStatus()
|
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())
|
if (oneill.getZPMCount() >= dungeon.getZPMsToWin())
|
||||||
{
|
{
|
||||||
flowoftime.stopTime();
|
flowoftime.stopTime();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package cicaprojekt;
|
package cicaprojekt;
|
||||||
|
|
||||||
public enum GameoverCause {
|
public enum GameoverCause {
|
||||||
TIMEOUT, ONEILLWON, JAFFAWON
|
TIMEOUT, ONEILLWON, JAFFAWON, DRAW
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user