use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class FiendArtisanEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int xValue = source.getManaCostsToPay().getX();
FilterCard filter = new FilterCreatureCard("creature card with mana value " + xValue + " or less");
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, xValue + 1));
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source);
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class RushedRebirthDelayedTriggeredAbility method makeEffect.
private static Effect makeEffect(Permanent permanent) {
FilterCard filter = new FilterCreatureCard("creature card with lesser mana value than " + permanent.getIdName());
filter.add(new RushedRebirthPredicate(permanent));
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true);
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class EnigmaticIncarnationEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) == 0 || !player.chooseUse(outcome, "Sacrifice an enchantment?", source, game)) {
return false;
}
TargetPermanent target = new TargetPermanent(0, 1, filter, true);
player.choose(outcome, target, source.getSourceId(), game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) {
return false;
}
game.getState().processAction(game);
int cmc = permanent.getManaValue();
if (!permanent.sacrifice(source, game)) {
return false;
}
FilterCard filterCard = new FilterCreatureCard("creature card with mana value " + (cmc + 1));
filterCard.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, cmc + 1));
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filterCard)).apply(game, source);
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class BifurcateEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
FilterCard filter = new FilterPermanentCard();
filter.add(new NamePredicate(permanent.getName()));
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source);
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class CartographersHawkEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (permanent == null || player == null) {
return false;
}
if (!player.moveCards(permanent, Zone.HAND, source, game)) {
return false;
}
if (!player.chooseUse(Outcome.PutLandInPlay, "Search your library for Plains card?", source, game)) {
return true;
}
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true).apply(game, source);
}
Aggregations