From 9be16fb5303c9bc185fb59369e1bc274610c5c99 Mon Sep 17 00:00:00 2001 From: lantua <16190491+lantua@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:09:25 -0400 Subject: [PATCH] Address feedback --- libs/gi/formula/src/calculator.ts | 6 ++---- libs/gi/formula/src/data/common/conds.ts | 6 +----- libs/gi/formula/src/data/common/resonance.ts | 10 ++++++++-- libs/sr/formula/src/calculator.ts | 6 ++---- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/libs/gi/formula/src/calculator.ts b/libs/gi/formula/src/calculator.ts index deef6c19a1..a1321f8e3a 100644 --- a/libs/gi/formula/src/calculator.ts +++ b/libs/gi/formula/src/calculator.ts @@ -12,6 +12,7 @@ const emptyInfo: Info = Object.freeze({ conds: Object.freeze({}) }) const { arithmetic } = calculation type MemRec = Partial> +/// conds[dst][src][sheet][name] type CondInfo = MemRec>>>> export type CalcMeta = PartialMeta & Info @@ -20,10 +21,7 @@ export type PartialMeta = { op: 'const' | 'sum' | 'prod' | 'min' | 'max' | 'sumfrac' | 'res' ops: CalcResult[] } -type Info = { - /// conds[dst][src][sheet][name] - conds: CondInfo -} +type Info = { conds: CondInfo } export class Calculator extends Base { override computeCustom(val: any[], op: string): any { diff --git a/libs/gi/formula/src/data/common/conds.ts b/libs/gi/formula/src/data/common/conds.ts index bc7436cbd3..d27025f71f 100644 --- a/libs/gi/formula/src/data/common/conds.ts +++ b/libs/gi/formula/src/data/common/conds.ts @@ -1,8 +1,4 @@ import { allBoolConditionals } from '../util' export const { enemyFrozen } = allBoolConditionals('static', 'both') -export const { - hasShield, - nearbyDendro1, // Burning, Quicken, Bloom - nearbyDendro2, // Aggravate, Spread, Hyperbloom, Burgeon -} = allBoolConditionals('static', 'dst') +export const { hasShield } = allBoolConditionals('static', 'dst') diff --git a/libs/gi/formula/src/data/common/resonance.ts b/libs/gi/formula/src/data/common/resonance.ts index 70d4a5b03b..12ce47521e 100644 --- a/libs/gi/formula/src/data/common/resonance.ts +++ b/libs/gi/formula/src/data/common/resonance.ts @@ -1,9 +1,15 @@ import { cmpGE } from '@genshin-optimizer/pando/engine' -import { register, team, teamBuff } from '../util' -import { enemyFrozen, hasShield, nearbyDendro1, nearbyDendro2 } from './conds' +import { allBoolConditionals, register, team, teamBuff } from '../util' +import { enemyFrozen, hasShield } from './conds' const count = team.common.count +// CAUTION: the names cannot collide with other 'static' conditionals on other sheets +export const { + nearbyDendro1, // Burning, Quicken, Bloom + nearbyDendro2, // Aggravate, Spread, Hyperbloom, Burgeon +} = allBoolConditionals('static', 'dst') + export default register( 'reso', teamBuff.premod.atk_.add(cmpGE(count.pyro, 2, 0.25)), diff --git a/libs/sr/formula/src/calculator.ts b/libs/sr/formula/src/calculator.ts index b79d74d7fc..4295340b18 100644 --- a/libs/sr/formula/src/calculator.ts +++ b/libs/sr/formula/src/calculator.ts @@ -12,6 +12,7 @@ const emptyInfo: Info = Object.freeze({ conds: Object.freeze({}) }) const { arithmetic } = calculation type MemRec = Partial> +/// conds[dst][src][sheet][name] type CondInfo = MemRec>>>> export type CalcMeta = PartialMeta & Info @@ -20,10 +21,7 @@ export type PartialMeta = { op: 'const' | 'sum' | 'prod' | 'min' | 'max' | 'sumfrac' | 'res' ops: CalcResult[] } -type Info = { - /// conds[dst][src][sheet][name] - conds: CondInfo -} +type Info = { conds: CondInfo } export class Calculator extends Base { override computeMeta(