Codota Logo
Cards.add
Code IndexAdd Codota to your IDE (free)

How to use
add
method
in
mage.cards.Cards

Best Java code snippets using mage.cards.Cards.add (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: magefree/mage

public void add(String name, Card card) {        
  this.createLookedAt(name).add(card);
}
origin: magefree/mage

public void add(String name, Card card) {
  this.get(name).add(card);
}
origin: magefree/mage

public void setTopHalfCard(Card topHalfCard, Game game) {
  this.topHalfCard = topHalfCard;
  this.topLastZoneChangeCounter = topHalfCard.getZoneChangeCounter(game);
  halves.add(topHalfCard.getId());
}
origin: magefree/mage

public void setBottomHalfCard(Card bottomHalfCard, Game game) {
  this.bottomHalfCard = bottomHalfCard;
  this.bottomLastZoneChangeCounter = bottomHalfCard.getZoneChangeCounter(game);
  halves.add(bottomHalfCard.getId());
}
origin: magefree/mage

private Permanent chooseOnePermanent(Game game, Player player, List<Permanent> permanents) {
  Permanent permanent = null;
  if (permanents.size() == 1) {
    permanent = permanents.iterator().next();
  } else if (permanents.size() > 1) {
    Cards cards = new CardsImpl();
    for (Permanent card : permanents) {
      cards.add(card);
    }
    TargetCard targetCard = new TargetCard(Zone.BATTLEFIELD, new FilterCard());
    if (player.choose(Outcome.Benefit, cards, targetCard, game)) {
      permanent = game.getPermanent(targetCard.getFirstTarget());
    }
  }
  return permanent;
}
origin: magefree/mage

  @Override
  public void doOpeningHandAction(Card card, Player player, Game game) {
    Cards cards = new CardsImpl();
    cards.add(card);
    player.revealCards(card.getName(), cards, game);
    this.resolve(game);
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
      return false;
    }
    Cards cardsToReturn = new CardsImpl();
    cards.getCards(game).stream().filter((card) -> (game.getState().getZone(card.getId()) == Zone.EXILED
        && card.getZoneChangeCounter(game) == cardMap.getOrDefault(card.getId(), -5) + 1)).forEachOrdered((card) -> {
      cardsToReturn.add(card);
    });
    return player.moveCards(cardsToReturn, Zone.GRAVEYARD, source, game);
  }
}
origin: magefree/mage

@Override
public void useDeck(Deck deck, Game game) {
  library.clear();
  library.addAll(deck.getCards(), game);
  sideboard.clear();
  for (Card card : deck.getSideboard()) {
    sideboard.add(card);
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
      return false;
    }

    Card card = player.getLibrary().getFromTop(game);
    if (card != null) {
      Cards cards = new CardsImpl();
      cards.add(card);
      player.lookAtCards("Sphinx of Jwar Isle", cards, game);
    } else {
      return false;
    }

    return true;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(targetPointer.getFirst(game, source));
  if (player != null && !player.getHand().isEmpty()) {
    Cards revealed = new CardsImpl();
    revealed.add(player.getHand().getRandom(game));
    player.revealCards("Merfolk Spy", revealed, game);
    return true;
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(targetPointer.getFirst(game, source));
  if (player != null && !player.getHand().isEmpty()) {
    Cards revealed = new CardsImpl();
    revealed.add(player.getHand().getRandom(game));
    player.revealCards("Hired Torturer", revealed, game);
    return true;
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  if (controller != null) {
    List<Permanent> tokenPermanents = (List<Permanent>) game.getState().getValue(source.getSourceId() + "_token");
    if (tokenPermanents != null) {
      Cards cards = new CardsImpl();
      for (Permanent permanent : tokenPermanents) {
        cards.add(permanent);
      }
      controller.moveCards(cards, Zone.EXILED, source, game);
      return true;
    }
  }
  return false;
}
origin: magefree/mage

@Override
public void watch(GameEvent event, Game game) {
  if (event.getType() == GameEvent.EventType.CYCLE_CARD
      && !game.isSimulation()) {
    Card card = game.getCard(event.getSourceId());
    Player controller = game.getPlayer(event.getPlayerId());
    if (card != null
        && controller != null
        && card.isOwnedBy(controller.getId())) {
      Cards c = getCardsCycledThisTurn(event.getPlayerId());
      c.add(card);
      cycledCardsThisTurn.put(event.getPlayerId(), c);
    }
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      Cards cards = new CardsImpl();
      for (UUID cardId : this.getTargetPointer().getTargets(game, source)) {
        Card card = controller.getGraveyard().get(cardId, game);
        if (card != null) {
          cards.add(card);
        }
      }
      return controller.putCardsOnBottomOfLibrary(cards, game, source, true);
    }
    return false;
  }
}
origin: magefree/mage

private void searchCard(Player player, Ability source, Game game, Cards cards, String subtype) {
  FilterCard filter = new FilterCard(subtype);
  filter.add(new SubtypePredicate(SubType.byDescription(subtype)));
  TargetCardInLibrary target = new TargetCardInLibrary(filter);
  if (player.searchLibrary(target, game)) {
    Card card = player.getLibrary().remove(target.getFirstTarget(), game);
    if (card != null) {
      card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
      cards.add(card);
    }
  }
}
origin: magefree/mage

private void searchLand(Player player, Ability source, Game game, Cards cards, String subtype) {
  FilterLandCard filter = new FilterLandCard(subtype);
  filter.add(new SubtypePredicate(SubType.byDescription(subtype)));
  TargetCardInLibrary target = new TargetCardInLibrary(filter);
  if (player.searchLibrary(target, game)) {
    Card card = player.getLibrary().remove(target.getFirstTarget(), game);
    if (card != null) {
      card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
      cards.add(card);
    }
  }
}
origin: magefree/mage

  private void searchLand(Player player, Ability source, Game game, Cards cards, String subtype) {
    FilterLandCard filter = new FilterLandCard(subtype);
    filter.add(new SubtypePredicate(SubType.byDescription(subtype)));
    TargetCardInLibrary target = new TargetCardInLibrary(filter);
    if (player.searchLibrary(target, game)) {
      Card card = player.getLibrary().remove(target.getFirstTarget(), game);
      if (card != null) {
        card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
        cards.add(card);
      }
    }
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player targetPlayer = game.getPlayer(source.getFirstTarget());
    if (targetPlayer != null && !targetPlayer.getHand().isEmpty()) {
      Cards revealed = new CardsImpl();
      Card card = targetPlayer.getHand().getRandom(game);
      if (card != null) {
        revealed.add(card);
        targetPlayer.revealCards("Singe-Mind Ogre", revealed, game);
        targetPlayer.loseLife(card.getConvertedManaCost(), game, false);
        return true;
      }
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
  if (opponent != null && !opponent.getHand().isEmpty()) {
    Cards revealed = new CardsImpl();
    Card card = opponent.getHand().getRandom(game);
    if (card != null) {
      revealed.add(card);
      opponent.revealCards("Planeswalker's Fury", revealed, game);
      opponent.damage(card.getConvertedManaCost(), source.getSourceId(), game, false, true);
    }
    return true;
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
  Player player = game.getPlayer(source.getControllerId());
  if (opponent != null && player!= null && !opponent.getHand().isEmpty()) {
    Cards revealed = new CardsImpl();
    Card card = opponent.getHand().getRandom(game);
    if (card != null) {
      revealed.add(card);
      opponent.revealCards("Planeswalker's Mirth", revealed, game);
      player.gainLife(card.getConvertedManaCost(), game, source);
    }
    return true;
  }
  return false;
}
mage.cardsCardsadd

Popular methods of Cards

  • getCards
  • size
  • isEmpty
  • clear
  • count
  • getRandom
  • addAll
  • contains
  • copy
  • get
  • iterator
  • remove
  • iterator,
  • remove,
  • removeAll,
  • toArray,
  • <init>,
  • getUniqueCards,
  • getValue,
  • stream

Popular in Java

  • Making http requests using okhttp
  • findViewById (Activity)
  • startActivity (Activity)
  • getSystemService (Context)
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now