Reveal foretold cards and other face-down cards when a player leaves the game or the game ends

This commit is contained in:
Alumi
2021-02-17 04:07:59 +00:00
committed by Michael Kamensky
parent 201f53fb09
commit 3ff19f7957
8 changed files with 39 additions and 0 deletions

View File

@@ -736,6 +736,17 @@ public class Game {
boolean planarControllerLost = false;
boolean isMultiplayer = this.getPlayers().size() > 2;
// 702.142f & 707.9
// If a player leaves the game, all face-down cards that player owns must be revealed to all players.
// At the end of each game, all face-down cards must be revealed to all players.
if (!isMultiplayer) {
for (Player pl : getPlayers()) {
pl.revealFaceDownCards();
}
} else {
p.revealFaceDownCards();
}
for(Card c : cards) {
if (c.getController().equals(p) && (c.isPlane() || c.isPhenomenon())) {
planarControllerLost = true;

View File

@@ -2839,6 +2839,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
return facedown;
}
public final boolean isRealFaceDown() {
return facedown;
}
public final void setFaceDown(boolean value) {
facedown = value;
}

View File

@@ -3546,4 +3546,23 @@ public class Player extends GameEntity implements Comparable<Player> {
&& Iterables.any(landsControlled, Predicates.and(CardPredicates.isType("Urza's"), CardPredicates.isType("Power-Plant")))
&& Iterables.any(landsControlled, Predicates.and(CardPredicates.isType("Urza's"), CardPredicates.isType("Tower")));
}
public void revealFaceDownCards() {
final List<List<ZoneType>> revealZones = Arrays.asList(Arrays.asList(ZoneType.Battlefield, ZoneType.Merged), Arrays.asList(ZoneType.Exile));
final PlayerCollection otherPlayers = new PlayerCollection(game.getRegisteredPlayers());
otherPlayers.remove(this);
for (List<ZoneType> z : revealZones) {
CardCollection revealCards = new CardCollection();
for (Card c : game.getCardsInOwnedBy(z, this)) {
if (!c.isRealFaceDown()) continue;
Card lki = CardUtil.getLKICopy(c);
lki.forceTurnFaceUp();
lki.setZone(c.getZone());
revealCards.add(lki);
}
game.getAction().revealTo(revealCards, otherPlayers, Localizer.getInstance().getMessage("lblRevealFaceDownCards"));
}
}
}