diff --git a/Mage.Sets/src/mage/cards/v/Vault112SadisticSimulation.java b/Mage.Sets/src/mage/cards/v/Vault112SadisticSimulation.java new file mode 100644 index 00000000000..b1f3a5183fd --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/Vault112SadisticSimulation.java @@ -0,0 +1,133 @@ +package mage.cards.v; + +import mage.ApprovingObject; +import mage.abilities.Ability; +import mage.abilities.ActivatedAbility; +import mage.abilities.PlayLandAbility; +import mage.abilities.SpellAbility; +import mage.abilities.common.SagaAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.PayEnergyCost; +import mage.abilities.effects.Effects; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect; +import mage.cards.*; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInExile; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class Vault112SadisticSimulation extends CardImpl { + + public Vault112SadisticSimulation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{R}"); + + this.subtype.add(SubType.SAGA); + + // (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.) + SagaAbility sagaAbility = new SagaAbility(this); + + // I, II -- Tap up to one target creature and put a stun counter on it. You get {E}{E}. + Effects effects = new Effects(); + effects.add(new TapTargetEffect().setText("Tap up to one target creature")); + effects.add(new AddCountersTargetEffect(CounterType.STUN.createInstance()).setText("and put a stun counter on it.")); + effects.add(new GetEnergyCountersControllerEffect(2)); + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_II, + effects, new TargetCreaturePermanent(0, 1) + ); + + // III -- Pay any amount of {E}. If you paid one or more {E} this way, shuffle your library, then exile that many cards from the top. You may play one of those cards without paying its mana cost. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_III, + new Vault112SadisticSimulationChapterEffect() + ); + + this.addAbility(sagaAbility); + } + + private Vault112SadisticSimulation(final Vault112SadisticSimulation card) { + super(card); + } + + @Override + public Vault112SadisticSimulation copy() { + return new Vault112SadisticSimulation(this); + } +} + +class Vault112SadisticSimulationChapterEffect extends OneShotEffect { + + Vault112SadisticSimulationChapterEffect() { + super(Outcome.Benefit); + staticText = "Pay any amount of {E}. If you paid one or more {E} this way, shuffle your library, " + + "then exile that many cards from the top. " + + "You may play one of those cards without paying its mana cost."; + } + + private Vault112SadisticSimulationChapterEffect(final Vault112SadisticSimulationChapterEffect effect) { + super(effect); + } + + @Override + public Vault112SadisticSimulationChapterEffect copy() { + return new Vault112SadisticSimulationChapterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + int numberToPay = controller.getAmount( + 0, controller.getCounters().getCount(CounterType.ENERGY), + "How many {E} do you like to pay?", game + ); + if (numberToPay <= 0) { + return true; + } + // Pay the chosen cost. + Cost cost = new PayEnergyCost(numberToPay); + if (!cost.pay(source, game, source, source.getControllerId(), true)) { + return true; + } + // Shuffle Library + controller.shuffleLibrary(source, game); + // Exile top X cards. + Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, numberToPay)); + controller.moveCardsToExile(cards.getCards(game), source, game, true, null, ""); + cards.retainZone(Zone.EXILED, game); + if (cards.isEmpty()) { + return true; + } + // Choose one, you may cast it without paying its mana cost. + TargetCardInExile target = new TargetCardInExile(0, 1, StaticFilters.FILTER_CARD_CARDS, null); + controller.choose(Outcome.PlayForFree, cards, target, source, game); + Card card = game.getCard(target.getFirstTarget()); + if (card == null) { + return true; + } + // Since we don't know if the card can be played as a land or cast, we search for both and activate the ability. + ActivatedAbility ability = controller.chooseLandOrSpellAbility(card, game, true); + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE); + if (ability instanceof SpellAbility) { + controller.cast((SpellAbility) ability, game, true, new ApprovingObject(source, game)); + } else if (ability instanceof PlayLandAbility && controller.canPlayLand()) { + controller.playLand(card, game, true); + } + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); + return true; + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Fallout.java b/Mage.Sets/src/mage/sets/Fallout.java index 17222ff4061..85bcc41e3aa 100644 --- a/Mage.Sets/src/mage/sets/Fallout.java +++ b/Mage.Sets/src/mage/sets/Fallout.java @@ -356,6 +356,7 @@ public final class Fallout extends ExpansionSet { cards.add(new SetCardInfo("Valorous Stance", 174, Rarity.UNCOMMON, mage.cards.v.ValorousStance.class)); cards.add(new SetCardInfo("Vandalblast", 355, Rarity.UNCOMMON, mage.cards.v.Vandalblast.class)); cards.add(new SetCardInfo("Vault 101: Birthday Party", 28, Rarity.RARE, mage.cards.v.Vault101BirthdayParty.class)); + cards.add(new SetCardInfo("Vault 112: Sadistic Simulation", 123, Rarity.RARE, mage.cards.v.Vault112SadisticSimulation.class)); cards.add(new SetCardInfo("Vault 12: The Necropolis", 51, Rarity.RARE, mage.cards.v.Vault12TheNecropolis.class)); cards.add(new SetCardInfo("Vault 21: House Gambit", 69, Rarity.RARE, mage.cards.v.Vault21HouseGambit.class)); cards.add(new SetCardInfo("Vault 75: Middle School", 27, Rarity.RARE, mage.cards.v.Vault75MiddleSchool.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/players/Player.java b/Mage/src/main/java/mage/players/Player.java index cec01ea1cd7..1c038ef72e1 100644 --- a/Mage/src/main/java/mage/players/Player.java +++ b/Mage/src/main/java/mage/players/Player.java @@ -493,6 +493,7 @@ public interface Player extends MageItem, Copyable { * @param approvingObject reference to the ability that allows to play the card * @return */ + // TODO: should have a version taking a PlayLandAbility or SpellAbility to handle MDFC/Zoetic Cavern/Adventure/etc... boolean playCard(Card card, Game game, boolean noMana, ApprovingObject approvingObject); /** @@ -504,6 +505,7 @@ public interface Player extends MageItem, Copyable { * of lands you already played. * @return */ + // TODO: should have a version taking a PlayLandAbility to handle MDFC/Zoetic Cavern/etc... boolean playLand(Card card, Game game, boolean ignoreTiming); boolean activateAbility(ActivatedAbility ability, Game game); diff --git a/Mage/src/main/java/mage/target/common/TargetCardInExile.java b/Mage/src/main/java/mage/target/common/TargetCardInExile.java index 55e31ad7d74..b316655923b 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInExile.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInExile.java @@ -34,7 +34,7 @@ public class TargetCardInExile extends TargetCard { } public TargetCardInExile(int minNumTargets, int maxNumTargets, FilterCard filter, UUID zoneId) { - this(minNumTargets, maxNumTargets, filter, zoneId, false); + this(minNumTargets, maxNumTargets, filter, zoneId, zoneId == null); } public TargetCardInExile(int minNumTargets, int maxNumTargets, FilterCard filter, UUID zoneId, boolean allExileZones) {