Search in sources :

Example 11 with ManaEvent

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

the class RitualOfSubdualReplacementEffect 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)

Example 12 with ManaEvent

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

the class ManaOptions method checkManaReplacementAndTriggeredMana.

/**
 * Generates triggered mana and checks replacement of Tapped_For_Mana event.
 * Also generates triggered mana for MANA_ADDED event.
 *
 * @param ability
 * @param game
 * @param mana
 * @return false if mana production was completely replaced
 */
private boolean checkManaReplacementAndTriggeredMana(Ability ability, Game game, Mana mana) {
    if (ability.hasTapCost()) {
        ManaEvent event = new TappedForManaEvent(ability.getSourceId(), ability, ability.getControllerId(), mana, game);
        if (game.replaceEvent(event)) {
            return false;
        }
        game.fireEvent(event);
    }
    ManaEvent manaEvent = new ManaEvent(GameEvent.EventType.MANA_ADDED, ability.getSourceId(), ability, ability.getControllerId(), mana);
    manaEvent.setData(mana.toString());
    game.fireEvent(manaEvent);
    return true;
}
Also used : TappedForManaEvent(mage.game.events.TappedForManaEvent) ManaEvent(mage.game.events.ManaEvent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 13 with ManaEvent

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

the class HallOfGemstoneEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    ObjectColor colorChosen = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
    if (colorChosen == null) {
        return false;
    }
    ManaEvent manaEvent = (ManaEvent) event;
    Mana mana = manaEvent.getMana();
    // 8/23/2016 	Colorless mana added to a player's mana pool isn't affected.
    int genericAmount = mana.getGeneric();
    int colorlessAmount = mana.getColorless();
    int coloredAmount = mana.countColored();
    switch(colorChosen.getOneColoredManaSymbol()) {
        case W:
            mana.setToMana(Mana.WhiteMana(coloredAmount));
            break;
        case U:
            mana.setToMana(Mana.BlueMana(coloredAmount));
            break;
        case B:
            mana.setToMana(Mana.BlackMana(coloredAmount));
            break;
        case R:
            mana.setToMana(Mana.RedMana(coloredAmount));
            break;
        case G:
            mana.setToMana(Mana.GreenMana(coloredAmount));
            break;
    }
    mana.setGeneric(genericAmount);
    mana.setColorless(colorlessAmount);
    return false;
}
Also used : Mana(mage.Mana) ObjectColor(mage.ObjectColor) ManaEvent(mage.game.events.ManaEvent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 14 with ManaEvent

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

the class BalduvianFallenAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    this.getEffects().clear();
    if (event.getTargetId().equals(this.getSourceId()) && event instanceof ManaEvent) {
        ManaEvent manaEvent = (ManaEvent) event;
        int total = manaEvent.getMana().getBlack() + manaEvent.getMana().getRed();
        if (total > 0) {
            this.getEffects().add(new BoostSourceEffect(total, 0, Duration.EndOfTurn));
        }
        return true;
    }
    return false;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) ManaEvent(mage.game.events.ManaEvent)

Example 15 with ManaEvent

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

the class ChaosMoonEvenReplacementEffect 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