[CLB] Implemented Navigation Orb

This commit is contained in:
Evan Kranzler 2022-05-30 10:37:09 -04:00
parent cc1c965a15
commit 5ab9ba66ae
2 changed files with 107 additions and 0 deletions

View file

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

View file

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