mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
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.
This commit is contained in:
parent
1efbe346b6
commit
707358f875
1 changed files with 10 additions and 2 deletions
|
@ -525,6 +525,10 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
// 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<Combat> {
|
|||
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<Combat> {
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue