* Grindstone - Infinite loop (with e.g. two Progenitus) is handled as a draw.

This commit is contained in:
LevelX2 2014-12-26 17:22:32 +01:00
parent 395997c66f
commit 40eef06944
7 changed files with 115 additions and 18 deletions

View file

@ -131,6 +131,7 @@ public interface Game extends MageItem, Serializable {
Combat getCombat();
GameState getState();
String getWinner();
void setDraw(UUID playerId);
boolean isADraw();
ContinuousEffects getContinuousEffects();
GameStates getGameStates();

View file

@ -2520,4 +2520,15 @@ public abstract class GameImpl implements Game, Serializable {
return startLife;
}
@Override
public void setDraw(UUID playerId) {
Player player = getPlayer(playerId);
if (player != null) {
for (UUID playerToSetId :player.getInRange()) {
Player playerToDraw = getPlayer(playerToSetId);
playerToDraw.lostForced(this);
}
}
}
}

View file

@ -260,6 +260,7 @@ public interface Player extends MageItem, Copyable<Player> {
void discardToMax(Game game);
boolean discard(Card card, Ability source, Game game);
void lost(Game game);
void lostForced(Game game);
void won(Game game);
void leave();
void concede(Game game);

View file

@ -1854,20 +1854,25 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public void lost(Game game) {
if (canLose(game)) {
logger.debug(this.getName() + " has lost gameId: " + game.getId());
//20100423 - 603.9
if (!this.wins) {
this.loses = true;
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LOST, null, null, playerId));
game.informPlayers(this.getName()+ " has lost the game.");
} else {
logger.debug(this.getName() + " has already won - stop lost");
}
// for draw - first all players that have lost have to be set to lost
if (!hasLeft()) {
logger.debug("Game over playerId: " + playerId);
game.gameOver(playerId);
}
lostForced(game);
}
}
@Override
public void lostForced(Game game) {
logger.debug(this.getName() + " has lost gameId: " + game.getId());
//20100423 - 603.9
if (!this.wins) {
this.loses = true;
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LOST, null, null, playerId));
game.informPlayers(this.getName()+ " has lost the game.");
} else {
logger.debug(this.getName() + " has already won - stop lost");
}
// for draw - first all players that have lost have to be set to lost
if (!hasLeft()) {
logger.debug("Game over playerId: " + playerId);
game.gameOver(playerId);
}
}