Package mage.target.common

Examples of mage.target.common.TargetControlledPermanent.choose()


        if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
            Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken());
            if (tokenPermanent != null) {
                //TODO: Make sure the Equipment can legally enchant the token, preferably on targetting.
                Target target = new TargetControlledPermanent(0, 1, filter, true);
                if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
                    Permanent equipmentPermanent = game.getPermanent(target.getFirstTarget());
                    if (equipmentPermanent != null) {
                        Permanent attachedTo = game.getPermanent(equipmentPermanent.getAttachedTo());
                        if (attachedTo != null) {
                            attachedTo.removeAttachment(equipmentPermanent.getId(), game);
View Full Code Here


    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            int drawnCards = player.drawCards(source.getManaCostsToPay().getX(), game);
            Target target = new TargetControlledPermanent(0, drawnCards, new FilterPermanent(), true);
            target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game);
            int sacrificedPermanents = 0;
            for (UUID permanentId : target.getTargets()) {
                Permanent permanent = game.getPermanent(permanentId);
                if (permanent != null) {
                    if (permanent.sacrifice(source.getSourceId(), game)) {
View Full Code Here

           
            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    TargetControlledPermanent target = new TargetControlledPermanent(minLand, minLand, new FilterControlledLandPermanent(), true);
                    if (target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game)) {
                        for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), player.getId(), source.getSourceId(), game)) {
                            if (permanent != null && !target.getTargets().contains(permanent.getId())) {
                                landsToSacrifice.add(permanent);
                            }
                        }
View Full Code Here

            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    TargetControlledPermanent target = new TargetControlledPermanent(minCreature, minCreature, new FilterControlledCreaturePermanent(), true);
                    if (target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game)) {
                        for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), player.getId(), source.getSourceId(), game)) {
                            if (permanent != null && !target.getTargets().contains(permanent.getId())) {
                                creaturesToSacrifice.add(permanent);
                            }
                        }
View Full Code Here

            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    Cards cards = new CardsImpl();
                    TargetCardInHand target = new TargetCardInHand(minCard, new FilterCard());
                    if (target.choose(Outcome.Discard, player.getId(), source.getSourceId(), game)) {
                        for (Card card : player.getHand().getCards(game)) {
                            if (card != null && !target.getTargets().contains(card.getId())) {
                                cards.add(card);
                            }
                        }
View Full Code Here

           
            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    TargetControlledPermanent target = new TargetControlledPermanent(minLand, minLand, new FilterControlledLandPermanent(), true);
                    if (target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game)) {
                        for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), player.getId(), source.getSourceId(), game)) {
                            if (permanent != null && !target.getTargets().contains(permanent.getId())) {
                                landsToSacrifice.add(permanent);
                            }
                        }
View Full Code Here

            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    TargetControlledPermanent target = new TargetControlledPermanent(minCreature, minCreature, new FilterControlledCreaturePermanent(), true);
                    if (target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game)) {
                        for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), player.getId(), source.getSourceId(), game)) {
                            if (permanent != null && !target.getTargets().contains(permanent.getId())) {
                                creaturesToSacrifice.add(permanent);
                            }
                        }
View Full Code Here

            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    Cards cards = new CardsImpl();
                    TargetCardInHand target = new TargetCardInHand(minCard, new FilterCard());
                    if (target.choose(Outcome.Discard, player.getId(), source.getSourceId(), game)) {
                        for (Card card : player.getHand().getCards(game)) {
                            if (card != null && !target.getTargets().contains(card.getId())) {
                                cards.add(card);
                            }
                        }
View Full Code Here

            // sacrifice permanents over the minimum
            for(UUID playerId : controller.getInRange()){
                Player player = game.getPlayer(playerId);
                if(player != null){
                    TargetControlledPermanent target = new TargetControlledPermanent(minPermanent, minPermanent, new FilterControlledPermanent(), true);
                    if(target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game)){
                        for(Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledPermanent(), player.getId(), source.getSourceId(), game)){
                            if(permanent != null && !target.getTargets().contains(permanent.getId())){
                                permanent.sacrifice(source.getSourceId(), game);
                            }
                        }
View Full Code Here

            // discard cards over the minimum
            for(UUID playerId : controller.getInRange()){
                Player player = game.getPlayer(playerId);
                if(player != null){
                    TargetCardInHand target = new TargetCardInHand(minCard, new FilterCard());
                    if(target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game)){
                        Cards cards =  player.getHand().copy();
                        for(UUID cardUUID : cards){
                            Card card = player.getHand().get(cardUUID, game);
                            if(card != null && !target.getTargets().contains(cardUUID)){
                                player.discard(card, source, game);
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.