Skip to content

Commit

Permalink
- Update another efficiency calculation
Browse files Browse the repository at this point in the history
- Deprecate old calculation
  • Loading branch information
lantua committed Dec 4, 2023
1 parent 4c12af7 commit b0c8975
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
4 changes: 3 additions & 1 deletion apps/frontend/src/app/Data/Artifacts/Artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export default class Artifact {
)
)

//ARTIFACT IN GENERAL
/**
* @deprecate
*/
static getArtifactEfficiency(
artifact: ICachedArtifact,
filter: Set<SubstatKey>
Expand Down
19 changes: 8 additions & 11 deletions libs/gi-util/src/artifact/artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,14 @@ export function getArtifactEfficiency(
filter.size -
matchedSlotCount -
(filter.has(artifact.mainStatKey as any) ? 1 : 0)
let maxEfficiency
if (emptySlotCount && unusedFilterCount)
maxEfficiency =
currentEfficiency + maxSubstatRollEfficiency[rarity] * rollsRemaining
// Rolls into good empty slot
else if (matchedSlotCount)
maxEfficiency =
currentEfficiency +
maxSubstatRollEfficiency[rarity] * (rollsRemaining - emptySlotCount)
// Rolls into existing matched slot
else maxEfficiency = currentEfficiency // No possible roll

let maxEfficiency = currentEfficiency
const maxRollEff = maxSubstatRollEfficiency[rarity]
// Rolls into good empty slots, assuming max-level artifacts have no empty slots
maxEfficiency += maxRollEff * Math.min(emptySlotCount, unusedFilterCount)
// Rolls into an existing good slot
if (matchedSlotCount || (emptySlotCount && unusedFilterCount))
maxEfficiency += maxRollEff * (rollsRemaining - emptySlotCount)

return { currentEfficiency, maxEfficiency }
}

0 comments on commit b0c8975

Please sign in to comment.