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

How to use
copy
method
in
mage.cards.Cards

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

origin: magefree/mage

public MnemonicBetrayalReturnEffect(final MnemonicBetrayalReturnEffect effect) {
  super(effect);
  this.cards = effect.cards.copy();
  this.cardMap.putAll(effect.cardMap);
}
origin: magefree/mage

public MnemonicBetrayalDelayedTriggeredAbility(final MnemonicBetrayalDelayedTriggeredAbility ability) {
  super(ability);
  this.cards = ability.cards.copy();
  this.cardMap.putAll(ability.cardMap);
}
origin: magefree/mage

private AbandonedSarcophagusWatcher(final AbandonedSarcophagusWatcher watcher) {
  super(watcher);
  for (Entry<UUID, Cards> entry : watcher.cycledCardsThisTurn.entrySet()) {
    cycledCardsThisTurn.put(entry.getKey(), entry.getValue().copy());
  }
}
origin: magefree/mage

public CardsCycledOrDiscardedThisTurnWatcher(final CardsCycledOrDiscardedThisTurnWatcher watcher) {
  super(watcher);
  for (Entry<UUID, Cards> entry : watcher.cycledOrDiscardedCardsThisTurn.entrySet()) {
    cycledOrDiscardedCardsThisTurn.put(entry.getKey(), entry.getValue().copy());
  }
  for (Entry<UUID, Set<MageObjectReference>> entry : watcher.numberOfCycledOrDiscardedCardsThisTurn.entrySet()) {
    Set<MageObjectReference> cycledOrDiscardedCards = new HashSet<>();
    cycledOrDiscardedCards.addAll(entry.getValue());
    numberOfCycledOrDiscardedCardsThisTurn.put(entry.getKey(), cycledOrDiscardedCards);
  }
  numberOfCycledOrDiscardedCardsThisTurn.putAll(watcher.numberOfCycledOrDiscardedCardsThisTurn);
}
origin: magefree/mage

public void update(String name, Cards cards) {
  this.put(name, cards.copy());
}

origin: magefree/mage

public LookedAt(final LookedAt lookedAt) {
  for (Map.Entry<String, Cards> entry: lookedAt.entrySet()) {
    this.put(entry.getKey(), entry.getValue().copy());
  }
}
origin: magefree/mage

public Revealed(final Revealed revealed) {
  for (Map.Entry<String, Cards> entry: revealed.entrySet()) {
    this.put(entry.getKey(), entry.getValue().copy());
  }
}
origin: magefree/mage

public void add(String name, Cards cards) {
  if (!this.containsKey(name)) {
    createLookedAt(name);
  }
  this.put(name, cards.copy());
}
origin: magefree/mage

public void add(String name, Cards cards) {
  if (this.containsKey(name)) {
    this.get(name).addAll(cards);
  } else  {
    this.put(name, cards.copy());
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(source.getFirstTarget());
  if (player != null) {
    for (UUID cid : player.getHand().copy()) {
      Card c = game.getCard(cid);
      if (c != null) {
        c.moveToExile(source.getSourceId(), "Hypnox", source.getSourceId(), 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) {
      Cards cardsInHand = controller.getHand().copy();
      TargetCard target = new TargetCardInHand(0, cardsInHand.size(), new FilterCard());
      controller.chooseTarget(outcome, cardsInHand, target, source, game);
      if (!target.getTargets().isEmpty()) {
        for (UUID cardId : target.getTargets()) {
          Card card = game.getCard(cardId);
          if (card != null) {
            controller.discard(card, source, game);
          }
        }
        game.applyEffects();
        controller.drawCards(target.getTargets().size(), 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) {
    Cards initialHand = controller.getHand().copy();
    controller.drawCards(cardsToDraw, game);
    Cards drawnCards = new CardsImpl(controller.getHand().copy());
    drawnCards.removeAll(initialHand);
    if (!drawnCards.isEmpty()) {
      TargetCard cardToDiscard = new TargetCard(Zone.HAND, new FilterCard("card to discard"));
      cardToDiscard.setNotTarget(true);
      if (controller.choose(Outcome.Discard, drawnCards, cardToDiscard, game)) {
        Card card = controller.getHand().get(cardToDiscard.getFirstTarget(), game);
        if (card != null) {
          return controller.discard(card, source, game);
        }
      }
    }
    return true;
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(source.getFirstTarget());
  if (player != null) {
    for (UUID cid : player.getHand().copy()) {
      Card c = game.getCard(cid);
      if (c != null) {
        c.moveToExile(null, null, source.getSourceId(), game);
      }
    }
    for (UUID cid : player.getGraveyard().copy()) {
      Card c = game.getCard(cid);
      if (c != null) {
        c.moveToExile(null, null, source.getSourceId(), game);
      }
    }
    return true;
  }
  return false;
}
origin: magefree/mage

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
  Player player = game.getPlayer(event.getPlayerId());
  if (player != null) {
    Cards oldHand = player.getHand().copy();
    if (player.drawCards(1, game, event.getAppliedEffects()) > 0) {
      Cards drawnCards = player.getHand().copy();
      drawnCards.removeAll(oldHand);
      player.revealCards(source, "The card drawn from " + player.getName() + "'s library.", drawnCards, game);
      for (Card cardDrawn : drawnCards.getCards(game)) {
        if (cardDrawn.isCreature()) {
          game.informPlayers("The card drawn by " + player.getName() + " is a creature card.  He/she must pay 3 life or that card gets discarded.");
          PayLifeCost cost = new PayLifeCost(3);
          if (cost.canPay(source, source.getSourceId(), player.getId(), game)
              && player.chooseUse(outcome, "Do you wish to pay 3 life to keep the card " + cardDrawn.getIdName() + "?  If not, you discard it.", source, game)) {
            cost.pay(source, game, source.getSourceId(), player.getId(), true, cost);
          } else {
            game.informPlayers("The cost of 3 life was not paid by " + player.getName() + ", so " + cardDrawn.getIdName() + " will be discarded.");
            player.discard(cardDrawn, source, game);
          }
        }
      }
    }
    return true;
  }
  return false;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
    if (spell != null) {
      int cmc = spell.getConvertedManaCost();
      Player targetPlayer = null;
      for (Target target : source.getTargets()) {
        if (target instanceof TargetPlayer) {
          targetPlayer = game.getPlayer(target.getFirstTarget());
        }
      }
      if (targetPlayer != null) {
        if (!targetPlayer.getHand().isEmpty()) {
          targetPlayer.revealCards("Infernal Kirin", targetPlayer.getHand(), game);
          for (UUID uuid : targetPlayer.getHand().copy()) {
            Card card = game.getCard(uuid);
            if (card != null && card.getConvertedManaCost() == cmc) {
              targetPlayer.discard(card, source, game);
            }
          }
        }
        return true;
      }
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
    if (controller != null && targetPlayer != null) {
      Cards cardsInHand = controller.getHand().copy();
      TargetCard target = new TargetCardInHand(0, cardsInHand.size(), new FilterCard("cards to discard"));
      controller.chooseTarget(outcome, cardsInHand, target, source, game);
      int discardCount = target.getTargets().size();
      if (discardCount > 0) {
        for (UUID cardId : target.getTargets()) {
          Card card = game.getCard(cardId);
          if (card != null) {
            controller.discard(card, source, game);
          }
        }
        FilterCard filter = new FilterCard((discardCount > 1 ? "" : "a") + " nonland card" + (discardCount > 1 ? "s" : ""));
        filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
        StaticValue discardValue = new StaticValue(discardCount);
        Effect effect = new DiscardCardYouChooseTargetEffect(discardValue, filter, TargetController.ANY);
        effect.setTargetPointer(new FixedTarget(targetPlayer.getId()));
        effect.apply(game, source);
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
      permanent.moveToExile(null, "", source.getSourceId(), game);
    }
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
      Player player = game.getPlayer(playerId);
      if (player != null) {
        for (UUID cid : player.getHand().copy()) {
          Card c = game.getCard(cid);
          if (c != null) {
            c.moveToExile(null, null, source.getSourceId(), game);
          }
        }
        for (UUID cid : player.getGraveyard().copy()) {
          Card c = game.getCard(cid);
          if (c != null) {
            c.moveToExile(null, null, source.getSourceId(), game);
          }
        }
      }
    }
    return true;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
      permanent.moveToExile(null, "", source.getSourceId(), game);
    }
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
      Player player = game.getPlayer(playerId);
      if (player != null) {
        for (UUID cid : player.getHand().copy()) {
          Card c = game.getCard(cid);
          if (c != null) {
            c.moveToExile(null, null, source.getSourceId(), game);
          }
        }
        for (UUID cid : player.getGraveyard().copy()) {
          Card c = game.getCard(cid);
          if (c != null) {
            c.moveToExile(null, null, source.getSourceId(), game);
          }
        }
        player.setLife(1, game, source);
      }
    }
    return true;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(targetPointer.getFirst(game, source));
  Player controller = game.getPlayer(source.getControllerId());
  MageObject sourceObject = source.getSourceObject(game);
  if (player != null && controller != null && sourceObject != null) {
    TargetCard targetCard = new TargetCard(Zone.ALL, new FilterCard());
    targetCard.setRequired(true);
    Cards options = player.getHand().copy();
    Card topdeck = player.getLibrary().getFromTop(game);
    options.add(topdeck);
    controller.lookAtCards("Top of Library (Psychotic Episode)", topdeck, game);
    if (controller.choose(Outcome.Discard, options, targetCard, game)) {
      Card card = game.getCard(targetCard.getFirstTarget());
      if (card != null) {
        CardsImpl cards = new CardsImpl();
        cards.add(card);
        player.revealCards(sourceObject.getIdName(), cards, game);
        player.putCardsOnBottomOfLibrary(cards, game, source, true);
      }
    }
    return true;
  }
  return false;
}
origin: magefree/mage

FilterControlledPermanent filter = new FilterControlledPermanent();
filter.add(new OwnerIdPredicate(player.getId()));
for (UUID uuid : player.getHand().copy()) {
  Card card = game.getCard(uuid);
  if (card != null) {
mage.cardsCardscopy

Popular methods of Cards

  • getCards
  • size
  • add
  • isEmpty
  • clear
  • count
  • getRandom
  • addAll
  • contains
  • 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 12 Jupyter Notebook extensions
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