From 2a61a31c8bea588106ba38d5101efdc0d43c5821 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 5 Jun 2018 14:53:57 -0400 Subject: [PATCH] Implemented Assembly Hall --- Mage.Sets/src/mage/cards/a/AssemblyHall.java | 92 +++++++++++++++++++ Mage.Sets/src/mage/cards/i/InfernalTutor.java | 6 +- Mage.Sets/src/mage/sets/MercadianMasques.java | 1 + 3 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/a/AssemblyHall.java diff --git a/Mage.Sets/src/mage/cards/a/AssemblyHall.java b/Mage.Sets/src/mage/cards/a/AssemblyHall.java new file mode 100644 index 0000000000..a495718139 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AssemblyHall.java @@ -0,0 +1,92 @@ +package mage.cards.a; + +import java.util.UUID; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.CardsImpl; +import mage.cards.SplitCard; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCardInHand; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author TheElk801 + */ +public final class AssemblyHall extends CardImpl { + + public AssemblyHall(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); + + // {4}, {tap}: Reveal a creature card in your hand. Search your library for a card with the same name as that card, reveal it, and put it into your hand. Then shuffle your library. + Ability ability = new SimpleActivatedAbility(new AssemblyHallEffect(), new GenericManaCost(4)); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + public AssemblyHall(final AssemblyHall card) { + super(card); + } + + @Override + public AssemblyHall copy() { + return new AssemblyHall(this); + } +} + +class AssemblyHallEffect extends OneShotEffect { + + public AssemblyHallEffect() { + super(Outcome.Benefit); + this.staticText = "reveal a creature card from your hand. " + + "Search your library for a card with the same name as that card, " + + "reveal it, and put it into your hand. Then shuffle your library"; + } + + public AssemblyHallEffect(final AssemblyHallEffect effect) { + super(effect); + } + + @Override + public AssemblyHallEffect copy() { + return new AssemblyHallEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (controller == null || controller.getHand().isEmpty() || sourceObject == null) { + return false; + } + Card cardToReveal = null; + Target target = new TargetCardInHand(StaticFilters.FILTER_CARD_CREATURE); + target.setNotTarget(true); + if (controller.chooseTarget(outcome, target, source, game)) { + cardToReveal = game.getCard(target.getFirstTarget()); + } + if (cardToReveal == null) { + return false; + } + controller.revealCards("from hand :" + sourceObject.getName(), new CardsImpl(cardToReveal), game); + String nameToSearch = cardToReveal.isSplitCard() ? ((SplitCard) cardToReveal).getLeftHalfCard().getName() : cardToReveal.getName(); + FilterCard filterCard = new FilterCard("card named " + nameToSearch); + filterCard.add(new NamePredicate(nameToSearch)); + return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filterCard), true, true).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/cards/i/InfernalTutor.java b/Mage.Sets/src/mage/cards/i/InfernalTutor.java index bae25f7970..eb4b152f66 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalTutor.java +++ b/Mage.Sets/src/mage/cards/i/InfernalTutor.java @@ -1,4 +1,3 @@ - package mage.cards.i; import java.util.UUID; @@ -17,6 +16,7 @@ import mage.cards.SplitCard; import mage.constants.CardType; import mage.constants.Outcome; import mage.filter.FilterCard; +import mage.filter.StaticFilters; import mage.filter.predicate.mageobject.NamePredicate; import mage.game.Game; import mage.players.Player; @@ -37,7 +37,7 @@ public final class InfernalTutor extends CardImpl { this.getSpellAbility().addEffect(new InfernalTutorEffect()); // Hellbent - If you have no cards in hand, instead search your library for a card, put it into your hand, then shuffle your library. Effect effect = new ConditionalOneShotEffect( - new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterCard()), false, true), + new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD), false, true), HellbentCondition.instance, "

Hellbent — If you have no cards in hand, instead search your library for a card, put it into your hand, then shuffle your library"); this.getSpellAbility().addEffect(effect); @@ -78,7 +78,7 @@ class InfernalTutorEffect extends OneShotEffect { if (!controller.getHand().isEmpty()) { Card cardToReveal = null; if (controller.getHand().size() > 1) { - Target target = new TargetCardInHand(new FilterCard()); + Target target = new TargetCardInHand(StaticFilters.FILTER_CARD); target.setNotTarget(true); if (controller.chooseTarget(outcome, target, source, game)) { cardToReveal = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/MercadianMasques.java b/Mage.Sets/src/mage/sets/MercadianMasques.java index a4d10d4350..d6cc0d7ffc 100644 --- a/Mage.Sets/src/mage/sets/MercadianMasques.java +++ b/Mage.Sets/src/mage/sets/MercadianMasques.java @@ -33,6 +33,7 @@ public final class MercadianMasques extends ExpansionSet { cards.add(new SetCardInfo("Armistice", 3, Rarity.RARE, mage.cards.a.Armistice.class)); cards.add(new SetCardInfo("Arms Dealer", 172, Rarity.UNCOMMON, mage.cards.a.ArmsDealer.class)); cards.add(new SetCardInfo("Arrest", 4, Rarity.UNCOMMON, mage.cards.a.Arrest.class)); + cards.add(new SetCardInfo("Assembly Hall", 286, Rarity.RARE, mage.cards.a.AssemblyHall.class)); cards.add(new SetCardInfo("Ballista Squad", 5, Rarity.UNCOMMON, mage.cards.b.BallistaSquad.class)); cards.add(new SetCardInfo("Balloon Peddler", 59, Rarity.COMMON, mage.cards.b.BalloonPeddler.class)); cards.add(new SetCardInfo("Battle Rampart", 173, Rarity.COMMON, mage.cards.b.BattleRampart.class));