From 1bc85ce730313aec55ea057597be13dac3791bf0 Mon Sep 17 00:00:00 2001 From: frzyc Date: Wed, 27 Nov 2024 14:36:44 -0500 Subject: [PATCH] more superimposition handling --- .../src/lightCone/sheets/PastSelfInMirror.tsx | 4 ++-- libs/sr/formula-ui/src/lightCone/util.tsx | 11 ++++++++++- libs/sr/formula/src/data/common/index.ts | 3 --- libs/sr/formula/src/data/util/tag.ts | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libs/sr/formula-ui/src/lightCone/sheets/PastSelfInMirror.tsx b/libs/sr/formula-ui/src/lightCone/sheets/PastSelfInMirror.tsx index 4eac36b560..ab060fb23c 100644 --- a/libs/sr/formula-ui/src/lightCone/sheets/PastSelfInMirror.tsx +++ b/libs/sr/formula-ui/src/lightCone/sheets/PastSelfInMirror.tsx @@ -42,7 +42,7 @@ const sheet: UISheetElement = { { title: 'Duration', fieldValue: ( - + {(superimpose) => dm.duration[superimpose]} ), @@ -61,7 +61,7 @@ const sheet: UISheetElement = { { title: 'Energy regen at start of each wave', fieldValue: ( - + {(superimpose) => dm.enerRegn[superimpose]} ), diff --git a/libs/sr/formula-ui/src/lightCone/util.tsx b/libs/sr/formula-ui/src/lightCone/util.tsx index afcd3d2f6c..f41b174f5c 100644 --- a/libs/sr/formula-ui/src/lightCone/util.tsx +++ b/libs/sr/formula-ui/src/lightCone/util.tsx @@ -1,13 +1,22 @@ +import type { LightConeKey } from '@genshin-optimizer/sr/consts' import { own } from '@genshin-optimizer/sr/formula' import { useSrCalcContext } from '@genshin-optimizer/sr/ui' import type { ReactNode } from 'react' export function SuperImposeWrapper({ + lcKey, children, }: { + lcKey: LightConeKey children: (superimpose: number) => ReactNode }) { const calc = useSrCalcContext() - const superimpose = calc?.compute(own.lightCone.superimpose).val ?? 1 + let superimpose = 1 + if (calc) { + const hasLightCone = !!calc.compute(own.common.count.sheet(lcKey)).val + if (hasLightCone) + superimpose = calc.compute(own.lightCone.superimpose).val ?? 1 + } + return children(superimpose) } diff --git a/libs/sr/formula/src/data/common/index.ts b/libs/sr/formula/src/data/common/index.ts index e78aa28fad..f7ab9f32f1 100644 --- a/libs/sr/formula/src/data/common/index.ts +++ b/libs/sr/formula/src/data/common/index.ts @@ -42,8 +42,5 @@ const data: TagMapNodeEntries = [ // Default conditionals to 0 reader.with('qt', 'cond').add(0), - - // Default superimposition to 1 - reader.withTag(own.lightCone.superimpose.tag).add(1), ] export default data diff --git a/libs/sr/formula/src/data/util/tag.ts b/libs/sr/formula/src/data/util/tag.ts index 6729188120..728adc657e 100644 --- a/libs/sr/formula/src/data/util/tag.ts +++ b/libs/sr/formula/src/data/util/tag.ts @@ -114,7 +114,7 @@ export const ownTag = { ...objKeyMap(bonusAbilities, () => isoSum), ...objKeyMap(statBoosts, () => isoSum), }, - lightCone: { lvl: iso, ascension: iso, superimpose: iso }, + lightCone: { lvl: iso, ascension: iso, superimpose: isoSum }, common: { count: isoSum, path: iso,