refactor: AttackedThisTurnWatcher is a default watcher

close #10982
This commit is contained in:
xenohedron 2023-11-29 20:27:30 -05:00
parent 9fbdede64b
commit f7d70a7b11
38 changed files with 21 additions and 43 deletions

View file

@ -64,8 +64,7 @@ public final class Aggression extends CardImpl {
new DestroyAttachedToEffect("enchanted"),
TargetController.CONTROLLER_ATTACHED_TO),
DidNotAttackThisTurnEnchantedCondition.instance,
"At the beginning of the end step of enchanted creature's controller, destroy that creature if it didn't attack this turn."),
new AttackedThisTurnWatcher());
"At the beginning of the end step of enchanted creature's controller, destroy that creature if it didn't attack this turn."));
}

View file

@ -31,7 +31,7 @@ public final class AngelsTrumpet extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(VigilanceAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent())));
// At the beginning of each player's end step, tap all untapped creatures that player controls that didn't attack this turn. Angel's Trumpet deals damage to the player equal to the number of creatures tapped this way.
this.addAbility(new BeginningOfEndStepTriggeredAbility(new AngelsTrumpetTapEffect(), TargetController.ANY, false), new AttackedThisTurnWatcher());
this.addAbility(new BeginningOfEndStepTriggeredAbility(new AngelsTrumpetTapEffect(), TargetController.ANY, false));
}
private AngelsTrumpet(final AngelsTrumpet card) {

View file

@ -37,7 +37,7 @@ public final class AvatarOfSlaughter extends CardImpl {
effect = new AttacksIfAbleAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES);
effect.setText("and attack each combat if able");
ability.addEffect(effect);
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}
private AvatarOfSlaughter(final AvatarOfSlaughter card) {

View file

@ -47,7 +47,6 @@ public final class Berserk extends CardImpl {
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addEffect(new BerserkDestroyEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
}

View file

@ -40,7 +40,7 @@ public final class ChargingCinderhorn extends CardImpl {
effect.setText("put a fury counter on {this}. Then {this} deals damage equal to the number of fury counters on it to that player");
BeginningOfEndStepTriggeredAbility ability
= new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY, new ChargingCinderhornCondition(), false);
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}
private ChargingCinderhorn(final ChargingCinderhorn card) {

View file

@ -43,7 +43,6 @@ public final class ErgRaiders extends CardImpl {
new BeginningOfEndStepTriggeredAbility(effect, TargetController.YOU, false),
new InvertCondition(AttackedThisTurnSourceCondition.instance),
"At the beginning of your end step, if {this} didn't attack this turn, {this} deals 2 damage to you unless it came under your control this turn.");
ability.addWatcher(new AttackedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -36,7 +36,6 @@ public final class FuryOfTheHorde extends CardImpl {
// Untap all creatures that attacked this turn. After this main phase, there is an additional combat phase followed by an additional main phase.
this.getSpellAbility().addEffect(new UntapAllThatAttackedEffect());
this.getSpellAbility().addEffect(new AddCombatAndMainPhaseEffect());
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
}

View file

@ -24,7 +24,7 @@ public final class GrandMelee extends CardImpl {
// All creatures attack each turn if able.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new AttacksIfAbleAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES));
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
// All creatures block each turn if able.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BlocksIfAbleAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES)));

View file

@ -32,7 +32,6 @@ public final class ImaginaryThreats extends CardImpl {
// Creatures target opponent controls attack this turn if able. During that player's next untap step, creatures they control don't untap.
getSpellAbility().addEffect(new ImaginaryThreatsEffect());
getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
getSpellAbility().addTarget(new TargetOpponent());
getSpellAbility().addEffect(new DontUntapInPlayersNextUntapStepAllEffect(new FilterCreaturePermanent())
.setText("During that player's next untap step, creatures they control don't untap"));

View file

@ -34,7 +34,6 @@ public final class InciteWar extends CardImpl {
// Choose one - Creatures target player controls attack this turn if able;
this.getSpellAbility().addEffect(new InciteWarMustAttackEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
// or creatures you control gain first strike until end of turn.
Mode mode = new Mode(new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES));

View file

@ -45,7 +45,6 @@ public final class InfernoHellion extends CardImpl {
+ "if {this} attacked or blocked this turn, "
+ "its owner shuffles it into their library."
);
ability.addWatcher(new AttackedThisTurnWatcher());
ability.addWatcher(new BlockedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -43,7 +43,6 @@ public final class Instigator extends CardImpl {
ability.addCost(new TapSourceCost());
ability.addCost(new DiscardCardCost());
ability.addTarget(new TargetPlayer());
ability.addWatcher(new AttackedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -50,7 +50,7 @@ public final class InstillFuror extends CardImpl {
"sacrifice this creature unless it attacked this turn"), TargetController.YOU, false);
Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA, Duration.WhileOnBattlefield);
effect.setText("Enchanted creature has \"At the beginning of your end step, sacrifice this creature unless it attacked this turn.\"");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect), new AttackedThisTurnWatcher());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -42,8 +42,7 @@ public final class Insubordination extends CardImpl {
new DamageAttachedControllerEffect(2),
TargetController.CONTROLLER_ATTACHED_TO),
DidNotAttackThisTurnEnchantedCondition.instance,
"At the beginning of the end step of enchanted creature's controller, {this} deals 2 damage to that player unless that creature attacked this turn."),
new AttackedThisTurnWatcher());
"At the beginning of the end step of enchanted creature's controller, {this} deals 2 damage to that player unless that creature attacked this turn."));
}
private Insubordination(final Insubordination card) {

View file

@ -40,7 +40,7 @@ public final class InvasionOfGobakhan extends CardImpl {
// When Invasion of Gobakhan enters the battlefield, look at target opponent's hand. You may exile a nonland card from it. For as long as that card remains exiled, its owner may play it. A spell cast this way costs {2} more to cast.
Ability ability = new EntersBattlefieldTriggeredAbility(new InvasionOfGobakhanEffect());
ability.addTarget(new TargetOpponent());
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}
private InvasionOfGobakhan(final InvasionOfGobakhan card) {

View file

@ -39,7 +39,6 @@ public final class KardurDoomscourge extends CardImpl {
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, Duration.UntilYourNextTurn
).setText("until your next turn, creatures your opponents control attack each combat if able"));
ability.addEffect(new KardurDoomscourgeEffect());
ability.addWatcher(new AttackedThisTurnWatcher());
this.addAbility(ability);
// Whenever an attacking creature dies, each opponent loses 1 life and you gain 1 life.

View file

@ -37,7 +37,7 @@ public final class KeldonTwilight extends CardImpl {
effect.setText("that player sacrifices a creature they controlled since the beginning of the turn");
BeginningOfEndStepTriggeredAbility ability
= new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY, new KeldonTwilightCondition(), false);
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}
private KeldonTwilight(final KeldonTwilight card) {

View file

@ -39,7 +39,6 @@ public final class Lurker extends CardImpl {
new CantBeTargetedSourceEffect(new FilterSpell(), Duration.WhileOnBattlefield),
new InvertCondition(new OrCondition(AttackedThisTurnSourceCondition.instance, BlockedThisTurnSourceCondition.instance)));
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect.setText("{this} can't be the target of spells unless it attacked or blocked this turn"));
ability.addWatcher(new AttackedThisTurnWatcher());
ability.addWatcher(new BlockedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -38,7 +38,6 @@ public final class MadDog extends CardImpl {
Ability ability = new ConditionalInterveningIfTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
new SacrificeSourceEffect(), TargetController.YOU, false), condition,
"At the beginning of your end step, if {this} didn't attack or come under your control this turn, sacrifice it");
ability.addWatcher(new AttackedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -56,7 +56,7 @@ public final class MaddeningImp extends CardImpl {
+ "At the beginning of the next end step, destroy each of those creatures that didn't attack this turn. "
+ "Activate only during an opponent's turn and only before combat.");
ability.addEffect(new MaddeningImpCreateDelayedTriggeredAbilityEffect());
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -50,7 +50,6 @@ public final class MetzaliTowerOfTriumph extends CardImpl {
// {2}{W}, {T}: Choose a creature at random that attacked this turn. Destroy that creature.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MetzaliTowerOfTriumphEffect(), new ManaCostsImpl<>("{2}{W}"));
ability.addCost(new TapSourceCost());
ability.addWatcher(new AttackedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -37,7 +37,7 @@ public final class MoraugFuryOfAkoum extends CardImpl {
this.toughness = new MageInt(6);
// Each creature you control gets +1/+0 for each time it has attacked this turn.
this.addAbility(new SimpleStaticAbility(new MoraugFuryOfAkoumBoostEffect()), new AttackedThisTurnWatcher());
this.addAbility(new SimpleStaticAbility(new MoraugFuryOfAkoumBoostEffect()));
// Landfall Whenever a land enters the battlefield under your control, if it's your main phase, there's an additional combat phase after this phase. At the beginning of that combat, untap all creatures you control.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(

View file

@ -54,7 +54,7 @@ public final class NettlingImp extends CardImpl {
+ "Activate only during an opponent's turn, before attackers are declared.");
ability.addEffect(new NettlingImpDelayedDestroyEffect());
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -69,7 +69,7 @@ public final class Norritt extends CardImpl {
+ "Activate only before attackers are declared.");
ability2.addEffect(new NorrittDelayedDestroyEffect());
ability2.addTarget(new TargetCreaturePermanent(filterCreature));
this.addAbility(ability2, new AttackedThisTurnWatcher());
this.addAbility(ability2);
}

View file

@ -49,7 +49,7 @@ public final class OracleEnVec extends CardImpl {
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new OracleEnVecEffect(), new TapSourceCost(), MyTurnCondition.instance);
ability.addTarget(new TargetOpponent());
ability.addHint(MyTurnHint.instance);
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}
private OracleEnVec(final OracleEnVec card) {

View file

@ -19,7 +19,6 @@ public final class RelentlessAssault extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{R}{R}");
// Untap all creatures that attacked this turn. After this main phase, there is an additional combat phase followed by an additional main phase.
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
this.getSpellAbility().addEffect(new UntapAllThatAttackedEffect());
this.getSpellAbility().addEffect(new AddCombatAndMainPhaseEffect());
}

View file

@ -71,7 +71,6 @@ public final class RidersOfTheMark extends CardImpl {
+ "1/1 white Human Soldier creature tokens equal to its toughness."
));
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
}
private RidersOfTheMark(final RidersOfTheMark card) {
@ -120,4 +119,4 @@ class RidersOfTheMarkEffect extends OneShotEffect {
return true;
}
}
}

View file

@ -52,7 +52,7 @@ public final class RobberOfTheRich extends CardImpl {
"if defending player has more cards in hand than you, exile the top card of their library. " +
"During any turn you attacked with a Rogue, you may cast that card and " +
"you may spend mana as though it were mana of any color to cast that spell."
).addHint(new ConditionHint(new RogueAttackedThisTurnCondition(null))), new AttackedThisTurnWatcher());
).addHint(new ConditionHint(new RogueAttackedThisTurnCondition(null))));
}
private RobberOfTheRich(final RobberOfTheRich card) {
@ -163,4 +163,3 @@ class RobberOfTheRichEffect extends OneShotEffect {
return false;
}
}

View file

@ -43,7 +43,6 @@ public final class SeasonOfTheWitch extends CardImpl {
// At the beginning of the end step, destroy all untapped creatures that didn't attack this turn, except for creatures that couldn't attack.
Ability ability = new BeginningOfEndStepTriggeredAbility(new SeasonOfTheWitchEffect(), TargetController.ANY, false);
ability.addWatcher(new AttackedThisTurnWatcher());
ability.addWatcher(new CouldAttackThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -42,7 +42,6 @@ public final class SirensCall extends CardImpl {
// At the beginning of the next end step, destroy all non-Wall creatures that player controls that didn't attack this turn. Ignore this effect for each creature the player didn't control continuously since the beginning of the turn.
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SirensCallDestroyEffect())));
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
}
private SirensCall(final SirensCall card) {

View file

@ -57,7 +57,7 @@ public final class TaigamOjutaiMaster extends CardImpl {
Ability ability = new ConditionalInterveningIfTriggeredAbility(new TaigamOjutaiMasterTriggeredAbility(),
AttackedThisTurnSourceCondition.instance,
effectText);
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}
private TaigamOjutaiMaster(final TaigamOjutaiMaster card) {

View file

@ -52,7 +52,7 @@ public final class TheFifthDoctor extends CardImpl {
TargetController.YOU, false
);
ability.addEffect(new UntapAllEffect(filter).setText("Untap those creatures"));
this.addAbility(ability.withFlavorWord("Peaceful Coexistence"), new AttackedThisTurnWatcher());
this.addAbility(ability.withFlavorWord("Peaceful Coexistence"));
}
private TheFifthDoctor(final TheFifthDoctor card) {
@ -72,4 +72,4 @@ enum TheFifthDoctorPredicate implements Predicate<Permanent> {
public boolean apply(Permanent input, Game game) {
return !game.getState().getWatcher(AttackedThisTurnWatcher.class).checkIfAttacked(input, game);
}
}
}

View file

@ -40,7 +40,6 @@ public final class VizierOfDeferment extends CardImpl {
// When Vizier of Deferment enters the battlefield, you may exile target creature if it attacked or blocked this turn. Return that card to the battlefield under its owner's control at the beginning of the next end step.
Ability ability = new EntersBattlefieldTriggeredAbility(new VizierOfDefermentEffect(), true);
ability.addTarget(new TargetCreaturePermanent());
ability.addWatcher(new AttackedThisTurnWatcher());
ability.addWatcher(new BlockedThisTurnWatcher());
this.addAbility(ability);
}

View file

@ -20,7 +20,6 @@ public final class WavesOfAggression extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R/W}{R/W}");
// Untap all creatures that attacked this turn. After this main phase, there is an additional combat phase followed by an additional main phase.
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
this.getSpellAbility().addEffect(new UntapAllThatAttackedEffect());
this.getSpellAbility().addEffect(new AddCombatAndMainPhaseEffect());
// Retrace

View file

@ -48,7 +48,7 @@ public final class WeddingAnnouncement extends CardImpl {
new SourceHasCounterCondition(CounterType.INVITATION, 3),
"Then if {this} has three or more invitation counters on it, transform it"
));
this.addAbility(ability, new AttackedThisTurnWatcher());
this.addAbility(ability);
}
private WeddingAnnouncement(final WeddingAnnouncement card) {

View file

@ -32,7 +32,7 @@ public final class WorldAtWar extends CardImpl {
this.getSpellAbility().addEffect(new WorldAtWarEffect());
// Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
this.addAbility(new ReboundAbility(), new AttackedThisTurnWatcher());
this.addAbility(new ReboundAbility());
}
private WorldAtWar(final WorldAtWar card) {

View file

@ -17,7 +17,6 @@ public class AttacksFirstTimeTriggeredAbility extends TriggeredAbilityImpl {
public AttacksFirstTimeTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
this.addWatcher(new AttackedThisTurnWatcher());
setTriggerPhrase("Whenever {this} attacks for the first time each turn, ");
}

View file

@ -28,7 +28,6 @@ public class BoastAbility extends ActivatedAbilityImpl {
public BoastAbility(Effect effect, Cost cost) {
super(Zone.BATTLEFIELD, effect, cost);
this.maxActivationsPerTurn = 1;
this.addWatcher(new AttackedThisTurnWatcher());
this.condition = BoastCondition.instance;
this.addHint(BoastHint.instance);
}