Search in sources :

Example 1 with FaerieRogueToken

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

the class NotoriousThrongEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class);
    if (controller != null && watcher != null) {
        int numTokens = 0;
        for (UUID opponentId : game.getOpponents(controller.getId())) {
            numTokens += watcher.getAmountOfDamageReceivedThisTurn(opponentId);
        }
        if (numTokens > 0) {
            new CreateTokenEffect(new FaerieRogueToken(), numTokens).apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) AmountOfDamageAPlayerReceivedThisTurnWatcher(mage.watchers.common.AmountOfDamageAPlayerReceivedThisTurnWatcher) FaerieRogueToken(mage.game.permanent.token.FaerieRogueToken) UUID(java.util.UUID) ProwlCostWasPaidHint(mage.abilities.hint.common.ProwlCostWasPaidHint)

Aggregations

UUID (java.util.UUID)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 ProwlCostWasPaidHint (mage.abilities.hint.common.ProwlCostWasPaidHint)1 FaerieRogueToken (mage.game.permanent.token.FaerieRogueToken)1 Player (mage.players.Player)1 AmountOfDamageAPlayerReceivedThisTurnWatcher (mage.watchers.common.AmountOfDamageAPlayerReceivedThisTurnWatcher)1