use of mage.game.permanent.token.StitcherGeralfZombieToken in project mage by magefree.
the class StitcherGeralfEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
cards.addAll(player.millCards(3, source, game));
}
}
cards.removeIf(uuid -> game.getState().getZone(uuid) != Zone.GRAVEYARD);
TargetCard target = new TargetCard(0, 2, Zone.GRAVEYARD, new FilterCreatureCard("creature cards to exile"));
controller.chooseTarget(outcome, cards, target, source, game);
int power = 0;
for (UUID cardId : target.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {
power += card.getPower().getValue();
controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.GRAVEYARD, true);
}
}
return new CreateTokenEffect(new StitcherGeralfZombieToken(power)).apply(game, source);
}
return false;
}
Aggregations