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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations