Package mage.filter

Examples of mage.filter.FilterPermanent


    protected CompoundAbility ability;
    protected boolean excludeSource;
    protected FilterPermanent filter;

    public GainAbilityControlledEffect(Ability ability, Duration duration) {
        this(ability, duration, new FilterPermanent("permanents"));
    }
View Full Code Here


    public GainAbilityControlledEffect(Ability ability, Duration duration) {
        this(ability, duration, new FilterPermanent("permanents"));
    }

    public GainAbilityControlledEffect(CompoundAbility ability, Duration duration) {
        this(ability, duration, new FilterPermanent("permanents"));
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        boolean conditionApplies = false;

        FilterPermanent localFilter = filter.copy();
        if (onlyControlled) {
            localFilter.add(new ControllerIdPredicate(source.getControllerId()));
        }

        switch ( this.type ) {
            case FEWER_THAN:
                conditionApplies = game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) < this.count;
View Full Code Here

    protected Ability ability;
    protected boolean excludeSource;
    protected FilterPermanent filter;

    public GainAbilityAllEffect(Ability ability, Duration duration) {
        this(ability, duration, new FilterPermanent());
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            FilterPermanent filter = new FilterControlledLandPermanent(new StringBuilder("any number of ").append(sweepSubtype).append("s you control").toString());
            filter.add(new SubtypePredicate(sweepSubtype));
            Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
            if (controller.chooseTarget(outcome, target, source, game)) {
                game.getState().setValue(CardUtil.getCardZoneString("sweep", source.getSourceId(), game), target.getTargets().size());
                for (UUID uuid : target.getTargets()) {
                    Permanent land = game.getPermanent(uuid);
View Full Code Here

                type = CardType.PLANESWALKER;
            } else if (choosenType.equals(CardType.TRIBAL.toString())) {
                type = CardType.TRIBAL;
            }
            if (type != null) {
                FilterPermanent filter = new FilterControlledPermanent(new StringBuilder("permanent you control of type ").append(type.toString()).toString());
                filter.add(new CardTypePredicate(type));

                TargetPermanent target = new TargetControlledPermanent(1, 1, filter, false);
                target.setNotTarget(true);

                // you always go first
View Full Code Here

        this("spell or permanent");
    }

    public FilterSpellOrPermanent(String name) {
        super(name);
        permanentFilter = new FilterPermanent();
        spellFilter = new FilterSpell();
    }
View Full Code Here

        assertLife(playerA, 20);
        assertLife(playerB, 20);
        assertLife(playerC, 20);
        assertLife(playerD, 20);

        FilterPermanent filterPermanent = new FilterLandPermanent();
        filterPermanent.add(new SubtypePredicate("Forest"));
        List<Permanent> forestCards = currentGame.getBattlefield().getAllActivePermanents(filterPermanent, currentGame);
        Assert.assertEquals(4, forestCards.size());
    }
View Full Code Here

        return new OranRiefTheVastwoodEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        FilterPermanent filter = new FilterPermanent();
        filter.add(new CardTypePredicate(CardType.CREATURE));
        filter.add(new ColorPredicate(ObjectColor.GREEN));
        for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
            if (permanent.getTurnsOnBattlefield() == 0) {
                permanent.addCounters(CounterType.P1P1.createInstance(), game);
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        boolean conditionApplies = false;

        FilterPermanent localFilter = filter.copy();
        localFilter.add(new ControllerPredicate(TargetController.OPPONENT));

        switch ( this.type ) {
            case FEWER_THAN:
                conditionApplies = game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game) < this.count;
                break;
View Full Code Here

TOP

Related Classes of mage.filter.FilterPermanent

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.