[AFR] fixed Bruenor Battlehammer (fixes #8055)

This commit is contained in:
Evan Kranzler 2021-07-27 09:59:57 -04:00
parent 9233b5c7d7
commit 806eba9691
2 changed files with 64 additions and 9 deletions

View file

@ -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

View file

@ -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);
}
}