From 5ab9ba66ae900ecb86fea1b16193d6765e4b8f85 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 30 May 2022 10:37:09 -0400 Subject: [PATCH] [CLB] Implemented Navigation Orb --- Mage.Sets/src/mage/cards/n/NavigationOrb.java | 106 ++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 107 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NavigationOrb.java diff --git a/Mage.Sets/src/mage/cards/n/NavigationOrb.java b/Mage.Sets/src/mage/cards/n/NavigationOrb.java new file mode 100644 index 0000000000..71c3e64294 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NavigationOrb.java @@ -0,0 +1,106 @@ +package mage.cards.n; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.*; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class NavigationOrb extends CardImpl { + + public NavigationOrb(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); + + // {2}, {T}, Sacrifice Navigation Orb: Search your library for up to two basic land cards and/or Gate cards, reveal those cards, put one onto the battlefield tapped and the other into your hand, then shuffle. + Ability ability = new SimpleActivatedAbility(new NavigationOrbEffect(), new GenericManaCost(2)); + ability.addCost(new TapSourceCost()); + ability.addCost(new SacrificeSourceCost()); + this.addAbility(ability); + } + + private NavigationOrb(final NavigationOrb card) { + super(card); + } + + @Override + public NavigationOrb copy() { + return new NavigationOrb(this); + } +} + +class NavigationOrbEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard("basic land cards and/or Gate cards"); + + static { + filter.add(Predicates.or(Predicates.and( + CardType.LAND.getPredicate(), + SuperType.BASIC.getPredicate() + ), SubType.GATE.getPredicate())); + } + + NavigationOrbEffect() { + super(Outcome.Benefit); + staticText = "search your library for up to two basic land cards and/or Gate cards, reveal those cards, " + + "put one onto the battlefield tapped and the other into your hand, then shuffle"; + } + + private NavigationOrbEffect(final NavigationOrbEffect effect) { + super(effect); + } + + @Override + public NavigationOrbEffect copy() { + return new NavigationOrbEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetCardInLibrary target = new TargetCardInLibrary(0, 2, filter); + player.searchLibrary(target, source, game); + Cards cards = new CardsImpl(); + target.getTargets() + .stream() + .map(uuid -> player.getLibrary().getCard(uuid, game)) + .forEach(cards::add); + player.revealCards(source, cards, game); + Card card; + switch (cards.size()) { + case 0: + player.shuffleLibrary(source, game); + return true; + case 1: + card = cards.getRandom(game); + break; + default: + TargetCard targetCard = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD); + targetCard.withChooseHint("To put onto the battlefield"); + player.choose(outcome, cards, targetCard, game); + card = cards.get(targetCard.getFirstTarget(), game); + } + cards.remove(card); + player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); + player.moveCards(cards, Zone.HAND, source, game); + player.shuffleLibrary(source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index c0fa55be3a..8f1dda1412 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -188,6 +188,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Nalia de'Arnise", 649, Rarity.MYTHIC, mage.cards.n.NaliaDeArnise.class)); cards.add(new SetCardInfo("Nature's Lore", 244, Rarity.COMMON, mage.cards.n.NaturesLore.class)); cards.add(new SetCardInfo("Nautiloid Ship", 328, Rarity.MYTHIC, mage.cards.n.NautiloidShip.class)); + cards.add(new SetCardInfo("Navigation Orb", 329, Rarity.COMMON, mage.cards.n.NavigationOrb.class)); cards.add(new SetCardInfo("Nemesis Phoenix", 189, Rarity.UNCOMMON, mage.cards.n.NemesisPhoenix.class)); cards.add(new SetCardInfo("Nimbleclaw Adept", 86, Rarity.COMMON, mage.cards.n.NimbleclawAdept.class)); cards.add(new SetCardInfo("Nine-Fingers Keene", 289, Rarity.RARE, mage.cards.n.NineFingersKeene.class));