Search in sources :

Example 1 with TappedForManaEvent

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

the class ChaosMoonEvenReplacementEffect method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    Permanent land = ((TappedForManaEvent) event).getPermanent();
    if (land == null || !land.hasSubtype(SubType.MOUNTAIN, game)) {
        return false;
    }
    this.getEffects().setTargetPointer(new FixedTarget(land.getControllerId()));
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 2 with TappedForManaEvent

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

the class ForsakenMonumentTriggeredManaAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    TappedForManaEvent mEvent = (TappedForManaEvent) event;
    Permanent permanent = mEvent.getPermanent();
    return permanent != null && isControlledBy(event.getPlayerId()) && mEvent.getMana().getColorless() > 0;
}
Also used : Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 3 with TappedForManaEvent

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

the class BubblingMuckTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    Permanent land = ((TappedForManaEvent) event).getPermanent();
    if (land == null || !land.hasSubtype(SubType.SWAMP, game)) {
        return false;
    }
    getEffects().setTargetPointer(new FixedTarget(land.getControllerId()));
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 4 with TappedForManaEvent

use of mage.game.events.TappedForManaEvent 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 TappedForManaEvent

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

the class RealityTwistEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    TappedForManaEvent manaEvent = (TappedForManaEvent) event;
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = manaEvent.getPermanent();
    if (controller == null || permanent == null) {
        return false;
    }
    Choice choice = new ChoiceColor(true);
    choice.getChoices().clear();
    choice.setMessage("Pick a color to produce");
    if (permanent.hasSubtype(SubType.PLAINS, game)) {
        choice.getChoices().add("Red");
    }
    if (permanent.hasSubtype(SubType.SWAMP, game)) {
        choice.getChoices().add("Green");
    }
    if (permanent.hasSubtype(SubType.MOUNTAIN, game)) {
        choice.getChoices().add("White");
    }
    if (permanent.hasSubtype(SubType.FOREST, game)) {
        choice.getChoices().add("Black");
    }
    String chosenColor;
    if (choice.getChoices().size() == 1) {
        chosenColor = choice.getChoices().iterator().next();
    } else {
        controller.choose(Outcome.PutManaInPool, choice, game);
        chosenColor = choice.getChoice();
    }
    if (chosenColor == null) {
        return false;
    }
    Mana mana = manaEvent.getMana();
    int amount = mana.count();
    switch(chosenColor) {
        case "White":
            mana.setToMana(Mana.WhiteMana(amount));
            break;
        case "Black":
            mana.setToMana(Mana.BlackMana(amount));
            break;
        case "Red":
            mana.setToMana(Mana.RedMana(amount));
            break;
        case "Green":
            mana.setToMana(Mana.GreenMana(amount));
            break;
    }
    return false;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) Mana(mage.Mana) Permanent(mage.game.permanent.Permanent) ChoiceColor(mage.choices.ChoiceColor) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Aggregations

TappedForManaEvent (mage.game.events.TappedForManaEvent)16 Permanent (mage.game.permanent.Permanent)15 FixedTarget (mage.target.targetpointer.FixedTarget)10 Mana (mage.Mana)4 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)3 Choice (mage.choices.Choice)2 ChoiceColor (mage.choices.ChoiceColor)2 FilterPermanent (mage.filter.FilterPermanent)2 ManaEvent (mage.game.events.ManaEvent)2 Player (mage.players.Player)2 ObjectColor (mage.ObjectColor)1 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 AddManaOfAnyTypeProducedEffect (mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect)1 Card (mage.cards.Card)1 FilterControlledLandPermanent (mage.filter.common.FilterControlledLandPermanent)1 FilterLandPermanent (mage.filter.common.FilterLandPermanent)1 TargetLandPermanent (mage.target.common.TargetLandPermanent)1