diff --git a/Mage.Sets/src/mage/cards/i/ImpedeMomentum.java b/Mage.Sets/src/mage/cards/i/ImpedeMomentum.java new file mode 100644 index 00000000000..efa51bbe2b8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/ImpedeMomentum.java @@ -0,0 +1,41 @@ +package mage.cards.i; + +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.effects.keyword.ScryEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.counters.CounterType; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ImpedeMomentum extends CardImpl { + + public ImpedeMomentum(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}"); + + // Tap target creature and put three stun counters on it. + this.getSpellAbility().addEffect(new TapTargetEffect()); + this.getSpellAbility().addEffect(new AddCountersTargetEffect( + CounterType.STUN.createInstance(3) + ).setText("and put three stun counters on it")); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + + // Scry 1. + this.getSpellAbility().addEffect(new ScryEffect(1).concatBy("
")); + } + + private ImpedeMomentum(final ImpedeMomentum card) { + super(card); + } + + @Override + public ImpedeMomentum copy() { + return new ImpedeMomentum(this); + } +} diff --git a/Mage.Sets/src/mage/sets/DominariaUnited.java b/Mage.Sets/src/mage/sets/DominariaUnited.java index ba9528cf274..bf3b0ae1978 100644 --- a/Mage.Sets/src/mage/sets/DominariaUnited.java +++ b/Mage.Sets/src/mage/sets/DominariaUnited.java @@ -32,6 +32,7 @@ public final class DominariaUnited extends ExpansionSet { cards.add(new SetCardInfo("Charismatic Vanguard", 10, Rarity.COMMON, mage.cards.c.CharismaticVanguard.class)); cards.add(new SetCardInfo("Evolved Sleeper", 93, Rarity.RARE, mage.cards.e.EvolvedSleeper.class)); cards.add(new SetCardInfo("Forest", 281, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS)); + cards.add(new SetCardInfo("Impede Momentum", 54, Rarity.COMMON, mage.cards.i.ImpedeMomentum.class)); cards.add(new SetCardInfo("Island", 278, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Jaya, Fiery Negotiator", 133, Rarity.MYTHIC, mage.cards.j.JayaFieryNegotiator.class)); cards.add(new SetCardInfo("Karplusan Forest", 250, Rarity.RARE, mage.cards.k.KarplusanForest.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/StunCounterEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/StunCounterEffect.java new file mode 100644 index 00000000000..9ddd233ac1f --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/keyword/StunCounterEffect.java @@ -0,0 +1,52 @@ +package mage.abilities.effects.keyword; + +import mage.abilities.Ability; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +/** + * @author TheElk801 + */ +public class StunCounterEffect extends ReplacementEffectImpl { + + public StunCounterEffect() { + super(Duration.Custom, Outcome.Tap); + this.staticText = "If a permanent with a stun counter would become untapped, remove one from it instead."; + } + + private StunCounterEffect(final StunCounterEffect effect) { + super(effect); + } + + @Override + public StunCounterEffect copy() { + return new StunCounterEffect(this); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent == null || permanent.getCounters(game).getCount(CounterType.STUN) < 1) { + return false; + } + permanent.removeCounters(CounterType.STUN.getName(), 1, source, game); + game.informPlayers("Removed a stun counter from " + permanent.getLogName()); + return true; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.UNTAP; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent permanent = game.getPermanent(event.getTargetId()); + return permanent != null && permanent.getCounters(game).getCount(CounterType.STUN) > 0; + } +} diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 4e18a1af1d3..64a938cd730 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -171,6 +171,7 @@ public enum CounterType { STORAGE("storage"), STRIFE("strife"), STUDY("study"), + STUN("stun"), SUSPECT("suspect"), TASK("task"), THEFT("theft"), diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index f8da9b83e2b..1d1f901b813 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -15,6 +15,7 @@ import mage.abilities.effects.PreventionEffectData; import mage.abilities.effects.common.CopyEffect; import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.keyword.ShieldCounterEffect; +import mage.abilities.effects.keyword.StunCounterEffect; import mage.abilities.keyword.*; import mage.abilities.mana.DelayedTriggeredManaAbility; import mage.abilities.mana.TriggeredManaAbility; @@ -674,7 +675,7 @@ public abstract class GameImpl implements Game { } else if (obj != null) { logger.error(String.format( "getSpellOrLKIStack got non-spell id %s correlating to non-spell object %s.", - obj.getClass().getName(),obj.getName()), + obj.getClass().getName(), obj.getName()), new Throwable() ); } @@ -1123,6 +1124,9 @@ public abstract class GameImpl implements Game { // Apply shield counter mechanic from SNC state.addAbility(new SimpleStaticAbility(Zone.ALL, new ShieldCounterEffect()), null); + // Apply stun counter mechanic + state.addAbility(new SimpleStaticAbility(Zone.ALL, new StunCounterEffect()), null); + // Handle companions Map playerCompanionMap = new HashMap<>(); for (Player player : state.getPlayers().values()) {