use of mage.target.TargetCard in project mage by magefree.
the class PatronOfTheMoonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCard target = new TargetCardInHand(0, 2, new FilterLandCard("up to two land cards to put onto the battlefield tapped"));
controller.chooseTarget(outcome, controller.getHand(), target, source, game);
return controller.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
}
return false;
}
use of mage.target.TargetCard in project mage by magefree.
the class RakdosAugermageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (player != null && controller != null) {
Cards revealedCards = new CardsImpl();
revealedCards.addAll(controller.getHand());
Card sourceCard = game.getCard(source.getSourceId());
player.revealCards((sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ") (" : "Discard (") + controller.getName() + ")", revealedCards, game);
TargetCard target = new TargetCard(Zone.HAND, new FilterCard());
if (player.choose(Outcome.Benefit, revealedCards, target, game)) {
Card card = revealedCards.get(target.getFirstTarget(), game);
return player.discard(card, false, source, game);
}
}
return false;
}
use of mage.target.TargetCard in project mage by magefree.
the class ShrineOfPiercingVisionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (player == null || permanent == null) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, permanent.getCounters(game).getCount(CounterType.CHARGE)));
if (!cards.isEmpty()) {
player.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put into your hand"));
if (player.choose(Outcome.DrawCard, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
player.moveCards(card, Zone.HAND, source, game);
}
}
player.putCardsOnBottomOfLibrary(cards, game, source, true);
}
return true;
}
use of mage.target.TargetCard in project mage by magefree.
the class TappingAtTheWindowEffect 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, 3));
TargetCard target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_CREATURE);
player.choose(outcome, cards, target, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.revealCards(source, new CardsImpl(card), game);
player.moveCards(card, Zone.HAND, source, game);
}
cards.retainZone(Zone.LIBRARY, game);
player.moveCards(card, Zone.GRAVEYARD, source, game);
return true;
}
use of mage.target.TargetCard in project mage by magefree.
the class TajuruParagonEffect 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));
player.revealCards(source, cards, game);
Permanent permanent = source.getSourcePermanentOrLKI(game);
if (permanent != null) {
FilterCard filter = new FilterCard("card that shares a creature type with " + permanent.getName());
filter.add(new SharesCreatureTypePredicate(permanent));
TargetCard target = new TargetCardInLibrary(0, 1, filter);
player.choose(outcome, cards, target, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.moveCards(card, Zone.HAND, source, game);
cards.remove(card);
}
}
player.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
}
Aggregations