diff --git a/Mage.Sets/src/mage/cards/f/FuryOfTheHorde.java b/Mage.Sets/src/mage/cards/f/FuryOfTheHorde.java index 7be92336414..3679df4841b 100644 --- a/Mage.Sets/src/mage/cards/f/FuryOfTheHorde.java +++ b/Mage.Sets/src/mage/cards/f/FuryOfTheHorde.java @@ -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()); } diff --git a/Mage.Sets/src/mage/cards/o/OverpoweringAttack.java b/Mage.Sets/src/mage/cards/o/OverpoweringAttack.java new file mode 100644 index 00000000000..a5e8544e9b1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OverpoweringAttack.java @@ -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); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/r/RelentlessAssault.java b/Mage.Sets/src/mage/cards/r/RelentlessAssault.java index f4ed42f3842..3653960e528 100644 --- a/Mage.Sets/src/mage/cards/r/RelentlessAssault.java +++ b/Mage.Sets/src/mage/cards/r/RelentlessAssault.java @@ -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()); } diff --git a/Mage.Sets/src/mage/cards/w/WavesOfAggression.java b/Mage.Sets/src/mage/cards/w/WavesOfAggression.java index 96a8dac9fec..42c836e8edd 100644 --- a/Mage.Sets/src/mage/cards/w/WavesOfAggression.java +++ b/Mage.Sets/src/mage/cards/w/WavesOfAggression.java @@ -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)); diff --git a/Mage.Sets/src/mage/sets/AssassinsCreed.java b/Mage.Sets/src/mage/sets/AssassinsCreed.java index 5897aac8c14..63b30bf8a39 100644 --- a/Mage.Sets/src/mage/sets/AssassinsCreed.java +++ b/Mage.Sets/src/mage/sets/AssassinsCreed.java @@ -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)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/UntapAllThatAttackedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/UntapAllThatAttackedEffect.java deleted file mode 100644 index 3070c20ed70..00000000000 --- a/Mage/src/main/java/mage/abilities/effects/common/UntapAllThatAttackedEffect.java +++ /dev/null @@ -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 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; - } - -} diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/AttackedThisTurnPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/AttackedThisTurnPredicate.java new file mode 100644 index 00000000000..6ad6e8aadb6 --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/permanent/AttackedThisTurnPredicate.java @@ -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 { + 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"; + } +}