From 77d22b99603f20d9e1be9b5f59da63d4ef218ca8 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 8 Apr 2021 08:22:25 -0400 Subject: [PATCH] [C21] Implemented Deekah, Fractal Theorist --- .../mage/cards/d/DeekahFractalTheorist.java | 81 +++++++++++++++++++ .../src/mage/sets/Commander2021Edition.java | 1 + .../main/java/mage/filter/StaticFilters.java | 7 ++ 3 files changed, 89 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DeekahFractalTheorist.java diff --git a/Mage.Sets/src/mage/cards/d/DeekahFractalTheorist.java b/Mage.Sets/src/mage/cards/d/DeekahFractalTheorist.java new file mode 100644 index 0000000000..62189b2386 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DeekahFractalTheorist.java @@ -0,0 +1,81 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.MagecraftAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.token.QuandrixToken; +import mage.game.stack.Spell; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DeekahFractalTheorist extends CardImpl { + + public DeekahFractalTheorist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Magecraft — Whenever you cast or copy an instant or sorcery spell, create a 0/0 green and blue Fractal creature token. Put X +1/+1 counters on it, where X is that spell's mana value. + this.addAbility(new MagecraftAbility(QuandrixToken.getEffect( + DeekahFractalTheoristValue.instance, "Put X +1/+1 counters on it, " + + "where X is that spell's mana value" + ))); + + // {3}{U}: Target creature token can't be blocked this turn. + Ability ability = new SimpleActivatedAbility( + new CantBeBlockedTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{3}{U}") + ); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_TOKEN)); + this.addAbility(ability); + } + + private DeekahFractalTheorist(final DeekahFractalTheorist card) { + super(card); + } + + @Override + public DeekahFractalTheorist copy() { + return new DeekahFractalTheorist(this); + } +} + +enum DeekahFractalTheoristValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Spell spell = (Spell) effect.getValue(MagecraftAbility.SPELL_KEY); + return spell != null ? spell.getConvertedManaCost() : 0; + } + + @Override + public DeekahFractalTheoristValue copy() { + return instance; + } + + @Override + public String getMessage() { + return ""; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index f2093cff4d..c5611233ee 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -37,6 +37,7 @@ public final class Commander2021Edition extends ExpansionSet { cards.add(new SetCardInfo("Daretti, Scrap Savant", 164, Rarity.MYTHIC, mage.cards.d.DarettiScrapSavant.class)); cards.add(new SetCardInfo("Darksteel Citadel", 285, Rarity.UNCOMMON, mage.cards.d.DarksteelCitadel.class)); cards.add(new SetCardInfo("Darksteel Mutation", 87, Rarity.UNCOMMON, mage.cards.d.DarksteelMutation.class)); + cards.add(new SetCardInfo("Deekah, Fractal Theorist", 26, Rarity.RARE, mage.cards.d.DeekahFractalTheorist.class)); cards.add(new SetCardInfo("Digsite Engineer", 15, Rarity.RARE, mage.cards.d.DigsiteEngineer.class)); cards.add(new SetCardInfo("Dispatch", 88, Rarity.UNCOMMON, mage.cards.d.Dispatch.class)); cards.add(new SetCardInfo("Dispeller's Capsule", 89, Rarity.COMMON, mage.cards.d.DispellersCapsule.class)); diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java index f2b186b85c..f57414b75a 100644 --- a/Mage/src/main/java/mage/filter/StaticFilters.java +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -668,6 +668,13 @@ public final class StaticFilters { FILTER_SPELL_KICKED_A.setLockedFilter(true); } + public static final FilterCreaturePermanent FILTER_CREATURE_TOKEN = new FilterCreaturePermanent("creature token"); + + static { + FILTER_CREATURE_TOKEN.add(TokenPredicate.instance); + FILTER_CREATURE_TOKEN.setLockedFilter(true); + } + public static final FilterCreaturePermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens"); static {