* Fixed cards with skip untap optional ability that cause game freezes (#5606)

This commit is contained in:
Oleg Agafonov 2019-03-01 18:10:32 +04:00
parent 4a14940414
commit 6846db75f4
169 changed files with 754 additions and 1172 deletions

View file

@ -12,7 +12,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CanAttackOnlyAloneEffect extends RestrictionEffect {
@ -32,7 +31,7 @@ public class CanAttackOnlyAloneEffect extends RestrictionEffect {
}
@Override
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) {
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game, boolean canUseChooseDialogs) {
return numberOfAttackers == 1;
}

View file

@ -29,7 +29,7 @@ public class CanBlockOnlyFlyingAttachedEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
if (attacker == null) {
return true;
}

View file

@ -29,7 +29,7 @@ public class CanBlockOnlyFlyingEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
if (attacker == null) {
return true;
}

View file

@ -13,7 +13,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantAttackAloneAttachedEffect extends RestrictionEffect {
@ -33,7 +32,7 @@ public class CantAttackAloneAttachedEffect extends RestrictionEffect {
}
@Override
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) {
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game, boolean canUseChooseDialogs) {
return numberOfAttackers > 1;
}

View file

@ -12,7 +12,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantAttackAloneSourceEffect extends RestrictionEffect {
@ -32,7 +31,7 @@ public class CantAttackAloneSourceEffect extends RestrictionEffect {
}
@Override
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) {
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game, boolean canUseChooseDialogs) {
return numberOfAttackers > 1;
}

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -30,7 +28,7 @@ public class CantAttackAnyPlayerAllEffect extends RestrictionEffect {
sb.append(' ').append(duration.toString());
}
}
staticText = sb.toString();
staticText = sb.toString();
}
public CantAttackAnyPlayerAllEffect(final CantAttackAnyPlayerAllEffect effect) {
@ -44,7 +42,7 @@ public class CantAttackAnyPlayerAllEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -10,7 +8,7 @@ import mage.game.permanent.Permanent;
/**
* The source of this effect can't attack any opponent
*
*
* @author BetaSteward_at_googlemail.com
*/
public class CantAttackAnyPlayerSourceEffect extends RestrictionEffect {
@ -29,7 +27,7 @@ public class CantAttackAnyPlayerSourceEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -10,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
@ -31,7 +28,7 @@ public class CantAttackAttachedEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -9,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantAttackBlockAllEffect extends RestrictionEffect {
@ -42,12 +40,12 @@ public class CantAttackBlockAllEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,10 +1,9 @@
package mage.abilities.effects.common.combat;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -31,12 +30,12 @@ public class CantAttackBlockAttachedEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -9,7 +7,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
@ -30,12 +27,12 @@ public class CantAttackBlockTargetEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -9,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantAttackBlockUnlessConditionSourceEffect extends RestrictionEffect {
@ -33,12 +31,12 @@ public class CantAttackBlockUnlessConditionSourceEffect extends RestrictionEffec
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -31,7 +31,7 @@ public class CantAttackControllerAttachedEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
if (defenderId == null) {
return true;
}

View file

@ -35,7 +35,7 @@ public class CantAttackIfDefenderControlsPermanent extends RestrictionEffect {
}
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
if (defenderId == null) {
return true;
}

View file

@ -1,15 +1,12 @@
package mage.abilities.effects.common.combat;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author BetaSteward_at_googlemail.com & L_J
*/
public class CantAttackSourceEffect extends RestrictionEffect {
@ -29,7 +26,7 @@ public class CantAttackSourceEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -10,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantAttackTargetEffect extends RestrictionEffect {
@ -29,7 +26,7 @@ public class CantAttackTargetEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}
@ -40,11 +37,11 @@ public class CantAttackTargetEffect extends RestrictionEffect {
@Override
public String getText(Mode mode) {
if(staticText != null && !staticText.isEmpty()) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
String text = "target " + mode.getTargets().get(0).getTargetName() + " can't attack";
if(this.duration == Duration.EndOfTurn) {
if (this.duration == Duration.EndOfTurn) {
text += " this turn";
}
return text;

View file

@ -35,7 +35,7 @@ public class CantAttackUnlessDefenderControllsPermanent extends RestrictionEffec
}
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
if (defenderId == null) {
return true;
}

View file

@ -48,7 +48,7 @@ public class CantAttackYouAllEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
if (defenderId == null) {
return true;
}

View file

@ -32,7 +32,7 @@ public class CantAttackYouEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
if (defenderId == null) {
return true;
}

View file

@ -38,7 +38,7 @@ public class CantAttackYouOrPlaneswalkerAllEffect extends RestrictionEffect {
}
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
if (defenderId == null) {
return true;
}

View file

@ -1,15 +1,13 @@
package mage.abilities.effects.common.combat;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class CantBeBlockedAllEffect extends RestrictionEffect {
@ -37,7 +35,7 @@ public class CantBeBlockedAllEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -9,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class CantBeBlockedAttachedEffect extends RestrictionEffect {
@ -29,7 +27,7 @@ public class CantBeBlockedAttachedEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -9,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantBeBlockedByAllSourceEffect extends RestrictionEffect {
@ -36,7 +34,7 @@ public class CantBeBlockedByAllSourceEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return !filterBlockedBy.match(blocker, source.getSourceId(), source.getControllerId(), game);
}

View file

@ -1,16 +1,15 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import static mage.constants.Duration.EndOfTurn;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import static mage.constants.Duration.EndOfTurn;
/**
*
* @author LevelX2
*/
public class CantBeBlockedByAllTargetEffect extends RestrictionEffect {
@ -38,7 +37,7 @@ public class CantBeBlockedByAllTargetEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return !filterBlockedBy.match(blocker, source.getSourceId(), source.getControllerId(), game);
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -9,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
@ -23,7 +21,7 @@ public class CantBeBlockedByCreaturesAllEffect extends RestrictionEffect {
this.filterCreatures = filterCreatures;
this.filterBlockedBy = filterBlockedBy;
staticText = new StringBuilder(filterCreatures.getMessage()).append(" can't be blocked ")
.append(filterBlockedBy.getMessage().startsWith("except by") ? "":"by ").append(filterBlockedBy.getMessage()).toString();
.append(filterBlockedBy.getMessage().startsWith("except by") ? "" : "by ").append(filterBlockedBy.getMessage()).toString();
}
public CantBeBlockedByCreaturesAllEffect(final CantBeBlockedByCreaturesAllEffect effect) {
@ -38,7 +36,7 @@ public class CantBeBlockedByCreaturesAllEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return !filterBlockedBy.match(blocker, source.getSourceId(), source.getControllerId(), game);
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -36,7 +35,7 @@ public class CantBeBlockedByCreaturesAttachedEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return !filter.match(blocker, source.getSourceId(), source.getControllerId(), game);
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -33,7 +32,7 @@ public class CantBeBlockedByCreaturesSourceEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return !filter.match(blocker, source.getSourceId(), source.getControllerId(), game);
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -8,7 +7,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantBeBlockedByCreaturesWithGreaterPowerEffect extends RestrictionEffect {
@ -28,7 +26,7 @@ public class CantBeBlockedByCreaturesWithGreaterPowerEffect extends RestrictionE
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return blocker.getPower().getValue() <= attacker.getPower().getValue();
}

View file

@ -1,14 +1,12 @@
package mage.abilities.effects.common.combat;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class CantBeBlockedByCreaturesWithLessPowerEffect extends RestrictionEffect {
@ -28,7 +26,7 @@ public class CantBeBlockedByCreaturesWithLessPowerEffect extends RestrictionEffe
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return (blocker.getPower().getValue() >= attacker.getPower().getValue());
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -10,7 +9,6 @@ import mage.game.permanent.Permanent;
import mage.target.Target;
/**
*
* @author LevelX2
*/
@ -18,7 +16,7 @@ public class CantBeBlockedByTargetSourceEffect extends RestrictionEffect {
/**
* Target creature(s) cant block the source creature
*
*
* @param duration
*/
@ -36,7 +34,7 @@ public class CantBeBlockedByTargetSourceEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return !this.getTargetPointer().getTargets(game, source).contains(blocker.getId());
}
@ -52,7 +50,7 @@ public class CantBeBlockedByTargetSourceEffect extends RestrictionEffect {
}
StringBuilder sb = new StringBuilder();
Target target = mode.getTargets().get(0);
if(target.getNumberOfTargets() > 1){
if (target.getNumberOfTargets() > 1) {
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
sb.append("Up to");
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -8,7 +7,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class CantBeBlockedSourceEffect extends RestrictionEffect {
@ -16,6 +14,7 @@ public class CantBeBlockedSourceEffect extends RestrictionEffect {
public CantBeBlockedSourceEffect() {
this(Duration.WhileOnBattlefield);
}
public CantBeBlockedSourceEffect(Duration duration) {
super(duration);
this.staticText = "{this} can't be blocked";
@ -34,7 +33,7 @@ public class CantBeBlockedSourceEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -13,7 +13,6 @@ import mage.target.Target;
import mage.util.CardUtil;
/**
*
* @author North
*/
public class CantBeBlockedTargetEffect extends RestrictionEffect {
@ -47,7 +46,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect {
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return !filter.match(blocker, source.getSourceId(), source.getControllerId(), game);
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -8,7 +7,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class CantBlockActivateAttachedEffect extends RestrictionEffect {
@ -26,20 +24,18 @@ public class CantBlockActivateAttachedEffect extends RestrictionEffect {
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (permanent.getId().equals(enchantment.getAttachedTo())) {
return true;
}
return permanent.getId().equals(enchantment.getAttachedTo());
}
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}
@Override
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -10,7 +9,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantBlockAllEffect extends RestrictionEffect {
@ -33,7 +31,7 @@ public class CantBlockAllEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -68,7 +68,7 @@ public class CantBlockAttachedEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
if (attacker == null) {
return true;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -8,7 +7,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantBlockAttackActivateAttachedEffect extends RestrictionEffect {
@ -26,25 +24,23 @@ public class CantBlockAttackActivateAttachedEffect extends RestrictionEffect {
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (permanent.getId().equals(enchantment.getAttachedTo())) {
return true;
}
return permanent.getId().equals(enchantment.getAttachedTo());
}
return false;
}
@Override
public boolean canAttack(Game game) {
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}
@Override
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -36,7 +36,7 @@ public class CantBlockCreaturesSourceEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
if (attacker == null) {
return true;
}

View file

@ -1,15 +1,12 @@
package mage.abilities.effects.common.combat;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class CantBlockSourceEffect extends RestrictionEffect {
@ -32,7 +29,7 @@ public class CantBlockSourceEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -11,7 +10,6 @@ import mage.target.Target;
import mage.util.CardUtil;
/**
*
* @author North
*/
public class CantBlockTargetEffect extends RestrictionEffect {
@ -30,7 +28,7 @@ public class CantBlockTargetEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -9,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantBlockUnlessYouControlSourceEffect extends RestrictionEffect {
@ -33,7 +31,7 @@ public class CantBlockUnlessYouControlSourceEffect extends RestrictionEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}