mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
fixed The Tabernacle at Pendrell Vale forcing sacrifice of creatures which have left and re-entered the battlefield (fixes #4861)
This commit is contained in:
parent
758634f5bb
commit
1e86f1607e
1 changed files with 15 additions and 9 deletions
|
@ -39,7 +39,7 @@ import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -51,12 +51,18 @@ import mage.players.Player;
|
||||||
public class TheTabernacleAtPendrellVale extends CardImpl {
|
public class TheTabernacleAtPendrellVale extends CardImpl {
|
||||||
|
|
||||||
public TheTabernacleAtPendrellVale(UUID ownerId, CardSetInfo setInfo) {
|
public TheTabernacleAtPendrellVale(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
|
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||||
addSuperType(SuperType.LEGENDARY);
|
addSuperType(SuperType.LEGENDARY);
|
||||||
|
|
||||||
// All creatures have "At the beginning of your upkeep, destroy this creature unless you pay {1}."
|
// 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);
|
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) {
|
public TheTabernacleAtPendrellVale(final TheTabernacleAtPendrellVale card) {
|
||||||
|
@ -69,8 +75,8 @@ public class TheTabernacleAtPendrellVale extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DestroySourceUnlessPaysEffect extends OneShotEffect {
|
class DestroySourceUnlessPaysEffect extends OneShotEffect {
|
||||||
|
|
||||||
protected Cost cost;
|
protected Cost cost;
|
||||||
|
|
||||||
public DestroySourceUnlessPaysEffect(Cost cost) {
|
public DestroySourceUnlessPaysEffect(Cost cost) {
|
||||||
|
@ -87,7 +93,7 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (player != null && permanent != null) {
|
if (player != null && permanent != null && source.getSourceObjectZoneChangeCounter() == permanent.getZoneChangeCounter(game)) {
|
||||||
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) {
|
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) {
|
||||||
cost.clearPaid();
|
cost.clearPaid();
|
||||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||||
|
@ -109,4 +115,4 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect {
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
return "destroy this creature unless you pay {1}";
|
return "destroy this creature unless you pay {1}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue