Package mage.filter.predicate.other

Examples of mage.filter.predicate.other.OwnerIdPredicate


    @Override
    public boolean replaceEvent(GameEvent event, Ability source, Game game) {
        Player player = game.getPlayer(event.getPlayerId());
        if (player != null) {
            FilterControlledPermanent filter = new FilterControlledPermanent();
            filter.add(new OwnerIdPredicate(player.getId()));
            for (UUID uuid : player.getHand().copy()) {
                Card card = game.getCard(uuid);
                if (card != null) {
                    card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                }
View Full Code Here


            for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
                Player opponent = game.getPlayer(opponentId);
                if (opponent != null) {
                    ability.getTargets().clear();
                    FilterCard filter = new FilterCard(new StringBuilder("instant or sorcery card from ").append(opponent.getName()).append("'s graveyard").toString());
                    filter.add(new OwnerIdPredicate(opponentId));
                    filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),new CardTypePredicate(CardType.SORCERY)));
                    TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0,1, filter);
                    ability.addTarget(target);
                }
            }
View Full Code Here

        Permanent permanent = (Permanent) game.getLastKnownInformation(target, Zone.BATTLEFIELD);
        if (permanent != null && controller != null) {
            Player player = game.getPlayer(permanent.getOwnerId());
            if (player != null) {
                FilterCreatureCard filter = new FilterCreatureCard(new StringBuilder("a creature card from ").append(player.getName()).append("'s graveyard").toString());
                filter.add(new OwnerIdPredicate(player.getId()));
                Target targetCreature = new TargetCardInGraveyard(filter);
                if (targetCreature.canChoose(source.getSourceId(), controller.getId(), game)
                    && controller.chooseTarget(outcome, targetCreature, source, game)) {
                    Card card = game.getCard(targetCreature.getFirstTarget());
                    if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) {
View Full Code Here

        if (controller != null) {
            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    FilterCard filter = new FilterCreatureCard("creature card with converted mana cost 3 or less from your graveyard");
                    filter.add(new OwnerIdPredicate(playerId));
                    filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, 4));
                    Target target = new TargetCardInGraveyard(filter);
                    if (target.canChoose(playerId, game) && player.chooseTarget(outcome, target, source, game)) {
                        Card card = game.getCard(target.getFirstTarget());
                        if (card != null) {
View Full Code Here

        // add all creatures in range
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            for (UUID playerId : controller.getInRange()) {
                FilterPermanent playerFilter = filter.copy();
                playerFilter.add(new OwnerIdPredicate(playerId));
                for (Permanent permanent :game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
                    objects.add(permanent.getId());
                }
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        FilterCard filter = new FilterCard();
        Player player = game.getPlayer(source.getTargets().getFirstTarget());
        if (player != null) {
            filter.add(new OwnerIdPredicate(player.getId()));
            Target target = new TargetCardInGraveyard(filter);
            game.getPermanent(target.getFirstTarget()).moveToExile(null, null, source.getSourceId(), game);
        }
        return false;
    }
View Full Code Here

            int opponentsReturnedCreatures = 0;
            for (UUID playerId : game.getOpponents(controller.getId())) {
                Player opponent = game.getPlayer(playerId);
                if (opponent != null) {
                    FilterCard filter = new FilterCreatureCard("creature card from your graveyard");
                    filter.add(new OwnerIdPredicate(opponent.getId()));
                    Target targetOpponent = new TargetCardInGraveyard(filter);

                    if (targetOpponent.canChoose(source.getSourceId(), opponent.getId(), game)) {
                        if (opponent.chooseUse(outcome, new StringBuilder("Return a creature card from your graveyard to the battlefield?").toString(), game)) {
                            if (opponent.chooseTarget(outcome, targetOpponent, source, game)) {
View Full Code Here

TOP

Related Classes of mage.filter.predicate.other.OwnerIdPredicate

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.