Search in sources :

Example 6 with TargetCreaturePermanentAmount

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);
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) SpellAbility(mage.abilities.SpellAbility) Ability(mage.abilities.Ability) TargetCreaturePermanentAmount(mage.target.common.TargetCreaturePermanentAmount) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) DamageMultiEffect(mage.abilities.effects.common.DamageMultiEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) Test(org.junit.Test)

Example 7 with TargetCreaturePermanentAmount

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;
}
Also used : Player(mage.players.Player) TargetCreaturePermanentAmount(mage.target.common.TargetCreaturePermanentAmount) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) UUID(java.util.UUID) TargetAmount(mage.target.TargetAmount)

Aggregations

TargetCreaturePermanentAmount (mage.target.common.TargetCreaturePermanentAmount)7 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)4 DamageMultiEffect (mage.abilities.effects.common.DamageMultiEffect)4 Ability (mage.abilities.Ability)3 SpellAbility (mage.abilities.SpellAbility)3 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)3 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)3 Permanent (mage.game.permanent.Permanent)3 Player (mage.players.Player)3 Test (org.junit.Test)3 ReflexiveTriggeredAbility (mage.abilities.common.delayed.ReflexiveTriggeredAbility)2 DistributeCountersEffect (mage.abilities.effects.common.counter.DistributeCountersEffect)2 FilterPermanent (mage.filter.FilterPermanent)2 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)2 UUID (java.util.UUID)1 OnLeaveReturnExiledToBattlefieldAbility (mage.abilities.common.delayed.OnLeaveReturnExiledToBattlefieldAbility)1 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)1 ManaCosts (mage.abilities.costs.mana.ManaCosts)1 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)1 TargetAmount (mage.target.TargetAmount)1