From cffc9de1f8ea50579c45635282f9aeab86d14cfe Mon Sep 17 00:00:00 2001 From: RumbleBBU Date: Fri, 16 Nov 2012 08:09:14 +0000 Subject: [PATCH] Display up to 2 + (wins/50) (max 8) options when unlocking sets. --- src/main/java/forge/quest/QuestUtilUnlockSets.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/forge/quest/QuestUtilUnlockSets.java b/src/main/java/forge/quest/QuestUtilUnlockSets.java index 7e4ecc1c0e8..ce9ed4920a0 100644 --- a/src/main/java/forge/quest/QuestUtilUnlockSets.java +++ b/src/main/java/forge/quest/QuestUtilUnlockSets.java @@ -119,8 +119,7 @@ public class QuestUtilUnlockSets { return emptyEditions; } - final int nrChoices = qData.getUnlocksTokens(); - if (nrChoices < 1) { // Should never happen if we made it this far but better safe than sorry... + if (qData.getUnlocksTokens() < 1) { // Should never happen if we made it this far but better safe than sorry... throw new RuntimeException("BUG? Could not find unlockable sets even though we should."); } List options = new ArrayList(); @@ -162,7 +161,13 @@ public class QuestUtilUnlockSets { } Collections.reverse(options); - return Collections.unmodifiableList(options); + final int nrChoices = Math.min(8, 2 + ((qData.getAchievements().getWin()) / 50)); + List choices = new ArrayList(); + + for (int i = 0; i < nrChoices; i++) { + choices.add(options.get(i)); + } + return Collections.unmodifiableList(choices); } /**