Search in sources :

Example 1 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class UntapAttackingThisTurnEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    // we can't add two turn modes at once, will add additional post combat on delayed trigger resolution
    TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT, TurnPhase.POSTCOMBAT_MAIN, false);
    game.getState().getTurnMods().add(combat);
    UntapDelayedTriggeredAbility delayedTriggeredAbility = new UntapDelayedTriggeredAbility();
    delayedTriggeredAbility.setConnectedTurnMod(combat.getId());
    game.addDelayedTriggeredAbility(delayedTriggeredAbility, source);
    return true;
}
Also used : TurnMod(mage.game.turn.TurnMod)

Example 2 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class DelayedAddMainPhaseAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (event.getType() == GameEvent.EventType.PHASE_CHANGED && this.connectedTurnMod.equals(event.getSourceId())) {
        enabled = true;
    }
    if (event.getType() == GameEvent.EventType.COMBAT_PHASE_PRE && enabled) {
        // add additional post combat main phase after that - after phase == null because add it after this combat
        game.getState().getTurnMods().add(new TurnMod(getControllerId(), TurnPhase.POSTCOMBAT_MAIN, null, false));
        enabled = false;
    }
    return false;
}
Also used : TurnMod(mage.game.turn.TurnMod)

Example 3 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class DelayedAddMainPhaseAbility method apply.

@Override
public boolean apply(Game game, Ability source) {
    // 15.07.2006 If it's somehow not a main phase when Fury of the Horde resolves, all it does is untap all creatures that attacked that turn. No new phases are created.
    if (game.getTurn().getPhaseType() == TurnPhase.PRECOMBAT_MAIN || game.getTurn().getPhaseType() == TurnPhase.POSTCOMBAT_MAIN) {
        // we can't add two turn modes at once, will add additional post combat on delayed trigger resolution
        TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT, TurnPhase.POSTCOMBAT_MAIN, false);
        game.getState().getTurnMods().add(combat);
        DelayedAddMainPhaseAbility delayedTriggeredAbility = new DelayedAddMainPhaseAbility();
        delayedTriggeredAbility.setConnectedTurnMod(combat.getId());
        game.addDelayedTriggeredAbility(delayedTriggeredAbility, source);
        return true;
    }
    return false;
}
Also used : TurnMod(mage.game.turn.TurnMod)

Example 4 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class MomirDuel method init.

@Override
protected void init(UUID choosingPlayerId) {
    Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Vanguard effects"));
    for (UUID playerId : state.getPlayerList(startingPlayerId)) {
        Player player = getPlayer(playerId);
        if (player != null) {
            CardInfo cardInfo = CardRepository.instance.findCard("Momir Vig, Simic Visionary");
            addEmblem(new MomirEmblem(), cardInfo.getCard(), playerId);
        }
    }
    getState().addAbility(ability, null);
    super.init(choosingPlayerId);
    state.getTurnMods().add(new TurnMod(startingPlayerId, PhaseStep.DRAW));
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) Player(mage.players.Player) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) CardInfo(mage.cards.repository.CardInfo) TurnMod(mage.game.turn.TurnMod) UUID(java.util.UUID) MomirEmblem(mage.game.command.emblems.MomirEmblem) InfoEffect(mage.abilities.effects.common.InfoEffect)

Example 5 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class CruelEntertainmentEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player1 = game.getPlayer(getTargetPointer().getFirst(game, source));
    Player player2 = null;
    if (getTargetPointer().getTargets(game, source).size() > 1) {
        player2 = game.getPlayer(getTargetPointer().getTargets(game, source).get(1));
    }
    if (player1 != null && player2 != null) {
        game.getState().getTurnMods().add(new TurnMod(player1.getId(), player2.getId()));
        game.getState().getTurnMods().add(new TurnMod(player2.getId(), player1.getId()));
        return true;
    }
    return false;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) TurnMod(mage.game.turn.TurnMod)

Aggregations

TurnMod (mage.game.turn.TurnMod)26 Player (mage.players.Player)13 UUID (java.util.UUID)6 Ability (mage.abilities.Ability)5 Permanent (mage.game.permanent.Permanent)5 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)3 InfoEffect (mage.abilities.effects.common.InfoEffect)3 TargetPlayer (mage.target.TargetPlayer)3 CardInfo (mage.cards.repository.CardInfo)2 MomirEmblem (mage.game.command.emblems.MomirEmblem)2 TargetPermanent (mage.target.TargetPermanent)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Objects (java.util.Objects)1 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)1 Cost (mage.abilities.costs.Cost)1 RemoveAllCountersSourceCost (mage.abilities.costs.common.RemoveAllCountersSourceCost)1 ManaCosts (mage.abilities.costs.mana.ManaCosts)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1