Package mage.filter.predicate.permanent

Examples of mage.filter.predicate.permanent.ControllerPredicate


        Player player = game.getPlayer(source.getTargets().getFirstTarget());
        Player controller = game.getPlayer(source.getControllerId());

        FilterControlledPermanent filter = new FilterControlledPermanent("creature");
        filter.add(new CardTypePredicate(CardType.CREATURE));
        filter.add(new ControllerPredicate(TargetController.YOU));
        TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);

        if (target.canChoose(player.getId(), game)) {
            player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
View Full Code Here


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

        FilterPermanent seasinger = new FilterPermanent();
        seasinger.add(new ControllerPredicate(TargetController.YOU));
        seasinger.add(new CardIdPredicate(this.getId()));

        // When you control no Islands, sacrifice Seasinger.
        this.addAbility(new SeasingerTriggeredAbility());
View Full Code Here

            triggeringCreature = (Permanent) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD);
        }
        if (triggeringCreature != null) {
            FilterPermanent filter = new FilterPermanent("another permanent you control that shares a card type with " + triggeringCreature.getName());
            filter.add(Predicates.not(new PermanentIdPredicate(triggeringCreature.getId())));
            filter.add(new ControllerPredicate(TargetController.YOU));
            Set<CardTypePredicate> cardTypes = new HashSet<CardTypePredicate>();
            for (CardType cardType :triggeringCreature.getCardType()) {
                cardTypes.add(new CardTypePredicate(cardType));
            }
            filter.add(Predicates.or(cardTypes));
View Full Code Here

    public void init(Ability source, Game game) {
        super.init(source, game);

        FilterLandPermanent filter = new FilterLandPermanent("Swamps");
        filter.add(new SubtypePredicate("Swamp"));
        filter.add(new ControllerPredicate(TargetController.YOU));
        this.amount = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);

        Player player = game.getPlayer(source.getControllerId());

        String message = "Should the target creature get -X/-X instead of +X/+X?";
View Full Code Here

        FilterCreaturePermanent filter = new FilterCreaturePermanent("monocolored creature");
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        if (player == null) {
            return false;
        }
        filter.add(new ControllerPredicate(TargetController.YOU));
        filter.add(new MonocoloredPredicate());
       
        int amount;
        int realCount = game.getBattlefield().countAll(filter, player.getId(), game);
        amount = Math.min(1, realCount);
View Full Code Here

        this.addAbility(FirstStrikeAbility.getInstance());
        // Other Knight creatures you control get +1/+1 and are indestructible.
        this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
        FilterCreaturePermanent indestructibleFilter = filter.copy();
        indestructibleFilter.add(new AnotherPredicate());
        indestructibleFilter.add(new ControllerPredicate(TargetController.YOU));
        indestructibleFilter.setMessage("Other Knight creatures you control");
        Effect effect = new GainAbilityAllEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield, indestructibleFilter, false);
        effect.setText("Other Knight creatures you control are indestructible");
        this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
View Full Code Here

        Player player = game.getPlayer(source.getTargets().getFirstTarget());
        Player controller = game.getPlayer(source.getControllerId());

        FilterControlledPermanent filter = new FilterControlledPermanent("creature");
        filter.add(new CardTypePredicate(CardType.CREATURE));
        filter.add(new ControllerPredicate(TargetController.YOU));
        TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true);

        //A spell or ability could have removed the only legal target this player
        //had, if thats the case this ability should fizzle.
        if (target.canChoose(player.getId(), game)) {
View Full Code Here

    }

    @Override
    public boolean apply(Game game, Ability source) {
        FilterLandPermanent filter = new FilterLandPermanent();
        filter.add(new ControllerPredicate(TargetController.YOU));

        int amount = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this);
        TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterBasicLandCard());

        Player player = game.getPlayer(source.getControllerId());
View Full Code Here

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

        filter.add(new ControllerPredicate(TargetController.YOU));

        int amount = count.calculate(game, source, this);
        int realCount = game.getBattlefield().countAll(filter, player.getId(), game);
        amount = Math.min(amount, realCount);
View Full Code Here

            for (UUID opponentId: game.getOpponents(controller.getId())) {
                Player opponent = game.getPlayer(opponentId);
                if (opponent != null) {
                    FilterControlledPermanent filter = new FilterControlledPermanent("creature to sacrifice");
                    filter.add(new CardTypePredicate(CardType.CREATURE));
                    filter.add(new ControllerPredicate(TargetController.YOU));
                    TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
                    if (target.canChoose(opponent.getId(), game)) {
                        if (opponent.chooseUse(Outcome.AIDontUseIt, new StringBuilder("Sacrifice a creature to tap ").append(descrationDemon.getName()).append("and put a +1/+1 counter on it?").toString(), game))
                        {
                            opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
View Full Code Here

TOP

Related Classes of mage.filter.predicate.permanent.ControllerPredicate

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.