Search in sources :

Example 1 with TemptWithVengeanceElementalToken

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

the class TemptWithVengeanceEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    int xValue = source.getManaCostsToPay().getX();
    if (controller != null && xValue > 0) {
        Token tokenCopy = new TemptWithVengeanceElementalToken();
        tokenCopy.putOntoBattlefield(xValue, game, source, source.getControllerId(), false, false);
        int opponentsAddedTokens = 0;
        for (UUID playerId : game.getOpponents(controller.getId())) {
            Player opponent = game.getPlayer(playerId);
            if (opponent != null) {
                if (opponent.chooseUse(outcome, "Create " + xValue + " Elemental tokens?", source, game)) {
                    opponentsAddedTokens += xValue;
                    tokenCopy.putOntoBattlefield(xValue, game, source, playerId, false, false);
                }
            }
        }
        if (opponentsAddedTokens > 0) {
            tokenCopy.putOntoBattlefield(opponentsAddedTokens, game, source, source.getControllerId(), false, false);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) Token(mage.game.permanent.token.Token) TemptWithVengeanceElementalToken(mage.game.permanent.token.TemptWithVengeanceElementalToken) TemptWithVengeanceElementalToken(mage.game.permanent.token.TemptWithVengeanceElementalToken) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 TemptWithVengeanceElementalToken (mage.game.permanent.token.TemptWithVengeanceElementalToken)1 Token (mage.game.permanent.token.Token)1 Player (mage.players.Player)1