Search in sources :

Example 1 with AddManaToManaPoolTargetControllerEffect

use of mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect in project mage by magefree.

the class MarkOfSakikoTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (((DamagedEvent) event).isCombatDamage()) {
        if (event.getSourceId().equals(getSourceId())) {
            this.getEffects().clear();
            Effect effect = new AddManaToManaPoolTargetControllerEffect(Mana.GreenMana(event.getAmount()), "that player", true);
            effect.setTargetPointer(new FixedTarget(getControllerId()));
            effect.setText("add that much {G}. Until end of turn, you don't lose this mana as steps and phases end");
            this.addEffect(effect);
            return true;
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) DamagedEvent(mage.game.events.DamagedEvent) AddManaToManaPoolTargetControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect) AddManaToManaPoolTargetControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect) Effect(mage.abilities.effects.Effect) AttachEffect(mage.abilities.effects.common.AttachEffect) GainAbilityAttachedEffect(mage.abilities.effects.common.continuous.GainAbilityAttachedEffect)

Example 2 with AddManaToManaPoolTargetControllerEffect

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

Example 3 with AddManaToManaPoolTargetControllerEffect

use of mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect in project mage by magefree.

the class SakikoMotherOfSummerTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (((DamagedPlayerEvent) event).isCombatDamage()) {
        Permanent creature = game.getPermanent(event.getSourceId());
        if (creature != null && creature.isControlledBy(controllerId)) {
            this.getEffects().clear();
            Effect effect = new AddManaToManaPoolTargetControllerEffect(Mana.GreenMana(event.getAmount()), "that player", true);
            effect.setTargetPointer(new FixedTarget(creature.getControllerId()));
            effect.setText("add that much {G}. Until end of turn, you don't lose this mana as steps and phases end");
            this.addEffect(effect);
            return true;
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) AddManaToManaPoolTargetControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect) AddManaToManaPoolTargetControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect) Effect(mage.abilities.effects.Effect) DamagedPlayerEvent(mage.game.events.DamagedPlayerEvent)

Example 4 with AddManaToManaPoolTargetControllerEffect

use of mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect in project mage by magefree.

the class StadiumVendorsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    TargetPlayer target = new TargetPlayer(1, 1, true);
    if (controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
        Player player = game.getPlayer(target.getFirstTarget());
        ChoiceColor colorChoice = new ChoiceColor(true);
        if (player == null || !player.choose(Outcome.Benefit, colorChoice, game)) {
            return false;
        }
        Effect effect = new AddManaToManaPoolTargetControllerEffect(colorChoice.getMana(2), "that player's");
        effect.setTargetPointer(new FixedTarget(player.getId(), game));
        return effect.apply(game, source);
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) AddManaToManaPoolTargetControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) AddManaToManaPoolTargetControllerEffect(mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect) Effect(mage.abilities.effects.Effect) ChoiceColor(mage.choices.ChoiceColor) TargetPlayer(mage.target.TargetPlayer)

Aggregations

Effect (mage.abilities.effects.Effect)4 AddManaToManaPoolTargetControllerEffect (mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect)4 FixedTarget (mage.target.targetpointer.FixedTarget)4 OneShotEffect (mage.abilities.effects.OneShotEffect)2 AtTheBeginOfMainPhaseDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility)1 AttachEffect (mage.abilities.effects.common.AttachEffect)1 GainAbilityAttachedEffect (mage.abilities.effects.common.continuous.GainAbilityAttachedEffect)1 ChoiceColor (mage.choices.ChoiceColor)1 DamagedEvent (mage.game.events.DamagedEvent)1 DamagedPlayerEvent (mage.game.events.DamagedPlayerEvent)1 Permanent (mage.game.permanent.Permanent)1 Spell (mage.game.stack.Spell)1 Player (mage.players.Player)1 TargetPlayer (mage.target.TargetPlayer)1 TargetSpell (mage.target.TargetSpell)1