Examples of choose()


Examples of mage.target.TargetSource.choose()

    public void init(Ability source, Game game) {
        Player player = game.getPlayer(source.getControllerId());
        TargetSource target = new TargetSource();
        target.setNotTarget(true);
        if (player != null) {
            target.choose(Outcome.PreventDamage, player.getId(), source.getSourceId(), game);
            this.targetSource = target;
        }
    }
   
    @Override

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

    @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);

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

            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) {

Examples of mage.target.common.TargetCardInLibrary.choose()

      TargetCardInLibrary newTarget;
      if (library.count(target.getFilter(), game) < target.getNumberOfTargets())
        newTarget = new TargetCardInLibrary(library.count(target.getFilter(), game), target.getMaxNumberOfTargets(), target.getFilter());
      else
        newTarget = target;
      if (newTarget.choose(Outcome.Neutral, playerId, game)) {
        game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SEARCHED, playerId, playerId));
        return true;
      }
    }
    return false;

Examples of mage.target.common.TargetCardInOpponentsGraveyard.choose()

        Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
        if (targetPlayer != null) {
            int numberToTarget = Math.min(targetPlayer.getGraveyard().size(), source.getManaCostsToPay().getX());
            TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(numberToTarget, numberToTarget, filter);
            if (you != null) {
                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) {

Examples of mage.target.common.TargetCardInYourGraveyard.choose()

                    player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
                }
            }
            else {
                Target target = new TargetCardInYourGraveyard(0, 1, filter);
                target.choose(Outcome.PutCardInPlay, source.getControllerId(), source.getSourceId(), game);
                Card card = player.getGraveyard().get(target.getFirstTarget(), game);
                if (card != null) {
                    player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
                }
            }

Examples of mage.target.common.TargetControlledCreaturePermanent.choose()

            Player targetPlayer = game.getPlayer(source.getFirstTarget());
            if (targetPlayer != null) {
                // Target player returns a creature he or she controls to its owner's hand,
                Target target = new TargetControlledCreaturePermanent();
                target.setNotTarget(true);
                if (target.choose(Outcome.ReturnToHand, targetPlayer.getId(), source.getSourceId(), game)) {
                    Permanent permanent = game.getPermanent(target.getFirstTarget());
                    if (permanent != null) {
                        targetPlayer.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
                    }
                }

Examples of mage.target.common.TargetControlledPermanent.choose()

        if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
            Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken());
            if (tokenPermanent != null) {
                //TODO: Make sure the Equipment can legally enchant the token, preferably on targetting.
                Target target = new TargetControlledPermanent(0, 1, filter, true);
                if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
                    Permanent equipmentPermanent = game.getPermanent(target.getFirstTarget());
                    if (equipmentPermanent != null) {
                        Permanent attachedTo = game.getPermanent(equipmentPermanent.getAttachedTo());
                        if (attachedTo != null) {
                            attachedTo.removeAttachment(equipmentPermanent.getId(), game);

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

        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++;
                }

Examples of mage.target.common.TargetLandPermanent.choose()

    @Override
    public boolean apply(Game game, Ability source) {
        TargetLandPermanent target = new TargetLandPermanent(0, amount, new FilterLandPermanent(), true);
        if (target.canChoose(source.getControllerId(), game)) {
            if (target.choose(Outcome.Untap, source.getControllerId(), source.getSourceId(), game)) {
                for (Object targetId : target.getTargets()) {
                    Permanent p = game.getPermanent((UUID) targetId);
                    if (p.isTapped())
                        p.untap(game);
                }
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.