mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +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,42 +732,35 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
|
||||
for (UUID uuid : attackers) {
|
||||
Permanent attacker = game.getPermanent(uuid);
|
||||
// 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 != null && this.blocked) {
|
||||
// Check if there are enough blockers to have a legal block
|
||||
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);
|
||||
blockers.clear();
|
||||
blockerOrder.clear();
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(attacker.getLogName() + " can't be blocked except by " + attacker.getMinBlockedBy() + " or more creatures. Blockers discarded.");
|
||||
}
|
||||
blockWasLegal = false;
|
||||
}
|
||||
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())
|
||||
.append(attacker.getMaxBlockedBy() == 1 ? " creature." : " creatures.")
|
||||
.append(" Blockers discarded.").toString());
|
||||
// Check if there are too many blockers (maxBlockedBy = 0 means no restrictions)
|
||||
if (attacker.getMaxBlockedBy() > 0 && attacker.getMaxBlockedBy() < blockers.size()) {
|
||||
for (UUID blockerId : new ArrayList<>(blockers)) {
|
||||
game.getCombat().removeBlocker(blockerId, game);
|
||||
}
|
||||
blockers.clear();
|
||||
blockerOrder.clear();
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder(attacker.getLogName())
|
||||
.append(" can't be blocked by more than ").append(attacker.getMaxBlockedBy())
|
||||
.append(attacker.getMaxBlockedBy() == 1 ? " creature." : " creatures.")
|
||||
.append(" Blockers discarded.").toString());
|
||||
}
|
||||
blockWasLegal = false;
|
||||
}
|
||||
blockWasLegal = false;
|
||||
}
|
||||
|
||||
}
|
||||
return blockWasLegal;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue