From 2c97aa86883037a906b9775cbdf95ebb9658c01c Mon Sep 17 00:00:00 2001 From: theelk801 Date: Thu, 2 Oct 2025 12:27:04 -0400 Subject: [PATCH] [FIC] Implement Duelist's Flame --- Mage.Sets/src/mage/cards/d/DuelistsFlame.java | 102 ++++++++++++++++++ .../src/mage/sets/FinalFantasyCommander.java | 1 + 2 files changed, 103 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DuelistsFlame.java diff --git a/Mage.Sets/src/mage/cards/d/DuelistsFlame.java b/Mage.Sets/src/mage/cards/d/DuelistsFlame.java new file mode 100644 index 00000000000..01eae7cd35d --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DuelistsFlame.java @@ -0,0 +1,102 @@ +package mage.cards.d; + +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.dynamicvalue.common.GetXValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.BlockedPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.TargetPermanent; +import mage.target.common.TargetCardInLibrary; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DuelistsFlame extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("blocked creature you control"); + + static { + filter.add(BlockedPredicate.instance); + } + + public DuelistsFlame(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{R}{R}"); + + // Until end of turn, target blocked creature you control gets +X/+0 and gains trample and "Whenever this creature deals combat damage to a player, look at that many cards from the top of your library. Exile up to one nonland card from among them and put the rest on the bottom of your library in a random order. You may cast the exiled card without paying its mana cost." + this.getSpellAbility().addEffect(new BoostTargetEffect(GetXValue.instance, StaticValue.get(0)) + .setText("until end of turn, target blocked creature you control gets +X/+0")); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance()).setText("and has trample")); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect( + new DealsCombatDamageToAPlayerTriggeredAbility(new DuelistsFlameEffect()) + ).setText("and \"Whenever this creature deals combat damage to a player, " + + "look at that many cards from the top of your library. Exile up to one nonland card " + + "from among them and put the rest on the bottom of your library in a random order. " + + "You may cast the exiled card without paying its mana cost.\"")); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + } + + private DuelistsFlame(final DuelistsFlame card) { + super(card); + } + + @Override + public DuelistsFlame copy() { + return new DuelistsFlame(this); + } +} + +class DuelistsFlameEffect extends OneShotEffect { + + DuelistsFlameEffect() { + super(Outcome.Benefit); + staticText = "look at that many cards from the top of your library. " + + "Exile up to one nonland card from among them and put the rest on the bottom of your library " + + "in a random order. You may cast the exiled card without paying its mana cost"; + } + + private DuelistsFlameEffect(final DuelistsFlameEffect effect) { + super(effect); + } + + @Override + public DuelistsFlameEffect copy() { + return new DuelistsFlameEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + int damage = (Integer) getValue("damage"); + if (player == null || damage < 1) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, damage)); + TargetCard target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_NON_LAND); + player.choose(Outcome.PlayForFree, cards, target, source, game); + Card card = game.getCard(target.getFirstTarget()); + player.moveCards(card, Zone.EXILED, source, game); + cards.retainZone(Zone.LIBRARY, game); + player.putCardsOnBottomOfLibrary(cards, game, source, false); + if (card != null) { + CardUtil.castSpellWithAttributesForFree(player, source, game, card); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index dcb53c9aec9..0a82aea3283 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -138,6 +138,7 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Dispatch", 241, Rarity.UNCOMMON, mage.cards.d.Dispatch.class)); cards.add(new SetCardInfo("Dragonskull Summit", 387, Rarity.RARE, mage.cards.d.DragonskullSummit.class)); cards.add(new SetCardInfo("Drowned Catacomb", 388, Rarity.RARE, mage.cards.d.DrownedCatacomb.class)); + cards.add(new SetCardInfo("Duelist's Flame", 452, Rarity.RARE, mage.cards.d.DuelistsFlame.class)); cards.add(new SetCardInfo("Duskshell Crawler", 301, Rarity.COMMON, mage.cards.d.DuskshellCrawler.class)); cards.add(new SetCardInfo("Edgar, Master Machinist", 169, Rarity.RARE, mage.cards.e.EdgarMasterMachinist.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Edgar, Master Machinist", 80, Rarity.RARE, mage.cards.e.EdgarMasterMachinist.class, NON_FULL_USE_VARIOUS));