Search in sources :

Example 1 with AtTheBeginOfMainPhaseDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility in project mage by magefree.

the class ScatteringStrokeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Spell spell = (Spell) game.getStack().getStackObject(getTargetPointer().getFirst(game, source));
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null && spell != null) {
        game.getStack().counter(spell.getId(), source, game);
        if (ClashEffect.getInstance().apply(game, source)) {
            Effect effect = new AddManaToManaPoolSourceControllerEffect(new Mana(0, 0, 0, 0, 0, 0, 0, spell.getManaValue()));
            AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility = new AtTheBeginOfMainPhaseDelayedTriggeredAbility(effect, true, TargetController.YOU, AtTheBeginOfMainPhaseDelayedTriggeredAbility.PhaseSelection.NEXT_MAIN);
            game.addDelayedTriggeredAbility(delayedAbility, source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) Mana(mage.Mana) AddManaToManaPoolSourceControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolSourceControllerEffect) AddManaToManaPoolSourceControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolSourceControllerEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ClashEffect(mage.abilities.effects.common.ClashEffect) Effect(mage.abilities.effects.Effect) AtTheBeginOfMainPhaseDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility) Spell(mage.game.stack.Spell) TargetSpell(mage.target.TargetSpell)

Example 2 with AtTheBeginOfMainPhaseDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility in project mage by magefree.

the class PlasmCaptureCounterEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
    if (spell != null) {
        game.getStack().counter(getTargetPointer().getFirst(game, source), source, game);
        // mana gets added also if counter is not successful
        int mana = spell.getManaValue();
        AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility = new AtTheBeginOfMainPhaseDelayedTriggeredAbility(new AddManaInAnyCombinationEffect(mana), false, TargetController.YOU, PhaseSelection.NEXT_PRECOMBAT_MAIN);
        game.addDelayedTriggeredAbility(delayedAbility, source);
        return true;
    }
    return false;
}
Also used : AtTheBeginOfMainPhaseDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility) Spell(mage.game.stack.Spell) TargetSpell(mage.target.TargetSpell) AddManaInAnyCombinationEffect(mage.abilities.effects.mana.AddManaInAnyCombinationEffect)

Example 3 with AtTheBeginOfMainPhaseDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility in project mage by magefree.

the class ManaDrainCounterEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
    if (spell != null) {
        game.getStack().counter(getTargetPointer().getFirst(game, source), source, game);
        // mana gets added also if counter is not successful
        int cmc = spell.getManaValue();
        Effect effect = new AddManaToManaPoolTargetControllerEffect(Mana.ColorlessMana(cmc), "your");
        effect.setTargetPointer(new FixedTarget(source.getControllerId()));
        AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility = new AtTheBeginOfMainPhaseDelayedTriggeredAbility(effect, false, TargetController.YOU, PhaseSelection.NEXT_MAIN);
        game.addDelayedTriggeredAbility(delayedAbility, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AddManaToManaPoolTargetControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) AddManaToManaPoolTargetControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect) Effect(mage.abilities.effects.Effect) AtTheBeginOfMainPhaseDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility) Spell(mage.game.stack.Spell) TargetSpell(mage.target.TargetSpell)

Aggregations

AtTheBeginOfMainPhaseDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility)3 Spell (mage.game.stack.Spell)3 TargetSpell (mage.target.TargetSpell)3 Effect (mage.abilities.effects.Effect)2 OneShotEffect (mage.abilities.effects.OneShotEffect)2 Mana (mage.Mana)1 ClashEffect (mage.abilities.effects.common.ClashEffect)1 AddManaInAnyCombinationEffect (mage.abilities.effects.mana.AddManaInAnyCombinationEffect)1 AddManaToManaPoolSourceControllerEffect (mage.abilities.effects.mana.AddManaToManaPoolSourceControllerEffect)1 AddManaToManaPoolTargetControllerEffect (mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect)1 Player (mage.players.Player)1 FixedTarget (mage.target.targetpointer.FixedTarget)1