Fix effects on phased out cards

This commit is contained in:
tool4EvEr
2021-06-02 20:56:59 +02:00
parent 58866b0595
commit db85958008
2 changed files with 5 additions and 4 deletions

View File

@@ -502,7 +502,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
// gameCard is LKI in that case, the card is not in game anymore // gameCard is LKI in that case, the card is not in game anymore
// or the timestamp did change // or the timestamp did change
// this should check Self too // this should check Self too
if (gameCard == null || !tgtC.equalsWithTimestamp(gameCard)) { if (gameCard == null || !tgtC.equalsWithTimestamp(gameCard) || gameCard.isPhasedOut()) {
continue; continue;
} }
if (sa.usesTargeting() && !gameCard.canBeTargetedBy(sa)) { if (sa.usesTargeting() && !gameCard.canBeTargetedBy(sa)) {

View File

@@ -4645,8 +4645,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
// If this is currently PhasedIn, it's about to phase out. // If this is currently PhasedIn, it's about to phase out.
// Run trigger before it does because triggers don't work with phased out objects // Run trigger before it does because triggers don't work with phased out objects
getGame().getTriggerHandler().runTrigger(TriggerType.PhaseOut, runParams, false); getGame().getTriggerHandler().runTrigger(TriggerType.PhaseOut, runParams, false);
runLeavesPlayCommands(); // when it doesn't exist the game will no longer see it as tapped
runUntapCommands(); runUntapCommands();
// TODO need to run UntilHostLeavesPlay commands but only when worded "for as long as"
} }
setPhasedOut(!phasedOut); setPhasedOut(!phasedOut);
@@ -5770,11 +5771,11 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
} }
public final boolean canBeDestroyed() { public final boolean canBeDestroyed() {
return isInPlay() && (!hasKeyword(Keyword.INDESTRUCTIBLE) || (isCreature() && getNetToughness() <= 0)); return isInPlay() && !isPhasedOut() && (!hasKeyword(Keyword.INDESTRUCTIBLE) || (isCreature() && getNetToughness() <= 0));
} }
public final boolean canBeSacrificed() { public final boolean canBeSacrificed() {
return isInPlay() && !this.isPhasedOut() && !hasKeyword("CARDNAME can't be sacrificed."); return isInPlay() && !isPhasedOut() && !hasKeyword("CARDNAME can't be sacrificed.");
} }
@Override @Override