mirror of
https://github.com/correl/mage.git
synced 2025-01-14 03:00:10 +00:00
Menace fix
This commit is contained in:
parent
3a800dea8e
commit
17800b6df1
1 changed files with 25 additions and 32 deletions
|
@ -302,7 +302,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
Map<UUID, Integer> assigned = new HashMap<>();
|
||||
if (blocked) {
|
||||
boolean excessDamageToDefender = true;
|
||||
for (UUID blockerId : new ArrayList<>(blockerOrder)) { // prevent ConcurrentModificationException
|
||||
for (UUID blockerId : blockerOrder) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (blocker != null) {
|
||||
int lethalDamage;
|
||||
|
@ -732,33 +732,26 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
|
||||
for (UUID uuid : attackers) {
|
||||
Permanent attacker = game.getPermanent(uuid);
|
||||
if (attacker != null && this.blocked) {
|
||||
// Check if there are enough blockers to have a legal block
|
||||
if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && !blockers.isEmpty() && blockers.size() < attacker.getMinBlockedBy()) {
|
||||
for (UUID blockerId : blockers) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (blocker != null) {
|
||||
blocker.setBlocking(blocker.getBlocking() - 1);
|
||||
}
|
||||
if (attacker.getMinBlockedBy() > 1 && !blockers.isEmpty() && blockers.size() < attacker.getMinBlockedBy()) {
|
||||
for (UUID blockerId : new ArrayList<>(blockers)) {
|
||||
game.getCombat().removeBlocker(blockerId, game);
|
||||
}
|
||||
blockers.clear();
|
||||
blockerOrder.clear();
|
||||
this.blocked = false;
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(attacker.getLogName() + " can't be blocked except by " + attacker.getMinBlockedBy() + " or more creatures. Blockers discarded.");
|
||||
}
|
||||
blockWasLegal = false;
|
||||
}
|
||||
// Check if there are too many blockers (maxBlockedBy = 0 means no restrictions)
|
||||
if (attacker != null && this.blocked && attacker.getMaxBlockedBy() > 0 && attacker.getMaxBlockedBy() < blockers.size()) {
|
||||
for (UUID blockerId : blockers) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (blocker != null) {
|
||||
blocker.setBlocking(blocker.getBlocking() - 1);
|
||||
}
|
||||
if (attacker.getMaxBlockedBy() > 0 && attacker.getMaxBlockedBy() < blockers.size()) {
|
||||
for (UUID blockerId : new ArrayList<>(blockers)) {
|
||||
game.getCombat().removeBlocker(blockerId, game);
|
||||
}
|
||||
blockers.clear();
|
||||
blockerOrder.clear();
|
||||
this.blocked = false;
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder(attacker.getLogName())
|
||||
.append(" can't be blocked by more than ").append(attacker.getMaxBlockedBy())
|
||||
|
@ -767,7 +760,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
}
|
||||
blockWasLegal = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return blockWasLegal;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue