Package mage.filter.predicate.mageobject

Examples of mage.filter.predicate.mageobject.ColorPredicate


        if (limited) {
            ArrayList<Predicate<MageObject>> predicates = new ArrayList<>();

            if (this.tbGreen.isSelected()) {
                predicates.add(new ColorPredicate(ObjectColor.GREEN));
            }
            if (this.tbRed.isSelected()) {
                predicates.add(new ColorPredicate(ObjectColor.RED));
            }
            if (this.tbBlack.isSelected()) {
                predicates.add(new ColorPredicate(ObjectColor.BLACK));
            }
            if (this.tbBlue.isSelected()) {
                predicates.add(new ColorPredicate(ObjectColor.BLUE));
            }
            if (this.tbWhite.isSelected()) {
                predicates.add(new ColorPredicate(ObjectColor.WHITE));
            }
            if (this.tbColorless.isSelected()) {
                predicates.add(new ColorlessPredicate());
            }
            filter.add(Predicates.or(predicates));
View Full Code Here


        this.color.setBlue(true);

        // You may exile a blue card from your hand rather than pay Misdirection's mana cost.
        FilterOwnedCard filterCardInHand = new FilterOwnedCard("a blue card from your hand");
        filterCardInHand.add(new ColorPredicate(ObjectColor.BLUE));
        // the exile cost can never be paid with the card itself
        filterCardInHand.add(Predicates.not(new CardIdPredicate(this.getId())));      
        this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(filterCardInHand))));

        // Change the target of target spell with a single target.
View Full Code Here

    }

    @Override
    public boolean apply(Game game, Ability source) {
        ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
        filter2.add(new ColorPredicate(choice.getColor()));
        filter2.setMessage(choice.getChoice());
        setAbility(new ProtectionAbility(new FilterCard(filter2)));
        return super.apply(game, source);
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Permanent creature = game.getPermanent(source.getSourceId());
        if (creature != null) {
            ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
            protectionFilter.add(new ColorPredicate(choice.getColor()));
            protectionFilter.setMessage(choice.getChoice());
            ProtectionAbility ability = new ProtectionAbility(protectionFilter);
            creature.addAbility(ability, source.getSourceId(), game);
            return true;
        }
View Full Code Here

        FilterCard protectionFilter = new FilterCard();
        ChoiceColorOrArtifact choice = (ChoiceColorOrArtifact) source.getChoices().get(0);
        if (choice.isArtifactSelected()) {
            protectionFilter.add(new CardTypePredicate(CardType.ARTIFACT));
        } else {
            protectionFilter.add(new ColorPredicate(choice.getColor()));
        }

        protectionFilter.setMessage(choice.getChoice());
        ((ProtectionAbility) ability).setFilter(protectionFilter);
        Permanent creature = game.getPermanent(source.getFirstTarget());
View Full Code Here

            Permanent permanent = game.getPermanent(source.getSourceId());
            if (permanent != null) {
                String color = (String) game.getState().getValue(permanent.getId() + "_color");
                if (color != null) {
                    protectionFilter = new FilterPermanent(color);
                    protectionFilter.add(new ColorPredicate(new ObjectColor(color)));
                }
            }
        }
        if (protectionFilter != null) {
            for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
View Full Code Here

        this.subtype.add("Arcane");
        this.color.setRed(true);

        // You may exile a red card with converted mana cost X from your hand rather than pay Blazing Shoal's mana cost.
        FilterOwnedCard filter = new FilterOwnedCard("a red card with converted mana cost X from your hand");
        filter.add(new ColorPredicate(ObjectColor.RED));
        filter.add(Predicates.not(new CardIdPredicate(this.getId()))); // the exile cost can never be paid with the card itself
        this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(filter))));

        // Target creature gets +X/+0 until end of turn.
        this.getSpellAbility().addEffect(new BoostTargetEffect(new ExileFromHandCostCardConvertedMana(), new StaticValue(0), Duration.EndOfTurn));
View Full Code Here

        this.color.setRed(true);

        // You may exile a red card from your hand rather than pay Cave-In's mana cost.
        FilterOwnedCard filter = new FilterOwnedCard("a red card from your hand");
        filter.add(new ColorPredicate(ObjectColor.RED));
        filter.add(Predicates.not(new CardIdPredicate(this.getId())));      
        this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(filter))));
       
        // Cave-In deals 2 damage to each creature and each player.
        this.getSpellAbility().addEffect(new DamageEverythingEffect(2));
View Full Code Here

        // At the beginning of the end step, sacrifice Ichorid.
        this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new SacrificeSourceEffect(), false));
        // At the beginning of your upkeep, if Ichorid is in your graveyard, you may exile a black creature card other than Ichorid from your graveyard. If you do, return Ichorid to the battlefield.
        FilterCard filter = new FilterCreatureCard("a black creature card other than Ichorid from your graveyard");
        filter.add(Predicates.not(new CardIdPredicate(this.getId())));
        filter.add(new ColorPredicate(ObjectColor.BLACK));
        Ability ability = new IchoridTriggerdAbility(filter);
        this.addAbility(ability);
       
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        FilterPermanent filter = new FilterPermanent();
        ObjectColor color = ((ChoiceColor) source.getChoices().get(0)).getColor();
        if (color != null) {
            filter.add(new ColorPredicate(color));

            for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
                permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true);
            }
            return true;
View Full Code Here

TOP

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

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.