From 1e86f1607e39c938ad17dcb8505301e33a3b9248 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 24 Apr 2018 19:26:58 -0400 Subject: [PATCH] fixed The Tabernacle at Pendrell Vale forcing sacrifice of creatures which have left and re-entered the battlefield (fixes #4861) --- .../cards/t/TheTabernacleAtPendrellVale.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java b/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java index df2f040990..963e5bca6a 100644 --- a/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java +++ b/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java @@ -39,7 +39,7 @@ import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; -import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -51,12 +51,18 @@ import mage.players.Player; public class TheTabernacleAtPendrellVale extends CardImpl { public TheTabernacleAtPendrellVale(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.LAND},""); + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); addSuperType(SuperType.LEGENDARY); // All creatures have "At the beginning of your upkeep, destroy this creature unless you pay {1}." Ability ability = new BeginningOfUpkeepTriggeredAbility(new DestroySourceUnlessPaysEffect(new ManaCostsImpl("{1}")), TargetController.YOU, false); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURES))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new GainAbilityAllEffect( + ability, + Duration.WhileOnBattlefield, + new FilterCreaturePermanent("All creatures") + ) + )); } public TheTabernacleAtPendrellVale(final TheTabernacleAtPendrellVale card) { @@ -69,14 +75,14 @@ public class TheTabernacleAtPendrellVale extends CardImpl { } } - class DestroySourceUnlessPaysEffect extends OneShotEffect { + protected Cost cost; public DestroySourceUnlessPaysEffect(Cost cost) { super(Outcome.DestroyPermanent); this.cost = cost; - } + } public DestroySourceUnlessPaysEffect(final DestroySourceUnlessPaysEffect effect) { super(effect); @@ -87,8 +93,8 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); - if (player != null && permanent != null) { - if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) { + if (player != null && permanent != null && source.getSourceObjectZoneChangeCounter() == permanent.getZoneChangeCounter(game)) { + if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; @@ -105,8 +111,8 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect { return new DestroySourceUnlessPaysEffect(this); } - @Override + @Override public String getText(Mode mode) { return "destroy this creature unless you pay {1}"; } - } \ No newline at end of file +}