mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
* Changed block requirment checking so that block lock is less probable.
This commit is contained in:
parent
fe1043e77a
commit
a0346109a2
1 changed files with 11 additions and 3 deletions
|
|
@ -481,7 +481,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
// map with attackers (UUID) that must be blocked by at least one blocker and a set of all creatures that can block it and don't block yet
|
// map with attackers (UUID) that must be blocked by at least one blocker and a set of all creatures that can block it and don't block yet
|
||||||
Map<UUID, Set<UUID>> mustBeBlockedByAtLeastOne = new HashMap<UUID, Set<UUID>>();
|
Map<UUID, Set<UUID>> mustBeBlockedByAtLeastOne = new HashMap<UUID, Set<UUID>>();
|
||||||
|
|
||||||
// check mustBlockAny
|
// check mustBlock requirements of creatures from opponents of attacking player
|
||||||
for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), player.getId(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), player.getId(), game)) {
|
||||||
// creature is controlled by an opponent of the attacker
|
// creature is controlled by an opponent of the attacker
|
||||||
if (opponents.contains(creature.getControllerId())) {
|
if (opponents.contains(creature.getControllerId())) {
|
||||||
|
|
@ -531,11 +531,19 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
// check the mustBlockAny requirement ----------------------------------------
|
// check the mustBlockAny requirement ----------------------------------------
|
||||||
if (effect.mustBlockAny(game)) {
|
if (effect.mustBlockAny(game)) {
|
||||||
// check that it can block at least one of the attackers
|
// check that it can block at least one of the attackers
|
||||||
|
// and no restictions prevent this
|
||||||
boolean mayBlock = false;
|
boolean mayBlock = false;
|
||||||
for (UUID attackingCreatureId : getAttackers()) {
|
for (UUID attackingCreatureId : getAttackers()) {
|
||||||
if (creature.canBlock(attackingCreatureId, game)) {
|
if (creature.canBlock(attackingCreatureId, game)) {
|
||||||
mayBlock = true;
|
// check restrictions of the creature to block that prevent it can be blocked
|
||||||
break;
|
Permanent attackingCreature = game.getPermanent(attackingCreatureId);
|
||||||
|
if (attackingCreature != null && attackingCreature.getMinBlockedBy() > 1) {
|
||||||
|
// TODO: check if enough possible blockers are available, if true, mayBlock can be set to true
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mayBlock = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if so inform human player or set block for AI player
|
// if so inform human player or set block for AI player
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue