diff --git a/Mage.Sets/src/mage/cards/f/FearOfSleepParalysis.java b/Mage.Sets/src/mage/cards/f/FearOfSleepParalysis.java new file mode 100644 index 00000000000..db977eb225d --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FearOfSleepParalysis.java @@ -0,0 +1,92 @@ +package mage.cards.f; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.abilityword.EerieAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Grath + */ +public final class FearOfSleepParalysis extends CardImpl { + + public FearOfSleepParalysis(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{5}{U}"); + + this.subtype.add(SubType.NIGHTMARE); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Eerie -- Whenever Fear of Sleep Paralysis or another enchantment you control enters and whenever you fully unlock a Room, tap up to one target creature and put a stun counter on it. + Ability ability = new EerieAbility(new TapTargetEffect()); + ability.addEffect(new AddCountersTargetEffect(CounterType.STUN.createInstance()).setText("and put a stun counter on it")); + ability.addTarget(new TargetCreaturePermanent(0, 1)); + this.addAbility(ability); + + // Stun counters can't be removed from permanents your opponents control. + this.addAbility(new SimpleStaticAbility(new FearOfSleepParalysisEffect())); + } + + private FearOfSleepParalysis(final FearOfSleepParalysis card) { + super(card); + } + + @Override + public FearOfSleepParalysis copy() { + return new FearOfSleepParalysis(this); + } +} + +class FearOfSleepParalysisEffect extends ReplacementEffectImpl { + + FearOfSleepParalysisEffect() { + super(Duration.WhileOnBattlefield, Outcome.PreventDamage); + staticText = "Stun counters can't be removed from permanents your opponents control"; + } + + private FearOfSleepParalysisEffect(final FearOfSleepParalysisEffect effect) { + super(effect); + } + + @Override + public FearOfSleepParalysisEffect copy() { + return new FearOfSleepParalysisEffect(this); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + return true; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.REMOVE_COUNTERS; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent target = game.getPermanent(event.getTargetId()); + return target != null && event.getData().equals(CounterType.STUN.getName()) && !target.getControllerId().equals(source.getControllerId()); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java index 7353d9329a1..b8d5ef137f1 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java @@ -107,6 +107,7 @@ public final class DuskmournHouseOfHorrorCommander extends ExpansionSet { cards.add(new SetCardInfo("Ezuri's Predation", 178, Rarity.RARE, mage.cards.e.EzurisPredation.class)); cards.add(new SetCardInfo("Falkenrath Noble", 140, Rarity.UNCOMMON, mage.cards.f.FalkenrathNoble.class)); cards.add(new SetCardInfo("Fate Unraveler", 141, Rarity.RARE, mage.cards.f.FateUnraveler.class)); + cards.add(new SetCardInfo("Fear of Sleep Paralysis", 12, Rarity.RARE, mage.cards.f.FearOfSleepParalysis.class)); cards.add(new SetCardInfo("Feed the Swarm", 78, Rarity.COMMON, mage.cards.f.FeedTheSwarm.class)); cards.add(new SetCardInfo("Fellwar Stone", 245, Rarity.UNCOMMON, mage.cards.f.FellwarStone.class)); cards.add(new SetCardInfo("Flooded Grove", 276, Rarity.RARE, mage.cards.f.FloodedGrove.class)); diff --git a/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java index 09ec8fe5b03..2e379faac2a 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java @@ -6,6 +6,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.AsThoughEffectType; +import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; @@ -27,7 +28,13 @@ public class UntapSourceCost extends CostImpl { public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { + int stunCount = permanent.getCounters(game).getCount(CounterType.STUN); paid = permanent.untap(game); + // 118.11 - if a stun counter replaces the untap, the cost has still been paid. + // Fear of Sleep Paralysis ruling - if the stun counter can't be removed, the untap cost hasn't been paid. + if (stunCount > 0) { + paid = permanent.getCounters(game).getCount(CounterType.STUN) < stunCount; + } } return paid; }