Search in sources :

Example 1 with ZombieArmyToken

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

the class AmassEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int xValue = amassNumber.calculate(game, source, this);
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    if (!game.getBattlefield().containsControlled(filter, source, game, 1)) {
        new CreateTokenEffect(new ZombieArmyToken()).apply(game, source);
    }
    Target target = new TargetPermanent(filter);
    target.setNotTarget(true);
    if (!player.choose(outcome, target, source.getSourceId(), game)) {
        return false;
    }
    Permanent permanent = game.getPermanent(target.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    permanent.addCounters(CounterType.P1P1.createInstance(xValue), source.getControllerId(), source, game);
    this.amassedCreatureId = permanent.getId();
    return true;
}
Also used : Player(mage.players.Player) Target(mage.target.Target) FilterPermanent(mage.filter.FilterPermanent) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) TargetPermanent(mage.target.TargetPermanent) ZombieArmyToken(mage.game.permanent.token.ZombieArmyToken)

Aggregations

CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)1 Permanent (mage.game.permanent.Permanent)1 ZombieArmyToken (mage.game.permanent.token.ZombieArmyToken)1 Player (mage.players.Player)1 Target (mage.target.Target)1 TargetPermanent (mage.target.TargetPermanent)1