* Neoform - fixed that it search wrong cmc and don't add counter (#5751);

This commit is contained in:
Oleg Agafonov 2019-04-24 20:24:15 +04:00
parent 9c1f55a08f
commit 5bb27f6146

View file

@ -3,6 +3,8 @@ package mage.cards.n;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card; import mage.cards.Card;
@ -21,6 +23,7 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
@ -37,7 +40,8 @@ public final class Neoform extends CardImpl {
1, 1, StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT, true 1, 1, StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT, true
))); )));
// Search your library for a creature card with converted mana cost equal to 1 plus the sacrificed creature's converted mana cost, put that card onto the battlefield with an additional +1/+1 counter on it, then shuffle your library. // Search your library for a creature card with converted mana cost equal to 1 plus the sacrificed creature's converted mana cost,
// put that card onto the battlefield with an additional +1/+1 counter on it, then shuffle your library.
this.getSpellAbility().addEffect(new NeoformEffect()); this.getSpellAbility().addEffect(new NeoformEffect());
} }
@ -81,14 +85,20 @@ class NeoformEffect extends OneShotEffect {
return false; return false;
} }
int newConvertedCost = sacrificedPermanent.getConvertedManaCost() + 1; int newConvertedCost = sacrificedPermanent.getConvertedManaCost() + 1;
FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost + " or less"); FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, newConvertedCost + 1)); filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, newConvertedCost));
filter.add(new CardTypePredicate(CardType.CREATURE)); filter.add(new CardTypePredicate(CardType.CREATURE));
TargetCardInLibrary target = new TargetCardInLibrary(filter); TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, source, game)) { if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
game.addEffect(new NeoformReplacementEffect(), source); if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game); ContinuousEffectImpl effect = new NeoformReplacementEffect();
effect.setTargetPointer(new FixedTarget(card, game));
game.addEffect(effect, source);
if (!controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
effect.discard();
}
}
} }
controller.shuffleLibrary(source, game); controller.shuffleLibrary(source, game);
return true; return true;