Package mage.target.common

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


        int tappedAmount = 0;
        Player you = game.getPlayer(source.getControllerId());
        TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
        while (true) {
            target.clearChosen();
            if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
                UUID creature = target.getFirstTarget();
                if (creature != null) {
                    game.getPermanent(creature).tap(game);
                    tappedAmount++;
                }
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
        while (true) {
            target.clearChosen();
            if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
                UUID vampire = target.getFirstTarget();
                if (vampire != null) {
                    game.getPermanent(vampire).tap(game);
                    game.getPermanent(vampire).addCounters(CounterType.P1P1.createInstance(), game);
                }
View Full Code Here

        TargetCreaturePermanent target2 = new TargetCreaturePermanent();

        if (you != null) {
            if (target1.canChoose(source.getControllerId(), game)
                    && you.choose(Outcome.Benefit, target1, source.getSourceId(), game)
                    && target2.canChoose(source.getControllerId(), game)
                    && you.choose(Outcome.Damage, target2, source.getSourceId(), game)) {
                Card creatureInGraveyard = game.getCard(target1.getFirstTarget());
                if (creatureInGraveyard != null) {
                    if (creatureInGraveyard.moveToZone(Zone.LIBRARY, id, game, true)) {
                        int power = creatureInGraveyard.getPower().getValue();
View Full Code Here

            int amount = (Integer) getValue("damage");
            if (amount > 0) {
                FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + player.getName() + " controls");
                filter.add(new ControllerIdPredicate(player.getId()));
                TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
                if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Damage, source.getControllerId(), source.getSourceId(), game)) {
                    UUID creature = target.getFirstTarget();
                    if (creature != null) {
                        game.getPermanent(creature).damage(amount, source.getSourceId(), game, false, true);
                        return true;
                    }
View Full Code Here

                if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
                    FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("creature controlled by ").append(nextPlayer.getName()).toString());
                    filter.add(new ControllerIdPredicate(nextPlayer.getId()));
                    Target target = new TargetCreaturePermanent(filter);
                    target.setNotTarget(false);
                    if (target.canChoose(source.getSourceId(), currentPlayer.getId(), game)) {
                        if (currentPlayer.chooseTarget(outcome, target, source, game)) {
                            playerCreature.put(currentPlayer.getId(), target.getFirstTarget());
                        }
                    }
                }
View Full Code Here

            if (player != null) {
                FilterCreaturePermanent filter = new FilterCreaturePermanent("nonartifact creature you control");
                filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
                filter.add(new ControllerIdPredicate(player.getId()));
                Target target = new TargetCreaturePermanent(filter);
                if (target.canChoose(this.getSourceId(), this.getControllerId(), game) && player.chooseTarget(Outcome.DestroyPermanent, target, this, game)) {
                    for (Effect effect: this.getEffects()) {
                        if (effect instanceof DestroyTargetEffect) {
                            effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
                        }
                    }
View Full Code Here

        if (defenderId != null) {
            FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
            filter.add(new ControllerIdPredicate(defenderId));
            TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
            Player player = game.getPlayer(source.getControllerId());
            if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                if (player.chooseTarget(Outcome.Detriment, target, source, game)) {
                    Permanent permanent = game.getPermanent(target.getFirstTarget());
                    Permanent cyclops = game.getPermanent(source.getSourceId());
                    if (permanent != null && cyclops != null) {
                        permanent.damage(cyclops.getPower().getValue(), cyclops.getId(), game, false, true);
View Full Code Here

        Permanent sourceCreature = game.getPermanent(source.getSourceId());
        if (controller != null && sourceCreature != null) {
            FilterCreaturePermanent filter = new FilterCreaturePermanent("creature it's blocking");
            filter.add(new BlockedByIdPredicate((source.getSourceId())));
            Target target = new TargetCreaturePermanent(filter);
            if (target.canChoose(source.getSourceId(), controller.getId(), game)) {
                if (controller.chooseTarget(outcome, target, source, game)) {
                    Permanent attackingCreature = game.getPermanent(target.getFirstTarget());
                    if (attackingCreature != null) {
                        int newSourcePower = attackingCreature.getPower().getValue();
                        int newAttackerPower = sourceCreature.getPower().getValue();
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.