use of mage.cards.CardsImpl in project mage by magefree.
the class JungleWayfinderEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.chooseUse(Outcome.Benefit, "Search your library for a card to put into your hand?", source, game)) {
player.searchLibrary(target, source, game);
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {
player.revealCards(source, new CardsImpl(card), game);
player.moveCards(card, Zone.HAND, source, game);
}
}
player.shuffleLibrary(source, game);
}
}
}
// prevent undo
controller.resetStoredBookmark(game);
return true;
}
return false;
}
use of mage.cards.CardsImpl in project mage by magefree.
the class KaaliaZenithSeekerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6));
Cards toHand = new CardsImpl();
for (CreatureFinder creatureFinder : CreatureFinder.values()) {
TargetCard targetCard = creatureFinder.getTarget();
if (player.choose(outcome, cards, targetCard, game)) {
toHand.addAll(targetCard.getTargets());
}
}
cards.removeAll(toHand);
player.revealCards(source, toHand, game);
player.moveCards(toHand, Zone.HAND, source, game);
player.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
}
use of mage.cards.CardsImpl in project mage by magefree.
the class LordOfTheVoidEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (player == null || controller == null) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 7));
controller.moveCards(cards, Zone.EXILED, source, game);
if (!cards.getCards(StaticFilters.FILTER_CARD_CREATURE, game).isEmpty()) {
TargetCard target = new TargetCard(Zone.EXILED, StaticFilters.FILTER_CARD_CREATURE);
if (controller.chooseTarget(outcome, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, false, null);
}
}
}
return true;
}
use of mage.cards.CardsImpl in project mage by magefree.
the class MyojinOfGrimBetrayalEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
CardsPutIntoGraveyardWatcher watcher = game.getState().getWatcher(CardsPutIntoGraveyardWatcher.class);
if (controller == null || watcher == null) {
return false;
}
Cards cards = new CardsImpl(watcher.getCardsPutIntoGraveyardFromBattlefield(game));
cards.removeIf(uuid -> !game.getCard(uuid).isCreature(game));
return controller.moveCards(cards, Zone.BATTLEFIELD, source, game);
}
use of mage.cards.CardsImpl in project mage by magefree.
the class MyrIncubatorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && controller.searchLibrary(target, source, game)) {
if (!target.getTargets().isEmpty()) {
tokensToCreate = target.getTargets().size();
controller.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game);
}
CreateTokenEffect effect = new CreateTokenEffect(new MyrToken(), tokensToCreate);
effect.apply(game, source);
controller.shuffleLibrary(source, game);
return true;
}
return false;
}
Aggregations