Search in sources :

Example 1 with AddManaToManaPoolSourceControllerEffect

use of mage.abilities.effects.mana.AddManaToManaPoolSourceControllerEffect 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)

Aggregations

Mana (mage.Mana)1 AtTheBeginOfMainPhaseDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility)1 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 ClashEffect (mage.abilities.effects.common.ClashEffect)1 AddManaToManaPoolSourceControllerEffect (mage.abilities.effects.mana.AddManaToManaPoolSourceControllerEffect)1 Spell (mage.game.stack.Spell)1 Player (mage.players.Player)1 TargetSpell (mage.target.TargetSpell)1