From 2b8be1528131a751b2dc824aafe26b2b4684eec8 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 14 Feb 2015 17:39:22 +0100 Subject: [PATCH] Fixed a bug of attack restriction effect that did not allow to attack even if the needed condition was fulfilled (Dandan, Godhunter Octopus, Serpent of the Endless Sea, Sea Serpent, Pirate Ship, Whimwader, Sea Monster, Dreamwinder, Sealock Monster). --- .../src/mage/sets/worldwake/TectonicEdge.java | 23 ++++++------------- ...ttackUnlessDefenderControllsPermanent.java | 11 ++++----- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/Mage.Sets/src/mage/sets/worldwake/TectonicEdge.java b/Mage.Sets/src/mage/sets/worldwake/TectonicEdge.java index 7c50e7b073..a25944f4cb 100644 --- a/Mage.Sets/src/mage/sets/worldwake/TectonicEdge.java +++ b/Mage.Sets/src/mage/sets/worldwake/TectonicEdge.java @@ -28,33 +28,24 @@ package mage.sets.worldwake; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; +import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.condition.common.OpponentControlsPermanentCondition; import mage.abilities.costs.CostImpl; -import mage.abilities.costs.Costs; -import mage.abilities.costs.CostsImpl; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterLandPermanent; import mage.game.Game; import mage.target.common.TargetNonBasicLandPermanent; -import java.util.UUID; -import mage.abilities.common.ActivateIfConditionActivatedAbility; -import mage.abilities.condition.common.OpponentControllsMoreCondition; -import mage.abilities.condition.common.OpponentControlsPermanentCondition; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; -import mage.filter.common.FilterLandCard; -import mage.target.common.TargetCardInLibrary; - /** * * @author BetaSteward_at_googlemail.com diff --git a/Mage/src/mage/abilities/effects/common/combat/CantAttackUnlessDefenderControllsPermanent.java b/Mage/src/mage/abilities/effects/common/combat/CantAttackUnlessDefenderControllsPermanent.java index 4f512a1c63..6c3b2e018c 100644 --- a/Mage/src/mage/abilities/effects/common/combat/CantAttackUnlessDefenderControllsPermanent.java +++ b/Mage/src/mage/abilities/effects/common/combat/CantAttackUnlessDefenderControllsPermanent.java @@ -62,25 +62,22 @@ public class CantAttackUnlessDefenderControllsPermanent extends RestrictionEffec return permanent.getId().equals(source.getSourceId()); } - @Override - public boolean canAttack(Game game) { - return false; - } - @Override public boolean canAttack(UUID defenderId, Ability source, Game game) { - UUID defendingPlayerId = null; + UUID defendingPlayerId; Player player = game.getPlayer(defenderId); if (player == null) { Permanent permanent = game.getPermanent(defenderId); if (permanent != null) { defendingPlayerId = permanent.getControllerId(); + } else { + return false; } } else { defendingPlayerId = defenderId; } if (defendingPlayerId != null && game.getBattlefield().countAll(filter, defendingPlayerId, game) == 0) { - return true; + return false; } return true; }