* Bolas's Citadel - fixed that opponent can use Bolas's play ability for own cards (#6741);

This commit is contained in:
Oleg Agafonov 2020-07-06 15:44:31 +04:00
parent d18093daf2
commit d1ccb621a1
3 changed files with 39 additions and 10 deletions

View file

@ -11,21 +11,18 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.*;
import mage.constants.*;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
import mage.cards.SplitCard;
import mage.cards.SplitCardHalf;
import mage.util.CardUtil;
import java.util.Objects;
import java.util.UUID;
/**
* @author jeffwadsworth
@ -97,6 +94,10 @@ class BolassCitadelPlayTheTopCardEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
if (!Objects.equals(source.getControllerId(), playerId)) {
return false;
}
Player player = game.getPlayer(playerId);
if (player != null) {
Card topCard = player.getLibrary().getFromTop(game);

View file

@ -129,4 +129,34 @@ public class BolassCitadelTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Ferocious Zheng", 1);
assertLife(playerA, 20 - 3);
}
@Test
public void testOpponentCantUseMyBolas() {
// https://github.com/magefree/mage/issues/6741
removeAllCardsFromLibrary(playerA);
removeAllCardsFromLibrary(playerB);
// You may play the top card of your library. If you cast a spell this way, pay life equal to its converted mana cost rather than pay its mana cost.
addCard(Zone.BATTLEFIELD, playerA, "Bolas's Citadel");
//
addCard(Zone.LIBRARY, playerA, "Balduvian Bears", 2); // {1}{G}
addCard(Zone.LIBRARY, playerB, "Grizzly Bears", 2); // {1}{G}
// 1 turn
checkPlayableAbility("A can use bolas on 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Balduvian Bears", true);
checkPlayableAbility("B cant use bolas on 1", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Grizzly Bears", false);
// 2 turn
checkPlayableAbility("A can't use bolas on 2", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Balduvian Bears", false);
checkPlayableAbility("B can't use bolas on 2", 2, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Grizzly Bears", false);
// 3 turn
checkPlayableAbility("A can use bolas on 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Balduvian Bears", true);
checkPlayableAbility("B cant use bolas on 1", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Grizzly Bears", false);
setStrictChooseMode(true);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
}

View file

@ -8,7 +8,6 @@ package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Duration;
@ -114,7 +113,6 @@ public class AmplifyEffect extends ReplacementEffectImpl {
// You cant reveal this card or any other cards that are entering the battlefield at the same time as this card.
filter.add(Predicates.not(new CardIdPredicate(source.getSourceId())));
for (Permanent enteringPermanent : game.getPermanentsEntering().values()) {
Card card = game.getCard(enteringPermanent.getId());
filter.add(Predicates.not(new CardIdPredicate(enteringPermanent.getId())));
}