Skip to content

Commit

Permalink
[qa] fix getting blueprints you don't need (already collected all pie…
Browse files Browse the repository at this point in the history
…ce but didn't use)
  • Loading branch information
nroutasuo committed Feb 13, 2020
1 parent 34ff2cd commit 98a91ed
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/game/helpers/PlayerActionResultsHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,12 @@ define([
for (var i = 0; i < levelBlueprints.length; i++) {
var blueprintId = levelBlueprints[i];
if (!upgradesComponent.hasUpgrade(blueprintId) && !upgradesComponent.hasAvailableBlueprint(blueprintId)) {
blueprintsToFind.push(blueprintId);
var blueprintVO = upgradesComponent.getBlueprint(blueprintId);
blueprintPiecesToFind += blueprintVO ? blueprintVO.maxPieces - blueprintVO.currentPieces : UpgradeConstants.getMaxPiecesForBlueprint(blueprintId);
var remainingPieces = blueprintVO ? blueprintVO.maxPieces - blueprintVO.currentPieces : UpgradeConstants.getMaxPiecesForBlueprint(blueprintId);
if (remainingPieces > 0) {
blueprintsToFind.push(blueprintId);
blueprintPiecesToFind += remainingPieces;
}
}
}

Expand All @@ -1055,9 +1058,9 @@ define([
var numScoutedLocales = scoutedLocales.length + 1 - numUnscoutedLocales;
var findBlueprintProbability = blueprintPiecesToFind / numUnscoutedLocales;

log.i("get result blueprint: " + blueprintType + " | pieces to find: " + blueprintPiecesToFind + " / unscouted locales: " + numUnscoutedLocales + " -> " + Math.round(findBlueprintProbability*100)/100 + ", scouted locales: " + numScoutedLocales);
//log.i(levelBlueprints);
//log.i(blueprintsToFind);
log.i("get result blueprint: " + blueprintType + " | pieces to find: " + blueprintPiecesToFind + " / unscouted locales: " + numUnscoutedLocales + " -> prob: " + Math.round(findBlueprintProbability*100)/100 + ", scouted locales: " + numScoutedLocales);
// log.i(levelBlueprints);
// log.i(blueprintsToFind);

var isFirstEver = playerPos.level == 13 && numScoutedLocales == 0;
if (isFirstEver || Math.random() < findBlueprintProbability) {
Expand Down

0 comments on commit 98a91ed

Please sign in to comment.