@Override public Counters getCounters(Game game) { return card.getCounters(game); }
@Override public Counters getCounters(GameState state) { return card.getCounters(state); }
@Override public boolean apply(Card input, Game game) { if (counter == null) { return !input.getCounters(game).keySet().isEmpty(); } else { return input.getCounters(game).containsKey(counter); } }
@Override public boolean apply(Card input, Game game) { if (counter == null) { return !input.getCounters(game).keySet().isEmpty(); } else { return input.getCounters(game).containsKey(counter); } }
@Override public boolean apply(Card input, Game game) { return input.getCounters(game).containsKey(counter); }
@Override public boolean checkTrigger(GameEvent event, Game game) { return (event.getTargetId().equals(this.getSourceId()) && game.getCard(event.getTargetId()).getCounters(game).getCount(CounterType.TIME) == 0); }
@Override public boolean checkTrigger(GameEvent event, Game game) { return (event.getTargetId().equals(this.getSourceId()) && game.getCard(event.getTargetId()).getCounters(game).getCount(CounterType.TIME) == 0); }
private void execute(final Game game, final Player controller, final MageObject sourceObject, Ability source, final List<Card> cards, final boolean removeCounter) { for (Card card : cards) { if (filter.match(card, game)) { final String counterName = counter.getName(); if (removeCounter) { final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); final Counter modifiedCounter = new Counter(counterName, countersToRemove); card.removeCounters(modifiedCounter, game); } else { card.addCounters(counter, source, game); } if (!game.isSimulation()) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") .append(controller.getLogName()).append(actionStr) .append(counter.getCount()).append(' ').append(counterName.toLowerCase(Locale.ENGLISH)) .append(" counter on ").append(card.getName()).toString()); } } } }
@Override public ActivationStatus canActivate(UUID playerId, Game game) { Card card = game.getCard(this.getSourceId()); if (card == null || card.getCounters(game).getCount(CounterType.TIME) == 0) { return ActivationStatus.getFalse(); } return super.canActivate(playerId, game); }
@Override public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getSourceId()); if (card != null) { if (game.getState().getZone(card.getId()) == Zone.EXILED && card.getCounters(game).getCount(CounterType.EGG) > 0) { return true; } } return false; } }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(getSourceId())) { Card card = game.getCard(getSourceId()); if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD && card.getCounters(game).getCount(CounterType.REPAIR) == 0) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(getSourceId())) { Card card = game.getCard(getSourceId()); if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED && card.getCounters(game).getCount(CounterType.TIME) == 0) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (Card card : controller.getGraveyard().getCards(game)) { if (card.getCounters(game).getCount("repair") > 0) { card.removeCounters("repair", 1, game); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getSourceId()); if (card != null) { boolean found = card.getAbilities().stream().anyMatch(ability -> ability instanceof SuspendAbility); if (!found) { found = game.getState().getAllOtherAbilities(source.getSourceId()).stream().anyMatch(ability -> ability instanceof SuspendAbility); } if (found) { if (game.getState().getZone(card.getId()) == Zone.EXILED && card.getCounters(game).getCount(CounterType.TIME) > 0) { return true; } } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Cards cardsToReturn = new CardsImpl(); for (Card card : controller.getGraveyard().getCards(game)) { if (card.isOwnedBy(controller.getId()) && card.getCounters(game).getCount(CounterType.REPAIR) > 0) { int number = card.getCounters(game).getCount(CounterType.REPAIR); if (number > 0) { cardsToReturn.add(card); card.removeCounters(CounterType.REPAIR.createInstance(number), game); } } } if (!cardsToReturn.isEmpty()) { controller.moveCards(cardsToReturn, Zone.BATTLEFIELD, source, game); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } MageObject sourceObject = source.getSourceObjectIfItStillExists(game); if (sourceObject instanceof Card) { Card card = (Card) sourceObject; new RemoveCounterSourceEffect(CounterType.EGG.createInstance()).apply(game, source); if (card.getCounters(game).getCount(CounterType.EGG) == 0) { controller.moveCards(card, Zone.BATTLEFIELD, source, game); } return true; } return false; } }
private void execute(final Ability source, final Game game, final Player controller, final MageObject sourceObject, final List<Card> cards) { if (cards == null || cards.isEmpty()) { return; } for (Card card : cards) { if (exiledFilter.match(card, game)) { final String counterName = counter.getName(); if (shouldRemoveCounters()) { final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); final Counter modifiedCounter = new Counter(counterName, countersToRemove); card.removeCounters(modifiedCounter, game); } else { card.addCounters(counter, source, game); } if (!game.isSimulation()) { game.informPlayers(sourceObject.getName() + ": " + controller.getLogName() + getActionStr() + "s " + counter.getCount() + ' ' + counterName.toLowerCase(Locale.ENGLISH) + " counter on " + card.getName()); } } } }
@Override public boolean apply(Game game, Ability source) { Card card = game.getCard(targetPointer.getFirst(game, source)); if (card != null) { // remove exiting suspend counters card.getCounters(game).clear(); // move to exile card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); game.getPlayer(card.getOwnerId()).shuffleLibrary(source, game); game.informPlayers("Riftsweeper: Choosen card was " + card.getName()); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Card allHallowsEve = game.getCard(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (allHallowsEve != null && controller != null && game.getExile().getCard(allHallowsEve.getId(), game) != null) { allHallowsEve.getCounters(game).removeCounter(CounterType.SCREAM, 1); if (allHallowsEve.getCounters(game).getCount(CounterType.SCREAM) == 0) { allHallowsEve.moveToZone(Zone.GRAVEYARD, source.getId(), game, false); for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { player.moveCards(player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game), Zone.BATTLEFIELD, source, game); } } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = source.getSourcePermanentIfItStillExists(game); if (permanent != null) { int toRemove = Math.min(counter.getCount(), permanent.getCounters(game).getCount(counter.getName())); if (toRemove > 0) { permanent.removeCounters(counter.getName(), toRemove, game); if (!game.isSimulation()) { game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + permanent.getLogName()); } } return true; } if (!(source.getSourceObject(game) instanceof Permanent)) { Card card = game.getCard(source.getSourceId()); if (card != null) { int toRemove = Math.min(counter.getCount(), card.getCounters(game).getCount(counter.getName())); if (toRemove > 0) { card.removeCounters(counter.getName(), toRemove, game); if (!game.isSimulation()) { game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + card.getLogName() + " (" + card.getCounters(game).getCount(counter.getName()) + " left)"); } } return true; } } return false; }