diff --git a/Mage.Sets/src/mage/cards/c/CaseTheJoint.java b/Mage.Sets/src/mage/cards/c/CaseTheJoint.java new file mode 100644 index 00000000000..c8d8ad8d518 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CaseTheJoint.java @@ -0,0 +1,75 @@ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +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.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CaseTheJoint extends CardImpl { + + public CaseTheJoint(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}"); + + // Draw two cards, then look at the top card of each player's library. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2)); + this.getSpellAbility().addEffect(new CaseTheJointEffect()); + } + + private CaseTheJoint(final CaseTheJoint card) { + super(card); + } + + @Override + public CaseTheJoint copy() { + return new CaseTheJoint(this); + } +} + +class CaseTheJointEffect extends OneShotEffect { + + CaseTheJointEffect() { + super(Outcome.Benefit); + staticText = ", then look at the top card of each player's library"; + } + + private CaseTheJointEffect(final CaseTheJointEffect effect) { + super(effect); + } + + @Override + public CaseTheJointEffect copy() { + return new CaseTheJointEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + continue; + } + Card card = player.getLibrary().getFromTop(game); + if (card == null) { + continue; + } + controller.lookAtCards(source, "Top card of " + player.getName() + "'s library", new CardsImpl(card), game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index f03dd2bbd22..e62bf6bec10 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -51,6 +51,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Cabaretti Initiate", 137, Rarity.COMMON, mage.cards.c.CabarettiInitiate.class)); cards.add(new SetCardInfo("Caldaia Strongarm", 138, Rarity.COMMON, mage.cards.c.CaldaiaStrongarm.class)); cards.add(new SetCardInfo("Call In a Professional", 103, Rarity.UNCOMMON, mage.cards.c.CallInAProfessional.class)); + cards.add(new SetCardInfo("Case the Joint", 37, Rarity.COMMON, mage.cards.c.CaseTheJoint.class)); cards.add(new SetCardInfo("Celebrity Fencer", 7, Rarity.COMMON, mage.cards.c.CelebrityFencer.class)); cards.add(new SetCardInfo("Celestial Regulator", 174, Rarity.COMMON, mage.cards.c.CelestialRegulator.class)); cards.add(new SetCardInfo("Cemetery Tampering", 69, Rarity.RARE, mage.cards.c.CemeteryTampering.class));