Search in sources :

Example 1 with IzoniInsectToken

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

the class GristTheHungerTideTokenEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    Token token = new IzoniInsectToken();
    while (true) {
        token.putOntoBattlefield(1, game, source, source.getControllerId());
        if (player.millCards(1, source, game).count(filter, game) < 1) {
            break;
        }
        if (permanent != null) {
            permanent.addCounters(CounterType.LOYALTY.createInstance(), source.getControllerId(), source, game);
        }
    }
    return true;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetControlledPermanent(mage.target.common.TargetControlledPermanent) IzoniInsectToken(mage.game.permanent.token.IzoniInsectToken) Token(mage.game.permanent.token.Token) IzoniInsectToken(mage.game.permanent.token.IzoniInsectToken)

Aggregations

Permanent (mage.game.permanent.Permanent)1 IzoniInsectToken (mage.game.permanent.token.IzoniInsectToken)1 Token (mage.game.permanent.token.Token)1 Player (mage.players.Player)1 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)1