Package mage.players

Examples of mage.players.Player.chooseTarget()


    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(game.getActivePlayerId());
        FilterLandPermanent filter = new FilterLandPermanent("land you control");
        filter.add(new ControllerIdPredicate(game.getActivePlayerId()));
        Target target = new TargetLandPermanent(filter);
        if (player != null && player.chooseTarget(Outcome.Untap, target, source, game)) {
            for (UUID landId : target.getTargets()) {
                Permanent land = game.getPermanent(landId);
                if (land != null) {
                    land.untap(game);
                }
View Full Code Here


        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, source.getSourceId(), you.getId());
                    return true;
                }
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            // Choose a Giant creature you control (not targeted, happens during effect resolving )
            Target target = new TargetControlledCreaturePermanent(1,1, filter,false);
            if (target.canChoose(source.getSourceId(), controller.getId(), game)
                    && controller.chooseTarget(outcome, target, source, game)) {
                Permanent giant = game.getPermanent(target.getFirstTarget());               
                if (giant != null) {
                    game.informPlayers(new StringBuilder("Crush Underfoot: Choosen Giant is").append(giant.getName()).toString());
                    Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
                    if (targetCreature != null) {
View Full Code Here

                return false;
            }           
            Player player = game.getPlayer(permanent.getControllerId());
            if (player.chooseUse(Outcome.ReturnToHand, "Sacrifice a land to copy this spell?", game)){
                TargetControlledPermanent target = new TargetControlledPermanent(new FilterControlledLandPermanent());
                if (player.chooseTarget(Outcome.Sacrifice, target, source, game)){
                    Permanent land = game.getPermanent(target.getFirstTarget());
                    if(land != null){
                        if(land.sacrifice(source.getSourceId(), game)){
                            Spell spell = game.getStack().getSpell(source.getSourceId());
                            if (spell != null) {
View Full Code Here

        if (player != null){
            TargetCardInHand target = new TargetCardInHand(new FilterLandCard());
            Cost cost = new DiscardTargetCost(target);
            if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) &&
                    player.chooseUse(outcome, "Discard land? (Otherwise Mox Diamond goes to graveyard)", game) &&
                    player.chooseTarget(Outcome.Discard, target, source, game)){
                player.discard(game.getCard(target.getFirstTarget()), source, game);
                return false;
            }
            else{
                Card card = game.getCard(event.getTargetId());
View Full Code Here

        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());
                    if (permanent != null) {
View Full Code Here

        Permanent permanent = game.getPermanent(source.getSourceId());
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null && permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) {
            permanent.removeCounters(CounterType.P1P1.createInstance(), game);
            Target target = new TargetCreatureOrPlayer();
            if (controller.chooseTarget(outcome, target, source, game)) {
                Effect effect = new DamageTargetEffect(1);
                effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
                return effect.apply(game, source);
            }
            return true;
View Full Code Here

        Player targetPlayer = game.getPlayer(source.getFirstTarget());
        if (targetPlayer != null) {
            FilterCard filter = new FilterCard("card from your graveyard");
            filter.add(new OwnerIdPredicate(targetPlayer.getId()));
            TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
            if (targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    targetPlayer.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD);
                }
                return 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

                    game.getState().setZone(card.getId(), Zone.PICK);
                }
            }
            if(cards.size() > 0){
                TargetCard target = new TargetCard(Zone.PICK, new FilterCard("Card to put back on top of library"));
                if(controller.chooseTarget(Outcome.Benefit, cards, target, source, game)){
                    Card card = cards.get(target.getFirstTarget(), game);
                    if(card != null){
                        card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                        cards.remove(card);
                    }
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.