Card: add Stun Counter Effect (#1379)

This commit is contained in:
Hans Mackowiak
2022-08-21 12:59:13 +02:00
committed by GitHub
parent 8503131782
commit ce89121ba3
4 changed files with 26 additions and 4 deletions

View File

@@ -2809,7 +2809,7 @@ public class ComputerUtil {
|| type.is(CounterEnumType.GOLD) || type.is(CounterEnumType.MUSIC) || type.is(CounterEnumType.PUPA) || type.is(CounterEnumType.GOLD) || type.is(CounterEnumType.MUSIC) || type.is(CounterEnumType.PUPA)
|| type.is(CounterEnumType.PARALYZATION) || type.is(CounterEnumType.SHELL) || type.is(CounterEnumType.SLEEP) || type.is(CounterEnumType.PARALYZATION) || type.is(CounterEnumType.SHELL) || type.is(CounterEnumType.SLEEP)
|| type.is(CounterEnumType.SLUMBER) || type.is(CounterEnumType.SLEIGHT) || type.is(CounterEnumType.WAGE) || type.is(CounterEnumType.SLUMBER) || type.is(CounterEnumType.SLEIGHT) || type.is(CounterEnumType.WAGE)
|| type.is(CounterEnumType.INCARNATION) || type.is(CounterEnumType.RUST); || type.is(CounterEnumType.INCARNATION) || type.is(CounterEnumType.RUST) || type.is(CounterEnumType.STUN);
} }
// this countertypes has no effect // this countertypes has no effect

View File

@@ -334,6 +334,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
private ReplacementEffect shieldCounterReplaceDamage = null; private ReplacementEffect shieldCounterReplaceDamage = null;
private ReplacementEffect shieldCounterReplaceDestroy = null; private ReplacementEffect shieldCounterReplaceDestroy = null;
private ReplacementEffect stunCounterReplaceUntap = null;
// Enumeration for CMC request types // Enumeration for CMC request types
public enum SplitCMCMode { public enum SplitCMCMode {
@@ -6100,16 +6101,16 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
} }
// Shield Counter aren't affected by Changed Card Traits // Shield Counter aren't affected by Changed Card Traits
if (this.getCounters(CounterEnumType.SHIELD) > 0) { if (getCounters(CounterEnumType.SHIELD) > 0) {
String sa = "DB$ RemoveCounter | Defined$ Self | CounterType$ Shield | CounterNum$ 1"; String sa = "DB$ RemoveCounter | Defined$ Self | CounterType$ Shield | CounterNum$ 1";
if (shieldCounterReplaceDamage == null) { if (shieldCounterReplaceDamage == null) {
String reStr = "Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Card.Self | PreventionEffect$ True | AlwaysReplace$ True " String reStr = "Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Card.Self | PreventionEffect$ True | AlwaysReplace$ True | Secondary$ True "
+ "| Description$ If damage would be dealt to this permanent, prevent that damage and remove a shield counter from it."; + "| Description$ If damage would be dealt to this permanent, prevent that damage and remove a shield counter from it.";
shieldCounterReplaceDamage = ReplacementHandler.parseReplacement(reStr, this, false, null); shieldCounterReplaceDamage = ReplacementHandler.parseReplacement(reStr, this, false, null);
shieldCounterReplaceDamage.setOverridingAbility(AbilityFactory.getAbility(sa, this)); shieldCounterReplaceDamage.setOverridingAbility(AbilityFactory.getAbility(sa, this));
} }
if (shieldCounterReplaceDestroy == null) { if (shieldCounterReplaceDestroy == null) {
String reStr = "Event$ Destroy | ActiveZones$ Battlefield | ValidCard$ Card.Self | ValidSource$ SpellAbility " String reStr = "Event$ Destroy | ActiveZones$ Battlefield | ValidCard$ Card.Self | ValidSource$ SpellAbility | Secondary$ True "
+ "| Description$ If this permanent would be destroyed as the result of an effect, instead remove a shield counter from it."; + "| Description$ If this permanent would be destroyed as the result of an effect, instead remove a shield counter from it.";
shieldCounterReplaceDestroy = ReplacementHandler.parseReplacement(reStr, this, false, null); shieldCounterReplaceDestroy = ReplacementHandler.parseReplacement(reStr, this, false, null);
shieldCounterReplaceDestroy.setOverridingAbility(AbilityFactory.getAbility(sa, this)); shieldCounterReplaceDestroy.setOverridingAbility(AbilityFactory.getAbility(sa, this));
@@ -6118,6 +6119,17 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
list.add(shieldCounterReplaceDamage); list.add(shieldCounterReplaceDamage);
list.add(shieldCounterReplaceDestroy); list.add(shieldCounterReplaceDestroy);
} }
if (getCounters(CounterEnumType.STUN) > 0) {
String sa = "DB$ RemoveCounter | Defined$ Self | CounterType$ Stun | CounterNum$ 1";
if (stunCounterReplaceUntap == null) {
String reStr = "Event$ Untap | ActiveZones$ Battlefield | ValidCard$ Card.Self | Secondary$ True "
+ "| Description$ If this permanent would become untapped, instead remove a stun counter from it.";
stunCounterReplaceUntap = ReplacementHandler.parseReplacement(reStr, this, false, null);
stunCounterReplaceUntap.setOverridingAbility(AbilityFactory.getAbility(sa, this));
}
list.add(stunCounterReplaceUntap);
}
} }
public boolean hasReplacementEffect(final ReplacementEffect re) { public boolean hasReplacementEffect(final ReplacementEffect re) {

View File

@@ -329,6 +329,8 @@ public enum CounterEnumType {
STUDY("STUDY", 226, 192, 165), STUDY("STUDY", 226, 192, 165),
STUN("STUN", 226, 192, 165),
TASK("TASK", 191, 63, 49), TASK("TASK", 191, 63, 49),
THEFT("THEFT", 255, 176, 125), THEFT("THEFT", 255, 176, 125),

View File

@@ -0,0 +1,8 @@
Name:Impede Momentum
ManaCost:1 U
Types:Sorcery
A:SP$ Tap | TgtPrompt$ Choose target creature | ValidTgts$ Creature | SubAbility$ DBCounter | SpellDescription$ Tap target creature and put three stun counters on it. (If a permanent with a stun counter would become untapped, remove one from it instead.)
SVar:DBCounter:DB$ PutCounter | Defined$ Targeted | CounterType$ Stun | CounterNum$ 3 | SubAbility$ DBScry
SVar:DBScry:DB$ Scry | ScryNum$ 1 | SpellDescription$ Scry 1. (Look at the top card of your library. You may put that card on the bottom of your library.)
DeckHints:Ability$Counters
Oracle:Tap target creature and put three stun counters on it. (If a permanent with a stun counter would become untapped, remove one from it instead.)\nScry 1. (Look at the top card of your library. You may put that card on the bottom of your library.)