Package mage.filter.common

Examples of mage.filter.common.FilterNonlandPermanent


  public TargetNonlandPermanent(int numTargets) {
    this(numTargets, numTargets, false);
  }

  public TargetNonlandPermanent(int minNumTargets, int maxNumTargets, boolean notTarget) {
    super(minNumTargets, maxNumTargets, new FilterNonlandPermanent(), notTarget);
    this.targetName = filter.getMessage();
  }
View Full Code Here


  public OblivionRing(UUID ownerId) {
    super(ownerId, 20, "Oblivion Ring", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
    this.expansionSetCode = "ALA";
    this.color.setWhite(true);
    FilterNonlandPermanent filter = new FilterNonlandPermanent();
    filter.setId(this.getId());
    filter.setNotId(true);
    Ability ability1 = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect(this.getId(), "Oblivion Ring exile"), false);
    ability1.addTarget(new TargetPermanent(filter));
    this.addAbility(ability1);
    Ability ability2 = new LeavesBattlefieldTriggeredAbility(new ReturnFromExileEffect(this.getId(), Zone.BATTLEFIELD), false);
    this.addAbility(ability2);
View Full Code Here

    public TargetNonlandPermanent(FilterNonlandPermanent filter) {
        this(1, 1, filter, false);
    }

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

    public TargetNonlandPermanent(int numTargets) {
        this(numTargets, numTargets, new FilterNonlandPermanent(), false);
    }

    public TargetNonlandPermanent(int minNumTargets, int maxNumTargets, boolean notTarget) {
        this(minNumTargets, maxNumTargets, new FilterNonlandPermanent(), notTarget);
    }
View Full Code Here

    }

    @Override
    public boolean apply(Game game, Ability source) {
        int xValue = source.getManaCostsToPay().getX();
        for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
            if (permanent.getManaCost().convertedManaCost() == xValue) {
                PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", permanent.getControllerId());
                if (watcher != null && watcher.hasSourceDoneDamage(source.getSourceId(), game)) {
                    permanent.destroy(source.getSourceId(), game, false);
                }
View Full Code Here

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

        // You have may Clever Impersonator enter the battlefield as a copy of any nonland permanent on the battlefield.
        this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
                new EntersBattlefieldEffect(new CopyPermanentEffect(new FilterNonlandPermanent()),
                        "You may have {this} enter the battlefield as a copy of any nonland permanent on the battlefield",
                        true)));
    }
View Full Code Here

        super(effect);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
            creature.moveToZone(Zone.HAND, source.getSourceId(), game, true);
        }
        return true;
    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Map<Permanent, Integer> chosenCards = new HashMap<>(2);
            int maxCount = 0;
            FilterNonlandPermanent filter = new FilterNonlandPermanent("a nonland permanent " + controller.getName() + " doesn't control");
            filter.add(Predicates.not(new ControllerIdPredicate(controller.getId())));
            //Players each choose a legal permanent
            PlayerList playerList = game.getState().getPlayerList();
            while (!playerList.get().equals(controller.getId()) && controller.isInGame()) {
                playerList.getNext();
            }
View Full Code Here

        this.color.setBlue(true);

        // Return target nonland permanent with converted mana cost X to its owner's hand.
        this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
        this.getSpellAbility().addTarget(new TargetPermanent(new FilterNonlandPermanent("nonland permanent with converted mana cost X")));


        // Draw a card.
        this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
    }
View Full Code Here

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

TOP

Related Classes of mage.filter.common.FilterNonlandPermanent

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.