mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Merge pull request #1634 from drmDev/master
Test for Breaker of Armies with Menace, reported bug.
This commit is contained in:
commit
57a316cfc6
3 changed files with 45 additions and 8 deletions
|
@ -29,6 +29,7 @@ package org.mage.test.cards.requirement;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
@ -178,9 +179,45 @@ public class BlockRequirementTest extends CardTestPlayerBase {
|
||||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
// Hill giant is still alive and Played B looses 3 lives
|
// Hill giant is still alive and Played B loses 3 lives
|
||||||
assertPermanentCount(playerA, "Hill Giant", 1);
|
assertPermanentCount(playerA, "Hill Giant", 1);
|
||||||
assertLife(playerB, 17);
|
assertLife(playerB, 17);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reported bug:
|
||||||
|
* When Breaker of Armies is granted Menace and there is only 1 valid blocker, the game enters a state
|
||||||
|
* that cannot be continued. He must be blocked by all creatures that are able, however, with menace
|
||||||
|
* the only valid blocks would be by more than one creature, so the expected behavior is no blocks can be made.
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
@Test
|
||||||
|
public void testBreakerOfArmiesWithMenace() {
|
||||||
|
|
||||||
|
// {8}
|
||||||
|
// All creatures able to block Breaker of Armies do so.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Breaker of Armies", 1); // 10/8
|
||||||
|
|
||||||
|
// 3/3 Vanilla creature
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant", 1);
|
||||||
|
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 8);
|
||||||
|
// {2}{B} Enchanted creature gets +2/+1 and has menace.
|
||||||
|
addCard(Zone.HAND, playerA, "Untamed Hunger", 1);
|
||||||
|
castSpell(1,PhaseStep.PRECOMBAT_MAIN, playerA, "Untamed Hunger", "Breaker of Armies");
|
||||||
|
|
||||||
|
attack(1, playerA, "Breaker of Armies");
|
||||||
|
|
||||||
|
// not allowed due to Breaker of Armies having menace
|
||||||
|
block(1, playerB, "Hill Giant", "Breaker of Armies");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
// Hill giant is still alive
|
||||||
|
assertPermanentCount(playerA, "Hill Giant", 1);
|
||||||
|
// Player B was unable to block, so goes down to 10 life
|
||||||
|
assertLife(playerB, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,21 +38,21 @@ import mage.game.Game;
|
||||||
public class MultipliedValue implements DynamicValue {
|
public class MultipliedValue implements DynamicValue {
|
||||||
|
|
||||||
private final DynamicValue value;
|
private final DynamicValue value;
|
||||||
private final int multiplier;
|
private final int multplier; // should be renamed to multiplier but don't want to break your stuff
|
||||||
|
|
||||||
public MultipliedValue(DynamicValue value, int multiplier) {
|
public MultipliedValue(DynamicValue value, int multiplier) {
|
||||||
this.value = value.copy();
|
this.value = value.copy();
|
||||||
this.multiplier = multiplier;
|
this.multplier = multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
MultipliedValue(final MultipliedValue dynamicValue) {
|
MultipliedValue(final MultipliedValue dynamicValue) {
|
||||||
this.value = dynamicValue.value.copy();
|
this.value = dynamicValue.value.copy();
|
||||||
this.multiplier = dynamicValue.multiplier;
|
this.multplier = dynamicValue.multplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
return multiplier * value.calculate(game, sourceAbility, effect);
|
return multplier * value.calculate(game, sourceAbility, effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,10 +63,10 @@ public class MultipliedValue implements DynamicValue {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (multiplier == 2) {
|
if (multplier == 2) {
|
||||||
sb.append("twice ");
|
sb.append("twice ");
|
||||||
} else {
|
} else {
|
||||||
sb.append(multiplier).append(" * ");
|
sb.append(multplier).append(" * ");
|
||||||
}
|
}
|
||||||
return sb.append(value.toString()).toString();
|
return sb.append(value.toString()).toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class BlockedCreatureCount implements DynamicValue {
|
||||||
|
|
||||||
public BlockedCreatureCount(String message, boolean beyondTheFirst) {
|
public BlockedCreatureCount(String message, boolean beyondTheFirst) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.beyondTheFirst = beyondTheFirst;
|
//this.beyondTheFirst = beyondTheFirst; this was never set in the original, so not setting here just in case ??
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockedCreatureCount(final BlockedCreatureCount dynamicValue) {
|
public BlockedCreatureCount(final BlockedCreatureCount dynamicValue) {
|
||||||
|
|
Loading…
Reference in a new issue