Package mage.filter

Examples of mage.filter.FilterPermanent


        for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
            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


}

class MichikoKondaTruthSeekerAbility extends TriggeredAbilityImpl {

    public MichikoKondaTruthSeekerAbility() {
        super(Zone.BATTLEFIELD, new SacrificeEffect(new FilterPermanent(), 1, "that player"), false);
    }
View Full Code Here

    @Override
    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

        }

        @Override
        public boolean apply(Game game, Ability source) {

            FilterPermanent filterEnchantments = new FilterPermanent();
            filterEnchantments.add(new CardTypePredicate(CardType.CREATURE));

            for (Permanent permanent : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) {
                Player controller = game.getPlayer(permanent.getControllerId());
                if (controller != null) {
                    controller.damage(1, permanent.getId(), game, false, true);
View Full Code Here

        Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
        if (permanent == null) {
            return false;
        }

        FilterPermanent filter = new FilterPermanent("black permanent");
        filter.add(new ColorPredicate(ObjectColor.BLACK));

        if (game.getBattlefield().countAll(filter, source.getControllerId(), game) == 0) {
            permanent.damage(2, source.getSourceId(), game, false, true);
        } else {
            permanent.destroy(source.getSourceId(), game, false);
View Full Code Here

        this.color.setGreen(true);
        this.power = new MageInt(2);
        this.toughness = new MageInt(2);

        // Forests you control are 1/1 green Elf creatures that are still lands.
        this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new AmbushCommanderToken(), "lands", new FilterPermanent("Forest", "Forests"), Duration.WhileOnBattlefield)));
        // {1}{G}, Sacrifice an Elf: Target creature gets +3/+3 until end of turn.
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(3,3, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}"));
        ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1, filter, true)));
        ability.addTarget(new TargetCreaturePermanent());
        this.addAbility(ability);
View Full Code Here

        return false;
    }

    @Override
    public boolean checkInterveningIfClause(Game game) {
        FilterPermanent filter = new FilterPermanent();
        filter.add(new ColorPredicate(ObjectColor.BLACK));
        if (game.getBattlefield().countAll(filter, this.controllerId, game) >= 1) {
            return true;
        }
        return false;
    }
View Full Code Here

        if (ability instanceof EntersBattlefieldTriggeredAbility) {
            for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
                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

        if (ability.getAbilityType().equals(AbilityType.TRIGGERED)) {
            Spell spell = game.getStack().getSpell(ability.getEffects().get(0).getTargetPointer().getFirst(game, ability));
            if (spell != null) {
                int cmc = spell.getConvertedManaCost();
                ability.getTargets().clear();
                FilterPermanent filter = new FilterCreaturePermanent(new StringBuilder("creature with converted mana costs of ").append(cmc).toString());
                Target target = new TargetPermanent(filter);
                ability.addTarget(target);
            }
        }
    }
View Full Code Here

        this.power = new MageInt(2);
        this.toughness = new MageInt(2);

        // When Noggle Hedge-Mage enters the battlefield, if you control two or more Islands, you may tap two target permanents.
        Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule, true);
        ability.addTarget(new TargetPermanent(2, new FilterPermanent()));
        this.addAbility(ability);
       
        // When Noggle Hedge-Mage enters the battlefield, if you control two or more Mountains, you may have Noggle Hedge-Mage deal 2 damage to target player.
        Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2, true);
        ability2.addTarget(new TargetPlayer());
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.