Reverted canBlock changes

due to some incorrect banding interactions
This commit is contained in:
L_J 2018-02-16 13:59:04 +00:00 committed by GitHub
parent 5f5750531f
commit f2a70193e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<UUID> 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<RestrictionEffect, Set<Ability>> 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<RestrictionEffect, Set<Ability>> 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<RestrictionEffect, Set<Ability>> 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<RestrictionEffect, Set<Ability>> 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