mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
[AFR] fixed Bruenor Battlehammer - correct tests, getPlayable support, additional info in choose pay dialog;
This commit is contained in:
parent
806eba9691
commit
c4dc83dec9
2 changed files with 25 additions and 9 deletions
|
@ -107,17 +107,29 @@ class BruenorBattlehammerCostEffect extends CostModificationEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||||
|
boolean applyReduce = false;
|
||||||
|
if (game.inCheckPlayableState()) {
|
||||||
|
// getPlayable use - apply all the time
|
||||||
|
applyReduce = true;
|
||||||
|
} else {
|
||||||
|
// real use - ask the player
|
||||||
Player controller = game.getPlayer(abilityToModify.getControllerId());
|
Player controller = game.getPlayer(abilityToModify.getControllerId());
|
||||||
if (controller == null || !controller.chooseUse(
|
if (controller != null
|
||||||
Outcome.PlayForFree, "Pay {0} to equip?", source, game
|
&& controller.chooseUse(Outcome.PlayForFree,
|
||||||
)) {
|
String.format("Pay {0} to equip instead %s?", abilityToModify.getManaCostsToPay().getText()), source, game)) {
|
||||||
return false;
|
applyReduce = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (applyReduce) {
|
||||||
abilityToModify.getCosts().clear();
|
abilityToModify.getCosts().clear();
|
||||||
abilityToModify.getManaCostsToPay().clear();
|
abilityToModify.getManaCostsToPay().clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BruenorBattlehammerCostEffect copy() {
|
public BruenorBattlehammerCostEffect copy() {
|
||||||
return new BruenorBattlehammerCostEffect(this);
|
return new BruenorBattlehammerCostEffect(this);
|
||||||
|
|
|
@ -24,10 +24,13 @@ public class BruenorBattlehammerTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, bonesplitter);
|
addCard(Zone.BATTLEFIELD, playerA, bonesplitter);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, morningstar);
|
addCard(Zone.BATTLEFIELD, playerA, morningstar);
|
||||||
|
|
||||||
setChoice(playerA, true);
|
// activate {2} for free
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}", lion);
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}", lion);
|
||||||
|
setChoice(playerA, true); // use for free
|
||||||
|
// activate {1} for mana
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {1}", lion);
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {1}", lion);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
assertAllCommandsUsed();
|
assertAllCommandsUsed();
|
||||||
|
@ -49,6 +52,7 @@ public class BruenorBattlehammerTest extends CardTestPlayerBase {
|
||||||
setChoice(playerA, true);
|
setChoice(playerA, true);
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", lion);
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", lion);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
assertAllCommandsUsed();
|
assertAllCommandsUsed();
|
||||||
|
|
Loading…
Reference in a new issue