diff --git a/Mage.Sets/src/mage/cards/j/JackalGeniusGeneticist.java b/Mage.Sets/src/mage/cards/j/JackalGeniusGeneticist.java new file mode 100644 index 00000000000..a149dd7f5e2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JackalGeniusGeneticist.java @@ -0,0 +1,88 @@ +package mage.cards.j; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.effects.common.CopyTargetStackObjectEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SetTargetPointer; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.counters.CounterType; +import mage.filter.common.FilterCreatureSpell; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.util.functions.RemoveTypeCopyApplier; + +import java.util.UUID; + +/** + * + * @author Jmlundeen + */ +public final class JackalGeniusGeneticist extends CardImpl { + + private static final FilterCreatureSpell filter = new FilterCreatureSpell("a creature spell with mana value equal to {this}'s power"); + + static { + filter.add(JackalGeniusGeneticistPredicate.instance); + } + + public JackalGeniusGeneticist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SCIENTIST); + this.subtype.add(SubType.VILLAIN); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever you cast a creature spell with mana value equal to Jackal's power, copy that spell, except the copy isn't legendary. Then put a +1/+1 counter on Jackal. + Ability ability = new SpellCastControllerTriggeredAbility( + new CopyTargetStackObjectEffect(false, false, false, 1, new RemoveTypeCopyApplier(SuperType.LEGENDARY)) + .setText("copy that spell, except the copy isn't legendary."), + filter, + false, + SetTargetPointer.SPELL + ); + ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()) + .concatBy("Then")); + this.addAbility(ability); + } + + private JackalGeniusGeneticist(final JackalGeniusGeneticist card) { + super(card); + } + + @Override + public JackalGeniusGeneticist copy() { + return new JackalGeniusGeneticist(this); + } +} + +enum JackalGeniusGeneticistPredicate implements ObjectSourcePlayerPredicate { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + Permanent sourcePermanent = input.getSource().getSourcePermanentOrLKI(game); + return sourcePermanent != null && input.getObject().getManaValue() == sourcePermanent.getPower().getValue(); + } + + @Override + public String toString() { + return "mana value equal to {this}'s power"; + } +} + diff --git a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java index a5b5414ea5f..5775573ffe9 100644 --- a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java +++ b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java @@ -101,6 +101,8 @@ public final class MarvelsSpiderMan extends ExpansionSet { cards.add(new SetCardInfo("Island", 195, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("J. Jonah Jameson", 261, Rarity.RARE, mage.cards.j.JJonahJameson.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("J. Jonah Jameson", 81, Rarity.RARE, mage.cards.j.JJonahJameson.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Jackal, Genius Geneticist", 131, Rarity.RARE, mage.cards.j.JackalGeniusGeneticist.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Jackal, Genius Geneticist", 272, Rarity.RARE, mage.cards.j.JackalGeniusGeneticist.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Kapow!", 103, Rarity.COMMON, mage.cards.k.Kapow.class)); cards.add(new SetCardInfo("Kraven the Hunter", 133, Rarity.RARE, mage.cards.k.KravenTheHunter.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Kraven the Hunter", 273, Rarity.RARE, mage.cards.k.KravenTheHunter.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/spm/JackalGeniusGeneticistTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/spm/JackalGeniusGeneticistTest.java new file mode 100644 index 00000000000..8cabc98289f --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/spm/JackalGeniusGeneticistTest.java @@ -0,0 +1,65 @@ +package org.mage.test.cards.single.spm; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author Jmlundeen + */ +public class JackalGeniusGeneticistTest extends CardTestPlayerBase { + + /* + Jackal, Genius Geneticist + {G}{U} + Legendary Creature - Human Scientist Villain + Trample + Whenever you cast a creature spell with mana value equal to Jackal's power, copy that spell, except the copy isn't legendary. Then put a +1/+1 counter on Jackal. + 1/1 + */ + private static final String jackalGeniusGeneticist = "Jackal, Genius Geneticist"; + + /* + Bear Cub + {1}{G} + Creature - Bear + + 2/2 + */ + private static final String bearCub = "Bear Cub"; + + /* + Ragavan, Nimble Pilferer + {R} + Legendary Creature - Monkey Pirate + Whenever Ragavan, Nimble Pilferer deals combat damage to a player, create a Treasure token and exile the top card of that player's library. Until end of turn, you may cast that card. + Dash {1}{R} + 2/1 + */ + private static final String ragavanNimblePilferer = "Ragavan, Nimble Pilferer"; + + @Test + public void testJackalGeniusGeneticist() { + setStrictChooseMode(true); + + addCard(Zone.BATTLEFIELD, playerA, jackalGeniusGeneticist); + addCard(Zone.BATTLEFIELD, playerA, "Taiga", 3); + addCard(Zone.HAND, playerA, ragavanNimblePilferer); + addCard(Zone.HAND, playerA, bearCub); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, ragavanNimblePilferer); + setChoice(playerA, "Cast with no"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bearCub); + + setStopAt(1, PhaseStep.PRECOMBAT_MAIN); + execute(); + + assertPermanentCount(playerA, ragavanNimblePilferer, 2); + assertPermanentCount(playerA, bearCub, 2); + assertCounterCount(playerA, jackalGeniusGeneticist, CounterType.P1P1, 2); + } +} \ No newline at end of file