Skip to content

Commit

Permalink
fix: relic scorer improvements (#644)
Browse files Browse the repository at this point in the history
* fix: relicScorer improvements

improve typings
move normalization out of function scope
remove unnecessary runtime arrays

* updated relicScorer caching and scoring

caching is now done by weight profile instead of by character
optimal parts calculation now tries to cache across sphere dmg% mainstats
flat stats now use a global scaling
fixed incorrect ScoringMetadata typing
updated method call in RelicFilterBar

* tests

* fix: enfore consistent speed order

* fix: stupid

* fix tests

* please work this time :cry~1:

* revert flat stat weight changes

* tests

* fix: unwanted padding on button group

* fix: sparkle lc default

---------

Co-authored-by: Fribbels <[email protected]>
  • Loading branch information
FI00ds and fribbels authored Nov 8, 2024
1 parent 0c32c14 commit 9a719e0
Show file tree
Hide file tree
Showing 7 changed files with 254 additions and 185 deletions.
1 change: 0 additions & 1 deletion src/components/CharacterPreview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ export function CharacterPreview(props) {
>
<div
style={{
position: 'relative',
zIndex: 1,
}}
>
Expand Down
6 changes: 3 additions & 3 deletions src/components/RelicFilterBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TooltipImage } from './TooltipImage'
import DB, { DBMetadataCharacter } from 'lib/db'
import { Hint } from 'lib/hint'
import { Utils } from 'lib/utils'
import { Constants, SetsRelics, setToId, Stats, UnreleasedSets } from 'lib/constants'
import { Constants, Sets, SetsRelics, setToId, Stats, UnreleasedSets } from 'lib/constants'
import { Assets } from 'lib/assets'
import { useSubscribe } from 'hooks/useSubscribe'
import { Renderer } from 'lib/renderer'
Expand Down Expand Up @@ -125,7 +125,7 @@ export default function RelicFilterBar(props: {

const gradeData = generateGradeTags([2, 3, 4, 5])
const verifiedData = generateVerifiedTags(['true', 'false'])
const setsData = generateImageTags(Object.values(Constants.SetsRelics).concat(Object.values(Constants.SetsOrnaments)).filter((x) => !UnreleasedSets[x]),
const setsData = generateImageTags(Object.values(Sets).filter((x) => !UnreleasedSets[x]),
(x) => Assets.getSetImage(x, Constants.Parts.PlanarSphere), true)
const partsData = generateImageTags(Object.values(Constants.Parts), (x) => Assets.getPart(x), false)
const mainStatsData = generateImageTags(Constants.MainStats, (x) => Assets.getStatIcon(x, true), true)
Expand Down Expand Up @@ -172,7 +172,7 @@ export default function RelicFilterBar(props: {
// NOTE: we cannot cache these results between renders by keying on the relic/characterId because
// both relic stats and char weights can be edited
for (const relic of relics) {
const weights: Partial<RelicScoringWeights> = characterId ? relicScorer.scoreFutureRelic(relic, characterId) : { current: 0, best: 0, average: 0 }
const weights: Partial<RelicScoringWeights> = characterId ? relicScorer.getFutureRelicScore(relic, characterId) : { current: 0, best: 0, average: 0 }
weights.potentialSelected = characterId ? relicScorer.scoreRelicPotential(relic, characterId) : { bestPct: 0, averagePct: 0 }
weights.potentialAllAll = { bestPct: 0, averagePct: 0 }
weights.potentialAllCustom = { bestPct: 0, averagePct: 0 }
Expand Down
2 changes: 1 addition & 1 deletion src/lib/conditionals/lightcone/5star/EarthlyEscapade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi
}

const teammateDefaults = {
maskActive: false,
maskActive: true,
}

const content: ContentDefinition<typeof defaults> = {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export const PartsToReadable = {
[Parts.Feet]: 'Feet',
[Parts.PlanarSphere]: 'Sphere',
[Parts.LinkRope]: 'Rope',
}
} as const
export type PartsToReadable = typeof PartsToReadable[keyof typeof PartsToReadable]

export const PartsMainStats = {
Expand Down Expand Up @@ -417,7 +417,7 @@ export const SetsRelics = {
TheWindSoaringValorous: 'The Wind-Soaring Valorous',
SacerdosRelivedOrdeal: "Sacerdos' Relived Ordeal",
ScholarLostInErudition: 'Scholar Lost in Erudition',
}
} as const

export const SetsOrnaments = {
SpaceSealingStation: 'Space Sealing Station',
Expand All @@ -438,7 +438,7 @@ export const SetsOrnaments = {
ForgeOfTheKalpagniLantern: 'Forge of the Kalpagni Lantern',
LushakaTheSunkenSeas: 'Lushaka, the Sunken Seas',
TheWondrousBananAmusementPark: 'The Wondrous BananAmusement Park',
}
} as const

// Delete unreleased data
export const officialOnly = false
Expand Down
Loading

0 comments on commit 9a719e0

Please sign in to comment.