Examples of canChoose()


Examples of mage.target.TargetPermanent.canChoose()

                // 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

Examples of mage.target.TargetPermanent.canChoose()

                // 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

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(notTarget);
            if (target.canChoose(source.getControllerId(), game)) {
                player.choose(Outcome.Copy, target, source.getSourceId(), game);
                Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget());
                if (copyFromPermanent != null) {
                    bluePrintPermanent = game.copyPermanent(copyFromPermanent, sourcePermanent, source, applier);
                    return true;
View Full Code Here

Examples of mage.target.TargetPermanent.canChoose()

            if (cost instanceof RemoveVariableCountersSourceCost) {
                numberToTap = ((RemoveVariableCountersSourceCost) cost).getAmount();
            }
        }
        TargetPermanent target = new TargetPermanent(numberToTap, filter);
        if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
            if (!target.getTargets().isEmpty()) {
                List<UUID> targets = target.getTargets();
                for (UUID targetId : targets) {
                    Permanent permanent = game.getPermanent(targetId);
                    if (permanent != null) {
View Full Code Here

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

    @Override
    public boolean apply(Game game, Ability source) {
        TargetArtifactPermanent target = new TargetArtifactPermanent();
        Player you = game.getPlayer(source.getControllerId());
        if (you != null) {
            if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.DestroyPermanent, source.getControllerId(), source.getSourceId(), game)) {
                Permanent targetedArtifact = game.getPermanent(target.getFirstTarget());
                if (targetedArtifact != null) {
                    Card artifact = game.getCard(targetedArtifact.getId());
                    Player controller = game.getPlayer(targetedArtifact.getControllerId());
                    targetedArtifact.destroy(id, game, true);
View Full Code Here

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

        FilterCard filter = new FilterCreatureCard(new StringBuilder("creature card with converted mana cost {").append(cmc).append("} exiled with Ashiok, Nightmare Weaver").toString());
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
        Target target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source));

        if (target.canChoose(source.getSourceId(), player.getId(), game)) {
            if (player.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null && player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId())) {
                    // why is this change of controller neccessary?
                    Permanent permanent = game.getPermanent(card.getId());
View Full Code Here

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

        Player you = game.getPlayer(source.getControllerId());
        FilterCard filter = new FilterCard("creature in that player's graveyard");
        filter.add(new CardTypePredicate(CardType.CREATURE));
        filter.add(new OwnerIdPredicate(damagedPlayer.getId()));
        TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
        if (target.canChoose(source.getSourceId(), you.getId(), game)) {
            if (you.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    card.putOntoBattlefield(game, Zone.GRAVEYARD, id, you.getId());
                    return true;
View Full Code Here

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

                Cards revealedCards = new CardsImpl(Zone.HAND);               
                numberToReveal = Math.min(player.getHand().size(), numberToReveal);
                if (player.getHand().size() > numberToReveal) {
                    TargetCardInHand chosenCards = new TargetCardInHand(numberToReveal, numberToReveal, new FilterCard("card in target player's hand"));
                    chosenCards.setNotTarget(true);
                    if (chosenCards.canChoose(player.getId(), game) && player.choose(Outcome.Discard, player.getHand(), chosenCards, game)) {
                        if (!chosenCards.getTargets().isEmpty()) {
                            List<UUID> targets = chosenCards.getTargets();
                            for (UUID targetid : targets) {
                                Card card = game.getCard(targetid);
                                if (card != null) {
View Full Code Here

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

            FilterCard filter = new FilterCard("card in your hand to exile");
            FilterCard filter2 = new FilterCard("(move the window) card exiled by " + sourceObject.getLogName() + " to put on top of library");
            TargetCardInHand target = new TargetCardInHand(0, controller.getHand().size(), filter);
            target.setRequired(false);
            int amountExiled = 0;
            if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
                if (!target.getTargets().isEmpty()) {
                    List<UUID> targets = target.getTargets();
                    for (UUID targetId : targets) {
                        Card card = game.getCard(targetId);
                        if (card != null) {
View Full Code Here

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

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Target target = new TargetCardInHand(new FilterLandCard("land card"));
            if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
                    && controller.choose(outcome, target, source.getSourceId(), game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId(), tapped);
                }
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.