@Override public Card getRandom(Game game) { if (this.isEmpty()) { return null; } UUID[] cards = this.toArray(new UUID[this.size()]); MageObject object = game.getObject(cards[RandomUtil.nextInt(cards.length)]); // neccessary if permanent tokens are in the collection if (object instanceof Card) { return (Card) object; } return null; }
cards.add(permanent); while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (cards.size() == 1) { Permanent permanent = game.getPermanent(cards.iterator().next()); permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (cards.size() == 1) { Card card = cards.get(cards.iterator().next(), game); card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { CardsImpl toReveal = new CardsImpl(); Card toBattlefield = null; for (Card card : controller.getLibrary().getCards(game)) { toReveal.add(card); game.fireUpdatePlayersEvent(); if (card.isArtifact()) { toBattlefield = card; break; } } controller.revealCards(source, toReveal, game); controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game); int damage = toReveal.size(); toReveal.remove(toBattlefield); controller.putCardsOnBottomOfLibrary(toReveal, game, source, false); controller.damage(damage, source.getSourceId(), game, false, true); return true; } return false; } }
if (cards.size() == 1) { cardToCopy = cards.getCards(game).iterator().next(); } else {
defendingPlayer.moveCards(cards, Zone.GRAVEYARD, source, game); if (!cards.isEmpty()) { ContinuousEffect effect = new BoostTargetEffect(cards.size(), 0, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(creature, game)); game.addEffect(effect, source);