Package mage.players

Examples of mage.players.Player


    return new SearchLibraryRevealPutInHandEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    player.searchLibrary(target, game);
    if (target.getTargets().size() > 0) {
      Cards revealed = new CardsImpl();
      for (UUID cardId: (List<UUID>)target.getTargets()) {
        Card card = player.getLibrary().remove(cardId, game);
        if (card != null) {
          card.moveToZone(Zone.HAND, source.getId(), game, false);
          revealed.add(card);
        }
      }
      player.shuffleLibrary(game);
      player.revealCards(revealed, game);
    }
    return true;
  }
View Full Code Here


  @Override
  public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
    int count = 0;
    MageObject targetSource = game.getObject(sourceId);
    for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) {
      Player player = game.getPlayer(playerId);
      if (player != null && player.canBeTargetedBy(targetSource) && filter.match(player)) {
        count++;
        if (count >= this.minNumberOfTargets)
          return true;
      }
    }
View Full Code Here

  @Override
  public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
    Set<UUID> possibleTargets = new HashSet<UUID>();
    MageObject targetSource = game.getObject(sourceId);
    for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) {
      Player player = game.getPlayer(playerId);
      if (player != null && player.canBeTargetedBy(targetSource) && filter.match(player)) {
        possibleTargets.add(playerId);
      }
    }
    for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterPlaneswalkerPermanent(), sourceControllerId, game)) {
      if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent)) {
View Full Code Here

      Permanent permanent = game.getPermanent(targetId);
      if (permanent != null) {
        sb.append(permanent.getName()).append(" ");
      }
      else {
        Player player = game.getPlayer(targetId);
        sb.append(player.getName()).append(" ");
      }
    }
    return sb.toString();
  }
View Full Code Here

    return sb.toString();
  }

  @Override
  public boolean canTarget(UUID id, Game game) {
    Player player = game.getPlayer(id);
    if (player != null) {
      return filter.match(player);
    }
    Permanent permanent = game.getPermanent(id);
    if (permanent != null) {
View Full Code Here

    return false;
  }

  @Override
  public boolean canTarget(UUID id, Ability source, Game game) {
    Player player = game.getPlayer(id);
    MageObject targetSource = game.getObject(attackerId);
    if (player != null) {
      return player.canBeTargetedBy(targetSource) && filter.match(player);
    }
    Permanent permanent = game.getPermanent(id);
    if (permanent != null) {
      return permanent.canBeTargetedBy(targetSource) && filter.match(permanent);
    }
View Full Code Here

    return new ReturnSourceFromGraveyardToBattlefieldEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Card card = player.getGraveyard().get(source.getSourceId(), game);
    if (card != null) {
      player.removeFromGraveyard(card, game);
      if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
        if (tapped) {
          Permanent permanent = game.getPermanent(card.getId());
          if (permanent != null)
            permanent.setTapped(true);
View Full Code Here

    return new SearchLibraryPutOnLibraryEffect(this);
  }

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
    player.searchLibrary(target, game);
    List<Card> cards = new ArrayList<Card>();
        if (target.getTargets().size() > 0) {
            for (UUID cardId: (List<UUID>)target.getTargets()) {
                Card card = player.getLibrary().remove(cardId, game);
                if (card != null)
          cards.add(card);
            }
            player.shuffleLibrary(game);
      for (Card card: cards) {
        card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
      }
        }
        return true;
View Full Code Here

    return new DiscardTargetEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player != null) {
      player.discard(amount, source, game);
      return true;
    }
    return false;
  }
View Full Code Here

  public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
    if (this.size() == 0 || noMana) {
      setPaid();
      return true;
    }
    Player player = game.getPlayer(controllerId);
    assignPayment(player.getManaPool());
    while (!isPaid()) {
      if (player.playMana(this.getUnpaid(), game))
        assignPayment(player.getManaPool());
      else
        return false;
    }
    for (ManaCost cost: this.getUnpaidVariableCosts()) {
      VariableManaCost vCost = (VariableManaCost) cost;
      while (!vCost.isPaid()) {
        if (player.playXMana(vCost, game))
          vCost.assignPayment(player.getManaPool());
        else
          return false;
      }
    }
    return true;
View Full Code Here

TOP

Related Classes of mage.players.Player

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.