* Amplify abilities - fixed that it allows reveal itself when put onto battlefield from hand (#6776);

This commit is contained in:
Oleg Agafonov 2020-07-06 15:29:53 +04:00
parent 4168e2714a
commit 49f4e54aaa
2 changed files with 33 additions and 13 deletions

View file

@ -8,6 +8,7 @@ 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;
@ -16,6 +17,7 @@ import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardIdPredicate;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
@ -108,6 +110,14 @@ public class AmplifyEffect extends ReplacementEffectImpl {
} else if (filterSubtypes.size() == 1) {
filter.add(filterSubtypes.get(0));
}
// 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())));
}
if (controller.getHand().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
if (controller.chooseUse(outcome, "Reveal cards to Amplify?", source, game)) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);