use of mage.filter.FilterCard in project mage by magefree.
the class DevelopmentEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.chooseUse(Outcome.Benefit, staticText + "?", source, game)) {
Cards cards = controller.getSideboard();
if (cards.isEmpty()) {
game.informPlayer(controller, "You have no cards outside the game.");
return true;
}
TargetCard target = new TargetCard(0, 4, Zone.OUTSIDE, new FilterCard("cards you own from outside the game"));
target.setNotTarget(true);
if (controller.choose(Outcome.Benefit, controller.getSideboard(), target, game)) {
controller.shuffleCardsToLibrary(new CardsImpl(target.getTargets()), game, source);
}
}
return true;
}
return false;
}
use of mage.filter.FilterCard in project mage by magefree.
the class SadisticSacramentEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
Player player = game.getPlayer(source.getControllerId());
if (player != null && targetPlayer != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterCard("cards to exile"));
if (player.searchLibrary(target, source, game, targetPlayer.getId())) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = targetPlayer.getLibrary().remove(targetId, game);
if (card != null) {
card.moveToExile(null, "", source, game);
}
}
}
targetPlayer.shuffleLibrary(source, game);
return true;
}
return false;
}
use of mage.filter.FilterCard 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.filter.FilterCard in project mage by magefree.
the class SecretSalvageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Card targetCard = game.getCard(getTargetPointer().getFirst(game, source));
if (targetCard != null) {
controller.moveCards(targetCard, Zone.EXILED, source, game);
String nameToSearch = CardUtil.getCardNameForSameNameSearch(targetCard);
FilterCard nameFilter = new FilterCard();
nameFilter.add(new NamePredicate(nameToSearch));
TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, nameFilter);
if (controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
Cards cards = new CardsImpl();
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().remove(cardId, game);
if (card != null) {
cards.add(card);
}
}
controller.revealCards(sourceObject.getIdName(), cards, game);
controller.moveCards(cards, Zone.HAND, source, game);
}
controller.shuffleLibrary(source, game);
return true;
}
}
}
return false;
}
use of mage.filter.FilterCard in project mage by magefree.
the class SehtsTigerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId());
ChoiceColor choice = new ChoiceColor();
if (controller != null && mageObject != null && controller.choose(Outcome.Protect, choice, game)) {
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(choice.getColor()));
filter.setMessage(choice.getChoice());
Ability ability = new ProtectionAbility(filter);
game.addEffect(new GainAbilityControllerEffect(ability, Duration.EndOfTurn), source);
return true;
}
return false;
}
Aggregations