Search in sources :

Example 16 with TurnMod

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

the class UntapAttackingThisTurnEffect method checkTrigger.

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

Example 17 with TurnMod

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

the class LoseGameDelayedTriggeredAbility method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return true;
    }
    TurnMod extraTurn = new TurnMod(player.getId(), false);
    game.getState().getTurnMods().add(extraTurn);
    if (loseGameAtEnd) {
        game.addDelayedTriggeredAbility(new LoseGameDelayedTriggeredAbility(extraTurn.getId()), source);
    }
    if (turnModApplier != null) {
        turnModApplier.apply(extraTurn.getId(), source, game);
    }
    return true;
}
Also used : Player(mage.players.Player) TurnMod(mage.game.turn.TurnMod)

Example 18 with TurnMod

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

the class ControlTargetPlayerNextTurnEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    UUID targetId = source.getFirstTarget();
    UUID controllerId = source.getControllerId();
    if (targetId != null && controllerId != null && !targetId.equals(controllerId)) {
        game.getState().getTurnMods().add(new TurnMod(targetId, controllerId));
        return true;
    }
    return false;
}
Also used : TurnMod(mage.game.turn.TurnMod) UUID(java.util.UUID)

Example 19 with TurnMod

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

the class GameImpl method playExtraTurns.

private boolean playExtraTurns() {
    // 20091005 - 500.7
    TurnMod extraTurn = getNextExtraTurn();
    while (extraTurn != null) {
        GameEvent event = new GameEvent(GameEvent.EventType.PLAY_TURN, null, null, extraTurn.getPlayerId());
        if (!replaceEvent(event)) {
            Player extraPlayer = this.getPlayer(extraTurn.getPlayerId());
            if (extraPlayer != null && extraPlayer.canRespond()) {
                state.setExtraTurn(true);
                state.setTurnId(extraTurn.getId());
                if (!this.isSimulation()) {
                    informPlayers(extraPlayer.getLogName() + " takes an extra turn");
                }
                if (!playTurn(extraPlayer)) {
                    return false;
                }
            }
        }
        extraTurn = getNextExtraTurn();
    }
    state.setTurnId(null);
    state.setExtraTurn(false);
    return true;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) TurnMod(mage.game.turn.TurnMod)

Example 20 with TurnMod

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

the class FinestHourEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
    if (permanent != null) {
        permanent.untap(game);
        game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
        return true;
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) 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