use of mage.filter.common.FilterCreatureCard in project mage by magefree.
the class SummoningTrapEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
if (!cards.isEmpty()) {
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCreatureCard("creature card to put on the battlefield"));
if (controller.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
if (!cards.isEmpty()) {
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
}
}
return true;
}
use of mage.filter.common.FilterCreatureCard in project mage by magefree.
the class ColfenorTheLastYewTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!super.checkTrigger(event, game)) {
return false;
}
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent permanent = zEvent.getTarget();
if (permanent == null) {
return false;
}
FilterCard filterCard = new FilterCreatureCard("creature card with toughness less than " + permanent.getToughness().getValue());
filterCard.add(new ToughnessPredicate(ComparisonType.FEWER_THAN, permanent.getToughness().getValue()));
filterCard.add(Predicates.not(new MageObjectReferencePredicate(new MageObjectReference(permanent, game))));
this.getTargets().clear();
this.addTarget(new TargetCardInYourGraveyard(0, 1, filterCard));
return true;
}
use of mage.filter.common.FilterCreatureCard in project mage by magefree.
the class DoublingChantTarget method makeFilter.
private static FilterCard makeFilter(Set<String> names) {
FilterCard filter = new FilterCreatureCard();
filter.add(Predicates.or(names.stream().map(name -> new NamePredicate(name)).collect(Collectors.toSet())));
return filter;
}
use of mage.filter.common.FilterCreatureCard 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.filter.common.FilterCreatureCard in project mage by magefree.
the class IsarethTheAwakenerReplacementEffect method makeFilter.
private static FilterCard makeFilter(int xValue) {
FilterCard filter = new FilterCreatureCard("creature card with mana value " + xValue + " or less from your graveyard");
filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, xValue));
return filter;
}
Aggregations