diff --git a/Mage/src/mage/abilities/effects/common/combat/MustBeBlockedByAllAttachedEffect.java b/Mage/src/mage/abilities/effects/common/combat/MustBeBlockedByAllAttachedEffect.java index db9c5afc6f..2209c62b66 100644 --- a/Mage/src/mage/abilities/effects/common/combat/MustBeBlockedByAllAttachedEffect.java +++ b/Mage/src/mage/abilities/effects/common/combat/MustBeBlockedByAllAttachedEffect.java @@ -62,9 +62,12 @@ public class MustBeBlockedByAllAttachedEffect extends RequirementEffect { + + public MustBeBlockedByAllTargetEffect(Duration duration) { + super(duration); + staticText = new StringBuilder("All creatures able to block target creature ") + .append(this.getDuration().equals(Duration.EndOfTurn) ? "this turn ":"") + .append("do so").toString(); + } + + public MustBeBlockedByAllTargetEffect(final MustBeBlockedByAllTargetEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + Permanent sourceCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); + if (sourceCreature != null && sourceCreature.isAttacking()) { + return permanent.canBlock(this.getTargetPointer().getFirst(game, source), game); + } + return false; + } + + @Override + public boolean mustAttack(Game game) { + return false; + } + + @Override + public boolean mustBlock(Game game) { + return true; + } + + @Override + public UUID mustBlockAttacker(Ability source, Game game) { + return this.getTargetPointer().getFirst(game, source); + } + + @Override + public MustBeBlockedByAllTargetEffect copy() { + return new MustBeBlockedByAllTargetEffect(this); + } + +}