From 707358f875c6e8d64b4118dc02d3f767ad3fad7d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 29 Sep 2015 00:36:08 +0200 Subject: [PATCH] Fixed a bug that effects forcing creatures to block an attacker forced also creatures of players not attacked (multiplayer games) to block, locking the game UI. --- Mage/src/mage/game/combat/Combat.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Mage/src/mage/game/combat/Combat.java b/Mage/src/mage/game/combat/Combat.java index d8d815e94e..b07f052ff3 100644 --- a/Mage/src/mage/game/combat/Combat.java +++ b/Mage/src/mage/game/combat/Combat.java @@ -525,6 +525,10 @@ public class Combat implements Serializable, Copyable { // has cost to block to pay so remove this attacker continue; } + if (!getDefendingPlayerId(attackingCreatureId, game).equals(possibleBlocker.getControllerId())) { + // Creature can't block if not the controller or a planeswalker of the controller of the possible blocker is attacked + continue; + } if (creatureMustBlockAttackers.containsKey(possibleBlocker.getId())) { creatureMustBlockAttackers.get(possibleBlocker.getId()).add(attackingCreatureId); } else { @@ -729,6 +733,10 @@ public class Combat implements Serializable, Copyable { if (creatureForcedToBlock == null) { break; } + if (!creatureForcedToBlock.getControllerId().equals(player.getId())) { + // ignore creatures controlled by other players + continue; + } // // check if creature has to pay a cost to block so it's not mandatory to block // boolean removedAttacker = false; @@ -1133,10 +1141,10 @@ public class Combat implements Serializable, Copyable { return defenderId; } - public UUID getDefendingPlayerId(UUID attackerId, Game game) { + public UUID getDefendingPlayerId(UUID attackingCreatureId, Game game) { UUID defenderId = null; for (CombatGroup group : groups) { - if (group.getAttackers().contains(attackerId)) { + if (group.getAttackers().contains(attackingCreatureId)) { defenderId = group.getDefenderId(); if (group.defenderIsPlaneswalker) { Permanent permanent = game.getPermanent(defenderId);