Search in sources :

Example 1 with AtTheEndOfCombatDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility in project mage by magefree.

the class DorotheasRetributionEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Token token = new DorotheasRetributionSpiritToken();
    token.putOntoBattlefield(1, game, source, source.getControllerId(), true, true);
    game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(new SacrificeTargetEffect().setTargetPointer(new FixedTargets(token, game)).setText("sacrifce that token")), source);
    return true;
}
Also used : FixedTargets(mage.target.targetpointer.FixedTargets) DorotheasRetributionSpiritToken(mage.game.permanent.token.DorotheasRetributionSpiritToken) DorotheasRetributionSpiritToken(mage.game.permanent.token.DorotheasRetributionSpiritToken) Token(mage.game.permanent.token.Token) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect)

Example 2 with AtTheEndOfCombatDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility in project mage by magefree.

the class CreateTokenCopyTargetEffect method removeTokensCreatedAtEndOf.

private void removeTokensCreatedAtEndOf(Game game, Ability source, PhaseStep phaseStepToExileCards, boolean exile) {
    Effect effect;
    if (exile) {
        effect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD).setText("exile the token copies");
    } else {
        effect = new SacrificeTargetEffect("sacrifice the token copies");
    }
    effect.setTargetPointer(new FixedTargets(addedTokenPermanents, game));
    DelayedTriggeredAbility exileAbility;
    switch(phaseStepToExileCards) {
        case END_TURN:
            exileAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
            break;
        case END_COMBAT:
            exileAbility = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
            break;
        default:
            return;
    }
    game.addDelayedTriggeredAbility(exileAbility, source);
}
Also used : AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) FixedTargets(mage.target.targetpointer.FixedTargets) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) OneShotEffect(mage.abilities.effects.OneShotEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Effect(mage.abilities.effects.Effect) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)

Example 3 with AtTheEndOfCombatDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility in project mage by magefree.

the class ClockworkCondorEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent p = game.getPermanent(source.getSourceId());
    if (p != null) {
        AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()));
        game.addDelayedTriggeredAbility(ability, source);
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) RemoveCounterSourceEffect(mage.abilities.effects.common.counter.RemoveCounterSourceEffect)

Example 4 with AtTheEndOfCombatDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility in project mage by magefree.

the class ClockworkBeetleEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent != null) {
        Effect effect = new RemoveCounterTargetEffect(CounterType.P1P1.createInstance());
        effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
        game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(effect), source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) RemoveCounterTargetEffect(mage.abilities.effects.common.counter.RemoveCounterTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) AddCountersSourceEffect(mage.abilities.effects.common.counter.AddCountersSourceEffect) Effect(mage.abilities.effects.Effect) RemoveCounterTargetEffect(mage.abilities.effects.common.counter.RemoveCounterTargetEffect) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)

Example 5 with AtTheEndOfCombatDelayedTriggeredAbility

use of mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility in project mage by magefree.

the class ClockworkVorracEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent p = game.getPermanent(source.getSourceId());
    if (p != null) {
        AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()));
        game.addDelayedTriggeredAbility(ability, source);
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) RemoveCounterSourceEffect(mage.abilities.effects.common.counter.RemoveCounterSourceEffect)

Aggregations

AtTheEndOfCombatDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)19 Permanent (mage.game.permanent.Permanent)14 FixedTarget (mage.target.targetpointer.FixedTarget)10 Effect (mage.abilities.effects.Effect)6 OneShotEffect (mage.abilities.effects.OneShotEffect)6 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)6 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)5 Player (mage.players.Player)5 FixedTargets (mage.target.targetpointer.FixedTargets)5 UUID (java.util.UUID)4 TargetPermanent (mage.target.TargetPermanent)4 MageObjectReference (mage.MageObjectReference)3 RemoveCounterSourceEffect (mage.abilities.effects.common.counter.RemoveCounterSourceEffect)3 CreateDelayedTriggeredAbilityEffect (mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect)2 SacrificeTargetEffect (mage.abilities.effects.common.SacrificeTargetEffect)2 AddCountersSourceEffect (mage.abilities.effects.common.counter.AddCountersSourceEffect)2 Card (mage.cards.Card)2 Token (mage.game.permanent.token.Token)2 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)2 ArrayList (java.util.ArrayList)1