[ACR] Implement Overpowering Attack (#13398)

* [ACR] Implement Overpowering Attack

* Replaced UntapAllThatAttackedEffect with filtered UntapAllEffect

* Add MyTurnCondition to Overpowering Attack
This commit is contained in:
Balázs Kristóf 2025-03-14 01:51:59 +01:00 committed by GitHub
parent 8267d7d770
commit cd8cb6afe5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 102 additions and 59 deletions

View file

@ -6,14 +6,15 @@ import mage.ObjectColor;
import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.costs.common.ExileFromHandCost;
import mage.abilities.effects.common.AddCombatAndMainPhaseEffect;
import mage.abilities.effects.common.UntapAllThatAttackedEffect;
import mage.abilities.effects.common.UntapAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.permanent.AttackedThisTurnPredicate;
import mage.target.common.TargetCardInHand;
import mage.watchers.common.AttackedThisTurnWatcher;
/**
*
@ -22,9 +23,11 @@ import mage.watchers.common.AttackedThisTurnWatcher;
public final class FuryOfTheHorde extends CardImpl {
private static final FilterCard filter = new FilterCard("red cards");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creatures that attacked this turn");
static {
filter.add(new ColorPredicate(ObjectColor.RED));
filter2.add(AttackedThisTurnPredicate.instance);
}
public FuryOfTheHorde(UUID ownerId, CardSetInfo setInfo) {
@ -34,7 +37,7 @@ public final class FuryOfTheHorde extends CardImpl {
this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(2, filter))));
// 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 UntapAllEffect(filter2));
this.getSpellAbility().addEffect(new AddCombatAndMainPhaseEffect());
}

View file

@ -0,0 +1,48 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.AddCombatAndMainPhaseEffect;
import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.abilities.keyword.FreerunningAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AttackedThisTurnPredicate;
/**
*
* @author balazskristof
*/
public final class OverpoweringAttack extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(AttackedThisTurnPredicate.instance);
}
public OverpoweringAttack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}{R}");
// Freerunning {2}{R}
this.addAbility(new FreerunningAbility("{2}{R}"));
// Untap all creatures you control that attacked this turn. If it's your main phase, there is an additional combat phase after this phase, followed by an additional main phase.
this.getSpellAbility().addEffect(new UntapAllControllerEffect(filter, "untap all creatures you control that attacked this turn"));
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new AddCombatAndMainPhaseEffect(), MyTurnCondition.instance, "If it's your main phase, there is an additional combat phase after this phase, followed by an additional main phase."));
}
private OverpoweringAttack(final OverpoweringAttack card) {
super(card);
}
@Override
public OverpoweringAttack copy() {
return new OverpoweringAttack(this);
}
}

View file

@ -3,11 +3,12 @@ package mage.cards.r;
import java.util.UUID;
import mage.abilities.effects.common.AddCombatAndMainPhaseEffect;
import mage.abilities.effects.common.UntapAllThatAttackedEffect;
import mage.abilities.effects.common.UntapAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.watchers.common.AttackedThisTurnWatcher;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AttackedThisTurnPredicate;
/**
*
@ -15,11 +16,17 @@ import mage.watchers.common.AttackedThisTurnWatcher;
*/
public final class RelentlessAssault extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures that attacked this turn");
static {
filter.add(AttackedThisTurnPredicate.instance);
}
public RelentlessAssault(UUID ownerId, CardSetInfo setInfo) {
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().addEffect(new UntapAllThatAttackedEffect());
this.getSpellAbility().addEffect(new UntapAllEffect(filter));
this.getSpellAbility().addEffect(new AddCombatAndMainPhaseEffect());
}

View file

@ -2,13 +2,15 @@
package mage.cards.w;
import java.util.UUID;
import mage.abilities.effects.common.AddCombatAndMainPhaseEffect;
import mage.abilities.effects.common.UntapAllThatAttackedEffect;
import mage.abilities.effects.common.UntapAllEffect;
import mage.abilities.keyword.RetraceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.watchers.common.AttackedThisTurnWatcher;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AttackedThisTurnPredicate;
/**
*
@ -16,11 +18,17 @@ import mage.watchers.common.AttackedThisTurnWatcher;
*/
public final class WavesOfAggression extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures that attacked this turn");
static {
filter.add(AttackedThisTurnPredicate.instance);
}
public WavesOfAggression(UUID ownerId, CardSetInfo setInfo) {
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().addEffect(new UntapAllThatAttackedEffect());
this.getSpellAbility().addEffect(new UntapAllEffect(filter));
this.getSpellAbility().addEffect(new AddCombatAndMainPhaseEffect());
// Retrace
this.addAbility(new RetraceAbility(this));

View file

@ -221,8 +221,8 @@ public final class AssassinsCreed extends ExpansionSet {
cards.add(new SetCardInfo("Murder", 92, Rarity.UNCOMMON, mage.cards.m.Murder.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Nurturing Peatland", 114, Rarity.RARE, mage.cards.n.NurturingPeatland.class));
cards.add(new SetCardInfo("Origin of the Hidden Ones", 36, Rarity.UNCOMMON, mage.cards.o.OriginOfTheHiddenOnes.class));
//cards.add(new SetCardInfo("Overpowering Attack", 218, Rarity.UNCOMMON, mage.cards.o.OverpoweringAttack.class, NON_FULL_USE_VARIOUS));
//cards.add(new SetCardInfo("Overpowering Attack", 37, Rarity.UNCOMMON, mage.cards.o.OverpoweringAttack.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Overpowering Attack", 218, Rarity.UNCOMMON, mage.cards.o.OverpoweringAttack.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Overpowering Attack", 37, Rarity.UNCOMMON, mage.cards.o.OverpoweringAttack.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Palazzo Archers", 222, Rarity.UNCOMMON, mage.cards.p.PalazzoArchers.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Palazzo Archers", 42, Rarity.UNCOMMON, mage.cards.p.PalazzoArchers.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Path to Exile", 178, Rarity.UNCOMMON, mage.cards.p.PathToExile.class, NON_FULL_USE_VARIOUS));

View file

@ -1,48 +0,0 @@
package mage.abilities.effects.common;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.AttackedThisTurnWatcher;
import java.util.Set;
/**
* @author LevelX2
*/
public class UntapAllThatAttackedEffect extends OneShotEffect {
public UntapAllThatAttackedEffect() {
super(Outcome.Benefit);
staticText = "Untap all creatures that attacked this turn";
}
protected UntapAllThatAttackedEffect(final UntapAllThatAttackedEffect effect) {
super(effect);
}
@Override
public UntapAllThatAttackedEffect copy() {
return new UntapAllThatAttackedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
if (watcher != null) {
Set<MageObjectReference> attackedThisTurn = watcher.getAttackedThisTurnCreatures();
for (MageObjectReference mor : attackedThisTurn) {
Permanent permanent = mor.getPermanent(game);
if (permanent != null && permanent.isCreature(game)) {
permanent.untap(game);
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,25 @@
package mage.filter.predicate.permanent;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.AttackedThisTurnWatcher;
/**
*
* @author balazskristof
*/
public enum AttackedThisTurnPredicate implements Predicate<Permanent> {
instance;
@Override
public boolean apply(Permanent input, Game game) {
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
return watcher != null && watcher.checkIfAttacked(input, game);
}
@Override
public String toString() {
return "attacked this turn";
}
}