* Added Celestial Convergence and some changes to game draw handling.

This commit is contained in:
LevelX2 2017-04-21 15:18:04 +02:00
parent 274e0f9052
commit e284922017
8 changed files with 278 additions and 31 deletions

View file

@ -2813,7 +2813,7 @@ public abstract class GameImpl implements Game, Serializable {
for (UUID playerToSetId : getState().getPlayersInRange(playerId, this)) {
Player playerToDraw = getPlayer(playerToSetId);
if (playerToDraw != null) {
playerToDraw.lostForced(this);
playerToDraw.drew(this);
}
}
}

View file

@ -176,7 +176,7 @@ public class GameEvent implements Serializable {
data originalId of the mana producing ability
*/
MANA_PAID,
LOSES, LOST, WINS,
LOSES, LOST, WINS, DRAW_PLAYER,
TARGET, TARGETED,
/* TARGETS_VALID
targetId id of the spell or id of stack ability the targets were set to

View file

@ -212,6 +212,8 @@ public interface Player extends MageItem, Copyable<Player> {
boolean hasLost();
boolean hasDrew();
boolean hasWon();
boolean hasQuit();
@ -430,6 +432,8 @@ public interface Player extends MageItem, Copyable<Player> {
void lostForced(Game game);
void drew(Game game);
void won(Game game);
void leave();

View file

@ -107,6 +107,7 @@ public abstract class PlayerImpl implements Player, Serializable {
protected boolean human;
protected int life;
protected boolean wins;
protected boolean draws;
protected boolean loses;
protected Library library;
protected Cards sideboard;
@ -226,6 +227,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.human = player.human;
this.life = player.life;
this.wins = player.wins;
this.draws = player.draws;
this.loses = player.loses;
this.library = player.library.copy();
@ -391,6 +393,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.abilities.clear();
this.counters.clear();
this.wins = false;
this.draws = false;
this.loses = false;
this.left = false;
// reset is neccessary because in tournament player will be used for each round
@ -2190,6 +2193,16 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
@Override
public void drew(Game game) {
if (!hasLost()) {
this.draws = true;
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DRAW_PLAYER, null, null, playerId));
game.informPlayers("For " + this.getLogName() + " the game is a draw.");
game.gameOver(playerId);
}
}
@Override
public boolean hasLost() {
return this.loses;
@ -2197,7 +2210,7 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public boolean isInGame() {
return !hasQuit() && !hasLost() && !hasWon() && !hasLeft();
return !hasQuit() && !hasLost() && !hasWon() && !hasDrew() && !hasLeft();
}
@Override
@ -2210,6 +2223,11 @@ public abstract class PlayerImpl implements Player, Serializable {
return !this.loses && this.wins;
}
@Override
public boolean hasDrew() {
return this.draws;
}
@Override
public void declareAttacker(UUID attackerId, UUID defenderId, Game game, boolean allowUndo) {
if (allowUndo) {