use of mage.target.common.TargetCreatureOrPlaneswalkerAmount in project mage by magefree.
the class StumpsquallHydraEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
int xValue = ManacostVariableValue.ETB.calculate(game, source, this);
if (player == null || xValue < 1) {
return false;
}
TargetAmount targetAmount = new TargetCreatureOrPlaneswalkerAmount(xValue, filter);
targetAmount.setNotTarget(true);
player.choose(outcome, targetAmount, source.getSourceId(), game);
for (UUID targetId : targetAmount.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
continue;
}
permanent.addCounters(CounterType.P1P1.createInstance(targetAmount.getTargetAmount(targetId)), source.getControllerId(), source, game);
}
return true;
}
Aggregations