Search in sources :

Example 1 with OonaQueenFaerieRogueToken

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

the class OonaQueenOfTheFaeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
    ChoiceColor choice = new ChoiceColor();
    if (controller == null || opponent == null || !controller.choose(outcome, choice, game)) {
        return false;
    }
    int cardsWithColor = 0;
    Cards cardsToExile = new CardsImpl();
    cardsToExile.addAll(opponent.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
    for (Card card : cardsToExile.getCards(game)) {
        if (card != null && card.getColor(game).contains(choice.getColor())) {
            cardsWithColor++;
        }
    }
    controller.moveCards(cardsToExile, Zone.EXILED, source, game);
    if (cardsWithColor > 0) {
        new CreateTokenEffect(new OonaQueenFaerieRogueToken(), cardsWithColor).apply(game, source);
    }
    game.informPlayers("Oona: " + cardsWithColor + " Token" + (cardsWithColor != 1 ? "s" : "") + " created");
    return true;
}
Also used : Player(mage.players.Player) OonaQueenFaerieRogueToken(mage.game.permanent.token.OonaQueenFaerieRogueToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) ChoiceColor(mage.choices.ChoiceColor)

Aggregations

CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 ChoiceColor (mage.choices.ChoiceColor)1 OonaQueenFaerieRogueToken (mage.game.permanent.token.OonaQueenFaerieRogueToken)1 Player (mage.players.Player)1