Search in sources :

Example 1 with BreedingPitThrullToken

use of mage.game.permanent.token.BreedingPitThrullToken in project mage by magefree.

the class SzatsWillEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Cards cards = new CardsImpl(game.getOpponents(source.getControllerId()).stream().map(game::getPlayer).filter(Objects::nonNull).map(Player::getGraveyard).flatMap(Collection::stream).collect(Collectors.toSet()));
    player.moveCards(cards, Zone.EXILED, source, game);
    cards.removeIf(uuid -> game.getState().getZone(uuid) != Zone.EXILED);
    int maxPower = cards.getCards(game).stream().filter(Objects::nonNull).filter(card -> card.isCreature(game)).map(MageObject::getPower).mapToInt(MageInt::getValue).max().orElse(0);
    if (maxPower > 0) {
        new BreedingPitThrullToken().putOntoBattlefield(maxPower, game, source, source.getControllerId());
    }
    return true;
}
Also used : Player(mage.players.Player) BreedingPitThrullToken(mage.game.permanent.token.BreedingPitThrullToken) Objects(java.util.Objects) Collection(java.util.Collection) MageInt(mage.MageInt) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl)

Aggregations

Collection (java.util.Collection)1 Objects (java.util.Objects)1 MageInt (mage.MageInt)1 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 BreedingPitThrullToken (mage.game.permanent.token.BreedingPitThrullToken)1 Player (mage.players.Player)1