use of mage.target.common.TargetCreaturePermanentAmount in project mage by magefree.
the class TargetPriorityTest method test_targetAmount_NormalCase.
@Test
public void test_targetAmount_NormalCase() {
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageMultiEffect(3), new ManaCostsImpl("R"));
ability.addTarget(new TargetCreaturePermanentAmount(3));
addCustomCardWithAbility("damage 3", playerA, ability);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
//
// 1/1
addCard(Zone.BATTLEFIELD, playerB, "Memnite", 3);
// 2/2
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 3);
// 2/2 with ability
addCard(Zone.BATTLEFIELD, playerB, "Ashcoat Bear", 3);
// 4/3
addCard(Zone.BATTLEFIELD, playerB, "Golden Bear", 3);
// 4/4 with ability
addCard(Zone.BATTLEFIELD, playerB, "Battering Sliver", 3);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: ");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerB, "Memnite", 3);
assertPermanentCount(playerB, "Balduvian Bears", 3);
assertPermanentCount(playerB, "Ashcoat Bear", 3);
assertPermanentCount(playerB, "Golden Bear", 3 - 1);
assertPermanentCount(playerB, "Battering Sliver", 3);
}
use of mage.target.common.TargetCreaturePermanentAmount 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