Examples of SubtypePredicate


Examples of mage.filter.predicate.mageobject.SubtypePredicate

    @Override
    public boolean applies(GameEvent event, Ability source, Game game) {
        if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
            FilterPermanent filter = new FilterPermanent();
            filter.add(new SubtypePredicate("Island"));

            if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
                return true;
            }
        }
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

                    controller.damage(2, permanent.getId(), game, false, true);
                    game.informPlayers("2 damage assigned to " + controller.getName() + " from " + permanent.getName());
                }
            }

            filterEnchantments.add(new SubtypePredicate("Aura"));
            for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) {
                if (auraEnchantment.getAttachedTo() != null) {
                    Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo());
                    if (attachedToCreature != null && attachedToCreature.getCardType().contains(CardType.CREATURE)) {
                        attachedToCreature.damage(2, auraEnchantment.getId(), game, false, true);
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

                }
            }  
            if(!isChangeling){
                ArrayList<Predicate<MageObject>> predicateList = new ArrayList<>();
                for(String subtype : permanent.getSubtype()){
                    predicateList.add(new SubtypePredicate(subtype));
                }
                filter.add(Predicates.or(predicateList));
            }
           
            power = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).size();
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

                if (!player.isInGame()) {
                    return false;
                }
            }
            FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
            filter.add(new SubtypePredicate(typeChoice.getChoice()));
            return new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)).apply(game, source);
        }
        return false;
    }
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

    @Override
    public boolean applies(GameEvent event, Ability source, Game game) {
        if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
            FilterPermanent filter = new FilterPermanent();
            filter.add(new SubtypePredicate("Island"));

            if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
                return true;
            }
        }
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

            Permanent permanent = game.getPermanent(source.getSourceId());
            if (permanent != null) {
                String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
                if (subtype != null) {
                    protectionFilter = new FilterPermanent(subtype+"s");
                    protectionFilter.add(new SubtypePredicate(subtype));
                }
            }
        }
        if (protectionFilter != null) {
            for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

    @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

Examples of mage.filter.predicate.mageobject.SubtypePredicate

       
        FilterPermanent filterAura = new FilterPermanent("Aura");
        FilterCard filterAuraCard = new FilterCard("Aura card");

        filterAura.add(new CardTypePredicate(CardType.ENCHANTMENT));
        filterAura.add(new SubtypePredicate("Aura"));
        filterAura.add(new AuraPermanentCanAttachToPermanentId(bruna));
        filterAuraCard.add(new CardTypePredicate(CardType.ENCHANTMENT));
        filterAuraCard.add(new SubtypePredicate("Aura"));
        filterAuraCard.add(new AuraCardCanAttachToPermanentId(bruna));
       
        if (player == null) {
            return false;
        }
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        Set<UUID> lands = new HashSet<>();
        if (controller != null && sourcePermanent != null) {
            for (String landName : new String[] {"Forest","Island","Mountain","Plains","Swamp"}) {
                FilterLandPermanent filter = new FilterLandPermanent(new StringBuilder(landName).append(" to destroy").toString());
                filter.add(new SubtypePredicate(landName));
                Target target = new TargetLandPermanent(1,1, filter, true);
                if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                    controller.chooseTarget(outcome, target, source, game);
                    lands.add(target.getFirstTarget());
                }
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && permanent != null){
            FilterCard filter = new FilterCard();
            filter.add(new SubtypePredicate("Aura"));
            filter.add(new AuraCardCanAttachToPermanentId(permanent.getId()));
            TargetCardInHand target = new TargetCardInHand(0, 1, filter);
            if (player.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
                Card auraInHand = game.getCard(target.getFirstTarget());
                if (auraInHand != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.