mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
* Fixed a problem with creatures forced to block while not able to do because the attacker has restrictions (e.g. menace).
This commit is contained in:
parent
672ac28931
commit
916836d0c9
2 changed files with 40 additions and 17 deletions
|
|
@ -801,6 +801,30 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Check if blocker is really able to block one or more attackers (maybe not if the attacker has menace) - if not continue with the next forced blocker
|
||||
// TODO: Probably there is some potential to abuse the check if forced blockers are assigned to differnt attackers with e.g. menace.
|
||||
// While if assigned all to one the block is possible
|
||||
if (creatureForcedToBlock.getBlocking() == 0) {
|
||||
boolean validBlockPossible = false;
|
||||
for (UUID possibleAttackerId : entry.getValue()) {
|
||||
CombatGroup attackersGroup = findGroup(possibleAttackerId);
|
||||
if (attackersGroup.getBlockers().contains(creatureForcedToBlock.getId())) {
|
||||
// forcedBlocker blocks a valid blocker, so no problem break check if valid block option exists
|
||||
validBlockPossible = true;
|
||||
break;
|
||||
}
|
||||
Permanent attackingCreature = game.getPermanent(possibleAttackerId);
|
||||
if (attackingCreature.getMinBlockedBy() > 1) { // e.g. Menace
|
||||
if (attackersGroup.getBlockers().size() + 1 >= attackingCreature.getMinBlockedBy()) {
|
||||
validBlockPossible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!validBlockPossible) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// // check if creature has to pay a cost to block so it's not mandatory to block
|
||||
// boolean removedAttacker = false;
|
||||
// for (Iterator<UUID> iterator = entry.getValue().iterator(); iterator.hasNext();) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue