Package mage.target

Examples of mage.target.TargetPermanent.canChoose()


        Player player = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanent(source.getSourceId());
        if (player != null && sourcePermanent != null) {
            Target target = new TargetPermanent(filter);
            target.setNotTarget(true);
            if (target.canChoose(source.getControllerId(), game)) {
                player.choose(Outcome.Copy, target, source.getSourceId(), game);
                Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget());
                if (copyFromPermanent != null) {
                    game.copyPermanent(copyFromPermanent, sourcePermanent, source, new ApplyToPermanent() {
                        @Override
View Full Code Here


        Player player = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanent(source.getSourceId());
        if (player != null && sourcePermanent != null) {
            Target target = new TargetPermanent(filter);
            target.setNotTarget(true);
            if (target.canChoose(source.getControllerId(), game)) {
                player.choose(Outcome.Copy, target, source.getSourceId(), game);
                Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget());
                if (copyFromPermanent != null) {
                    game.copyPermanent(copyFromPermanent, sourcePermanent, source, new ApplyToPermanent() {
                        @Override
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            boolean targetChosen = false;
            TargetPermanent target = new TargetPermanent(1, 1, filter, false);

            if (target.canChoose(controller.getId(), game)) {
                controller.choose(Outcome.ReturnToHand, target, source.getSourceId(), game);
                Permanent permanent = game.getPermanent(target.getFirstTarget());

                if ( permanent != null ) {
                    targetChosen = true;
View Full Code Here

    public boolean apply(Game game, Ability source) {
        boolean targetChosen = false;
        Player player = game.getPlayer(source.getControllerId());
        TargetPermanent target = new TargetPermanent(1, 1, filter, false);

        if (target.canChoose(player.getId(), game)) {
            player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
            Permanent permanent = game.getPermanent(target.getFirstTarget());

            if ( permanent != null ) {
                targetChosen = true;
View Full Code Here

            if (multipleExist) {
                FilterCreaturePermanent filter = new FilterCreaturePermanent("one of the creatures with the least power");
                filter.add(new PowerPredicate(Filter.ComparisonType.Equal, leastPower));
                Target target = new TargetPermanent(filter);
                target.setNotTarget(true);
                if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                    if (controller.choose(outcome, target, source.getSourceId(), game)) {
                        permanentToDestroy = game.getPermanent(target.getFirstTarget());
                    }
                }
            }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
        if (player != null) {
            Target target = new TargetPermanent();
            if (target.canChoose(source.getSourceId(), player.getId(), game)
                    && player.choose(outcome, target, source.getSourceId(), game)) {
                Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
                if (targetPermanent != null) {
                    if (targetPermanent.isTapped()) {
                        if (player.chooseUse(Outcome.Untap, "Untap that permanent?", game)) {
View Full Code Here

    public boolean apply(Game game, Ability source) {
        boolean targetChosen = false;
        Player player = game.getPlayer(source.getControllerId());
        TargetPermanent target = new TargetPermanent(1, 1, filter, false);

        if (target.canChoose(player.getId(), game)) {
            player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
            Permanent permanent = game.getPermanent(target.getFirstTarget());

            if ( permanent != null ) {
                targetChosen = true;
View Full Code Here

            }
            filter.add(Predicates.or(cardTypes));
            TargetPermanent target = new TargetPermanent(1,1,filter, true);
            Player controller = game.getPlayer(source.getControllerId());
            if (controller != null) {
                if (target.canChoose(controller.getId(), game) && controller.chooseTarget(outcome, target, source, game)) {
                    Permanent returningCreature = game.getPermanent(target.getFirstTarget());
                    if (returningCreature != null) {
                        if (returningCreature.moveToZone(Zone.HAND, source.getSourceId(), game, true)) {
                            game.informPlayers(new StringBuilder("Cloudstone Curio: Returning ").append(returningCreature.getName()).append(" to owner's hand").toString());
                            return true;
View Full Code Here

        if (controller != null) {
            int tappedAmount = 0;
            TargetPermanent target = new TargetPermanent(0,1,filter, false);
            while (true && controller.isInGame()) {
                target.clearChosen();
                if (target.canChoose(source.getControllerId(), game)) {
                    Map<String, Serializable> options = new HashMap<>();
                    options.put("UI.right.btn.text", "Tapping complete");
                    controller.choose(outcome, target, source.getControllerId(), game, options);
                    if (target.getTargets().size() > 0) {
                        UUID creature = target.getFirstTarget();
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            boolean targetChosen = false;
            TargetPermanent target = new TargetPermanent(1, 1, filter, false);

            if (target.canChoose(controller.getId(), game)) {
                controller.choose(Outcome.ReturnToHand, target, source.getSourceId(), game);
                Permanent permanent = game.getPermanent(target.getFirstTarget());

                if ( permanent != null ) {
                    targetChosen = true;
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.