Search in sources :

Example 1 with AddCountersTargetEffect

use of mage.abilities.effects.common.counter.AddCountersTargetEffect in project mage by magefree.

the class ImpulsiveWagerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
        DiscardCardCost cost = (DiscardCardCost) source.getCosts().get(0);
        if (cost != null) {
            List<Card> cards = cost.getCards();
            if (cards.size() == 1 && cards.get(0).isLand(game)) {
                Effect effect = new AddCountersTargetEffect(CounterType.BOUNTY.createInstance());
                effect.setTargetPointer(getTargetPointer());
                effect.apply(game, source);
            } else {
                player.drawCards(2, source, game);
            }
        }
        return true;
    }
    return false;
}
Also used : DiscardCardCost(mage.abilities.costs.common.DiscardCardCost) Player(mage.players.Player) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) Card(mage.cards.Card)

Example 2 with AddCountersTargetEffect

use of mage.abilities.effects.common.counter.AddCountersTargetEffect in project mage by magefree.

the class AwakenElementalToken method apply.

@Override
public boolean apply(Game game, Ability source) {
    UUID targetId = null;
    for (Target target : source.getTargets()) {
        targetId = target.getFirstTarget();
    }
    if (targetId != null) {
        FixedTarget fixedTarget = new FixedTarget(targetId, game);
        ContinuousEffect continuousEffect = new BecomesCreatureTargetEffect(new AwakenElementalToken(), false, true, Duration.EndOfGame);
        continuousEffect.setTargetPointer(fixedTarget);
        game.addEffect(continuousEffect, source);
        Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(3));
        effect.setTargetPointer(fixedTarget);
        return effect.apply(game, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Target(mage.target.Target) FixedTarget(mage.target.targetpointer.FixedTarget) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) Effect(mage.abilities.effects.Effect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect)

Example 3 with AddCountersTargetEffect

use of mage.abilities.effects.common.counter.AddCountersTargetEffect in project mage by magefree.

the class RemnantOfTheRisingStarEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    ManaCosts<ManaCost> cost = new ManaCostsImpl<>("{X}");
    if (player == null || !player.chooseUse(Outcome.BoostCreature, "Pay " + cost.getText() + "?", source, game)) {
        return false;
    }
    int xValue = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
    cost.add(new GenericManaCost(xValue));
    if (!cost.pay(source, game, source, source.getControllerId(), false, null)) {
        return false;
    }
    Permanent permanent = (Permanent) getValue("permanentEnteringBattlefield");
    if (permanent == null) {
        return false;
    }
    game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance(xValue)).setTargetPointer(new FixedTarget(permanent, game)), false), source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) FilterPermanent(mage.filter.FilterPermanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) Permanent(mage.game.permanent.Permanent) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) ManaCost(mage.abilities.costs.mana.ManaCost) ReflexiveTriggeredAbility(mage.abilities.common.delayed.ReflexiveTriggeredAbility) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) Hint(mage.abilities.hint.Hint) ValueHint(mage.abilities.hint.ValueHint)

Example 4 with AddCountersTargetEffect

use of mage.abilities.effects.common.counter.AddCountersTargetEffect in project mage by magefree.

the class RakishHeirTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
    Permanent permanent = game.getPermanent(event.getSourceId());
    if (damageEvent.isCombatDamage() && permanent != null && permanent.hasSubtype(SubType.VAMPIRE, game) && permanent.isControlledBy(controllerId)) {
        this.getEffects().clear();
        AddCountersTargetEffect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance());
        effect.setTargetPointer(new FixedTarget(permanent, game));
        this.addEffect(effect);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) DamagedPlayerEvent(mage.game.events.DamagedPlayerEvent) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect)

Example 5 with AddCountersTargetEffect

use of mage.abilities.effects.common.counter.AddCountersTargetEffect in project mage by magefree.

the class RideTheAvalancheTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (!isControlledBy(event.getPlayerId())) {
        return false;
    }
    Spell spell = game.getSpell(event.getTargetId());
    if (spell == null) {
        return false;
    }
    this.getEffects().clear();
    this.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(spell.getManaValue())));
    return true;
}
Also used : AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) Spell(mage.game.stack.Spell)

Aggregations

AddCountersTargetEffect (mage.abilities.effects.common.counter.AddCountersTargetEffect)36 FixedTarget (mage.target.targetpointer.FixedTarget)27 Permanent (mage.game.permanent.Permanent)24 Effect (mage.abilities.effects.Effect)21 OneShotEffect (mage.abilities.effects.OneShotEffect)18 Player (mage.players.Player)18 Card (mage.cards.Card)7 UUID (java.util.UUID)6 ContinuousEffect (mage.abilities.effects.ContinuousEffect)6 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)6 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)6 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)6 Target (mage.target.Target)5 TargetPermanent (mage.target.TargetPermanent)5 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)4 Ability (mage.abilities.Ability)3 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)3 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)3 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)3 AddCountersSourceEffect (mage.abilities.effects.common.counter.AddCountersSourceEffect)3