Implemented Fiend Artisan

This commit is contained in:
Evan Kranzler 2020-04-08 22:35:37 -04:00
parent 0424d0282a
commit 9b52a7340b
2 changed files with 101 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));