mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Facedown: fix effects turning cards face down in exile
This commit is contained in:
committed by
Michael Kamensky
parent
b8a0882b66
commit
08041e14fb
@@ -185,8 +185,7 @@ public class GameAction {
|
||||
// all sort of funky shenanigans may happen later (e.g. their ETB replacement effects are set
|
||||
// up on the wrong card state etc.).
|
||||
if (wasFacedown && (fromBattlefield || (toHand && zoneFrom.is(ZoneType.Exile)))) {
|
||||
c.setState(CardStateName.Original, true);
|
||||
c.runFaceupCommands();
|
||||
c.turnFaceUp();
|
||||
}
|
||||
|
||||
if (!c.isToken()) {
|
||||
@@ -306,8 +305,8 @@ public class GameAction {
|
||||
}
|
||||
|
||||
if (game.getStack().isResolving(c) && !zoneTo.is(ZoneType.Graveyard) && repres == ReplacementResult.Prevented) {
|
||||
copied.getOwner().removeInboundToken(copied);
|
||||
return moveToGraveyard(c, cause, params);
|
||||
copied.getOwner().removeInboundToken(copied);
|
||||
return moveToGraveyard(c, cause, params);
|
||||
}
|
||||
copied.getOwner().removeInboundToken(copied);
|
||||
return c;
|
||||
@@ -445,13 +444,9 @@ public class GameAction {
|
||||
|
||||
// rule 504.6: reveal a face-down card leaving the stack
|
||||
if (zoneFrom != null && zoneTo != null && zoneFrom.is(ZoneType.Stack) && !zoneTo.is(ZoneType.Battlefield) && wasFacedown) {
|
||||
// FIXME: tracker freeze-unfreeze is needed here to avoid a bug with the card staying face down in the View for the reveal
|
||||
boolean trackerFrozen = game.getTracker().isFrozen();
|
||||
game.getTracker().unfreeze();
|
||||
c.setState(CardStateName.Original, true);
|
||||
reveal(new CardCollection(c), c.getOwner(), true, "Face-down card moves from the stack: ");
|
||||
c.setState(CardStateName.FaceDown, true);
|
||||
if (trackerFrozen) { game.getTracker().freeze(); }
|
||||
Card revealLKI = CardUtil.getLKICopy(c);
|
||||
revealLKI.turnFaceUp(true, false);
|
||||
reveal(new CardCollection(revealLKI), revealLKI.getOwner(), true, "Face-down card moves from the stack: ");
|
||||
}
|
||||
|
||||
if (fromBattlefield) {
|
||||
@@ -480,14 +475,12 @@ public class GameAction {
|
||||
}
|
||||
// Reveal if face-down
|
||||
if (wasFacedown) {
|
||||
// FIXME: tracker freeze-unfreeze is needed here to avoid a bug with the card staying face down in the View for the reveal
|
||||
boolean trackerFrozen = game.getTracker().isFrozen();
|
||||
game.getTracker().unfreeze();
|
||||
c.setState(CardStateName.Original, true);
|
||||
reveal(new CardCollection(c), c.getOwner(), true, "Face-down card leaves the battlefield: ");
|
||||
c.setState(CardStateName.FaceDown, true);
|
||||
if (trackerFrozen) { game.getTracker().freeze(); }
|
||||
copied.setState(CardStateName.Original, true);
|
||||
Card revealLKI = CardUtil.getLKICopy(c);
|
||||
revealLKI.turnFaceUp(true, false);
|
||||
|
||||
reveal(new CardCollection(revealLKI), revealLKI.getOwner(), true, "Face-down card leaves the battlefield: ");
|
||||
|
||||
copied.setState(CardStateName.Original, true);
|
||||
}
|
||||
unattachCardLeavingBattlefield(copied);
|
||||
// Remove all changed keywords
|
||||
@@ -506,9 +499,9 @@ public class GameAction {
|
||||
game.getStack().fizzleTriggersOnStackTargeting(copied, TriggerType.DamageDoneOnce);
|
||||
}
|
||||
} else if (zoneTo.is(ZoneType.Graveyard)
|
||||
|| zoneTo.is(ZoneType.Hand)
|
||||
|| zoneTo.is(ZoneType.Library)
|
||||
|| zoneTo.is(ZoneType.Exile)) {
|
||||
|| zoneTo.is(ZoneType.Hand)
|
||||
|| zoneTo.is(ZoneType.Library)
|
||||
|| zoneTo.is(ZoneType.Exile)) {
|
||||
copied.setTimestamp(game.getNextTimestamp());
|
||||
copied.clearOptionalCostsPaid();
|
||||
if (copied.isFaceDown()) {
|
||||
@@ -1238,14 +1231,14 @@ public class GameAction {
|
||||
}
|
||||
|
||||
if (reason == null) {
|
||||
List<Player> notLost = Lists.newArrayList();
|
||||
Set<Integer> teams = Sets.newHashSet();
|
||||
for (Player p : allPlayers) {
|
||||
List<Player> notLost = Lists.newArrayList();
|
||||
Set<Integer> teams = Sets.newHashSet();
|
||||
for (Player p : allPlayers) {
|
||||
if (p.getOutcome() == null || p.getOutcome().hasWon()) {
|
||||
notLost.add(p);
|
||||
teams.add(p.getTeam());
|
||||
notLost.add(p);
|
||||
teams.add(p.getTeam());
|
||||
}
|
||||
}
|
||||
}
|
||||
int cntNotLost = notLost.size();
|
||||
if (cntNotLost == 1) {
|
||||
reason = GameEndReason.AllOpponentsLost;
|
||||
@@ -1733,7 +1726,7 @@ public class GameAction {
|
||||
} while (!allKept);
|
||||
|
||||
//Vancouver Mulligan as a scry with the decisions inside
|
||||
List<Player> scryers = Lists.newArrayList();
|
||||
List<Player> scryers = Lists.newArrayList();
|
||||
for(Player p : whoCanMulligan) {
|
||||
if (p.getStartingHandSize() > p.getZone(ZoneType.Hand).size()) {
|
||||
scryers.add(p);
|
||||
|
||||
@@ -2,7 +2,6 @@ package forge.game.ability.effects;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import forge.card.CardStateName;
|
||||
import forge.game.Game;
|
||||
import forge.game.GlobalRuleChange;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
@@ -43,7 +42,7 @@ public class ManifestEffect extends SpellAbilityEffect {
|
||||
//check if lki would be a land entering the battlefield
|
||||
if (game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLandBattlefield)) {
|
||||
Card lki = CardUtil.getLKICopy(c);
|
||||
lki.setState(CardStateName.FaceDown, false);
|
||||
lki.turnFaceDownNoUpdate();
|
||||
lki.setManifested(true);
|
||||
lki.setLastKnownZone(p.getZone(ZoneType.Battlefield));
|
||||
CardCollection preList = new CardCollection(lki);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.game.ability.effects;
|
||||
|
||||
import forge.card.CardStateName;
|
||||
import forge.game.Game;
|
||||
import forge.game.GameLogEntryType;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
@@ -63,8 +62,8 @@ public class MillEffect extends SpellAbilityEffect {
|
||||
}
|
||||
for (final Card c : milled) {
|
||||
c.setExiledWith(host);
|
||||
if (facedown) {
|
||||
c.setState(CardStateName.FaceDown, true);
|
||||
if (facedown) {
|
||||
c.turnFaceDown(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.google.common.collect.Lists;
|
||||
import forge.GameCommand;
|
||||
import forge.StaticData;
|
||||
import forge.card.CardRulesPredicates;
|
||||
import forge.card.CardStateName;
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityFactory;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
@@ -153,7 +152,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
|
||||
final boolean wasFaceDown;
|
||||
if (tgtCard.isFaceDown()) {
|
||||
tgtCard.setState(CardStateName.Original, false);
|
||||
tgtCard.turnFaceUp(false, false);
|
||||
wasFaceDown = true;
|
||||
} else {
|
||||
wasFaceDown = false;
|
||||
@@ -165,7 +164,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
|
||||
if (optional && !controller.getController().confirmAction(sa, null, TextUtil.concatWithSpace("Do you want to play", TextUtil.addSuffix(tgtCard.toString(),"?")))) {
|
||||
if (wasFaceDown) {
|
||||
tgtCard.setState(CardStateName.FaceDown, false);
|
||||
tgtCard.turnFaceDownNoUpdate();
|
||||
}
|
||||
saidNoTo.add(tgtCard);
|
||||
continue;
|
||||
|
||||
@@ -7,6 +7,7 @@ import forge.game.GameLogEntryType;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.card.CardUtil;
|
||||
import forge.game.card.CounterType;
|
||||
import forge.game.event.GameEventCardStatsChanged;
|
||||
import forge.game.player.Player;
|
||||
@@ -73,13 +74,9 @@ public class SetStateEffect extends SpellAbilityEffect {
|
||||
// facedown cards that are not Permanent, can't turn faceup there
|
||||
if ("TurnFace".equals(mode) && tgt.isFaceDown() && tgt.isInZone(ZoneType.Battlefield)
|
||||
&& !tgt.getState(CardStateName.Original).getType().isPermanent()) {
|
||||
// need to cache manifest status
|
||||
boolean manifested = tgt.isManifested();
|
||||
// FIXME setState has to many other Consequences, use LKI?
|
||||
tgt.setState(CardStateName.Original, true);
|
||||
game.getAction().reveal(new CardCollection(tgt), tgt.getOwner(), true, "Face-down card can't turn face up");
|
||||
tgt.setState(CardStateName.FaceDown, true);
|
||||
tgt.setManifested(manifested);
|
||||
Card lki = CardUtil.getLKICopy(tgt);
|
||||
lki.turnFaceUp(true, false);
|
||||
game.getAction().reveal(new CardCollection(lki), lki.getOwner(), true, "Face-down card can't turn face up");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user