Package mage.filter.common

Examples of mage.filter.common.FilterNonlandCard


  protected void findPlayables(Game game) {
    playableInstant.clear();
    playableNonInstant.clear();
    unplayable.clear();
    playableAbilities.clear();
    Set<Card> nonLands = hand.getCards(new FilterNonlandCard(), game);
    ManaOptions available = getManaAvailable(game);
    available.addMana(manaPool.getMana());

    for (Card card: nonLands) {
      ManaOptions options = card.getManaCost().getOptions();
View Full Code Here


        this.power = new MageInt(2);
        this.toughness = new MageInt(2);

        // {2}, Exile a nonland card from your hand: Put four time counters on the exiled card. If it doesn't have suspend, it gains suspend.
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new JhoiraOfTheGhituSuspendEffect(), new GenericManaCost(2));
        ability.addCost(new ExileFromHandCost(new TargetCardInHand(new FilterNonlandCard("a nonland card from your hand"))));
        this.addAbility(ability);

    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        Player sourcePlayer = game.getPlayer(source.getControllerId());
        if (player != null && sourcePlayer != null) {
            TargetCard targetCard = new TargetCard(Zone.ALL, new FilterNonlandCard());
            targetCard.setRequired(false);
            if (sourcePlayer.choose(Outcome.Discard, player.getHand(), targetCard, game)) {
                Card c = game.getCard(targetCard.getFirstTarget());
                if (c != null) {
                    CardsImpl cards = new CardsImpl();
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        MageObject mageObject = game.getObject(source.getSourceId());
        if (controller != null) {
            Player player = game.getPlayer(targetPointer.getFirst(game, source));
            FilterCard filter = new FilterNonlandCard();
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
            UUID exileId = CardUtil.getCardExileZoneId(game, source);
            if (player != null) {

                // putting cards to exile shouldn't end the game, so getting minimun available
                int cardsCount = Math.min(source.getManaCostsToPay().getX(), player.getLibrary().size());
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        Player targetPlayer = game.getPlayer(source.getFirstTarget());
        if (player != null && targetPlayer != null) {
            targetPlayer.revealCards("Night Terrors", targetPlayer.getHand(), game);

            TargetCard target = new TargetCard(Zone.PICK, new FilterNonlandCard("nonland card to exile"));
            if (player.choose(Outcome.Exile, targetPlayer.getHand(), target, game)) {
                Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
                if (card != null) {
                    card.moveToExile(null, "", source.getSourceId(), game);
                }
View Full Code Here

        Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (controller != null && opponent != null && sourcePermanent != null) {
            opponent.revealCards(sourcePermanent.getLogName(), opponent.getHand(), game);

            FilterCard filter = new FilterNonlandCard("nonland card to exile");
            TargetCard target = new TargetCard(Zone.HAND, filter);
            if (opponent.getHand().count(filter, game) > 0 && controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {
                Card card = opponent.getHand().get(target.getFirstTarget(), game);
                // If source permanent leaves the battlefield before its triggered ability resolves, the target card won't be exiled.
                if (card != null && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        MageObject mageObject = game.getObject(source.getSourceId());
        if (player != null && mageObject != null) {
            Cost cost = new DiscardTargetCost(new TargetCardInHand(new FilterNonlandCard()));
            String message = "Discard a nonland card to search your library?";
            if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
                    && player.chooseUse(Outcome.Detriment, message, game)) {
                if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
                    Card card = game.getCard(cost.getTargets().getFirstTarget());
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, new FilterNonlandCard());
            if (player.searchLibrary(target, game)) {
                for (UUID targetId : target.getTargets()) {
                    Card card = player.getLibrary().remove(targetId, game);
                    if (card != null) {
                        card.moveToExile(null, "", source.getSourceId(), game);
View Full Code Here

        Player opponent = game.getPlayer(source.getFirstTarget());
        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (controller != null && opponent != null && sourcePermanent != null) {
            opponent.revealCards(sourcePermanent.getName(), opponent.getHand(), game);

            TargetCard target = new TargetCard(Zone.PICK, new FilterNonlandCard("nonland card to exile"));
            if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {
                Card card = opponent.getHand().get(target.getFirstTarget(), game);
                if (card != null) {
                    controller.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), sourcePermanent.getName(), source.getSourceId(), game, Zone.HAND);
                }
View Full Code Here

           
            // reveal hand of target player
            targetPlayer.revealCards(sourceObject.getLogName(), targetPlayer.getHand(), game);
           
            // You choose a nonland card from it
            TargetCardInHand target = new TargetCardInHand(new FilterNonlandCard());
            target.setNotTarget(true);
            Card chosenCard = null;
            if (controller.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
                chosenCard = game.getCard(target.getFirstTarget());
            }
View Full Code Here

TOP

Related Classes of mage.filter.common.FilterNonlandCard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.