Examples of TargetControlledPermanent


Examples of mage.target.common.TargetControlledPermanent

    private static final FilterControlledPermanent filter = new FilterControlledLandPermanent();

    public RuinousMinotaurTriggeredAbility() {
        super(Zone.BATTLEFIELD, new SacrificeTargetEffect(), true);
        this.addTarget(new TargetControlledPermanent(filter));
    }
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

        List<Card> chosen = new ArrayList<>();

        for (UUID playerId : game.getPlayerList()) {
            Player player = game.getPlayer(playerId);

            Target target1 = new TargetControlledPermanent(1, 1, filter1, false);
            Target target2 = new TargetControlledPermanent(1, 1, filter2, false);
            Target target3 = new TargetControlledPermanent(1, 1, filter3, false);
            Target target4 = new TargetControlledPermanent(1, 1, filter4, false);


            target1.setNotTarget(true);
            target2.setNotTarget(true);
            target3.setNotTarget(true);
            target4.setNotTarget(true);

            if (target1.canChoose(player.getId(), game)) {
                while (player.isInGame() && !target1.isChosen() && target1.canChoose(player.getId(), game)) {
                    player.choose(Outcome.Benefit, target1, source.getSourceId(), game);
                }
                Permanent artifact = game.getPermanent(target1.getFirstTarget());
                if (artifact != null) {
                    chosen.add(artifact);
                }
                target1.clearChosen();
            }

            if (target2.canChoose(player.getId(), game)) {
                while (player.isInGame() && !target2.isChosen() && target2.canChoose(player.getId(), game)) {
                    player.choose(Outcome.Benefit, target2, source.getSourceId(), game);
                }
                Permanent creature = game.getPermanent(target2.getFirstTarget());
                if (creature != null) {
                    chosen.add(creature);
                }
                target2.clearChosen();
            }

            if (target3.canChoose(player.getId(), game)) {
                while (player.isInGame() && !target3.isChosen() && target3.canChoose(player.getId(), game)) {
                    player.choose(Outcome.Benefit, target3, source.getSourceId(), game);
                }
                Permanent enchantment = game.getPermanent(target3.getFirstTarget());
                if (enchantment != null) {
                    chosen.add(enchantment);
                }
                target3.clearChosen();
            }
           
            if (target4.canChoose(player.getId(), game)) {
                while (player.isInGame() && !target4.isChosen() && target4.canChoose(player.getId(), game)) {
                    player.choose(Outcome.Benefit, target4, source.getSourceId(), game);
                }
                Permanent land = game.getPermanent(target4.getFirstTarget());
                if (land != null) {
                    chosen.add(land);
                }
                target4.clearChosen();
            }

        }

        for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

            }
            if (type != null) {
                FilterPermanent filter = new FilterControlledPermanent(new StringBuilder("permanent you control of type ").append(type.toString()).toString());
                filter.add(new CardTypePredicate(type));

                TargetPermanent target = new TargetControlledPermanent(1, 1, filter, false);
                target.setNotTarget(true);

                // you always go first
                if (target.canChoose(you.getId(), game)) {
                    while (you.isInGame() && !target.isChosen() && target.canChoose(you.getId(), game)) {
                        you.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                    }
                    Permanent permanent = game.getPermanent(target.getFirstTarget());
                    if (permanent != null) {
                        chosen.add(permanent);
                    }
                }

                target.clearChosen();

                // opponents follow
                for (UUID playerId : game.getPlayerList()) {
                    if (playerId != you.getId()) {
                        Player player = game.getPlayer(playerId);
                        if (target.canChoose(playerId, game)) {
                            while (!target.isChosen() && target.canChoose(playerId, game)) {
                                player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                            }
                            Permanent permanent = game.getPermanent(target.getFirstTarget());
                            if (permanent != null) {
                                chosen.add(permanent);
                            }
                            target.clearChosen();
                        }
                    }
                }

                // all chosen permanents are sacrificed together
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

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

        // When Kor Outfitter enters the battlefield, you may attach target Equipment you control to target creature you control.
        Ability ability = new EntersBattlefieldTriggeredAbility(new EquipEffect(), true);
        ability.addTarget(new TargetControlledPermanent(filter));
        ability.addTarget(new TargetControlledCreaturePermanent());
        this.addAbility(ability);
    }
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

        super(ownerId, 136, "Magma Rift", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{R}");
        this.expansionSetCode = "ZEN";
        this.color.setRed(true);

        // As an additional cost to cast Magma Rift, sacrifice a land.
        this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));

        // Magma Rift deals 5 damage to target creature.
        this.getSpellAbility().addEffect(new DamageTargetEffect(5));
        this.getSpellAbility().addTarget(new TargetCreaturePermanent());
    }
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

        // Flying
        this.addAbility(FlyingAbility.getInstance());
       
        // At the beginning of your upkeep, sacrifice Living Tsunami unless you return a land you control to its owner's hand.
        this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SacrificeSourceUnlessPaysEffect(new ReturnToHandTargetCost(new TargetControlledPermanent(1, 1, filter, true))), TargetController.YOU, false));
    }
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            TargetControlledPermanent target = new TargetControlledPermanent(number, number, filter, true);
            if (player.choose(this.outcome, target, source.getSourceId(), game)) {
                for (UUID targetCreatureId : target.getTargets()) {
                    Permanent permanent = game.getPermanent(targetCreatureId);
                    if (permanent != null) {
                        player.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
                    }
                }
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

        this.subtype.add("Giant");
        this.color.setGreen(true);
        this.power = new MageInt(4);
        this.toughness = new MageInt(4);
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new TapSourceCost());
        ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
        ability.addTarget(new TargetPlayer());
        this.addAbility(ability);
    }
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

        List<UUID> perms = new ArrayList<UUID>();
        for (UUID playerId : game.getOpponents(source.getControllerId())) {
            Player player = game.getPlayer(playerId);
            if (player != null) {
                int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game));
                TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false);
                if (target.canChoose(player.getId(), game)) {
                    while (!target.isChosen() && player.isInGame()) {
                        player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                    }
                    perms.addAll(target.getTargets());
                }
            }
        }
        for (UUID permID : perms) {
            Permanent permanent = game.getPermanent(permID);
View Full Code Here

Examples of mage.target.common.TargetControlledPermanent

        return new EldraziMonumentEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        TargetControlledPermanent target = new TargetControlledCreaturePermanent();
        Player player = game.getPlayer(source.getControllerId());
        if (target.canChoose(source.getControllerId(), game)) {
            player.choose(this.outcome, target, source.getSourceId(), game);
            Permanent permanent = game.getPermanent(target.getFirstTarget());
            if (permanent != null) {
                return permanent.sacrifice(source.getSourceId(), game);
            }
        }
        Permanent permanent = game.getPermanent(source.getSourceId());
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.