- 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
This commit is contained in:
Sol
2013-02-16 20:29:34 +00:00
parent 095feac987
commit 0c142cb32c

View File

@@ -365,12 +365,12 @@ public class QuestWinLose extends ControlWinLose {
final PlayerOutcome outcome = kvRating.getValue().getOutcome(); final PlayerOutcome outcome = kvRating.getValue().getOutcome();
final GameLossReason whyAiLost = outcome.lossState; final GameLossReason whyAiLost = outcome.lossState;
final int altReward = this.getCreditsRewardForAltWin(whyAiLost); int altReward = this.getCreditsRewardForAltWin(whyAiLost);
if (altReward > 0) {
String winConditionName = "Unknown (bug)"; String winConditionName = "Unknown (bug)";
if (game.getWinCondition() == GameEndReason.WinsGameSpellEffect) { if (game.getWinCondition() == GameEndReason.WinsGameSpellEffect) {
winConditionName = game.getWinSpellEffect(); winConditionName = game.getWinSpellEffect();
altReward = this.getCreditsRewardForAltWin(null);
} else { } else {
switch (whyAiLost) { switch (whyAiLost) {
case Poisoned: case Poisoned:
@@ -387,9 +387,10 @@ public class QuestWinLose extends ControlWinLose {
} }
} }
credGameplay += 50; if (altReward > 0) {
credGameplay += altReward;
sb.append(String.format("Alternate win condition: <u>%s</u>! " + "Bonus: %d credits.<br>", sb.append(String.format("Alternate win condition: <u>%s</u>! " + "Bonus: %d credits.<br>",
winConditionName, 50)); winConditionName, altReward));
} }
} }
// Mulligan to zero // Mulligan to zero
@@ -756,7 +757,7 @@ public class QuestWinLose extends ControlWinLose {
QuestPreferences qp = Singletons.getModel().getQuestPreferences(); QuestPreferences qp = Singletons.getModel().getQuestPreferences();
if (null == whyAiLost) { if (null == whyAiLost) {
// Felidar, Helix Pinnacle, etc. // Felidar, Helix Pinnacle, etc.
return qp.getPreferenceInt(QPref.REWARDS_UNDEFEATED); return qp.getPreferenceInt(QPref.REWARDS_ALTERNATIVE);
} }
switch (whyAiLost) { switch (whyAiLost) {
case LifeReachedZero: case LifeReachedZero:
@@ -766,7 +767,7 @@ public class QuestWinLose extends ControlWinLose {
case Poisoned: case Poisoned:
return qp.getPreferenceInt(QPref.REWARDS_POISON); return qp.getPreferenceInt(QPref.REWARDS_POISON);
case SpellEffect: // Door to Nothingness, etc. case SpellEffect: // Door to Nothingness, etc.
return qp.getPreferenceInt(QPref.REWARDS_UNDEFEATED); return qp.getPreferenceInt(QPref.REWARDS_ALTERNATIVE);
default: default:
return 0; return 0;
} }