From ce976bd391a95d087cacd8bb5d3dff978084ec2b Mon Sep 17 00:00:00 2001 From: Agetian Date: Wed, 27 May 2015 16:35:26 +0000 Subject: [PATCH] - When checking state-based effects, check the game over condition early to account for win conditions that trigger before the cards die due to zero toughness (e.g. Platinum Angel + lethal Hurricane that gets both players to zero or below). - To be on the safe side I left the original check intact and I'm running it in case the first check wasn't positive, assuming that the situation may change somehow after all the card-based state effects are checked and relevant effects apply. Is this necessary? - Please test this in various win/lose conditions and let me know if anything is wrong with this approach, I can try to adapt or revert as necessary. --- forge-game/src/main/java/forge/game/GameAction.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/forge-game/src/main/java/forge/game/GameAction.java b/forge-game/src/main/java/forge/game/GameAction.java index 47bc8958fb2..cb9f9ce3375 100644 --- a/forge-game/src/main/java/forge/game/GameAction.java +++ b/forge-game/src/main/java/forge/game/GameAction.java @@ -691,6 +691,9 @@ public class GameAction { game.getStack().setFrozen(true); game.getTracker().freeze(); //prevent views flickering during while updating for state-based effects + // check the game over condition early for win conditions such as Platinum Angel + Hurricane lethal for both players + checkGameOverCondition(); + // do this multiple times, sometimes creatures/permanents will survive when they shouldn't for (int q = 0; q < 9; q++) { checkStaticAbilities(false, affectedCards); @@ -800,7 +803,12 @@ public class GameAction { game.fireEvent(new GameEventCardStatsChanged(affectedCards)); } - checkGameOverCondition(); + // recheck the game over condition at this point to make sure no other win conditions apply now. + // TODO: is this necessary at this point if it's checked early above anyway? + if (!game.isGameOver()) { + checkGameOverCondition(); + } + if (game.getAge() != GameStage.Play) { return; }