Package mage.filter.common

Examples of mage.filter.common.FilterCreaturePermanent


    }

    @Override
    public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
        Set<UUID> possibleTargets = new HashSet<UUID>();
        for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) {
            if (filter.match(permanent, null, sourceControllerId, game)) {
                possibleTargets.add(permanent.getId());
            }
        }
        return possibleTargets;
View Full Code Here


* @author BetaSteward_at_googlemail.com
*/
public class TargetCreaturePermanent extends TargetPermanent {

    public TargetCreaturePermanent() {
        this(1, 1, new FilterCreaturePermanent(), false);
    }
View Full Code Here

    public TargetCreaturePermanent(FilterCreaturePermanent filter) {
        this(1, 1, filter, false);
    }

    public TargetCreaturePermanent(int numTargets) {
        this(numTargets, numTargets, new FilterCreaturePermanent(), false);
    }
View Full Code Here

    public TargetCreaturePermanent(int numTargets) {
        this(numTargets, numTargets, new FilterCreaturePermanent(), false);
    }

    public TargetCreaturePermanent(int minNumTargets, int maxNumTargets) {
        this(minNumTargets, maxNumTargets, new FilterCreaturePermanent(), false);
    }
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
            FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
            UUID defenderId = game.getCombat().getDefenderId(sourceId);
            filter.add(new ControllerIdPredicate(defenderId));

            this.getTargets().clear();
            TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
            this.addTarget(target);
            return true;
View Full Code Here

        // At the beginning of your upkeep, you may put a treasure counter on Legacy's Allure.
        this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(new Counter("treasure")), TargetController.YOU, true));

        // Sacrifice Legacy's Allure: Gain control of target creature with power less than or equal to the number of treasure counters on Legacy's Allure.
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.EndOfGame, true),new SacrificeSourceCost());
        ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on Legacy's Allure")));
        this.addAbility(ability);
    }
View Full Code Here

    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SimpleActivatedAbility) {
            Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
            if (sourcePermanent != null) {
                int numbCounters = sourcePermanent.getCounters().getCount("treasure");
                FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on Legacy's Allure");
                filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, numbCounters + 1));
                ability.getTargets().clear();
                ability.getTargets().add(new TargetCreaturePermanent(filter));
            }
        }
    }
View Full Code Here

        super(ownerId, 348, "Spontaneous Combustion", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{B}{R}");
        this.expansionSetCode = "TMP";
        this.color.setRed(true);
        this.color.setBlack(true);
        this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
        this.getSpellAbility().addEffect(new DamageAllEffect(3, new FilterCreaturePermanent()));
    }
View Full Code Here

        this.expansionSetCode = "5ED";

        this.color.setBlue(true);

        // You and target player exchange control of the creature you each control with the highest converted mana cost. Then exchange control of artifacts the same way. If two or more permanents a player controls are tied for highest cost, their controller chooses one of them.
        this.getSpellAbility().addEffect(new JuxtaposeEffect(new FilterCreaturePermanent(), "You and target player exchange control of the creature you each control with the highest converted mana cost."));
        this.getSpellAbility().addEffect(new JuxtaposeEffect(new FilterArtifactPermanent(), "Then exchange control of artifacts the same way. If two or more permanents a player controls are tied for highest cost, their controller chooses one of them."));
        this.getSpellAbility().addTarget(new TargetPlayer() );
    }
View Full Code Here

        // Whenever a Sliver deals combat damage to a player, its controller may draw a card.
        Effect effect = new DrawCardTargetEffect(1);
        effect.setText("its controller may draw a card");
        this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(effect,
                        new FilterCreaturePermanent("Sliver", "a Sliver"),
                        true, true, true));
    }
View Full Code Here

TOP

Related Classes of mage.filter.common.FilterCreaturePermanent

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.