From 806eba969130af5a001df344b73ad8b327fb0313 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 27 Jul 2021 09:59:57 -0400 Subject: [PATCH] [AFR] fixed Bruenor Battlehammer (fixes #8055) --- .../src/mage/cards/b/BruenorBattlehammer.java | 13 ++-- .../single/afr/BruenorBattlehammerTest.java | 60 +++++++++++++++++++ 2 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/afr/BruenorBattlehammerTest.java diff --git a/Mage.Sets/src/mage/cards/b/BruenorBattlehammer.java b/Mage.Sets/src/mage/cards/b/BruenorBattlehammer.java index 57a806918d..c2751114a2 100644 --- a/Mage.Sets/src/mage/cards/b/BruenorBattlehammer.java +++ b/Mage.Sets/src/mage/cards/b/BruenorBattlehammer.java @@ -21,8 +21,6 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -import static mage.constants.Outcome.Benefit; - /** * @author TheElk801 */ @@ -91,7 +89,7 @@ class BruenorBattlehammerBoostEffect extends ContinuousEffectImpl { class BruenorBattlehammerCostEffect extends CostModificationEffectImpl { BruenorBattlehammerCostEffect() { - super(Duration.Custom, Benefit, CostModificationType.SET_COST); + super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.SET_COST); this.staticText = "you may pay {0} rather than pay the equip cost " + "of the first equip ability you activate each turn."; } @@ -102,16 +100,13 @@ class BruenorBattlehammerCostEffect extends CostModificationEffectImpl { @Override public boolean applies(Ability abilityToModify, Ability source, Game game) { - return source.isControlledBy(abilityToModify.getControllerId()) - && !BruenorBattlehammerWatcher.checkPlayer(abilityToModify.getControllerId(), game) - && abilityToModify instanceof EquipAbility; + return abilityToModify instanceof EquipAbility + && source.isControlledBy(abilityToModify.getControllerId()) + && !BruenorBattlehammerWatcher.checkPlayer(abilityToModify.getControllerId(), game); } @Override public boolean apply(Game game, Ability source, Ability abilityToModify) { - if (!game.inCheckPlayableState()) { - return false; - } Player controller = game.getPlayer(abilityToModify.getControllerId()); if (controller == null || !controller.chooseUse( Outcome.PlayForFree, "Pay {0} to equip?", source, game diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/afr/BruenorBattlehammerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/afr/BruenorBattlehammerTest.java new file mode 100644 index 0000000000..fab9ac5bef --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/afr/BruenorBattlehammerTest.java @@ -0,0 +1,60 @@ +package org.mage.test.cards.single.afr; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author TheElk801 + */ +public class BruenorBattlehammerTest extends CardTestPlayerBase { + + private static final String bruenor = "Bruenor Battlehammer"; + private static final String lion = "Silvercoat Lion"; + private static final String bonesplitter = "Bonesplitter"; + private static final String morningstar = "Vulshok Morningstar"; + private static final String hauberk = "Demonmail Hauberk"; + + @Test + public void testModifyOnce() { + addCard(Zone.BATTLEFIELD, playerA, "Plains"); + addCard(Zone.BATTLEFIELD, playerA, lion); + addCard(Zone.BATTLEFIELD, playerA, bruenor); + addCard(Zone.BATTLEFIELD, playerA, bonesplitter); + addCard(Zone.BATTLEFIELD, playerA, morningstar); + + setChoice(playerA, true); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}", lion); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {1}", lion); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertTapped("Plains", true); + assertPermanentCount(playerA, bruenor, 1); + assertPermanentCount(playerA, bonesplitter, 1); + assertPermanentCount(playerA, morningstar, 1); + // +2 from each equipment, +2x2 from Bruenor + assertPowerToughness(playerA, lion, 2 + 2 + 2 + (2 * 2), 2 + 2); + } + + @Test + public void testHauberk() { + addCard(Zone.BATTLEFIELD, playerA, lion); + addCard(Zone.BATTLEFIELD, playerA, bruenor); + addCard(Zone.BATTLEFIELD, playerA, hauberk); + + setChoice(playerA, true); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", lion); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + setStopAt(1, PhaseStep.END_TURN); + assertPermanentCount(playerA, bruenor, 1); + assertPowerToughness(playerA, lion, 2 + 4 + (1 * 2), 2 + 2); + } +}