Package mage.target.common

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


  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
      TargetControlledPermanent target = new TargetControlledPermanent(filter);
      if (target.canChoose(null, source.getControllerId(), game)) {
        target.setRequired(true);
        if (player.choose(Outcome.Neutral, target, game)) {
          Permanent permanent = game.getPermanent(target.getFirstTarget());
          if (permanent != null) {
            permanent.addCounters("phylactery", 1);
View Full Code Here


  @Override
  public boolean apply(Game game, Ability source) {
    TargetControlledPermanent target = new TargetControlledCreaturePermanent();
    target.setRequired(true);
    Player player = game.getPlayer(source.getControllerId());
    if (target.canChoose(source.getId(), source.getControllerId(), game)) {
      player.choose(this.outcome, target, game);
      Permanent permanent = game.getPermanent(target.getFirstTarget());
      if (permanent != null) {
        return permanent.sacrifice(source.getSourceId(), game);
      }
View Full Code Here

        for (UUID playerId : controller.getInRange()) {
            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, true);
                if (target.canChoose(player.getId(), game)) {
                    while (!target.isChosen() && player.isInGame()) {
                        player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                    }
                    perms.addAll(target.getTargets());
                }
View Full Code Here

                        cards.add(permanent);
                        controller.lookAtCards("Soulbond", cards, game);
                        if (controller.chooseUse(Outcome.Benefit, "Use Soulbond?", game)) {
                            TargetControlledPermanent target = new TargetControlledPermanent(filter);
                            target.setNotTarget(true);
                            if (target.canChoose(permanent.getId(), controller.getId(), game)) {
                                if (controller.choose(Outcome.Benefit, target, permanent.getId(), game)) {
                                    Permanent chosen = game.getPermanent(target.getFirstTarget());
                                    if (chosen != null) {
                                        chosen.setPairedCard(permanent.getId());
                                        permanent.setPairedCard(chosen.getId());
View Full Code Here

                    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) {
View Full Code Here

                }
                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);
View Full Code Here

                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) {
View Full Code Here

                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);
View Full Code Here

                // 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) {
View Full Code Here

                // 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);
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.