[TDM] Implement Caustic Exhale

This commit is contained in:
theelk801 2025-03-19 14:28:30 -04:00
parent d6e831b692
commit 142e5b9240
3 changed files with 151 additions and 0 deletions

View file

@ -0,0 +1,41 @@
package mage.cards.c;
import mage.abilities.costs.OrCost;
import mage.abilities.costs.common.BeholdDragonCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CausticExhale extends CardImpl {
public CausticExhale(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
// As an additional cost to cast this spell, behold a Dragon or pay {1}.
this.getSpellAbility().addCost(new OrCost(
"behold a Dragon or pay {1}",
new BeholdDragonCost(), new GenericManaCost(1)
));
// Target creature gets -3/-3 until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(-3, -3));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
private CausticExhale(final CausticExhale card) {
super(card);
}
@Override
public CausticExhale copy() {
return new CausticExhale(this);
}
}

View file

@ -26,6 +26,7 @@ public final class TarkirDragonstorm extends ExpansionSet {
cards.add(new SetCardInfo("Bloodfell Caves", 250, Rarity.COMMON, mage.cards.b.BloodfellCaves.class));
cards.add(new SetCardInfo("Blossoming Sands", 251, Rarity.COMMON, mage.cards.b.BlossomingSands.class));
cards.add(new SetCardInfo("Boulderborn Dragon", 239, Rarity.COMMON, mage.cards.b.BoulderbornDragon.class));
cards.add(new SetCardInfo("Caustic Exhale", 74, Rarity.COMMON, mage.cards.c.CausticExhale.class));
cards.add(new SetCardInfo("Craterhoof Behemoth", 138, Rarity.MYTHIC, mage.cards.c.CraterhoofBehemoth.class));
cards.add(new SetCardInfo("Cruel Truths", 76, Rarity.COMMON, mage.cards.c.CruelTruths.class));
cards.add(new SetCardInfo("Devoted Duelist", 104, Rarity.COMMON, mage.cards.d.DevotedDuelist.class));

View file

@ -0,0 +1,109 @@
package mage.abilities.costs.common;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.cards.Card;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPermanent;
import mage.target.common.TargetCardInHand;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public class BeholdDragonCost extends CostImpl {
private static final FilterPermanent filterPermanent = new FilterControlledPermanent(SubType.DRAGON);
private static final FilterCard filterCard = new FilterCard("a Dragon card");
static {
filterCard.add(SubType.DRAGON.getPredicate());
}
public BeholdDragonCost() {
super();
this.text = "behold a Dragon";
}
private BeholdDragonCost(final BeholdDragonCost cost) {
super(cost);
}
@Override
public BeholdDragonCost copy() {
return new BeholdDragonCost(this);
}
@Override
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
return Optional
.ofNullable(game.getPlayer(controllerId))
.map(Player::getHand)
.map(cards -> cards.count(filterCard, game) > 0)
.orElse(false)
|| game
.getBattlefield()
.contains(filterPermanent, controllerId, source, game, 1);
}
@Override
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
Player player = game.getPlayer(controllerId);
if (player == null) {
paid = false;
return paid;
}
boolean hasPermanent = game
.getBattlefield()
.contains(filterPermanent, controllerId, source, game, 1);
boolean hasHand = player.getHand().count(filterCard, game) > 0;
boolean usePermanent;
if (hasPermanent && hasHand) {
usePermanent = player.chooseUse(
Outcome.Neutral, "Choose a Dragon you control or reveal one from your hand?",
null, "Choose controlled", "Reveal from hand", source, game);
} else if (hasPermanent) {
usePermanent = true;
} else if (hasHand) {
usePermanent = false;
} else {
paid = false;
return paid;
}
if (usePermanent) {
TargetPermanent target = new TargetPermanent(filterPermanent);
target.withNotTarget(true);
player.choose(Outcome.Neutral, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) {
paid = false;
return paid;
}
game.informPlayers(player.getLogName() + " chooses to behold " + permanent.getLogName());
paid = true;
return true;
}
TargetCard target = new TargetCardInHand(filterCard);
player.choose(Outcome.Neutral, player.getHand(), target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
paid = false;
return paid;
}
player.revealCards(source, new CardsImpl(card), game);
paid = true;
return paid;
}
}