diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/requirement/BlockRequirementTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/requirement/BlockRequirementTest.java index 6797cdc95a5..3fca8549681 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/requirement/BlockRequirementTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/requirement/BlockRequirementTest.java @@ -112,4 +112,48 @@ public class BlockRequirementTest extends CardTestPlayerBase { assertGraveyardCount(playerA, "Bog Wraith", 1); } + /** + * Elemental Uprising - "it must be blocked this turn if able", not working + * + * The bug just happened for me today as well - the problem is "must be + * blocked" is not being enforced correctly. During opponent's main phase he + * casted Elemental Uprising targeting an untapped land. He attacked with + * two creatures, I had one creature to block with, and did not block the + * land-creature targeted by Elemental Uprising. Instead I blocked a 2/2 of + * his with my 2/3. I should have been forced to block the land targeted by + * Elemental Uprising. + */ + @Test + public void testElementalUprising() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2 + // Target land you control becomes a 4/4 Elemental creature with haste until end of turn. It's still a land. It must be blocked this turn if able. + addCard(Zone.HAND, playerA, "Elemental Uprising"); + + addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox"); // 2/4 + + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}"); + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Elemental Uprising", "Mountain"); + + // Silvercoat Lion has not to block because it has to pay {3} to block + attack(1, playerA, "Mountain"); + attack(1, playerA, "Silvercoat Lion"); + block(1, playerB, "Pillarfield Ox", "Silvercoat Lion"); // Not allowed, the Mountain has to be blocked + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertGraveyardCount(playerA, "Elemental Uprising", 1); + assertPowerToughness(playerA, "Mountain", 4, 4); + + assertPermanentCount(playerA, "Silvercoat Lion", 1); + assertGraveyardCount(playerB, "Pillarfield Ox", 1); + + assertLife(playerB, 18); + + } } diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index aa6c20c20ff..6777d5384e6 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -740,7 +740,8 @@ public class Combat implements Serializable, Copyable { for (UUID possibleBlockerId : mustBeBlockedByAtLeastOne.get(toBeBlockedCreatureId)) { String blockRequiredMessage = isCreatureDoingARequiredBlock(possibleBlockerId, mustBeBlockedByAtLeastOne, game); if (blockRequiredMessage != null) { // message means not required - game.informPlayer(controller, blockRequiredMessage + "It's a requirement to block " + toBeBlockedCreature.getIdName()); + removeBlocker(possibleBlockerId, game); + game.informPlayer(controller, blockRequiredMessage + " Existing block removed. It's a requirement to block " + toBeBlockedCreature.getIdName() + "."); return false; } } @@ -755,6 +756,9 @@ public class Combat implements Serializable, Copyable { Permanent possibleBlocker = game.getPermanent(possibleBlockerId); Player defender = game.getPlayer(possibleBlocker.getControllerId()); if (defender != null) { + if (possibleBlocker.getBlocking() > 0) { + removeBlocker(possibleBlockerId, game); + } defender.declareBlocker(defender.getId(), possibleBlockerId, toBeBlockedCreatureId, game); } break; @@ -873,6 +877,9 @@ public class Combat implements Serializable, Copyable { Permanent blockedAttacker = game.getPermanent(blockedAttackerId); return possibleBlocker.getIdName() + " blocks with other creatures " + blockedAttacker.getIdName() + ", which has to be blocked by only one creature. "; } + // The possible blocker blocks an attacker for that is no attack forced + Permanent blockedAttacker = game.getPermanent(blockedAttackerId); + return possibleBlocker.getIdName() + " blocks " + blockedAttacker.getIdName() + ", which not has to be blocked as a requirement."; } } }