From 0c142cb32c2b7f9c455e8946fa4d9292ebf90e7d Mon Sep 17 00:00:00 2001 From: Sol Date: Sat, 16 Feb 2013 20:29:34 +0000 Subject: [PATCH] - Fixing logic error in QuestWinLose that prevent WinGameEffects from awarding alternate win bonus - Fix issue with not actually using the alt win number that's calculated and using the wrong preference value where it is calculated --- .../java/forge/gui/match/QuestWinLose.java | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/main/java/forge/gui/match/QuestWinLose.java b/src/main/java/forge/gui/match/QuestWinLose.java index ccb326428d7..c8621aff35a 100644 --- a/src/main/java/forge/gui/match/QuestWinLose.java +++ b/src/main/java/forge/gui/match/QuestWinLose.java @@ -365,31 +365,32 @@ public class QuestWinLose extends ControlWinLose { final PlayerOutcome outcome = kvRating.getValue().getOutcome(); final GameLossReason whyAiLost = outcome.lossState; - final int altReward = this.getCreditsRewardForAltWin(whyAiLost); + int altReward = this.getCreditsRewardForAltWin(whyAiLost); + + String winConditionName = "Unknown (bug)"; + if (game.getWinCondition() == GameEndReason.WinsGameSpellEffect) { + winConditionName = game.getWinSpellEffect(); + altReward = this.getCreditsRewardForAltWin(null); + } else { + switch (whyAiLost) { + case Poisoned: + winConditionName = "Poison"; + break; + case Milled: + winConditionName = "Milled"; + break; + case SpellEffect: + winConditionName = outcome.loseConditionSpell; + break; + default: + break; + } + } if (altReward > 0) { - String winConditionName = "Unknown (bug)"; - if (game.getWinCondition() == GameEndReason.WinsGameSpellEffect) { - winConditionName = game.getWinSpellEffect(); - } else { - switch (whyAiLost) { - case Poisoned: - winConditionName = "Poison"; - break; - case Milled: - winConditionName = "Milled"; - break; - case SpellEffect: - winConditionName = outcome.loseConditionSpell; - break; - default: - break; - } - } - - credGameplay += 50; + credGameplay += altReward; sb.append(String.format("Alternate win condition: %s! " + "Bonus: %d credits.
", - winConditionName, 50)); + winConditionName, altReward)); } } // Mulligan to zero @@ -756,7 +757,7 @@ public class QuestWinLose extends ControlWinLose { QuestPreferences qp = Singletons.getModel().getQuestPreferences(); if (null == whyAiLost) { // Felidar, Helix Pinnacle, etc. - return qp.getPreferenceInt(QPref.REWARDS_UNDEFEATED); + return qp.getPreferenceInt(QPref.REWARDS_ALTERNATIVE); } switch (whyAiLost) { case LifeReachedZero: @@ -766,7 +767,7 @@ public class QuestWinLose extends ControlWinLose { case Poisoned: return qp.getPreferenceInt(QPref.REWARDS_POISON); case SpellEffect: // Door to Nothingness, etc. - return qp.getPreferenceInt(QPref.REWARDS_UNDEFEATED); + return qp.getPreferenceInt(QPref.REWARDS_ALTERNATIVE); default: return 0; }