Search in sources :

Example 6 with TappedForManaEvent

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

the class ManaWebeffect method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    // it's non mana triggered ability, so ignore it on checking, see TAPPED_FOR_MANA
    if (game.inCheckPlayableState()) {
        return false;
    }
    Permanent permanent = ((TappedForManaEvent) event).getPermanent();
    if (permanent == null || !permanent.isLand(game) || !game.getOpponents(permanent.getControllerId()).contains(getControllerId())) {
        return false;
    }
    this.getEffects().setValue("tappedPermanent", permanent);
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 7 with TappedForManaEvent

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

the class TapForManaAllTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    // it's non mana triggered ability, so ignore it on checking, see TAPPED_FOR_MANA
    if (game.inCheckPlayableState()) {
        return false;
    }
    TappedForManaEvent manaEvent = ((TappedForManaEvent) event);
    Permanent permanent = manaEvent.getPermanent();
    if (permanent == null || !filter.match(permanent, getSourceId(), getControllerId(), game)) {
        return false;
    }
    getEffects().setValue("mana", manaEvent.getMana());
    getEffects().setValue("tappedPermanent", permanent);
    switch(setTargetPointer) {
        case PERMANENT:
            getEffects().setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game)));
            break;
        case PLAYER:
            getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId()));
            break;
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterPermanent(mage.filter.FilterPermanent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 8 with TappedForManaEvent

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

the class VorinclexTriggeredAbility2 method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    // it's non mana triggered ability, so ignore it on checking, see TAPPED_FOR_MANA
    if (game.inCheckPlayableState()) {
        return false;
    }
    if (!game.getOpponents(getControllerId()).contains(event.getPlayerId())) {
        return false;
    }
    Permanent permanent = ((TappedForManaEvent) event).getPermanent();
    if (permanent == null || !permanent.isLand(game)) {
        return false;
    }
    getEffects().setTargetPointer(new FixedTarget(permanent, game));
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterControlledLandPermanent(mage.filter.common.FilterControlledLandPermanent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 9 with TappedForManaEvent

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

the class TapForManaAllTriggeredManaAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    TappedForManaEvent manaEvent = ((TappedForManaEvent) event);
    Permanent permanent = manaEvent.getPermanent();
    if (permanent == null || !filter.match(permanent, getSourceId(), getControllerId(), game)) {
        return false;
    }
    getEffects().setValue("mana", manaEvent.getMana());
    getEffects().setValue("tappedPermanent", permanent);
    switch(setTargetPointer) {
        case PERMANENT:
            getEffects().setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game)));
            break;
        case PLAYER:
            getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId()));
            break;
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterPermanent(mage.filter.FilterPermanent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 10 with TappedForManaEvent

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

the class GauntletOfPowerManaEffect2 method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    TappedForManaEvent mEvent = (TappedForManaEvent) event;
    Permanent permanent = mEvent.getPermanent();
    if (permanent == null || !permanent.isLand() || !permanent.isBasic()) {
        return false;
    }
    ObjectColor color = (ObjectColor) game.getState().getValue(getSourceId() + "_color");
    if (color == null) {
        return false;
    }
    Mana mana = mEvent.getMana();
    if ((!color.isBlack() || mana.getBlack() < 1) && (!color.isBlue() || mana.getBlue() < 1) && (!color.isGreen() || mana.getGreen() < 1) && (!color.isWhite() || mana.getWhite() < 1) && (!color.isRed() || mana.getRed() < 1)) {
        return false;
    }
    getEffects().setValue("mana", mEvent.getMana());
    getEffects().setTargetPointer(new FixedTarget(permanent, game));
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Mana(mage.Mana) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) ObjectColor(mage.ObjectColor) 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