Search in sources :

Example 1 with StitcherGeralfZombieToken

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;
}
Also used : Player(mage.players.Player) FilterCreatureCard(mage.filter.common.FilterCreatureCard) StitcherGeralfZombieToken(mage.game.permanent.token.StitcherGeralfZombieToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) TargetCard(mage.target.TargetCard) UUID(java.util.UUID) FilterCreatureCard(mage.filter.common.FilterCreatureCard) TargetCard(mage.target.TargetCard)

Aggregations

UUID (java.util.UUID)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 FilterCreatureCard (mage.filter.common.FilterCreatureCard)1 StitcherGeralfZombieToken (mage.game.permanent.token.StitcherGeralfZombieToken)1 Player (mage.players.Player)1 TargetCard (mage.target.TargetCard)1