mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[DSC] Implement Fear of Sleep Paralysis
Also fix UntapSourceCost to allow 'consuming a stun counter' to count as paying untap cost, per rule 118.11, but only if Fear of Sleep Paralysis isn't making stun permanent.
This commit is contained in:
parent
c6bec887b9
commit
8f3cd5a106
3 changed files with 100 additions and 0 deletions
92
Mage.Sets/src/mage/cards/f/FearOfSleepParalysis.java
Normal file
92
Mage.Sets/src/mage/cards/f/FearOfSleepParalysis.java
Normal file
|
|
@ -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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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("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("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("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("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("Fellwar Stone", 245, Rarity.UNCOMMON, mage.cards.f.FellwarStone.class));
|
||||||
cards.add(new SetCardInfo("Flooded Grove", 276, Rarity.RARE, mage.cards.f.FloodedGrove.class));
|
cards.add(new SetCardInfo("Flooded Grove", 276, Rarity.RARE, mage.cards.f.FloodedGrove.class));
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
import mage.abilities.costs.CostImpl;
|
import mage.abilities.costs.CostImpl;
|
||||||
import mage.constants.AsThoughEffectType;
|
import mage.constants.AsThoughEffectType;
|
||||||
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
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) {
|
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
|
int stunCount = permanent.getCounters(game).getCount(CounterType.STUN);
|
||||||
paid = permanent.untap(game);
|
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;
|
return paid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue