Implemented Assembly Hall

This commit is contained in:
Evan Kranzler 2018-06-05 14:53:57 -04:00
parent 2e72503b8c
commit 2a61a31c8b
3 changed files with 96 additions and 3 deletions

View file

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

View file

@ -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,
"<br/><br/><i>Hellbent</i> &mdash; 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());

View file

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