From 2dee81cc07944943d56d90c0b9535f68125c5fe3 Mon Sep 17 00:00:00 2001 From: Kr4u7 Date: Sun, 17 Nov 2024 20:31:46 +0100 Subject: [PATCH] [ACR] Add Viewpoint Synchronization --- .../cards/v/ViewpointSynchronization.java | 39 +++++++++ Mage.Sets/src/mage/sets/AssassinsCreed.java | 1 + ...InHandRestOntoBattlefieldTappedEffect.java | 79 +++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/v/ViewpointSynchronization.java create mode 100644 Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect.java diff --git a/Mage.Sets/src/mage/cards/v/ViewpointSynchronization.java b/Mage.Sets/src/mage/cards/v/ViewpointSynchronization.java new file mode 100644 index 000000000000..c50cb426bd35 --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/ViewpointSynchronization.java @@ -0,0 +1,39 @@ +package mage.cards.v; + +import java.util.UUID; + +import mage.abilities.effects.common.search.SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect; +import mage.abilities.keyword.FreerunningAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.StaticFilters; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author Kr4u7 + */ +public final class ViewpointSynchronization extends CardImpl { + + public ViewpointSynchronization(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}"); + + + // Freerunning {2}{G} + this.addAbility(new FreerunningAbility("{2}{G}")); + + // Search your library for up to three basic land cards and reveal them. Put two of them onto the battlefield tapped and the other into your hand, then shuffle. + this.getSpellAbility().addEffect(new SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect( + new TargetCardInLibrary(0, 3, StaticFilters.FILTER_CARD_BASIC_LANDS))); + } + + private ViewpointSynchronization(final ViewpointSynchronization card) { + super(card); + } + + @Override + public ViewpointSynchronization copy() { + return new ViewpointSynchronization(this); + } +} diff --git a/Mage.Sets/src/mage/sets/AssassinsCreed.java b/Mage.Sets/src/mage/sets/AssassinsCreed.java index 531396e3e2cd..96bff0ced0c2 100644 --- a/Mage.Sets/src/mage/sets/AssassinsCreed.java +++ b/Mage.Sets/src/mage/sets/AssassinsCreed.java @@ -137,6 +137,7 @@ private AssassinsCreed() { cards.add(new SetCardInfo("The Spear of Leonidas", 38, Rarity.RARE, mage.cards.t.TheSpearOfLeonidas.class)); cards.add(new SetCardInfo("Towering Viewpoint", 77, Rarity.UNCOMMON, mage.cards.t.ToweringViewpoint.class)); cards.add(new SetCardInfo("Tranquilize", 284, Rarity.COMMON, mage.cards.t.Tranquilize.class)); + cards.add(new SetCardInfo("Viewpoint Synchronization", 43, Rarity.UNCOMMON, mage.cards.v.ViewpointSynchronization.class)); cards.add(new SetCardInfo("Waterlogged Grove", 116, Rarity.RARE, mage.cards.w.WaterloggedGrove.class)); cards.add(new SetCardInfo("Yggdrasil, Rebirth Engine", 78, Rarity.MYTHIC, mage.cards.y.YggdrasilRebirthEngine.class)); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect.java new file mode 100644 index 000000000000..877d9602d83b --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect.java @@ -0,0 +1,79 @@ +package mage.abilities.effects.common.search; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.SearchEffect; +import mage.cards.Card; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * @author Kr4u7 + */ +public class SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect extends SearchEffect { + + private static final FilterCard filter = new FilterCard("card to put on the battlefield tapped"); + + public SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect(TargetCardInLibrary target) { + super(target, Outcome.PutLandInPlay); + staticText = "search your library for " + target.getDescription() + + ", reveal those cards, put two onto the battlefield tapped and the other into your hand, then shuffle"; + } + + protected SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect(final SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect effect) { + super(effect); + } + + @Override + public SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect copy() { + return new SearchLibraryPutOneInHandRestOntoBattlefieldTappedEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = game.getObject(source); + if (controller == null || sourceObject == null) { + return false; + } + + if (controller.searchLibrary(target, source, game)) { + if (!target.getTargets().isEmpty()) { + Cards revealed = new CardsImpl(target.getTargets()); + controller.revealCards(sourceObject.getIdName(), revealed, game); + + if (target.getTargets().size() >= 2) { + Cards cardsToHand = new CardsImpl(revealed); + while (cardsToHand.size()>1) { + TargetCardInLibrary targetCardToBattlefield = new TargetCardInLibrary(filter); + controller.choose(Outcome.PutLandInPlay, revealed, targetCardToBattlefield, source, game); + + Card cardToBattlefield = revealed.get(targetCardToBattlefield.getFirstTarget(), game); + + if (cardToBattlefield != null) { + controller.moveCards(cardToBattlefield, Zone.BATTLEFIELD, source, game, true, false, false, null); + cardsToHand.remove(cardToBattlefield); + } + } + controller.moveCardsToHandWithInfo(cardsToHand, source, game, true); + } else if (target.getTargets().size() == 1) { + Cards cards = new CardsImpl(revealed); + Card cardToBattlefield = cards.getRandom(game); + if (cardToBattlefield != null) { + controller.moveCards(cardToBattlefield, Zone.BATTLEFIELD, source, game, true, false, false, null); + } + } + } + controller.shuffleLibrary(source, game); + return true; + } + controller.shuffleLibrary(source, game); + return false; + } +}