use of mage.target.TargetAmount 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;
}
use of mage.target.TargetAmount in project mage by magefree.
the class BlessingOfFrostEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int snow = ManaPaidSourceWatcher.getSnowPaid(source.getId(), game);
if (snow > 0) {
TargetAmount target = new TargetCreaturePermanentAmount(snow, StaticFilters.FILTER_CONTROLLED_CREATURE);
target.setNotTarget(true);
target.chooseTarget(outcome, player.getId(), source, game);
for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
continue;
}
permanent.addCounters(CounterType.P1P1.createInstance(target.getTargetAmount(targetId)), source.getControllerId(), source, game);
}
}
game.getState().processAction(game);
player.drawCards(game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game), source, game);
return true;
}
Aggregations