Examples of SubtypePredicate


Examples of mage.filter.predicate.mageobject.SubtypePredicate

            return false;
        }

        FilterCard filter = new FilterCard("Aura card");
        filter.add(new CardTypePredicate(CardType.ENCHANTMENT));
        filter.add(new SubtypePredicate("Aura"));

        Card card = null;
        Zone zone = null;
        if (player.chooseUse(Outcome.Neutral, "Search your graveyard for an Aura card?", game)) {
            TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

    @Override
    public boolean apply(Game game, Ability source) {
        boolean conditionApplies = false;
        FilterPermanent filter = new FilterPermanent();
        filter.add(new SubtypePredicate("Human"));

        Set<UUID> opponents = game.getOpponents(source.getControllerId());
        for (UUID opponentId : opponents) {
            conditionApplies |= game.getBattlefield().countAll(filter, opponentId, game) > 0;
        }
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            FilterCard filter = new FilterCard("Zombie card");
            filter.add(new SubtypePredicate("Zombie"));
            Card[] cards = player.getGraveyard().getCards(filter, game).toArray(new Card[0]);
            if (cards.length > 0) {
                Random rnd = new Random();
                Card card = cards[rnd.nextInt(cards.length)];
                card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

         if (event instanceof DamagedPlayerEvent) {
            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
            Permanent p = game.getPermanent(event.getSourceId());
            if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
                FilterPermanent filter = new FilterPermanent("Equipment that player controls");
                filter.add(new SubtypePredicate("Equipment"));
                filter.add(new ControllerIdPredicate(event.getPlayerId()));
                filter.setMessage("creature controlled by " + game.getPlayer(event.getTargetId()).getName());

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

Examples of mage.filter.predicate.mageobject.SubtypePredicate

        if (player == null) {
            return false;
        }

        FilterCard filter = new FilterCard("Equipment");
        filter.add(new SubtypePredicate("Equipment"));
        TargetCardInLibrary target = new TargetCardInLibrary(filter);
        if (player.searchLibrary(target, game)) {
            Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
            if (card != null) {
                card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

                if (card.getCardType().contains(CardType.CREATURE)) {
                    FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();

                    ArrayList<Predicate<MageObject>> subtypes = new ArrayList<>();
                    for (String subtype: card.getSubtype()) {
                        subtypes.add(new SubtypePredicate(subtype));
                    }
                    filter.add(Predicates.or(subtypes));

                    int count = game.getBattlefield().getAllActivePermanents(filter, player.getId(), game).size();
                    if (count > 0) {
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

        if (targetPlayer == null || controller == null) {
            return false;
        }

        FilterControlledPermanent filter = new FilterControlledPermanent();
        filter.add(new SubtypePredicate("Faerie"));
        int numberOfFaeries = game.getBattlefield().countAll(filter, controller.getId(), game);

        Cards revealedCards = new CardsImpl();
        if (numberOfFaeries > 0 && targetPlayer.getHand().size() > numberOfFaeries) {
            Cards cardsInHand = new CardsImpl(Zone.PICK);
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

    @Override
    public int calculate(Game game, Ability sourceAbility, Effect effect) {
        FilterPermanent zombiesBattlefield = new FilterPermanent("Zombies on the battlefield");
        FilterCard zombiesInGraveyard = new FilterCard("Zombie cards in all graveyards");
        zombiesBattlefield.add(new SubtypePredicate("Zombie"));
        zombiesInGraveyard.add(new SubtypePredicate("Zombie"));
       
        int count = game.getBattlefield().count(zombiesBattlefield, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
        for (UUID playerId : game.getPlayer(sourceAbility.getControllerId()).getInRange()) {
            Player player = game.getPlayer(playerId);
            if (player != null) {
View Full Code Here

Examples of mage.filter.predicate.mageobject.SubtypePredicate

    @Override
    public boolean apply(Game game, Ability source) {
        boolean applied = false;
        FilterPermanent filter = new FilterPermanent();
        filter.add(Predicates.or(new SubtypePredicate("Equipment"),
                new SubtypePredicate("Aura")));
        Permanent targetCreature = game.getPermanent(source.getFirstTarget());
        if (targetCreature != null
                && targetCreature.getAttachments().size() > 0) {
            for (Permanent attachment : game.getBattlefield().getAllActivePermanents(filter, game)) {
                if (attachment != 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.