Implemented Bond of Insight

This commit is contained in:
Evan Kranzler 2019-04-13 18:49:41 -04:00
parent 9fd2cb503d
commit 1baf044402
2 changed files with 84 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));