mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
[DMU] Implemented Impede Momentum (#9383)
This commit is contained in:
parent
55caa5e4eb
commit
5e656b8da5
5 changed files with 100 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -171,6 +171,7 @@ public enum CounterType {
|
|||
STORAGE("storage"),
|
||||
STRIFE("strife"),
|
||||
STUDY("study"),
|
||||
STUN("stun"),
|
||||
SUSPECT("suspect"),
|
||||
TASK("task"),
|
||||
THEFT("theft"),
|
||||
|
|
|
|||
|
|
@ -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<Player, Card> playerCompanionMap = new HashMap<>();
|
||||
for (Player player : state.getPlayers().values()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue