From 0b5638fbaea368932bf6f611e4bbfa74026d8803 Mon Sep 17 00:00:00 2001 From: jmlundeen Date: Wed, 3 Sep 2025 20:57:33 -0500 Subject: [PATCH] [SPM] Implement Parker Luck --- Mage.Sets/src/mage/cards/p/ParkerLuck.java | 91 +++++++++++++++++++ Mage.Sets/src/mage/sets/MarvelsSpiderMan.java | 2 + .../test/cards/single/spm/ParkerLuckTest.java | 79 ++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/ParkerLuck.java create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/spm/ParkerLuckTest.java diff --git a/Mage.Sets/src/mage/cards/p/ParkerLuck.java b/Mage.Sets/src/mage/cards/p/ParkerLuck.java new file mode 100644 index 00000000000..e1293bd3873 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/ParkerLuck.java @@ -0,0 +1,91 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; + +import java.util.UUID; + +/** + * + * @author Jmlundeen + */ +public final class ParkerLuck extends CardImpl { + + public ParkerLuck(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}"); + + + // At the beginning of your end step, two target players each reveal the top card of their library. They each lose life equal to the mana value of the card revealed by the other player. Then they each put the card they revealed into their hand. + Ability ability = new BeginningOfEndStepTriggeredAbility(new ParkerLuckEffect()); + ability.addTarget(new TargetPlayer(2)); + this.addAbility(ability); + } + + private ParkerLuck(final ParkerLuck card) { + super(card); + } + + @Override + public ParkerLuck copy() { + return new ParkerLuck(this); + } +} + +class ParkerLuckEffect extends OneShotEffect { + + public ParkerLuckEffect() { + super(Outcome.Damage); + staticText = "two target players each reveal the top card of their library. " + + "They each lose life equal to the mana value of the card " + + "revealed by the other player. Then they each put the card they revealed into their hand"; + } + + protected ParkerLuckEffect(final ParkerLuckEffect effect) { + super(effect); + } + + @Override + public ParkerLuckEffect copy() { + return new ParkerLuckEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetOne = game.getPlayer(getTargetPointer().getTargets(game, source).get(0)); + Player targetTwo = game.getPlayer(getTargetPointer().getTargets(game, source).get(1)); + if (targetOne == null || targetTwo == null) { + return false; + } + // each reveal top card + Card targetOneCard = targetOne.getLibrary().getFromTop(game); + int targetOneMv = 0; + Card targetTwoCard = targetTwo.getLibrary().getFromTop(game); + int targetTwoMv = 0; + if (targetOneCard != null) { + targetOne.revealCards(source, new CardsImpl(targetOneCard), game); + targetOneMv = targetOneCard.getManaValue(); + } + if (targetTwoCard != null) { + targetTwo.revealCards(source, new CardsImpl(targetTwoCard), game); + targetTwoMv = targetTwoCard.getManaValue(); + } + // lose life to mana value of each others card + targetOne.loseLife(targetTwoMv, game, source, false); + targetTwo.loseLife(targetOneMv, game, source, false); + // each put card into their hand + targetOne.moveCards(targetOneCard, Zone.HAND, source, game); + targetTwo.moveCards(targetTwoCard, Zone.HAND, source, game); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java index 06595fc04c8..e975d6694cd 100644 --- a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java +++ b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java @@ -130,6 +130,8 @@ public final class MarvelsSpiderMan extends ExpansionSet { cards.add(new SetCardInfo("Origin of Spider-Man", 9, Rarity.RARE, mage.cards.o.OriginOfSpiderMan.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Oscorp Industries", 182, Rarity.RARE, mage.cards.o.OscorpIndustries.class)); cards.add(new SetCardInfo("Oscorp Research Team", 40, Rarity.COMMON, mage.cards.o.OscorpResearchTeam.class)); + cards.add(new SetCardInfo("Parker Luck", 258, Rarity.RARE, mage.cards.p.ParkerLuck.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Parker Luck", 60, Rarity.RARE, mage.cards.p.ParkerLuck.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Peter Parker", 10, Rarity.MYTHIC, mage.cards.p.PeterParker.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Peter Parker", 208, Rarity.MYTHIC, mage.cards.p.PeterParker.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Peter Parker", 232, Rarity.MYTHIC, mage.cards.p.PeterParker.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/spm/ParkerLuckTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/spm/ParkerLuckTest.java new file mode 100644 index 00000000000..0e1bb20db49 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/spm/ParkerLuckTest.java @@ -0,0 +1,79 @@ +package org.mage.test.cards.single.spm; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestCommander4Players; + +/** + * + * @author Jmlundeen + */ +public class ParkerLuckTest extends CardTestCommander4Players { + + /* + Parker Luck + {2}{B} + Enchantment + At the beginning of your end step, two target players each reveal the top card of their library. They each lose life equal to the mana value of the card revealed by the other player. Then they each put the card they revealed into their hand. + */ + private static final String parkerLuck = "Parker Luck"; + + /* + Bear Cub + {1}{G} + Creature - Bear + + 2/2 + */ + private static final String bearCub = "Bear Cub"; + + /* + Fugitive Wizard + {U} + Creature - Human Wizard + + 1/1 + */ + private static final String fugitiveWizard = "Fugitive Wizard"; + + @Test + public void testParkerLuck() { + setStrictChooseMode(true); + skipInitShuffling(); + + addCard(Zone.BATTLEFIELD, playerA, parkerLuck); + addCard(Zone.LIBRARY, playerD, bearCub); + addCard(Zone.LIBRARY, playerC, fugitiveWizard); + + addTarget(playerA, playerC); + addTarget(playerA, playerD); + + setStopAt(1, PhaseStep.CLEANUP); + execute(); + + assertLife(playerC, 20 - 2); + assertLife(playerD, 20 - 1); + assertHandCount(playerC, 1); + assertHandCount(playerD, 1); + } + + @Test + public void testParkerLuckOneLibraryEmpty() { + setStrictChooseMode(true); + skipInitShuffling(); + removeAllCardsFromLibrary(playerC); + + addCard(Zone.BATTLEFIELD, playerA, parkerLuck); + addCard(Zone.LIBRARY, playerD, bearCub); + + addTarget(playerA, playerC); + addTarget(playerA, playerD); + + setStopAt(1, PhaseStep.CLEANUP); + execute(); + + assertLife(playerC, 20 - 2); + assertHandCount(playerD, 1); + } +} \ No newline at end of file