mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
fixed The Tabernacle at Pendrell Vale text
This commit is contained in:
parent
1ad3a0f768
commit
57229ce7c9
1 changed files with 21 additions and 114 deletions
|
@ -1,24 +1,24 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.DestroySourceEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TheTabernacleAtPendrellVale extends CardImpl {
|
||||
|
||||
|
@ -28,12 +28,16 @@ public final class TheTabernacleAtPendrellVale extends CardImpl {
|
|||
|
||||
// All creatures have "At the beginning of your upkeep, destroy this creature unless you pay {1}."
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new TheTabernacleAtPendrellValeEffect())
|
||||
);
|
||||
new GainAbilityAllEffect(new BeginningOfUpkeepTriggeredAbility(
|
||||
new DoIfCostPaid(
|
||||
new InfoEffect(""), new DestroySourceEffect(), new GenericManaCost(1)
|
||||
).setText("destroy this creature unless you pay {1}"),
|
||||
TargetController.YOU, false
|
||||
), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURES)
|
||||
));
|
||||
}
|
||||
|
||||
public TheTabernacleAtPendrellVale(final TheTabernacleAtPendrellVale card) {
|
||||
private TheTabernacleAtPendrellVale(final TheTabernacleAtPendrellVale card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -42,100 +46,3 @@ public final class TheTabernacleAtPendrellVale extends CardImpl {
|
|||
return new TheTabernacleAtPendrellVale(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TheTabernacleAtPendrellValeEffect extends ContinuousEffectImpl {
|
||||
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(
|
||||
new DestroySourceUnlessPaysEffect(
|
||||
new ManaCostsImpl("{1}")),
|
||||
TargetController.YOU,
|
||||
false);
|
||||
|
||||
public TheTabernacleAtPendrellValeEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.AddAbility);
|
||||
ability = ability.copy();
|
||||
this.ability.newId();
|
||||
staticText = "All creatures have \"At the beginning of your upkeep, destroy this creature unless you pay {1}";
|
||||
}
|
||||
|
||||
public TheTabernacleAtPendrellValeEffect(final TheTabernacleAtPendrellValeEffect effect) {
|
||||
super(effect);
|
||||
this.ability = effect.ability.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheTabernacleAtPendrellValeEffect copy() {
|
||||
return new TheTabernacleAtPendrellValeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) {
|
||||
if (permanent != null) {
|
||||
switch (layer) {
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
if (sublayer == SubLayer.NA
|
||||
&& !permanent.getAbilities().contains(ability)) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.AbilityAddingRemovingEffects_6;
|
||||
}
|
||||
}
|
||||
|
||||
class DestroySourceUnlessPaysEffect extends OneShotEffect {
|
||||
|
||||
protected Cost cost;
|
||||
|
||||
public DestroySourceUnlessPaysEffect(Cost cost) {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
public DestroySourceUnlessPaysEffect(final DestroySourceUnlessPaysEffect effect) {
|
||||
super(effect);
|
||||
this.cost = effect.cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
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;
|
||||
}
|
||||
}
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DestroySourceUnlessPaysEffect copy() {
|
||||
return new DestroySourceUnlessPaysEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return "destroy this creature unless you pay {1}";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue