Search in sources :

Example 41 with TargetCard

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;
}
Also used : Player(mage.players.Player) TargetCardInHand(mage.target.common.TargetCardInHand) FilterLandCard(mage.filter.common.FilterLandCard) TargetCard(mage.target.TargetCard) CardsImpl(mage.cards.CardsImpl)

Example 42 with TargetCard

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;
}
Also used : FilterCard(mage.filter.FilterCard) Player(mage.players.Player) TargetCard(mage.target.TargetCard) FilterCard(mage.filter.FilterCard) TargetCard(mage.target.TargetCard)

Example 43 with TargetCard

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;
}
Also used : FilterCard(mage.filter.FilterCard) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetCard(mage.target.TargetCard) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl) TargetCard(mage.target.TargetCard) Card(mage.cards.Card) FilterCard(mage.filter.FilterCard)

Example 44 with TargetCard

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;
}
Also used : Player(mage.players.Player) TargetCard(mage.target.TargetCard) TargetCardInLibrary(mage.target.common.TargetCardInLibrary) TargetCard(mage.target.TargetCard)

Example 45 with TargetCard

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;
}
Also used : FilterCard(mage.filter.FilterCard) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) SharesCreatureTypePredicate(mage.filter.predicate.mageobject.SharesCreatureTypePredicate) TargetCard(mage.target.TargetCard) TargetCardInLibrary(mage.target.common.TargetCardInLibrary) FilterCard(mage.filter.FilterCard) TargetCard(mage.target.TargetCard)

Aggregations

TargetCard (mage.target.TargetCard)309 Player (mage.players.Player)297 FilterCard (mage.filter.FilterCard)177 Card (mage.cards.Card)130 CardsImpl (mage.cards.CardsImpl)96 UUID (java.util.UUID)83 Cards (mage.cards.Cards)81 MageObject (mage.MageObject)80 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)52 Permanent (mage.game.permanent.Permanent)49 TargetCardInYourGraveyard (mage.target.common.TargetCardInYourGraveyard)30 ApprovingObject (mage.ApprovingObject)26 TargetPlayer (mage.target.TargetPlayer)25 FilterCreatureCard (mage.filter.common.FilterCreatureCard)22 TargetOpponent (mage.target.common.TargetOpponent)22 TargetCardInHand (mage.target.common.TargetCardInHand)21 Target (mage.target.Target)19 FilterNonlandCard (mage.filter.common.FilterNonlandCard)18 FixedTarget (mage.target.targetpointer.FixedTarget)18 ArrayList (java.util.ArrayList)16