Package mage.cards

Examples of mage.cards.Cards


  }

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Cards cards = new CardsImpl(Zone.PICK);
    for (int i = 0; i < scryNumber; i++) {
      Card card = player.getLibrary().removeFromTop(game);
      cards.add(card);
      game.setZone(card.getId(), Zone.PICK);
    }
    TargetCard target1 = new TargetCard(Zone.PICK, filter1);
    while (cards.size() > 0 && player.choose(cards, target1, game)) {
      Card card = cards.get(target1.getFirstTarget(), game);
      cards.remove(card);
      card.moveToZone(Zone.LIBRARY, source.getId(), game, false);
      target1.clearChosen();
    }
    if (cards.size() > 1) {
      TargetCard target2 = new TargetCard(Zone.PICK, filter2);
      target2.setRequired(true);
      while (cards.size() > 1) {
        player.choose(cards, target2, game);
        Card card = cards.get(target2.getFirstTarget(), game);
        cards.remove(card);
        card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
        target2.clearChosen();
      }
    }
    if (cards.size() == 1) {
      Card card = cards.get(cards.iterator().next(), game);
      card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
    }
    return true;
  }
View Full Code Here


  @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);
    }
View Full Code Here

    List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(FilterCreaturePermanent.getDefault(), source.getControllerId());
    count = creatures.size();
    for (Permanent creature: creatures) {
      creature.moveToExile(null, null, source.getId(), game);
    }
    Cards revealed = new CardsImpl();
    Cards creatureCards = new CardsImpl();
    Cards nonCreatureCards = new CardsImpl();
    Player player = game.getPlayer(source.getControllerId());
    while (creatureCards.size() < count && player.getLibrary().size() > 0) {
      Card card = player.getLibrary().removeFromTop(game);
      revealed.add(card);
      if (card.getCardType().contains(CardType.CREATURE))
        creatureCards.add(card);
      else
        nonCreatureCards.add(card);
    }
    player.revealCards(revealed, game);
    for (Card creatureCard: creatureCards.getCards(game)) {
      creatureCard.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
    }
    player.getLibrary().addAll(nonCreatureCards.getCards(game), game);
    player.getLibrary().shuffle();
    return true;
  }
View Full Code Here

  public boolean apply(Game game, Ability source) {
    TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
    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);
        revealed.add(card);
      }
      player.revealCards(revealed, game);
      if (target.getTargets().size() == 2) {
        TargetCard target2 = new TargetCard(Zone.PICK, filter);
        target2.setRequired(true);
        player.choose(revealed, target2, game);
        Card card = revealed.get(target2.getFirstTarget(), game);
        card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
        revealed.remove(card);
        Permanent permanent = game.getPermanent(card.getId());
        if (permanent != null)
          permanent.setTapped(true);
        card = revealed.getCards(game).iterator().next();
        card.moveToZone(Zone.HAND, source.getId(), game, false);
      }
      else if (target.getTargets().size() == 1) {
        Card card = revealed.getCards(game).iterator().next();
        card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
        Permanent permanent = game.getPermanent(card.getId());
        if (permanent != null)
          permanent.setTapped(true);
      }
View Full Code Here

    cardChoice.setChoices(Sets.getCardNames());
    for (Player player: game.getPlayers().values()) {
      cardChoice.clearChoice();
      player.choose(Outcome.DrawCard, cardChoice, game);
      Card card = player.getLibrary().removeFromTop(game);
      Cards cards  = new CardsImpl();
      cards.add(card);
      player.revealCards(cards, game);
      if (card.getName().equals(cardChoice.getChoice())) {
        card.moveToZone(Zone.HAND, source.getId(), game, true);
      }
      else {
View Full Code Here

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player != null && player.getHand().size() > 0) {
      Card card = player.getHand().getRandom(game);
      Cards cards = new CardsImpl();
      cards.add(card);
      player.revealCards(cards, game);
      if (card.getCardType().contains(CardType.LAND)) {
        card.putOntoBattlefield(game, Zone.HAND, source.getId(), player.getId());
      }
      else {
View Full Code Here

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player != null && player.getHand().size() > 0) {
      Cards revealed = new CardsImpl();
      revealed.add(player.getHand().getRandom(game));
      player.revealCards(revealed, game);
      return true;
    }
    return false;
  }
View Full Code Here

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player player = game.getPlayer(source.getFirstTarget());
    if (controller != null && player != null) {
      Cards cards = new CardsImpl();
      cards.add(player.getLibrary().getFromTop(game));
      controller.lookAtCards(cards, game);
      if (controller.chooseUse(outcome, "Do you wish to put card on the bottom of player's library?", game)) {
        Card card = player.getLibrary().removeFromTop(game);
        if (card != null) {
          card.moveToZone(Zone.LIBRARY, source.getId(), game, false);
View Full Code Here

      if (player.getLibrary().size() == 1) {
        Card card = player.getLibrary().removeFromTop(game);
        card.moveToZone(Zone.HAND, source.getId(), game, false);
      }
      else {
        Cards cards = new CardsImpl(Zone.PICK);
        Card card = player.getLibrary().removeFromTop(game);
        cards.add(card);
        game.setZone(card.getId(), Zone.PICK);
        card = player.getLibrary().removeFromTop(game);
        cards.add(card);
        game.setZone(card.getId(), Zone.PICK);
        TargetCard target = new TargetCard(Zone.PICK, filter);
        target.setRequired(true);
        player.lookAtCards(cards, game);
        player.choose(cards, target, game);
        card = cards.get(target.getFirstTarget(), game);
        if (card != null) {
          card.moveToZone(Zone.HAND, source.getId(), game, false);
          cards.remove(card);
        }
        for (Card card1: cards.getCards(game)) {
          card1.moveToZone(Zone.LIBRARY, source.getId(), game, false);
        }
      }
      return true;
    }
View Full Code Here

        defender = game.getPlayer(group.getDefenderId());
        break;
      }
    }
    if (defender != null) {
      Cards cards = new CardsImpl();
      Card card = defender.getLibrary().getFromTop(game);
      if (card != null) {
        cards.add(card);
        defender.revealCards(cards, game);
        if (card.getCardType().contains(CardType.LAND)) {
          defender.getLibrary().removeFromTop(game);
          card.moveToZone(Zone.HAND, source.getId(), game, true);
        }
View Full Code Here

TOP

Related Classes of mage.cards.Cards

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.