Fix Silent Arbiter's blocking conditions to allow one block per player. (#9906)

As reported in #9905 per rule 802.4b, if you somehow have multiple creatures attacking (such as with Myriad in a multiplayer game) each player is allowed to make one block while Silent Arbiter is in play.
This commit is contained in:
Grath 2023-01-26 11:17:52 -05:00 committed by GitHub
parent 894f2910da
commit 37f958b160
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,7 +92,16 @@ class SilentArbiterBlockRestrictionEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return game.getCombat().getBlockers().isEmpty();
public boolean canBlock(Permanent attacker, Permanent newBlocker, Ability source, Game game, boolean canUseChooseDialogs) {
if (attacker == null) {
return true;
}
for (UUID creatureId : game.getCombat().getBlockers()) {
Permanent existingBlocker = game.getPermanent(creatureId);
if (game.getPlayer(existingBlocker.getControllerId()).hasOpponent(attacker.getControllerId(), game) && existingBlocker.isControlledBy(newBlocker.getControllerId())) {
return false;
}
}
return true;
}
}