From 9b52a7340b3ac7457fcb5e0dd0afe5d518b6e20d Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 8 Apr 2020 22:35:37 -0400 Subject: [PATCH] Implemented Fiend Artisan --- Mage.Sets/src/mage/cards/f/FiendArtisan.java | 100 ++++++++++++++++++ .../src/mage/sets/IkoriaLairOfBehemoths.java | 1 + 2 files changed, 101 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FiendArtisan.java diff --git a/Mage.Sets/src/mage/cards/f/FiendArtisan.java b/Mage.Sets/src/mage/cards/f/FiendArtisan.java new file mode 100644 index 0000000000..abd1a9676d --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FiendArtisan.java @@ -0,0 +1,100 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.game.Game; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FiendArtisan extends CardImpl { + + private static final DynamicValue xValue + = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE); + private static final FilterControlledPermanent filter + = new FilterControlledCreaturePermanent("another creature"); + + static { + filter.add(AnotherPredicate.instance); + } + + public FiendArtisan(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B/G}{B/G}"); + + this.subtype.add(SubType.NIGHTMARE); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Fiend Artisan gets +1/+1 for each creature card in your graveyard. + this.addAbility(new SimpleStaticAbility(new BoostSourceEffect( + xValue, xValue, Duration.WhileOnBattlefield + ).setText("{this} gets +1/+1 for each creature card in your graveyard"))); + + // {X}{B/G}, {T}, Sacrifice another creature: Search your library for a creature card with converted mana cost X or less, put it onto the battlefield, then shuffle your library. Activate this ability only any time you could cast a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility( + Zone.BATTLEFIELD, new FiendArtisanEffect(), new ManaCostsImpl("{X}{B/G}") + ); + ability.addCost(new TapSourceCost()); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + this.addAbility(ability); + } + + private FiendArtisan(final FiendArtisan card) { + super(card); + } + + @Override + public FiendArtisan copy() { + return new FiendArtisan(this); + } +} + +class FiendArtisanEffect extends OneShotEffect { + + FiendArtisanEffect() { + super(Outcome.Benefit); + staticText = "search your library for a creature card with converted mana cost X or less, " + + "put it onto the battlefield, then shuffle your library"; + } + + private FiendArtisanEffect(final FiendArtisanEffect effect) { + super(effect); + } + + @Override + public FiendArtisanEffect copy() { + return new FiendArtisanEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int xValue = source.getCosts().getVariableCosts().get(0).getAmount(); + FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less"); + filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, xValue + 1)); + return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index d7f5ba4898..5349289cb4 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -92,6 +92,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Exuberant Wolfbear", 151, Rarity.UNCOMMON, mage.cards.e.ExuberantWolfbear.class)); cards.add(new SetCardInfo("Farfinder", 2, Rarity.COMMON, mage.cards.f.Farfinder.class)); cards.add(new SetCardInfo("Fertilid", 152, Rarity.COMMON, mage.cards.f.Fertilid.class)); + cards.add(new SetCardInfo("Fiend Artisan", 220, Rarity.MYTHIC, mage.cards.f.FiendArtisan.class)); cards.add(new SetCardInfo("Fight as One", 12, Rarity.UNCOMMON, mage.cards.f.FightAsOne.class)); cards.add(new SetCardInfo("Flame Spill", 117, Rarity.UNCOMMON, mage.cards.f.FlameSpill.class)); cards.add(new SetCardInfo("Flourishing Fox", 13, Rarity.UNCOMMON, mage.cards.f.FlourishingFox.class));