Package mage.target

Examples of mage.target.Target.canChoose()


                if (opponent != null) {
                    FilterCard filter = new FilterCreatureCard("creature card from your graveyard");
                    filter.add(new OwnerIdPredicate(opponent.getId()));
                    Target targetOpponent = new TargetCardInGraveyard(filter);

                    if (targetOpponent.canChoose(source.getSourceId(), opponent.getId(), game)) {
                        if (opponent.chooseUse(outcome, new StringBuilder("Return a creature card from your graveyard to the battlefield?").toString(), game)) {
                            if (opponent.chooseTarget(outcome, targetOpponent, source, game)) {
                                Card card = game.getCard(targetOpponent.getFirstTarget());
                                if (card != null) {
                                    opponentsReturnedCreatures++;
View Full Code Here


    }

    private boolean returnCreatureFromGraveToBattlefield(Player player, Ability source, Game game) {
        Target target = new TargetCardInYourGraveyard(new FilterCreatureCard());
        target.setNotTarget(false);
        if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
            if (player.chooseTarget(outcome, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
                }
View Full Code Here

        FilterCreaturePermanent filter = new FilterCreaturePermanent();
        filter.add(new ControllerPredicate(TargetController.YOU));
        Target target = new TargetControlledPermanent(1, 1, filter, true);

        if (target.canChoose(player.getId(), game)) {
            while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
                player.chooseTarget(Outcome.ReturnToHand, target, source, game);
            }

            for (UUID targetId: target.getTargets()) {
View Full Code Here

        FilterCreaturePermanent filter = new FilterCreaturePermanent();
        filter.add(new ControllerPredicate(TargetController.YOU));
        Target target = new TargetControlledPermanent(1, 1, filter, true);

        if (target.canChoose(player.getId(), game)) {
            while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
                player.chooseTarget(Outcome.ReturnToHand, target, source, game);
            }

            for (UUID targetId: target.getTargets()) {
                Permanent permanent = game.getPermanent(targetId);
View Full Code Here

        if (player == null) {
            return false;
        }

        Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent());
        if (target.canChoose(player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
            Permanent permanent = game.getPermanent(target.getFirstTarget());
            if (permanent != null) {
                return permanent.sacrifice(source.getSourceId(), game);
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Target target = new TargetCardInHand(filter);
            if (target.canChoose(source.getSourceId(), controller.getId(), game) &&
              controller.chooseUse(outcome, "Cast an instant or sorcery card from your hand without paying its mana cost?", game)) {
                Card cardToCast = null;
                boolean cancel = false;
                while (controller.isInGame() && !cancel) {
                    if (controller.chooseTarget(outcome, target, 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.