Skip to content

Commit

Permalink
Update roll efficiency calculation (#1362)
Browse files Browse the repository at this point in the history
* Update roll efficiency calculation

* - Update another efficiency calculation
- Deprecate old calculation
  • Loading branch information
lantua authored Dec 8, 2023
1 parent 17e3a3d commit ecd37e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
25 changes: 11 additions & 14 deletions 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 All @@ -59,19 +61,14 @@ export default class Artifact {
filter.size -
matchedSlotCount -
(filter.has(artifact.mainStatKey as any) ? 1 : 0)
let maxEfficiency
if (emptySlotCount && unusedFilterCount)
maxEfficiency =
currentEfficiency +
Artifact.maxSubstatRollEfficiency[rarity] * rollsRemaining
// Rolls into good empty slot
else if (matchedSlotCount)
maxEfficiency =
currentEfficiency +
Artifact.maxSubstatRollEfficiency[rarity] *
(rollsRemaining - emptySlotCount)
// Rolls into existing matched slot
else maxEfficiency = currentEfficiency // No possible roll

let maxEfficiency = currentEfficiency
const maxRollEff = Artifact.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 }
}
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 ecd37e1

Please sign in to comment.