Added additional test for #7251;

Added last error info in too many errors game message;
This commit is contained in:
Oleg Agafonov 2020-12-18 16:46:05 +04:00
parent c13d07b73d
commit 53c5abea14
3 changed files with 31 additions and 6 deletions

View file

@ -7,6 +7,8 @@ import mage.game.Game;
import mage.watchers.common.CardsDrawnThisTurnWatcher;
/**
* Don't forget to add CardsDrawnThisTurnWatcher in card's definition
*
* @author TheElk801
*/
public enum CardsDrawnThisTurnDynamicValue implements DynamicValue {

View file

@ -1394,10 +1394,11 @@ public abstract class GameImpl implements Game, Serializable {
this.fireErrorEvent("Game exception occurred: ", ex);
restoreState(bookmark, "Game exception: " + ex.getMessage());
bookmark = 0;
Player activePlayer = this.getPlayer(getActivePlayerId());
if (errorContinueCounter > 15) {
throw new MageException("Iterated player priority after game exception too often, game ends!");
throw new MageException("Iterated player priority after game exception too often, game ends! Last error:\n "
+ ex.getMessage());
}
Player activePlayer = this.getPlayer(getActivePlayerId());
if (activePlayer != null && !activePlayer.isTestMode()) {
errorContinueCounter++;
continue;