implement [EOE] Divert Disaster

This commit is contained in:
Susucre 2025-07-18 18:49:15 +02:00
parent 1a7d8ce397
commit 6ee1319f06
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,78 @@
package mage.cards.d;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.token.LanderToken;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetSpell;
import java.util.UUID;
/**
* @author Susucr
*/
public final class DivertDisaster extends CardImpl {
public DivertDisaster(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Counter target spell unless its controller pays {2}. If they do, you create a Lander token.
this.getSpellAbility().addEffect(new DivertDisasterEffect());
this.getSpellAbility().addTarget(new TargetSpell());
}
private DivertDisaster(final DivertDisaster card) {
super(card);
}
@Override
public DivertDisaster copy() {
return new DivertDisaster(this);
}
}
class DivertDisasterEffect extends OneShotEffect {
DivertDisasterEffect() {
super(Outcome.Benefit);
staticText = "counter target spell unless its controller pays {2}. If they do, you create a Lander token.";
}
private DivertDisasterEffect(final DivertDisasterEffect effect) {
super(effect);
}
@Override
public DivertDisasterEffect copy() {
return new DivertDisasterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getSpell(getTargetPointer().getFirst(game, source));
if (spell == null) {
return false;
}
Player player = game.getPlayer(spell.getControllerId());
if (player == null) {
return game.getStack().counter(spell.getId(), source, game);
}
Cost cost = new GenericManaCost(2);
if (!cost.canPay(source, source, player.getId(), game)
|| !player.chooseUse(outcome, "Pay {2}?", source, game)
|| !cost.pay(source, game, source, player.getId(), false)) {
return game.getStack().counter(spell.getId(), source, game);
}
new CreateTokenEffect(new LanderToken()).apply(game, source);
return true;
}
}

View file

@ -85,6 +85,7 @@ public final class EdgeOfEternities extends ExpansionSet {
cards.add(new SetCardInfo("Devastating Onslaught", 132, Rarity.MYTHIC, mage.cards.d.DevastatingOnslaught.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Devastating Onslaught", 132, Rarity.MYTHIC, mage.cards.d.DevastatingOnslaught.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Devastating Onslaught", 308, Rarity.MYTHIC, mage.cards.d.DevastatingOnslaught.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Devastating Onslaught", 308, Rarity.MYTHIC, mage.cards.d.DevastatingOnslaught.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Devastating Onslaught", 361, Rarity.MYTHIC, mage.cards.d.DevastatingOnslaught.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Devastating Onslaught", 361, Rarity.MYTHIC, mage.cards.d.DevastatingOnslaught.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Divert Disaster", 55, Rarity.COMMON, mage.cards.d.DivertDisaster.class));
cards.add(new SetCardInfo("Drill Too Deep", 133, Rarity.COMMON, mage.cards.d.DrillTooDeep.class)); cards.add(new SetCardInfo("Drill Too Deep", 133, Rarity.COMMON, mage.cards.d.DrillTooDeep.class));
cards.add(new SetCardInfo("Drix Fatemaker", 178, Rarity.COMMON, mage.cards.d.DrixFatemaker.class)); cards.add(new SetCardInfo("Drix Fatemaker", 178, Rarity.COMMON, mage.cards.d.DrixFatemaker.class));
cards.add(new SetCardInfo("Dual-Sun Technique", 13, Rarity.UNCOMMON, mage.cards.d.DualSunTechnique.class)); cards.add(new SetCardInfo("Dual-Sun Technique", 13, Rarity.UNCOMMON, mage.cards.d.DualSunTechnique.class));