use of mage.cards.CardsImpl in project mage by magefree.
the class ThoughtpickerWitchEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (controller != null && opponent != null) {
Cards cards = new CardsImpl(opponent.getLibrary().getTopCards(game, 2));
if (!cards.isEmpty()) {
TargetCard target = new TargetCardInLibrary(new FilterCard("card to exile"));
if (controller.choose(Outcome.Exile, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
opponent.moveCards(card, Zone.EXILED, source, game);
}
}
}
return true;
}
return false;
}
use of mage.cards.CardsImpl in project mage by magefree.
the class ThrillingEncoreEffect 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 ThinkTankLookLibraryEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
CardsImpl cards = new CardsImpl();
cards.add(card);
controller.lookAtCards("Think Tank", cards, game);
if (controller.chooseUse(Outcome.Neutral, "Put that card into your graveyard?", source, game)) {
return controller.moveCards(card, Zone.GRAVEYARD, source, game);
}
}
}
return true;
}
return false;
}
use of mage.cards.CardsImpl in project mage by magefree.
the class ThoughtDistortionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player == null) {
return false;
}
player.revealCards(source, player.getHand(), game);
Cards cards = new CardsImpl(player.getHand().getCards(filter, game));
cards.addAll(player.getGraveyard().getCards(filter, game));
return player.moveCards(cards, Zone.EXILED, source, game);
}
use of mage.cards.CardsImpl in project mage by magefree.
the class ThrasiosTritonHeroEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
controller.scry(1, source, game);
if (!controller.getLibrary().hasCards()) {
return true;
}
CardsImpl cards = new CardsImpl();
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
cards.add(card);
controller.revealCards(source, cards, game);
if (card.isLand(game)) {
return controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
}
controller.drawCards(1, source, game);
return true;
}
Aggregations