@Override public void setConcedingPlayer(UUID playerId) { Player player = null; if (state.getChoosingPlayerId() != null) { player = getPlayer(state.getChoosingPlayerId()); } else if (state.getPriorityPlayerId() != null) { player = getPlayer(state.getPriorityPlayerId()); } if (player != null) { if (!player.hasLeft() && player.isHuman()) { if (!concedingPlayers.contains(playerId)) { logger.debug("Game over for player Id: " + playerId + " gameId " + getId()); concedingPlayers.add(playerId); player.signalPlayerConcede(); } } else { // no asynchronous action so check directly concedingPlayers.add(playerId); checkConcede(); } } else { checkConcede(); checkIfGameIsOver(); } }
((GameImpl) game).checkConcede(); if (game.hasEnded()) { return;
/** * 116.5. Each time a player would get priority, the game first performs all * applicable state-based actions as a single event (see rule 704, * “State-Based Actions”), then repeats this process until no state-based * actions are performed. Then triggered abilities are put on the stack (see * rule 603, “Handling Triggered Abilities”). These steps repeat in order * until no further state-based actions are performed and no abilities * trigger. Then the player who would have received priority does so. * * @return */ @Override public boolean checkStateAndTriggered() { boolean somethingHappened = false; //20091005 - 115.5 while (!isPaused() && !checkIfGameIsOver()) { if (!checkStateBasedActions()) { // nothing happened so check triggers state.handleSimultaneousEvent(this); if (isPaused() || checkIfGameIsOver() || getTurn().isEndTurnRequested() || !checkTriggered()) { break; } } state.handleSimultaneousEvent(this); applyEffects(); // needed e.g if boost effects end and cause creatures to die somethingHappened = true; } checkConcede(); return somethingHappened; }
checkConcede(); applyEffects(); state.getPlayers().resetPassed();