mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
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).
This commit is contained in:
parent
1f7ce0f806
commit
2b8be15281
2 changed files with 11 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue