From 1baf044402ef3696e48c2d34a4044c6877d0776d Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 13 Apr 2019 18:49:41 -0400 Subject: [PATCH] Implemented Bond of Insight --- Mage.Sets/src/mage/cards/b/BondOfInsight.java | 83 +++++++++++++++++++ Mage.Sets/src/mage/sets/WarOfTheSpark.java | 1 + 2 files changed, 84 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BondOfInsight.java diff --git a/Mage.Sets/src/mage/cards/b/BondOfInsight.java b/Mage.Sets/src/mage/cards/b/BondOfInsight.java new file mode 100644 index 00000000000..fcd7cdda7e6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BondOfInsight.java @@ -0,0 +1,83 @@ +package mage.cards.b; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileSpellEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BondOfInsight extends CardImpl { + + public BondOfInsight(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}"); + + // Each player puts the top four cards of their library into their graveyard. Return up to two instant and/or sorcery cards from your graveyard to your hand. Exile Bond of Insight. + this.getSpellAbility().addEffect(new BondOfInsightEffect()); + this.getSpellAbility().addEffect(ExileSpellEffect.getInstance()); + } + + private BondOfInsight(final BondOfInsight card) { + super(card); + } + + @Override + public BondOfInsight copy() { + return new BondOfInsight(this); + } +} + +class BondOfInsightEffect extends OneShotEffect { + + BondOfInsightEffect() { + super(Outcome.Benefit); + staticText = "Each player puts the top four cards of their library into their graveyard. " + + "Return up to two instant and/or sorcery cards from your graveyard to your hand."; + } + + private BondOfInsightEffect(final BondOfInsightEffect effect) { + super(effect); + } + + @Override + public BondOfInsightEffect copy() { + return new BondOfInsightEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + if (player == null) { + continue; + } + player.moveCards(player.getLibrary().getTopCards(game, 4), Zone.GRAVEYARD, source, game); + } + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetCard target = new TargetCardInYourGraveyard( + 0, 2, StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, true + ); + if (!player.choose(outcome, target, source.getSourceId(), game)) { + return false; + } + Cards cards = new CardsImpl(target.getTargets()); + return player.moveCards(cards, Zone.HAND, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/WarOfTheSpark.java b/Mage.Sets/src/mage/sets/WarOfTheSpark.java index 04394476832..cffe4392133 100644 --- a/Mage.Sets/src/mage/sets/WarOfTheSpark.java +++ b/Mage.Sets/src/mage/sets/WarOfTheSpark.java @@ -39,6 +39,7 @@ public final class WarOfTheSpark extends ExpansionSet { cards.add(new SetCardInfo("Blindblast", 114, Rarity.COMMON, mage.cards.b.Blindblast.class)); cards.add(new SetCardInfo("Bloom Hulk", 154, Rarity.COMMON, mage.cards.b.BloomHulk.class)); cards.add(new SetCardInfo("Bolt Bend", 115, Rarity.UNCOMMON, mage.cards.b.BoltBend.class)); + cards.add(new SetCardInfo("Bond of Insight", 43, Rarity.UNCOMMON, mage.cards.b.BondOfInsight.class)); cards.add(new SetCardInfo("Bulwark Giant", 7, Rarity.COMMON, mage.cards.b.BulwarkGiant.class)); cards.add(new SetCardInfo("Burning Prophet", 117, Rarity.COMMON, mage.cards.b.BurningProphet.class)); cards.add(new SetCardInfo("Chainwhip Cyclops", 118, Rarity.COMMON, mage.cards.c.ChainwhipCyclops.class));