diff --git a/Mage.Sets/src/mage/cards/s/SinisterSabotage.java b/Mage.Sets/src/mage/cards/s/SinisterSabotage.java new file mode 100644 index 00000000000..836b8455104 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SinisterSabotage.java @@ -0,0 +1,36 @@ +package mage.cards.s; + +import java.util.UUID; +import mage.abilities.effects.common.CounterTargetEffect; +import mage.abilities.effects.keyword.SurveilEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.target.TargetSpell; + +/** + * + * @author TheElk801 + */ +public final class SinisterSabotage extends CardImpl { + + public SinisterSabotage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{U}"); + + // Counter target spell. + this.getSpellAbility().addEffect(new CounterTargetEffect()); + this.getSpellAbility().addTarget(new TargetSpell()); + + // Surveil 1. + this.getSpellAbility().addEffect(new SurveilEffect(1)); + } + + public SinisterSabotage(final SinisterSabotage card) { + super(card); + } + + @Override + public SinisterSabotage copy() { + return new SinisterSabotage(this); + } +} diff --git a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java index b8fb13f75ff..836ea3a20db 100644 --- a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java +++ b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java @@ -28,6 +28,7 @@ public final class GuildsOfRavnica extends ExpansionSet { cards.add(new SetCardInfo("Narcomoeba", 47, Rarity.RARE, mage.cards.n.Narcomoeba.class)); cards.add(new SetCardInfo("Overgrown Tomb", 253, Rarity.RARE, mage.cards.o.OvergrownTomb.class)); cards.add(new SetCardInfo("Sacred Foundry", 254, Rarity.RARE, mage.cards.s.SacredFoundry.class)); + cards.add(new SetCardInfo("Sinister Sabotage", 54, Rarity.UNCOMMON, mage.cards.s.SinisterSabotage.class)); cards.add(new SetCardInfo("Steam Vents", 257, Rarity.RARE, mage.cards.s.SteamVents.class)); cards.add(new SetCardInfo("Temple Garden", 258, Rarity.RARE, mage.cards.t.TempleGarden.class)); cards.add(new SetCardInfo("Watery Grave", 259, Rarity.RARE, mage.cards.w.WateryGrave.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ScryEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ScryEffect.java index b714b72f2d5..99fd8e360a6 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ScryEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ScryEffect.java @@ -1,10 +1,8 @@ - package mage.abilities.effects.keyword; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.constants.Outcome; -import mage.filter.FilterCard; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; @@ -15,8 +13,6 @@ import mage.util.CardUtil; */ public class ScryEffect extends OneShotEffect { - protected static FilterCard filter1 = new FilterCard("card to put on the bottom of your library"); - protected int scryNumber; public ScryEffect(int scryNumber) { diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/SurveilEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/SurveilEffect.java new file mode 100644 index 00000000000..6ac26220dec --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/keyword/SurveilEffect.java @@ -0,0 +1,54 @@ +package mage.abilities.effects.keyword; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.util.CardUtil; + +/** + * + * @author TheElk801 + */ +public class SurveilEffect extends OneShotEffect { + + protected int surveilNumber; + + public SurveilEffect(int scryNumber) { + super(Outcome.Benefit); + this.surveilNumber = scryNumber; + this.setText(); + } + + public SurveilEffect(final SurveilEffect effect) { + super(effect); + this.surveilNumber = effect.surveilNumber; + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + return player.surveil(surveilNumber, source, game); + } + return false; + } + + @Override + public SurveilEffect copy() { + return new SurveilEffect(this); + } + + private void setText() { + StringBuilder sb = new StringBuilder("surveil ").append(surveilNumber); + if (surveilNumber == 1) { + sb.append(". (Look at the top card of your library. You may put that card into your graveyard.)"); + } else { + sb.append(". (Look at the top "); + sb.append(CardUtil.numberToText(surveilNumber)); + sb.append(" cards of your library, then put any number of them into your graveyard and the rest on top in any order.)"); + } + staticText = sb.toString(); + } +} diff --git a/Mage/src/main/java/mage/players/Player.java b/Mage/src/main/java/mage/players/Player.java index 415dfec7c14..0c8ea5bc355 100644 --- a/Mage/src/main/java/mage/players/Player.java +++ b/Mage/src/main/java/mage/players/Player.java @@ -870,6 +870,8 @@ public interface Player extends MageItem, Copyable { boolean scry(int value, Ability source, Game game); + boolean surveil(int value, Ability source, Game game); + /** * Only used for test player for pre-setting targets * diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index b6167fa2142..c5bc6b7c108 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -3898,7 +3898,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (!cards.isEmpty()) { String text; if (cards.size() == 1) { - text = "card if you want to put it to the bottom of your library (Scry)"; + text = "card if you want to put it on the bottom of your library (Scry)"; } else { text = "cards you want to put on the bottom of your library (Scry)"; } @@ -3912,6 +3912,29 @@ public abstract class PlayerImpl implements Player, Serializable { return true; } + @Override + public boolean surveil(int value, Ability source, Game game) { + game.informPlayers(getLogName() + " surveils " + value); + Cards cards = new CardsImpl(); + cards.addAll(getLibrary().getTopCards(game, value)); + if (!cards.isEmpty()) { + String text; + if (cards.size() == 1) { + text = "card if you want to put it into your graveyard (Surveil)"; + } else { + text = "cards you want to put into your graveyard (Surveil)"; + } + TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, new FilterCard(text)); + chooseTarget(Outcome.Benefit, cards, target, source, game); + moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); + cards.removeAll(target.getTargets()); + putCardsOnTopOfLibrary(cards, game, source, true); + } +// Waiting to see if this event is needed - TheElk801 +// game.fireEvent(new GameEvent(GameEvent.EventType.SURVEIL, getId(), source == null ? null : source.getSourceId(), getId(), value, true)); + return true; + } + @Override public boolean addTargets(Ability ability, Game game ) {