Search in sources :

Example 1 with ManaEvent

use of mage.game.events.ManaEvent in project mage by magefree.

the class HarvestMageReplacementEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    ManaEvent manaEvent = (ManaEvent) event;
    Mana mana = manaEvent.getMana();
    if (game != null && game.inCheckPlayableState()) {
        mana.setToMana(new Mana(0, 0, 0, 0, 0, 0, 1, 0));
        return false;
    }
    new AddManaOfAnyColorEffect().apply(game, source);
    mana.setToMana(new Mana(0, 0, 0, 0, 0, 0, 0, 0));
    return true;
}
Also used : AddManaOfAnyColorEffect(mage.abilities.effects.mana.AddManaOfAnyColorEffect) Mana(mage.Mana) ManaEvent(mage.game.events.ManaEvent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 2 with ManaEvent

use of mage.game.events.ManaEvent in project mage by magefree.

the class PulseOfLlanowarReplacementEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    ManaEvent manaEvent = (ManaEvent) event;
    Mana mana = manaEvent.getMana();
    new AddManaOfAnyColorEffect(mana.count()).apply(game, source);
    mana.setToMana(new Mana(0, 0, 0, 0, 0, 0, 0, 0));
    return true;
}
Also used : AddManaOfAnyColorEffect(mage.abilities.effects.mana.AddManaOfAnyColorEffect) Mana(mage.Mana) ManaEvent(mage.game.events.ManaEvent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 3 with ManaEvent

use of mage.game.events.ManaEvent in project mage by magefree.

the class DampingSphereIncreasementAllEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    ManaEvent manaEvent = (ManaEvent) event;
    Mana mana = manaEvent.getMana();
    mana.setToMana(Mana.ColorlessMana(1));
    return false;
}
Also used : Mana(mage.Mana) ManaEvent(mage.game.events.ManaEvent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 4 with ManaEvent

use of mage.game.events.ManaEvent in project mage by magefree.

the class ExtraplanarLensTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    // need only info about permanent
    Permanent landTappedForMana = ((TappedForManaEvent) event).getPermanent();
    Permanent extraplanarLens = game.getPermanent(getSourceId());
    if (extraplanarLens != null && landTappedForMana != null && !extraplanarLens.getImprinted().isEmpty()) {
        Card imprinted = game.getCard(extraplanarLens.getImprinted().get(0));
        if (imprinted != null && game.getState().getZone(imprinted.getId()) == Zone.EXILED) {
            if (landTappedForMana.getName().equals(imprinted.getName()) && landTappedForMana.isLand(game)) {
                ManaEvent mEvent = (ManaEvent) event;
                for (Effect effect : getEffects()) {
                    effect.setValue("mana", mEvent.getMana());
                    effect.setValue("tappedPermanent", landTappedForMana);
                }
                getEffects().get(0).setTargetPointer(new FixedTarget(landTappedForMana.getId()));
                return true;
            }
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) FilterLandPermanent(mage.filter.common.FilterLandPermanent) TargetLandPermanent(mage.target.common.TargetLandPermanent) Permanent(mage.game.permanent.Permanent) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) AddManaOfAnyTypeProducedEffect(mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect) ManaEvent(mage.game.events.ManaEvent) TappedForManaEvent(mage.game.events.TappedForManaEvent) TappedForManaEvent(mage.game.events.TappedForManaEvent) Card(mage.cards.Card)

Example 5 with ManaEvent

use of mage.game.events.ManaEvent in project mage by magefree.

the class PaleMoonReplacementEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    ManaEvent manaEvent = (ManaEvent) event;
    Mana mana = manaEvent.getMana();
    mana.setToMana(Mana.ColorlessMana(mana.count()));
    return false;
}
Also used : Mana(mage.Mana) ManaEvent(mage.game.events.ManaEvent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Aggregations

ManaEvent (mage.game.events.ManaEvent)15 TappedForManaEvent (mage.game.events.TappedForManaEvent)12 Mana (mage.Mana)11 AddManaOfAnyColorEffect (mage.abilities.effects.mana.AddManaOfAnyColorEffect)2 Permanent (mage.game.permanent.Permanent)2 ConditionalMana (mage.ConditionalMana)1 ObjectColor (mage.ObjectColor)1 Cost (mage.abilities.costs.Cost)1 CostsImpl (mage.abilities.costs.CostsImpl)1 OrCost (mage.abilities.costs.OrCost)1 ManaCost (mage.abilities.costs.mana.ManaCost)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)1 AddManaOfAnyTypeProducedEffect (mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect)1 Card (mage.cards.Card)1 FilterMana (mage.filter.FilterMana)1 FilterLandPermanent (mage.filter.common.FilterLandPermanent)1 GameEvent (mage.game.events.GameEvent)1