Tabnine Logo
Cards.contains
Code IndexAdd Tabnine to your IDE (free)

How to use
contains
method
in
mage.cards.Cards

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

origin: magefree/mage

@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
  Player player = game.getPlayer(controllerId);
  if (player != null && player.getHand().contains(sourceId)) {
    return true;
  }
  return false;
}
origin: magefree/mage

public Card getCard(UUID cardId, Game game) {
  for (Cards cards: this.values()) {
    if (cards.contains(cardId)) {
      return game.getCard(cardId);
    }
  }
  return null;
}
origin: magefree/mage

@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
  Player player = game.getPlayer(controllerId);
  if (player != null && player.getHand().contains(sourceId)) {
    return true;
  }
  return false;
}
origin: magefree/mage

public Card getCard(UUID cardId, Game game) {
  for (Cards cards: this.values()) {
    if (cards.contains(cardId))
      return game.getCard(cardId);
  }
  return null;
}
origin: magefree/mage

@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
  return game.getPlayer(controllerId).getHand().contains(sourceId);
}
origin: magefree/mage

@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
  return game.getPlayer(controllerId).getHand().contains(sourceId);
}
origin: magefree/mage

public boolean hasBottomHalf(Game game) {
  boolean value = bottomLastZoneChangeCounter == bottomHalfCard.getZoneChangeCounter(game)
      && halves.contains(bottomHalfCard.getId());
  if (!value) {
    halves.remove(bottomHalfCard);
  }
  return value;
}
origin: magefree/mage

public boolean hasTopHalf(Game game) {
  boolean value = topLastZoneChangeCounter == topHalfCard.getZoneChangeCounter(game)
      && halves.contains(topHalfCard.getId());
  if (!value) {
    halves.remove(topHalfCard);
  }
  return value;
}
origin: magefree/mage

@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
  Card card = game.getCard(sourceId);
  Player player = game.getPlayer(controllerId);
  if (player != null && player.getHand().contains(sourceId) && card != null) {
    paid = card.moveToExile(ability.getSourceId(), "from Hand", ability.getSourceId(), game);
  }
  return paid;
}
origin: magefree/mage

@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
  Card card = game.getCard(sourceId);
  Player player = game.getPlayer(controllerId);
  if (player != null && player.getHand().contains(sourceId) && card != null) {
    paid = card.moveToExile(ability.getSourceId(), "from Hand", ability.getSourceId(), game);
  }
  return paid;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  JandorsRingWatcher watcher = game.getState().getWatcher(JandorsRingWatcher.class);
  return watcher != null
      && watcher.lastDrawnCards != null && game.getPlayer(source.getControllerId()).getHand().contains(watcher.getLastDrewCard(source.getControllerId()));
}
origin: magefree/mage

@Override
public void updateZoneChangeCounter(Game game, ZoneChangeEvent event) {
  if (isCopy() || !isMelded()) {
    super.updateZoneChangeCounter(game, event);
    return;
  }
  game.getState().updateZoneChangeCounter(objectId);
  if (topLastZoneChangeCounter == topHalfCard.getZoneChangeCounter(game)
      && halves.contains(topHalfCard.getId())) {
    topHalfCard.updateZoneChangeCounter(game, event);
    topLastZoneChangeCounter = topHalfCard.getZoneChangeCounter(game);
  }
  if (bottomLastZoneChangeCounter == bottomHalfCard.getZoneChangeCounter(game)
      && halves.contains(bottomHalfCard.getId())) {
    bottomHalfCard.updateZoneChangeCounter(game, event);
    bottomLastZoneChangeCounter = bottomHalfCard.getZoneChangeCounter(game);
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Permanent discordantDirge = game.getPermanentOrLKIBattlefield(source.getSourceId());
  if (discordantDirge != null) {
    int verseCounters = discordantDirge.getCounters(game).getCount(CounterType.VERSE);
    Player targetOpponent = game.getPlayer(source.getFirstTarget());
    Player controller = game.getPlayer(source.getControllerId());
    if (targetOpponent != null
        && controller != null) {
      controller.lookAtCards(targetOpponent.getName() + " hand", targetOpponent.getHand(), game);
      TargetCard target = new TargetCard(0, verseCounters, Zone.HAND, new FilterCard());
      target.setNotTarget(true);
      if (controller.choose(Outcome.Benefit, targetOpponent.getHand(), target, game)) {
        target.getTargets().stream().map(game::getCard).filter((card) -> (card != null
            &&  targetOpponent.getHand().contains(card.getId()))).forEachOrdered((card) -> {
              targetOpponent.discard(card, source, game);
        });
        return true;
      }
    }
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
  MageObject sourceObject = game.getObject(source.getSourceId());
  String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
  if (opponent != null && sourceObject != null && !cardName.isEmpty()) {
    int costX = source.getManaCostsToPay().getX();
    if (costX > 0 && !opponent.getHand().isEmpty()) {
      Cards cards = new CardsImpl();
      while (costX > 0) {
        Card card = opponent.getHand().getRandom(game);
        if (!cards.contains(card.getId())) {
          cards.add(card);
          costX--;
        }
        if (opponent.getHand().size() <= cards.size()) {
          break;
        }
      }
      opponent.revealCards(sourceObject.getIdName(), cards, game);
      for (Card cardToDiscard : cards.getCards(game)) {
        if (cardToDiscard.getName().equals(cardName)) {
          opponent.discard(cardToDiscard, source, game);
        }
      }
    }
    return true;
  }
  return false;
}
origin: magefree/mage

while (player.isInGame() && cards.size() < numberOfCardsToDiscard) {
  Card card = player.getHand().getRandom(game);
  if (!cards.contains(card.getId())) {
    cards.add(card);
origin: magefree/mage

for (Card card : game.getCards()) {
  if (card.isOwnedBy(player.getId()) && !card.isCopy() // no copies
      && !player.getSideboard().contains(card.getId())
origin: magefree/mage

    return false;
} while (cards.contains(card.getId()));
cards.add(card);
origin: magefree/mage

if (isCopy()) { // copied cards have no need to be removed from a previous zone
  removed = true;
} else if (game.getPlayer(ownerId).getSideboard().contains(this.getId())) {
  game.getPlayer(ownerId).getSideboard().remove(this.getId());
  removed = true;
origin: magefree/mage

case HAND:
  for (Player player : getPlayers().values()) {
    if (player.getHand().contains(card.getId())) {
      player.getHand().remove(card);
      break;
mage.cardsCardscontains

Popular methods of Cards

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

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JCheckBox (javax.swing)
  • JFrame (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now