use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class HuntingWildsToken method apply.
@Override
public boolean apply(Game game, Ability source) {
for (Effect sourceEffect : source.getEffects()) {
if (sourceEffect instanceof SearchLibraryPutInPlayEffect) {
Cards foundCards = new CardsImpl(((SearchLibraryPutInPlayEffect) sourceEffect).getTargets());
if (!foundCards.isEmpty()) {
FixedTargets fixedTargets = new FixedTargets(foundCards, game);
UntapTargetEffect untapEffect = new UntapTargetEffect();
untapEffect.setTargetPointer(fixedTargets);
untapEffect.apply(game, source);
BecomesCreatureTargetEffect becomesCreatureEffect = new BecomesCreatureTargetEffect(new HuntingWildsToken(), false, true, Duration.Custom);
becomesCreatureEffect.setTargetPointer(fixedTargets);
game.addEffect(becomesCreatureEffect, source);
}
return true;
}
}
return false;
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class VivienMonstersAdvocateTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = game.getSpell(event.getTargetId());
if (spell != null && spell.isCreature(game)) {
int cmc = spell.getManaValue();
FilterCard filter = new FilterCreatureCard("creature card with mana value less than " + cmc);
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, cmc));
this.getEffects().clear();
this.getEffects().add(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)));
return true;
}
return false;
}
use of mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect in project mage by magefree.
the class MaskOfTheMimicEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature == null) {
return false;
}
FilterCard filter = new FilterCard("a card named " + creature.getName());
filter.add(new NamePredicate(creature.getName()));
return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source);
}
Aggregations