From 575d9db1a468d13d57f4be69740272da49a0a163 Mon Sep 17 00:00:00 2001 From: Maxmtg Date: Mon, 12 Sep 2011 18:12:19 +0000 Subject: [PATCH] Door to nothingness (as well as any other spell effect causing a GL) should be displayed correctly in quest battle debriefing --- src/main/java/forge/GameAction.java | 4 ++-- src/main/java/forge/Gui_WinLose.java | 1 + src/main/java/forge/Player.java | 7 +++---- src/main/java/forge/game/GamePlayerRating.java | 8 +++++++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/forge/GameAction.java b/src/main/java/forge/GameAction.java index 77c64187efa..f0fbaa5d35c 100644 --- a/src/main/java/forge/GameAction.java +++ b/src/main/java/forge/GameAction.java @@ -618,8 +618,8 @@ public class GameAction { boolean isGameDone = humanWins || computerWins; if (isGameDone) { - game.getPlayerRating(PlayerIndex.AI).setLossReason(computer.getLossState()); - game.getPlayerRating(PlayerIndex.HUMAN).setLossReason(human.getLossState()); + game.getPlayerRating(PlayerIndex.AI).setLossReason(computer.getLossState(), computer.getLossConditionSource()); + game.getPlayerRating(PlayerIndex.HUMAN).setLossReason(human.getLossState(), computer.getLossConditionSource()); AllZone.getMatchState().addGamePlayed(game); } diff --git a/src/main/java/forge/Gui_WinLose.java b/src/main/java/forge/Gui_WinLose.java index 456ef981080..672910cbf37 100644 --- a/src/main/java/forge/Gui_WinLose.java +++ b/src/main/java/forge/Gui_WinLose.java @@ -264,6 +264,7 @@ public class Gui_WinLose extends JFrame implements NewConstants { switch(whyAiLost) { case Poisoned: winConditionName = "Poison"; break; case Milled: winConditionName = "Milled"; break; + case SpellEffect: winConditionName = aiRating.getLossSpellName(); break; default: break; } } diff --git a/src/main/java/forge/Player.java b/src/main/java/forge/Player.java index 011a92aea63..27923d62ab9 100644 --- a/src/main/java/forge/Player.java +++ b/src/main/java/forge/Player.java @@ -1388,16 +1388,15 @@ public abstract class Player extends GameEntity { * * @return a {@link java.lang.String} object. */ - public GameLossReason getLossState() { - return lossState; - } + public GameLossReason getLossState() { return lossState; } + public String getLossConditionSource() { return loseConditionSpell; } /** *

altWinConditionMet.

* * @param s a {@link java.lang.String} object. */ - public void altWinBySpellEffect( String sourceName ) { + public void altWinBySpellEffect(final String sourceName) { if (cantWin()) { System.out.println("Tried to win, but currently can't."); return; diff --git a/src/main/java/forge/game/GamePlayerRating.java b/src/main/java/forge/game/GamePlayerRating.java index 65bca34d053..29282f944a0 100644 --- a/src/main/java/forge/game/GamePlayerRating.java +++ b/src/main/java/forge/game/GamePlayerRating.java @@ -13,12 +13,18 @@ public class GamePlayerRating { protected int timesMulliganed = 0; protected GameLossReason lossReason = GameLossReason.DidNotLoseYet; + protected String lossSpellName; public final GameLossReason getLossReason() { return lossReason; } - public void setLossReason(GameLossReason loseCondition) { + + public void setLossReason(GameLossReason loseCondition, String spellName) { lossReason = loseCondition; + lossSpellName = spellName; + } + public String getLossSpellName() { + return lossSpellName; } public final int getOpeningHandSize() {