diff --git a/Mage.Sets/src/mage/cards/f/FaramirPrinceOfIthilien.java b/Mage.Sets/src/mage/cards/f/FaramirPrinceOfIthilien.java index 7484036a920..b930af0a933 100644 --- a/Mage.Sets/src/mage/cards/f/FaramirPrinceOfIthilien.java +++ b/Mage.Sets/src/mage/cards/f/FaramirPrinceOfIthilien.java @@ -2,6 +2,7 @@ package mage.cards.f; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; import mage.abilities.common.delayed.AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility; import mage.abilities.effects.Effect; @@ -40,8 +41,7 @@ public final class FaramirPrinceOfIthilien extends CardImpl { this.toughness = new MageInt(3); // At the beginning of your end step, choose an opponent. - // At the beginning of that player's next end step, - // you draw a card if they didn't attack you that turn. + // At the beginning of that player's next end step, you draw a card if they didn't attack you that turn. // Otherwise, create three 1/1 white Human Soldier creature tokens. this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new FaramirPrinceOfIthilienEffect(), false)); } @@ -92,11 +92,12 @@ class FaramirPrinceOfIthilienEffect extends OneShotEffect { Effect effect = new FaramirPrinceOfIthilienDelayedEffect(); effect.setTargetPointer(new FixedTarget(opponent.getId(), game)); - game.addDelayedTriggeredAbility( - new AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility( + DelayedTriggeredAbility delayed = new AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility( effect, opponent.getId() - ), source); + ); + delayed.addWatcher(new PlayersAttackedThisTurnWatcher()); + game.addDelayedTriggeredAbility(delayed, source); return true; } @@ -123,7 +124,7 @@ class FaramirPrinceOfIthilienDelayedEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { PlayersAttackedThisTurnWatcher watcher = game.getState().getWatcher(PlayersAttackedThisTurnWatcher.class); - if(watcher == null){ + if (watcher == null) { return false; } @@ -131,14 +132,14 @@ class FaramirPrinceOfIthilienDelayedEffect extends OneShotEffect { UUID targetId = getTargetPointer().getFirst(game, source); Player controller = game.getPlayer(controllerId); - if(controller == null){ + if (controller == null) { return false; } - if(watcher.hasPlayerAttackedPlayer(targetId, controllerId)){ + if (watcher.hasPlayerAttackedPlayer(targetId, controllerId)) { return new CreateTokenEffect(new HumanSoldierToken(), 3).apply(game, source); } else { return new DrawCardSourceControllerEffect(1).apply(game, source); } } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/m/MilitantAngel.java b/Mage.Sets/src/mage/cards/m/MilitantAngel.java index 31604e0b2b2..17092af0f46 100644 --- a/Mage.Sets/src/mage/cards/m/MilitantAngel.java +++ b/Mage.Sets/src/mage/cards/m/MilitantAngel.java @@ -12,6 +12,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.game.permanent.token.KnightToken; +import mage.watchers.common.PlayersAttackedThisTurnWatcher; import java.util.UUID; @@ -35,7 +36,7 @@ public final class MilitantAngel extends CardImpl { // When Militant Angel enters the battlefield, create a number of 2/2 white Knight creature tokens with vigilance equal to the number of opponents you attacked this turn. Effect effect = new CreateTokenEffect(new KnightToken(), AttackedThisTurnOpponentsCount.instance); effect.setText("create a number of 2/2 white Knight creature tokens with vigilance equal to the number of opponents you attacked this turn"); - this.addAbility(new EntersBattlefieldTriggeredAbility(effect)); + this.addAbility(new EntersBattlefieldTriggeredAbility(effect), new PlayersAttackedThisTurnWatcher()); } private MilitantAngel(final MilitantAngel card) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/gnt/MilitantAngelTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/gnt/MilitantAngelTest.java index f686297194f..bee291ef3e6 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/gnt/MilitantAngelTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/gnt/MilitantAngelTest.java @@ -25,7 +25,7 @@ public class MilitantAngelTest extends CardTestCommander4Players { // it's testing counter only (no need to test card -- it's same) // When Militant Angel enters the battlefield, create a number of 2/2 white Knight creature tokens // with vigilance equal to the number of opponents you attacked this turn. - //addCard(Zone.BATTLEFIELD, playerA, "Militant Angel", 2); + addCard(Zone.HAND, playerA, "Militant Angel", 1); // to add watcher addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1); addCard(Zone.BATTLEFIELD, playerA, "Kitesail Corsair", 1); diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttackedThisTurnOpponentsCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttackedThisTurnOpponentsCount.java index 2435fda94a7..dd177feaf48 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttackedThisTurnOpponentsCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttackedThisTurnOpponentsCount.java @@ -8,6 +8,8 @@ import mage.game.Game; import mage.watchers.common.PlayersAttackedThisTurnWatcher; /** + * Remember to add PlayersAttackedThisTurnWatcher to card init + * * @author JayDi85 */ public enum AttackedThisTurnOpponentsCount implements DynamicValue { diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 0b71172942e..7d3aad0b462 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1342,7 +1342,6 @@ public abstract class GameImpl implements Game { newWatchers.add(new DamageDoneWatcher()); // TODO: no need to be default watcher newWatchers.add(new PlanarRollWatcher()); // TODO: no need to be default watcher newWatchers.add(new AttackedThisTurnWatcher()); - newWatchers.add(new PlayersAttackedThisTurnWatcher()); // TODO: no need to be default watcher newWatchers.add(new CardsDrawnThisTurnWatcher()); newWatchers.add(new ManaSpentToCastWatcher()); newWatchers.add(new ManaPaidSourceWatcher());