Fix logical error that opens all levels instead of locking them.

WaiverAmount should be reducer, not from whom reduces.
This commit is contained in:
BONNe 2019-01-23 19:50:15 +02:00
parent 38fce9a4b0
commit 53da2d67c7

View File

@ -488,10 +488,10 @@ public class ChallengesManager
{ {
// To find how many challenges user still must do in previous level, we must // To find how many challenges user still must do in previous level, we must
// know how many challenges there were and how many has been done. Then // know how many challenges there were and how many has been done. Then
// from waiver amount remove calculated value and you get count. // remove waiver amount to get count of challenges that still necessary to do.
int challengesToDo = previousLevel == null ? 0 : int challengesToDo = previousLevel == null ? 0 :
level.getWaiverAmount() - (previousLevel.getChallenges().size() - doneChallengeCount); (previousLevel.getChallenges().size() - doneChallengeCount - level.getWaiverAmount());
// As level already contains unique ids of challenges, just iterate through them. // As level already contains unique ids of challenges, just iterate through them.
doneChallengeCount = (int) level.getChallenges().stream().filter(playerData::isChallengeDone).count(); doneChallengeCount = (int) level.getChallenges().stream().filter(playerData::isChallengeDone).count();