Package mage.target

Examples of mage.target.Target


    return true;
  }

  @Override
  public String getText(Ability source) {
    Target target = source.getTargets().get(0);
    if (target.getNumberOfTargets() > 1)
      return "tap " + target.getNumberOfTargets() + " target " + source.getTargets().get(0).getTargetName() + "s";
    else
      return "tap target " + source.getTargets().get(0).getTargetName();
  }
View Full Code Here


    return new DamageMultiEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Target multiTarget = source.getTargets().get(0);
    for (UUID target: multiTarget.getTargets()) {
      Permanent permanent = game.getPermanent(target);
      if (permanent != null) {
        permanent.damage(multiTarget.getTargetAmount(target), source.getId(), game, true, false);
      }
      else {
        Player player = game.getPlayer(target);
        if (player != null) {
          player.damage(multiTarget.getTargetAmount(target), source.getId(), game, false, true);
        }
      }
    }
    return true;
  }
View Full Code Here

    return true;
  }

  @Override
  public String getText(Ability source) {
    Target target = source.getTargets().get(0);
    if (target.getNumberOfTargets() > 1)
      return "untap " + target.getNumberOfTargets() + " target " + source.getTargets().get(0).getTargetName() + "s";
    else
      return "untap target " + source.getTargets().get(0).getTargetName();
  }
View Full Code Here

    this.power = new MageInt(2);
    this.toughness = new MageInt(2);

    this.addAbility(DeathtouchAbility.getInstance());
    Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false);
    Target target = new TargetPermanent(filter);
    target.setRequired(true);
    ability.addTarget(target);
    this.addAbility(ability);
  }
View Full Code Here

    this.color.setRed(true);
    this.power = new MageInt(2);
    this.toughness = new MageInt(2);

    Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false);
    Target target = new TargetPermanent(filter);
    target.setRequired(true);
    ability.addTarget(target);
    this.addAbility(ability);
  }
View Full Code Here

  protected void resolve(SimulationNode node, int depth, Game game) {
    StackObject ability = game.getStack().pop();
    if (ability instanceof StackAbility) {
      SearchEffect effect = getSearchEffect((StackAbility) ability);
      if (effect != null && ability.getControllerId().equals(playerId)) {
        Target target = effect.getTarget();
        if (!target.doneChosing()) {
          for (UUID targetId: target.possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
            Game sim = game.copy();
            StackAbility newAbility = (StackAbility) ability.copy();
            SearchEffect newEffect = getSearchEffect((StackAbility) newAbility);
            newEffect.getTarget().addTarget(targetId, newAbility, sim);
            sim.getStack().push(newAbility);
View Full Code Here

  @Override
  public void assignDamage(int damage, List<UUID> targets, UUID sourceId, Game game) {
    int remainingDamage = damage;
    while (remainingDamage > 0) {
      Target target = new TargetCreatureOrPlayer();
      choose(Outcome.Damage, target, game);
      if (targets.size() == 0 || targets.contains(target.getFirstTarget())) {
        int damageAmount = getAmount(0, remainingDamage, "Select amount", game);
        Permanent permanent = game.getPermanent(target.getFirstTarget());
        if (permanent != null) {
          permanent.damage(damageAmount, sourceId, game, true, false);
          remainingDamage -= damageAmount;
        }
        else {
          Player player = game.getPlayer(target.getFirstTarget());
          if (player != null) {
            player.damage(damageAmount, sourceId, game, false, true);
            remainingDamage -= damageAmount;
          }
        }
View Full Code Here

  }

  public boolean chooseNewTargets(Game game) {
    Player player = game.getPlayer(controllerId);
    for (Target target: ability.getTargets()) {
      Target newTarget = target.copy();
      newTarget.clearChosen();
      for (UUID targetId: target.getTargets()) {
        MageObject object = game.getObject(targetId);
        if (player.chooseUse(ability.getEffects().get(0).getOutcome(), "Change target from " + object.getName() + "?", game)) {
          if (!player.chooseTarget(ability.getEffects().get(0).getOutcome(), newTarget, ability, game))
            newTarget.addTarget(targetId, ability, game);
        }
        else {
          newTarget.addTarget(targetId, ability, game);
        }
      }
      target.clearChosen();
      for (UUID newTargetId: newTarget.getTargets()) {
        target.addTarget(newTargetId, ability, game);
      }
    }
    return true;
  }
View Full Code Here

                            if (!cards.contains(card.getId())) {
                                cards.add(card);
                            }
                        }
                    } else {
                        Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, new FilterCard(), playerId);
                        player.chooseTarget(outcome, target, source, game);
                        cards.addAll(target.getTargets());
                    }
                    cardsToDiscard.put(playerId, cards);
                }
            }
            // discard all choosen cards
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        if (player != null) {
            Target target = null;
            switch (zone) {
                case HAND:
                    target = new TargetCardInHand(Math.min(player.getHand().count(filter, game), amount), filter);
                    break;
                case GRAVEYARD:
                    target = new TargetCardInYourGraveyard(Math.min(player.getGraveyard().count(filter, game), amount), filter);
                    break;
                default:
            }
            if (target != null && target.canChoose(player.getId(), game)) {
                if (target.choose(Outcome.Exile, player.getId(), source.getSourceId(), game)) {
                    for (UUID cardId : target.getTargets()) {
                        Card card = game.getCard(cardId);
                        if (card != null) {
                            card.moveToExile(exileId, exileName, source.getSourceId(), game);
                        }
                    }
View Full Code Here

TOP

Related Classes of mage.target.Target

Copyright © 2018 www.massapicom. 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.