@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; }
public Card getCard(UUID cardId, Game game) { for (Cards cards: this.values()) { if (cards.contains(cardId)) { return game.getCard(cardId); } } return null; }
@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; }
public Card getCard(UUID cardId, Game game) { for (Cards cards: this.values()) { if (cards.contains(cardId)) return game.getCard(cardId); } return null; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { return game.getPlayer(controllerId).getHand().contains(sourceId); }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { return game.getPlayer(controllerId).getHand().contains(sourceId); }
public boolean hasBottomHalf(Game game) { boolean value = bottomLastZoneChangeCounter == bottomHalfCard.getZoneChangeCounter(game) && halves.contains(bottomHalfCard.getId()); if (!value) { halves.remove(bottomHalfCard); } return value; }
public boolean hasTopHalf(Game game) { boolean value = topLastZoneChangeCounter == topHalfCard.getZoneChangeCounter(game) && halves.contains(topHalfCard.getId()); if (!value) { halves.remove(topHalfCard); } return value; }
@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; }
@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; }
@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())); }
@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); } }
@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; }
@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; }
while (player.isInGame() && cards.size() < numberOfCardsToDiscard) { Card card = player.getHand().getRandom(game); if (!cards.contains(card.getId())) { cards.add(card);
for (Card card : game.getCards()) { if (card.isOwnedBy(player.getId()) && !card.isCopy() // no copies && !player.getSideboard().contains(card.getId())
return false; } while (cards.contains(card.getId())); cards.add(card);
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;
case HAND: for (Player player : getPlayers().values()) { if (player.getHand().contains(card.getId())) { player.getHand().remove(card); break;