From 827ffb5fb247dd13bba2903ff132ec33b4c803e7 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 29 Sep 2020 18:55:51 -0400 Subject: [PATCH] changed how effects are applied for triggered abilities, added test (fixes #7083) --- .../single/m21/HoodedBlightfangTest.java | 24 +++++++++++++++++++ ...cksCreatureYouControlTriggeredAbility.java | 2 +- .../main/java/mage/game/combat/Combat.java | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/m21/HoodedBlightfangTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/m21/HoodedBlightfangTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/m21/HoodedBlightfangTest.java new file mode 100644 index 0000000000..9180aa4901 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/m21/HoodedBlightfangTest.java @@ -0,0 +1,24 @@ +package org.mage.test.cards.single.m21; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +public class HoodedBlightfangTest extends CardTestPlayerBase { + + @Test + public void testBowOfNylea() { + addCard(Zone.BATTLEFIELD, playerA, "Hooded Blightfang"); + addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin"); + addCard(Zone.BATTLEFIELD, playerA, "Bow of Nylea"); + + attack(1, playerA, "Raging Goblin"); + setStopAt(2, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertLife(playerA, 20 + 1); + assertLife(playerB, 20 - 1 - 1); + } +} diff --git a/Mage/src/main/java/mage/abilities/common/AttacksCreatureYouControlTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/AttacksCreatureYouControlTriggeredAbility.java index 466c8579b7..1a5e985641 100644 --- a/Mage/src/main/java/mage/abilities/common/AttacksCreatureYouControlTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/AttacksCreatureYouControlTriggeredAbility.java @@ -44,6 +44,7 @@ public class AttacksCreatureYouControlTriggeredAbility extends TriggeredAbilityI super(ability); this.filter = ability.filter; this.setTargetPointer = ability.setTargetPointer; + this.once = ability.once; } public void setOnce(boolean once) { @@ -57,7 +58,6 @@ public class AttacksCreatureYouControlTriggeredAbility extends TriggeredAbilityI @Override public boolean checkTrigger(GameEvent event, Game game) { - game.applyEffects(); // Hooded Blightfang Permanent sourcePermanent = game.getPermanent(event.getSourceId()); if (sourcePermanent != null && filter.match(sourcePermanent, sourceId, controllerId, game)) { if (setTargetPointer) { diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index 977b0f44c1..bbb822a9dd 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -275,6 +275,7 @@ public class Combat implements Serializable, Copyable { attackingPermanent.tap(true, game); // to tap with event finally here is needed to prevent abusing of Vampire Envoy like cards } } + game.applyEffects(); handleBanding(attacker, game); // This can only be used to modify the event, the attack can't be replaced here game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ATTACKER_DECLARED, group.defenderId, attacker, attackingPlayerId));