From f2a70193e3f6dfe13fb00b9eb91e5a6e6019a1f0 Mon Sep 17 00:00:00 2001 From: L_J Date: Fri, 16 Feb 2018 13:59:04 +0000 Subject: [PATCH] Reverted canBlock changes due to some incorrect banding interactions --- .../mage/game/permanent/PermanentImpl.java | 54 ++++++++----------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 84846c374d..c09efe959e 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -1121,44 +1121,32 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { if (tapped && !game.getState().getContinuousEffects().asThough(this.getId(), AsThoughEffectType.BLOCK_TAPPED, this.getControllerId(), game)) { return false; } - Permanent baseAttacker = game.getPermanent(attackerId); - if (baseAttacker == null) { + Permanent attacker = game.getPermanent(attackerId); + if (attacker == null) { return false; } - List attackerIdsToCheck = new ArrayList<>(baseAttacker.getBandedCards()); // handles banding - attackerIdsToCheck.add(attackerId); - blockCheck: - for (UUID bandedId : attackerIdsToCheck) { - Permanent attacker = game.getPermanent(bandedId); - if (attacker == null) { - continue blockCheck; - } - // controller of attacking permanent must be an opponent - if (!game.getPlayer(this.getControllerId()).hasOpponent(attacker.getControllerId(), game)) { - continue blockCheck; - } - //20101001 - 509.1b - // check blocker restrictions - for (Map.Entry> entry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) { - for (Ability ability : entry.getValue()) { - if (!entry.getKey().canBlock(attacker, this, ability, game)) { - continue blockCheck; - } + // controller of attacking permanent must be an opponent + if (!game.getPlayer(this.getControllerId()).hasOpponent(attacker.getControllerId(), game)) { + return false; + } + //20101001 - 509.1b + // check blocker restrictions + for (Map.Entry> entry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) { + for (Ability ability : entry.getValue()) { + if (!entry.getKey().canBlock(attacker, this, ability, game)) { + return false; } } - // check also attacker's restriction effects - for (Map.Entry> restrictionEntry : game.getContinuousEffects().getApplicableRestrictionEffects(attacker, game).entrySet()) { - for (Ability ability : restrictionEntry.getValue()) { - if (!restrictionEntry.getKey().canBeBlocked(attacker, this, ability, game)) { - continue blockCheck; - } - } - } - if (!attacker.hasProtectionFrom(this, game)) { - return true; - } } - return false; + // check also attacker's restriction effects + for (Map.Entry> restrictionEntry : game.getContinuousEffects().getApplicableRestrictionEffects(attacker, game).entrySet()) { + for (Ability ability : restrictionEntry.getValue()) { + if (!restrictionEntry.getKey().canBeBlocked(attacker, this, ability, game)) { + return false; + } + } + } + return !attacker.hasProtectionFrom(this, game); } @Override