diff --git a/Mage.Sets/src/mage/cards/f/FlawlessForgery.java b/Mage.Sets/src/mage/cards/f/FlawlessForgery.java new file mode 100644 index 0000000000..0ded8c115d --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FlawlessForgery.java @@ -0,0 +1,93 @@ +package mage.cards.f; + +import mage.ApprovingObject; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.CasualtyAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.common.FilterInstantOrSorceryCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FlawlessForgery extends CardImpl { + + private static final FilterCard filter + = new FilterInstantOrSorceryCard("instant or sorcery card from an opponent's graveyard"); + + static { + filter.add(TargetController.OPPONENT.getOwnerPredicate()); + } + + public FlawlessForgery(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}{U}"); + + // Casualty 3 + this.addAbility(new CasualtyAbility(this, 3)); + + // Exile target instant or sorcery card from an opponent's graveyard. Copy that card. You may cast the copy without paying its mana cost. + this.getSpellAbility().addEffect(new FlawlessForgeryEffect()); + this.getSpellAbility().addTarget(new TargetCardInGraveyard(filter)); + } + + private FlawlessForgery(final FlawlessForgery card) { + super(card); + } + + @Override + public FlawlessForgery copy() { + return new FlawlessForgery(this); + } +} + +class FlawlessForgeryEffect extends OneShotEffect { + + FlawlessForgeryEffect() { + super(Outcome.Benefit); + staticText = "exile target instant or sorcery card from an opponent's graveyard. " + + "Copy that card. You may cast the copy without paying its mana cost"; + } + + private FlawlessForgeryEffect(final FlawlessForgeryEffect effect) { + super(effect); + } + + @Override + public FlawlessForgeryEffect copy() { + return new FlawlessForgeryEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Card card = game.getCard(getTargetPointer().getFirst(game, source)); + if (player == null || card == null) { + return false; + } + player.moveCards(card, Zone.EXILED, source, game); + Card cardCopy = game.copyCard(card, source, source.getControllerId()); + if (!player.chooseUse(outcome, "Cast copy of " + + card.getName() + " without paying its mana cost?", source, game)) { + return true; + } + game.getState().setValue("PlayFromNotOwnHandZone" + cardCopy.getId(), Boolean.TRUE); + player.cast( + player.chooseAbilityForCast(cardCopy, game, true), + game, true, new ApprovingObject(source, game) + ); + game.getState().setValue("PlayFromNotOwnHandZone" + cardCopy.getId(), null); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/NewCapennaCommander.java b/Mage.Sets/src/mage/sets/NewCapennaCommander.java index ee8ec37076..8dc0054b3b 100644 --- a/Mage.Sets/src/mage/sets/NewCapennaCommander.java +++ b/Mage.Sets/src/mage/sets/NewCapennaCommander.java @@ -127,6 +127,7 @@ public final class NewCapennaCommander extends ExpansionSet { cards.add(new SetCardInfo("Fellwar Stone", 367, Rarity.UNCOMMON, mage.cards.f.FellwarStone.class)); cards.add(new SetCardInfo("Fetid Heath", 401, Rarity.RARE, mage.cards.f.FetidHeath.class)); cards.add(new SetCardInfo("First Responder", 60, Rarity.RARE, mage.cards.f.FirstResponder.class)); + cards.add(new SetCardInfo("Flawless Forgery", 26, Rarity.RARE, mage.cards.f.FlawlessForgery.class)); cards.add(new SetCardInfo("Flooded Grove", 402, Rarity.RARE, mage.cards.f.FloodedGrove.class)); cards.add(new SetCardInfo("Foreboding Ruins", 403, Rarity.RARE, mage.cards.f.ForebodingRuins.class)); cards.add(new SetCardInfo("Forgotten Ancient", 291, Rarity.RARE, mage.cards.f.ForgottenAncient.class));