Package mage.filter.predicate.mageobject

Examples of mage.filter.predicate.mageobject.CardTypePredicate


    }

    @Override
    public boolean replaceEvent(GameEvent event, Ability source, Game game) {
        FilterCard filter = new FilterCard();
        filter.add(new CardTypePredicate(CardType.CREATURE));
        Player player = game.getPlayer(event.getPlayerId());
        Cards cards = new CardsImpl(Zone.PICK);
        if (player != null) {
            for (int i = 0; i < 3; i++) {
                Card card = player.getLibrary().removeFromTop(game);
View Full Code Here


                Player opponent = game.getPlayer(opponentId);
                if (opponent != null) {
                    ability.getTargets().clear();
                    FilterPermanent filter = new FilterPermanent(new StringBuilder("noncreature permanent from opponent ").append(opponent.getName()).toString());
                    filter.add(new ControllerIdPredicate(opponentId));
                    filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
                    TargetPermanent target = new TargetPermanent(0,1, filter,false);
                    ability.addTarget(target);
                }
            }
        }
View Full Code Here

                Permanent evershrikePermanent = game.getPermanent(source.getSourceId());
                if (evershrikePermanent == null) {
                    return false;
                }
                FilterCard filterAuraCard = new FilterCard("Aura card with converted mana cost X or less from your hand");
                filterAuraCard.add(new CardTypePredicate(CardType.ENCHANTMENT));
                filterAuraCard.add(new SubtypePredicate("Aura"));
                filterAuraCard.add(new AuraCardCanAttachToPermanentId(evershrikePermanent.getId()));
                filterAuraCard.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, xAmount));
                int count = you.getHand().count(filterAuraCard, game);
                while (you.isInGame() && count > 0 && you.chooseUse(Outcome.Benefit, "Do you wish to put an Aura card from your hand onto Evershrike", game)) {
View Full Code Here

                Card card = player.getLibrary().getFromTop(game);
                cards.add(card);
                card.moveToExile(null, null, source.getSourceId(), game);
            }
            FilterCard filter = new FilterCard("creature and/or land cards to put onto the battlefield");
            filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE),
                                     new CardTypePredicate(CardType.LAND)));
            TargetCard target1 = new TargetCard(0, Integer.MAX_VALUE, Zone.EXILED, filter);
            if (cards.size() > 0
                    && target1.canChoose(source.getSourceId(), source.getControllerId(), game)
                    && player.choose(Outcome.PutCardInPlay, cards, target1, game)) {
                for (UUID targetId: target1.getTargets()) {
View Full Code Here

        if (player == null) {
            return false;
        }
   
        FilterCard filter = new FilterCard("creature card with converted mana cost X or less");
        filter.add(new CardTypePredicate(CardType.CREATURE));
        //Set the mana cost one higher to 'emulate' a less than or equal to comparison.
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
   
  TargetCardInLibrary target = new TargetCardInLibrary(filter);
        if (player.searchLibrary(target, game)) {
View Full Code Here

            if (player.chooseUse(Outcome.PutCardInPlay, "Cast a nonland card in your hand that shares a card type with that spell without paying its mana cost?", game)) {
                FilterCard filter = new FilterCard();
                ArrayList<Predicate<MageObject>> types = new ArrayList<Predicate<MageObject>>();
                for (CardType type: stackObject.getCardType()) {
                    if (type != CardType.LAND) {
                        types.add(new CardTypePredicate(type));
                    }
                }
                filter.add(Predicates.or(types));
                TargetCardInHand target = new TargetCardInHand(filter);
                if (player.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
View Full Code Here

       
        FilterPermanent filter = new FilterPermanent("artifacts, creatures, and enchantments");
   
   
        filter.add(Predicates.or(
                new CardTypePredicate(CardType.ARTIFACT),
                new CardTypePredicate(CardType.CREATURE),
                new CardTypePredicate(CardType.ENCHANTMENT)));
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));

   
        for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
            permanent.destroy(source.getSourceId(), game, false);
View Full Code Here

        if (cards.size() > 0) {
            controller.revealCards(sourceObject.getLogName(), cards, game);
            FilterCard filter = new FilterCard("cards with converted mana cost " + xValue + " or less to put onto the battlefield");
            filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, xValue + 1));
            filter.add(
                    Predicates.or(new CardTypePredicate(CardType.ARTIFACT),
                                     new CardTypePredicate(CardType.CREATURE),
                                     new CardTypePredicate(CardType.ENCHANTMENT),
                                     new CardTypePredicate(CardType.LAND),
                                     new CardTypePredicate(CardType.PLANESWALKER)
                    ));
            TargetCard target1 = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, filter);
            target1.setRequired(false);

            controller.choose(Outcome.PutCardInPlay, cards, target1, game);
View Full Code Here

    public ElspethKnightErrantEmblem() {
        this.setName("EMBLEM: Elspeth, Knight-Errant");
        FilterControlledPermanent filter = new FilterControlledPermanent("Artifacts, creatures, enchantments, and lands you control");
        filter.add(Predicates.or(
                new CardTypePredicate(CardType.ARTIFACT),
                new CardTypePredicate(CardType.CREATURE),
                new CardTypePredicate(CardType.ENCHANTMENT),
                new CardTypePredicate(CardType.LAND)));
        Effect effect = new GainAbilityAllEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield, filter, false);
        effect.setText("Artifacts, creatures, enchantments, and lands you control are indestructible");
        this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, effect));
        this.setExpansionSetCodeForImage("MMA");
    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getTargets().getFirstTarget());
        Player controller = game.getPlayer(source.getControllerId());

        FilterControlledPermanent filter = new FilterControlledPermanent("creature");
        filter.add(new CardTypePredicate(CardType.CREATURE));
        filter.add(new ControllerPredicate(TargetController.YOU));
        TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true);

        //A spell or ability could have removed the only legal target this player
        //had, if thats the case this ability should fizzle.
View Full Code Here

TOP

Related Classes of mage.filter.predicate.mageobject.CardTypePredicate

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.