use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class HibernationsEndEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && player != null) {
int newConvertedCost = sourcePermanent.getCounters(game).getCount("age");
FilterCard filter = new FilterCard("creature card with mana value " + newConvertedCost);
filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, newConvertedCost));
filter.add(CardType.CREATURE.getPredicate());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
return new SearchLibraryPutInPlayEffect(target).apply(game, source);
}
return false;
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class SisayWeatherlightCaptainEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (permanent == null) {
return false;
}
int power = permanent.getPower().getValue();
FilterCard filter = new FilterPermanentCard("legendary permanent card with mana value less than " + power);
filter.add(SuperType.LEGENDARY.getPredicate());
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, power));
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source);
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class SurveyorsScopeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int numberOfLands = 0;
int ownLands = game.getBattlefield().countAll(new FilterLandPermanent(), controller.getId(), game);
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
if (!playerId.equals(controller.getId())) {
if (game.getBattlefield().countAll(new FilterLandPermanent(), playerId, game) > ownLands + 1) {
numberOfLands++;
}
}
}
game.informPlayers("Surveyor's Scope: X = " + numberOfLands);
// 10/17/2013 If no players control at least two more lands than you when the ability resolves, you'll still search and shuffle your library.
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, numberOfLands, StaticFilters.FILTER_CARD_BASIC_LAND)).apply(game, source);
}
return false;
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class SylvanPrimordialEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
boolean result = false;
int destroyedCreatures = 0;
for (Target target : source.getTargets()) {
if (target instanceof TargetPermanent) {
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
if (targetPermanent != null) {
if (targetPermanent.destroy(source, game, false)) {
destroyedCreatures++;
}
}
}
}
if (destroyedCreatures > 0) {
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(destroyedCreatures, filterForest), true, true).apply(game, source);
}
return result;
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class TajNarSwordsmithEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.chooseUse(Outcome.Benefit, "Do you want to pay {X} to search and put Equipment?", source, game)) {
// can be zero
int payCount = ManaUtil.playerPaysXGenericMana(true, "Taj-Nar Swordsmith", player, source, game);
FilterCard filter = new FilterCard("Equipment card with mana value {" + payCount + "} or less");
filter.add(SubType.EQUIPMENT.getPredicate());
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, payCount + 1));
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, filter), false, true).apply(game, source);
return true;
}
return false;
}
Aggregations