mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed blocking change for AI player not locking the game.
This commit is contained in:
parent
7bb6fabfef
commit
6f8ee8e3de
2 changed files with 16 additions and 3 deletions
|
@ -49,6 +49,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -99,7 +100,7 @@ class CantBeBlockedByMoreThanOneAttachedEffect extends ContinuousEffectImpl<Cant
|
|||
super(duration, Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
this.attachmentType = attachmentType;
|
||||
staticText = (attachmentType.equals(AttachmentType.AURA) ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + amount + " creature" + (amount==1 ?"":"s");
|
||||
staticText = (attachmentType.equals(AttachmentType.AURA) ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s");
|
||||
}
|
||||
|
||||
public CantBeBlockedByMoreThanOneAttachedEffect(final CantBeBlockedByMoreThanOneAttachedEffect effect) {
|
||||
|
|
|
@ -257,8 +257,14 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
if (game.isPaused() || game.isGameOver()) {
|
||||
return;
|
||||
}
|
||||
choose = !checkBlockRestrictions(game.getPlayer(defenderId), game);
|
||||
choose |= !checkBlockRequirementsAfter(defender, defender, game);
|
||||
if (!checkBlockRestrictions(game.getPlayer(defenderId), game)) {
|
||||
// only human player can decide to do the block in another way
|
||||
if (player.isHuman()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
choose = !checkBlockRequirementsAfter(defender, defender, game);
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, defenderId, defenderId));
|
||||
}
|
||||
|
@ -266,6 +272,12 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the block restrictions
|
||||
* @param player
|
||||
* @param game
|
||||
* @return false - if block restrictions were not complied
|
||||
*/
|
||||
public boolean checkBlockRestrictions(Player player, Game game) {
|
||||
int count = 0;
|
||||
boolean blockWasLegal = true;
|
||||
|
|
Loading…
Reference in a new issue