From bf70d0b6756a8f681e623533d11892d826b44826 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 18 Apr 2022 22:01:09 -0400 Subject: [PATCH] [SNC] Implemented Wiretapping --- Mage.Sets/src/mage/cards/w/Wiretapping.java | 87 +++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + 2 files changed, 88 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/Wiretapping.java diff --git a/Mage.Sets/src/mage/cards/w/Wiretapping.java b/Mage.Sets/src/mage/cards/w/Wiretapping.java new file mode 100644 index 0000000000..c65e2725fe --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/Wiretapping.java @@ -0,0 +1,87 @@ +package mage.cards.w; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.CardsInHandCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.HideawayPlayEffect; +import mage.abilities.keyword.HideawayAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.watchers.common.CardsDrawnDuringDrawStepWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Wiretapping extends CardImpl { + + public Wiretapping(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}"); + + // Hideaway 5 + this.addAbility(new HideawayAbility(5)); + + // Whenever you draw your first card during each of your draw steps, draw a card. Then if you have nine or more cards in hand, you may play the exiled card without paying its mana cost. + this.addAbility(new WiretappingTriggeredAbility()); + } + + private Wiretapping(final Wiretapping card) { + super(card); + } + + @Override + public Wiretapping copy() { + return new Wiretapping(this); + } +} + +class WiretappingTriggeredAbility extends TriggeredAbilityImpl { + + private static final Condition condition = new CardsInHandCondition(ComparisonType.MORE_THAN, 8); + + WiretappingTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1)); + this.addEffect(new ConditionalOneShotEffect(new HideawayPlayEffect(), condition)); + this.addWatcher(new CardsDrawnDuringDrawStepWatcher()); + } + + private WiretappingTriggeredAbility(final WiretappingTriggeredAbility ability) { + super(ability); + } + + @Override + public WiretappingTriggeredAbility copy() { + return new WiretappingTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DREW_CARD; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return game.isActivePlayer(event.getPlayerId()) + && game.getStep().getType() == PhaseStep.DRAW + && isControlledBy(event.getPlayerId()) + && game + .getState() + .getWatcher(CardsDrawnDuringDrawStepWatcher.class) + .getAmountCardsDrawn(event.getPlayerId()) == 0; + } + + @Override + public String getRule() { + return "Whenever you draw your first card during each of your draw steps, draw a card. " + + "Then if you have nine or more cards in hand, you may play the exiled card without paying its mana cost."; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index 8500d545e2..5fb3ea856d 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -259,6 +259,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Whack", 99, Rarity.UNCOMMON, mage.cards.w.Whack.class)); cards.add(new SetCardInfo("Widespread Thieving", 130, Rarity.RARE, mage.cards.w.WidespreadThieving.class)); cards.add(new SetCardInfo("Wingshield Agent", 64, Rarity.UNCOMMON, mage.cards.w.WingshieldAgent.class)); + cards.add(new SetCardInfo("Wiretapping", 65, Rarity.RARE, mage.cards.w.Wiretapping.class)); cards.add(new SetCardInfo("Witness Protection", 66, Rarity.COMMON, mage.cards.w.WitnessProtection.class)); cards.add(new SetCardInfo("Witty Roastmaster", 131, Rarity.COMMON, mage.cards.w.WittyRoastmaster.class)); cards.add(new SetCardInfo("Workshop Warchief", 165, Rarity.RARE, mage.cards.w.WorkshopWarchief.class));