Package mage.filter.predicate.mageobject

Examples of mage.filter.predicate.mageobject.ConvertedManaCostPredicate


            if (permanent != null && permanent.getManaCost().convertedManaCost() > maxCMC) {
                maxCMC = permanent.getManaCost().convertedManaCost();
            }
        }
        FilterPermanent filterMaxCMC = new FilterCreaturePermanent();
        filterMaxCMC.add(new ConvertedManaCostPredicate(ComparisonType.Equal, maxCMC));
        for (Permanent permanent : game.getBattlefield().getActivePermanents(filterMaxCMC, source.getControllerId(), game)) {
            if (permanent != null) {
                permanent.addAbility(new ProtectionAbility(filter), source.getSourceId(), game);
            }
        }
View Full Code Here


    public boolean apply(Game game, Ability source) {
        Spell spell = game.getState().getStack().getSpell(getTargetPointer().getFirst(game, source));
        if (spell != null) {
            int cmc = spell.getConvertedManaCost();
            FilterPermanent filter = new FilterPermanent();
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
            return new DestroyAllEffect(filter).apply(game, source);
        }
        return false;
    }
View Full Code Here

        }
        int xCost = source.getManaCostsToPay().getX();
        FilterCard filter = new FilterCard(new StringBuilder("creature card with converted mana cost ").append(xCost).append(" or less").toString());
        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, xCost + 1));
        TargetCardInLibrary target = new TargetCardInLibrary(filter);
        if (player.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                if (card != null) {
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (player != null && sourcePermanent != null) {
            int numCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1);
            FilterCreaturePermanent filter = new FilterCreaturePermanent();
            filter.add(new ConvertedManaCostPredicate(ComparisonType.Equal, numCounters));
            for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
                permanent.destroy(source.getSourceId(), game, false);
            }
            return true;
        }
View Full Code Here

                }
                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)) {
                    TargetCard targetAura = new TargetCard(Zone.PICK, filterAuraCard);
                    if (you.choose(Outcome.Benefit, you.getHand(), targetAura, game)) {
                        Card aura = game.getCard(targetAura.getFirstTarget());
View Full Code Here

    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SpellAbility) {
            ability.getTargets().clear();
            int xValue = ability.getManaCostsToPay().getX();
            FilterNonlandPermanent filter = new FilterNonlandPermanent(new StringBuilder("nonland permanent with converted mana cost ").append(xValue).toString());
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, xValue));
            ability.addTarget(new TargetNonlandPermanent(filter));
        }
    }
View Full Code Here

        }
   
        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)) {
            if (target.getTargets().size() > 0) {
                Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
View Full Code Here

                }
            }
            // cast the possible cards without paying the mana
            ExileZone epicExperimentExileZone = game.getExile().getExileZone(source.getSourceId());
            FilterCard filter = filterStatic.copy();
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
            filter.setMessage("instant and sorcery cards with converted mana cost "+ source.getManaCostsToPay().getX() +" or less");
            while (epicExperimentExileZone != null && epicExperimentExileZone.count(filter, game) > 0
                    && controller.chooseUse(Outcome.PlayForFree, "Cast cards exiled with Epic Experiment without paying its mana cost?", game)) {
                TargetCardInExile target = new TargetCardInExile(filter, source.getSourceId());
                while (epicExperimentExileZone.count(filter, game) > 0 && controller.choose(Outcome.PlayForFree, epicExperimentExileZone, target, game)) {
View Full Code Here

   
        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

                    cmc = ((RemoveVariableCountersSourceCost)cost).getAmount();
                }
            }

            FilterNonlandCard filter = new FilterNonlandCard("nonland card with converted mana cost X = " + cmc);
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
            TargetCardInLibrary target = new TargetCardInLibrary(filter);

            if (player.searchLibrary(target, game)) {
                Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                if (card != null) {
View Full Code Here

TOP

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

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.