mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
* Turntimber Basilisk - Fix a bug when a creature that must be blocked is not attacking
This commit is contained in:
parent
d94a2712ba
commit
b9add2e041
2 changed files with 34 additions and 0 deletions
|
@ -298,4 +298,33 @@ public class AttackBlockRestrictionsTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerB, "Walking Corpse", 1);
|
||||
assertPermanentCount(playerB, "Llanowar Elves", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reproduces a bug when a creature that must be blocked is not attacking
|
||||
*/
|
||||
@Test
|
||||
public void testTurntimberBasilisk() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Turntimber Basilisk");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
|
||||
addCard(Zone.HAND, playerA, "Forest");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Storm Crow");
|
||||
|
||||
playLand(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest");
|
||||
addTarget(playerA, "Storm Crow");
|
||||
|
||||
attack(3, playerA, "Grizzly Bears");
|
||||
block(3, playerB, "Storm Crow", "Grizzly Bears");
|
||||
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Turntimber Basilisk", 1);
|
||||
assertPermanentCount(playerA, "Grizzly Bears", 1);
|
||||
assertPermanentCount(playerB, "Storm Crow", 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -538,6 +538,11 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
UUID attackingCreatureId = requirementEntry.getKey().mustBlockAttacker(ability, game);
|
||||
Player defender = game.getPlayer(possibleBlocker.getControllerId());
|
||||
if (attackingCreatureId != null && defender != null && possibleBlocker.canBlock(attackingCreatureId, game)) {
|
||||
Permanent attackingCreature = game.getPermanent(attackingCreatureId);
|
||||
if (attackingCreature == null || !attackingCreature.isAttacking()) {
|
||||
// creature that must be blocked is not attacking
|
||||
continue;
|
||||
}
|
||||
// check if the possible blocker has to pay cost to block, if so don't force
|
||||
if (game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects(
|
||||
GameEvent.getEvent(GameEvent.EventType.DECLARE_BLOCKER, attackingCreatureId, possibleBlocker.getId(), possibleBlocker.getControllerId()), game)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue