Package mage.filter.common

Examples of mage.filter.common.FilterArtifactPermanent


        this.toughness = new MageInt(1);

        // {X}, Sacrifice Hearth Kami: Destroy target artifact with converted mana cost X.
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}"));
        ability.addCost(new SacrificeSourceCost());
        ability.addTarget(new TargetPermanent(new FilterArtifactPermanent("artifact with converted mana cost X")));
        this.addAbility(ability);
    }
View Full Code Here


    @Override
    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SimpleActivatedAbility) {
            int xValue = ability.getManaCostsToPay().getX();
            ability.getTargets().clear();
            FilterArtifactPermanent filter = new FilterArtifactPermanent(new StringBuilder("artifact with converted mana cost ").append(xValue).toString());
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, xValue));
            Target target = new TargetPermanent(filter);
            ability.addTarget(target);
        }
    }
View Full Code Here

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event instanceof DamagedPlayerEvent) {
            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
            if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
                FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact that player controls");
                filter.add(new ControllerIdPredicate(event.getPlayerId()));
                filter.setMessage("artifact controlled by " + game.getPlayer(event.getTargetId()).getName());

                this.getTargets().clear();
                this.addTarget(new TargetPermanent(filter));
                return true;
            }
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) {
            FilterArtifactPermanent filter = new FilterArtifactPermanent();
            if (!game.getBattlefield().contains(filter, controllerId, 1, game)) {
                return true;
            }
        }
        return false;
View Full Code Here

                        new BeginningOfUpkeepTriggeredAbility(
                                new SacrificeSourceUnlessPaysEffect(new GenericManaCost(2)),
                                TargetController.YOU,
                                false),
                        Duration.WhileOnBattlefield,
                        new FilterArtifactPermanent(),
                        "All artifacts have \"At the beginning of your upkeep, sacrifice this artifact unless you pay {2}.\"")));
    }
View Full Code Here

        this.color.setWhite(true);
        this.power = new MageInt(1);
        this.toughness = new MageInt(1);

        // Whenever an artifact enters the battlefield, you may gain 1 life.
        this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(1), new FilterArtifactPermanent(), true));
    }
View Full Code Here

        super(effect);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        FilterArtifactPermanent filter = new FilterArtifactPermanent("noncreature, non-Equipment artifact");
        filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
        filter.add(Predicates.not(new SubtypePredicate("Equipment")));

        List<UUID> affectedPermanents = new ArrayList<UUID>();
        List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
        for (Permanent permanent : permanents) {
            if (permanent != null) {
View Full Code Here

        // {G}, {tap}, Sacrifice Elvish Scrapper: Destroy target artifact.
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{G}"));
        ability.addCost(new TapSourceCost());
        ability.addCost(new SacrificeSourceCost());
        ability.addTarget(new TargetPermanent(new FilterArtifactPermanent()));
        this.addAbility(ability);
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            int lifeToGain = game.getBattlefield().count(new FilterCreaturePermanent(), source.getSourceId(), source.getControllerId(), game);
            lifeToGain += game.getBattlefield().count(new FilterArtifactPermanent(), source.getSourceId(), source.getControllerId(), game);
            player.gainLife(lifeToGain, game);
        }
        return true;
    }
View Full Code Here

        // You may sacrifice two Mountains rather than pay Pulverize's mana cost.
        this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true))));
       
        // Destroy all artifacts.
        this.getSpellAbility().addEffect(new DestroyAllEffect(new FilterArtifactPermanent()));
    }
View Full Code Here

TOP

Related Classes of mage.filter.common.FilterArtifactPermanent

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.