Skip to content

Commit

Permalink
Fix various issues (frzyc#2493)
Browse files Browse the repository at this point in the history
* Fix Scroll duration

* Fix HMR

* Fix Clorinde duration

* Fix inconsistent spacing

* Fix Sethos multipliers

* Fix Xilonen sheet logic

* Fix error
  • Loading branch information
nguyentvan7 authored and macerator-yaro committed Oct 29, 2024
1 parent 8f8695b commit eb9f26a
Show file tree
Hide file tree
Showing 18 changed files with 173 additions and 114 deletions.
5 changes: 3 additions & 2 deletions libs/gi/localization/assets/locales/en/char_Xilonen.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"sourceCond": "Source Samples are active",
"geoSourceActive": "Geo Source Sample activated",
"sourceCond": "Nighsoul Points hit the maximum",
"sourceActive": "Source Samples activated",
"geoSourceActive": "<geo>Geo</geo> Source Sample activated",
"c4Cond": "Under the Blooming Blessing effect",
"c6Cond": "In the Imperishable Night's Blessing state",
"ns_dmg": "Blade Roller Plunge DMG",
Expand Down
8 changes: 4 additions & 4 deletions libs/gi/page-archive/src/TabWeapon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import { i18n } from '@genshin-optimizer/gi/i18n'
import { getWeaponSheet } from '@genshin-optimizer/gi/sheets'
import { getWeaponStat } from '@genshin-optimizer/gi/stats'
import {
GetCalcDisplay,
SubstatMultiAutocomplete,
WeaponName,
getCalcDisplay,
resolveInfo,
} from '@genshin-optimizer/gi/ui'
import type { CalcResult } from '@genshin-optimizer/gi/uidata'
Expand Down Expand Up @@ -126,8 +126,8 @@ export default function TabWeapon() {
const mainNode = weaponUIData.get(input.weapon.main)
const subNode = weaponUIData.get(input.weapon.sub)
cache.set(wKey, {
main: getCalcDisplay(mainNode).valueString,
sub: getCalcDisplay(subNode).valueString,
main: GetCalcDisplay(mainNode).valueString,
sub: GetCalcDisplay(subNode).valueString,
})
})
return cache
Expand Down Expand Up @@ -367,7 +367,7 @@ function StatDisplay({ node }: { node: CalcResult }) {
<Typography flexGrow={1}>
{icon} {name}
</Typography>
<Typography>{getCalcDisplay(node).valueString}</Typography>
<Typography>{GetCalcDisplay(node).valueString}</Typography>
</Box>
)
}
4 changes: 2 additions & 2 deletions libs/gi/page-team/src/CharacterDisplay/FormulaModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
AmpReactionModeText,
DataContext,
FormulaDataContext,
getCalcDisplay,
GetCalcDisplay,
getDisplayHeader,
getDisplaySections,
resolveInfo,
Expand Down Expand Up @@ -139,7 +139,7 @@ function FormulaAccordian({ node }: { node: CalcResult }) {
}, [scrollRef, node, contextNode])

const { variant, subVariant } = resolveInfo(node.info)
const calcDisplay = getCalcDisplay(node)
const calcDisplay = GetCalcDisplay(node)
return (
<Accordion
sx={{ bgcolor: 'contentNormal.main' }}
Expand Down
6 changes: 3 additions & 3 deletions libs/gi/page-team/src/CharacterDisplay/StatModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { getCharEle, isCharMelee } from '@genshin-optimizer/gi/stats'
import {
DataContext,
FieldDisplayList,
GetCalcDisplay,
NodeFieldDisplay,
StatEditorList,
getCalcDisplay,
resolveInfo,
StatEditorList,
} from '@genshin-optimizer/gi/ui'
import type { ReadNode } from '@genshin-optimizer/gi/wr'
import { allInputPremodKeys, uiInput as input } from '@genshin-optimizer/gi/wr'
Expand Down Expand Up @@ -237,7 +237,7 @@ function MainStatsCards() {
{icon} {name}
</ColorText>
</span>
<span>{getCalcDisplay(specialNode).valueString}</span>
<span>{GetCalcDisplay(specialNode).valueString}</span>
</ListItem>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const sheet: SetEffectSheet = {
})),
{
text: stg('duration'),
value: 10,
value: 15,
unit: 's',
},
],
Expand Down Expand Up @@ -156,7 +156,7 @@ const sheet: SetEffectSheet = {
})),
{
text: stg('duration'),
value: 10,
value: 20,
unit: 's',
},
],
Expand Down
8 changes: 7 additions & 1 deletion libs/gi/sheets/src/Characters/Clorinde/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ const dm = {
thrust3Heal: skillParam_gen.skill[s++][0],
bondHealConvert: skillParam_gen.skill[s++][0],
bladeDmg: skillParam_gen.skill[s++],
bladeInterval: skillParam_gen.skill[s++][0],
duration: skillParam_gen.skill[s++][0],
idk9: skillParam_gen.skill[s++][0],
cd: skillParam_gen.skill[s++][0],
},
burst: {
Expand Down Expand Up @@ -411,10 +411,16 @@ const sheet: TalentSheet = {
name: ct.chg(`skill.skillParams.5`),
}),
},
{
text: ct.chg('skill.skillParams.6'),
value: dm.skill.bladeInterval,
unit: 's',
},
{
text: stg('duration'),
value: dm.skill.duration,
unit: 's',
fixed: 1,
},
{
text: stg('cd'),
Expand Down
10 changes: 5 additions & 5 deletions libs/gi/sheets/src/Characters/Sethos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ const dm = {
skillParam_gen.auto[a++], // 3
],
},
plunging: {
dmg: skillParam_gen.auto[a++],
low: skillParam_gen.auto[a++],
high: skillParam_gen.auto[a++],
},
charged: {
aimed: skillParam_gen.auto[a++],
fullyAimed: skillParam_gen.auto[a++],
shadowAtk: skillParam_gen.auto[a++],
shadowEm: skillParam_gen.auto[a++],
},
plunging: {
dmg: skillParam_gen.auto[a++],
low: skillParam_gen.auto[a++],
high: skillParam_gen.auto[a++],
},
skill: {
dmg: skillParam_gen.skill[s++],
energyRegen: skillParam_gen.skill[s++][0],
Expand Down
95 changes: 67 additions & 28 deletions libs/gi/sheets/src/Characters/Xilonen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
sum,
tally,
target,
threshold,
} from '@genshin-optimizer/gi/wr'
import { cond, st, stg } from '../../SheetUtil'
import { CharacterSheet } from '../CharacterSheet'
Expand Down Expand Up @@ -114,18 +113,13 @@ const [condSourceActivePath, condSourceActive] = cond(key, 'sourceActive')
const [condNsBlessingPath, condNsBlessing] = cond(key, 'nsBlessing')
const buffableEle = ['pyro', 'hydro', 'cryo', 'electro'] as const
const convertedSources = sum(...buffableEle.map((ele) => tally[ele]))
const geoSourcePossible = threshold(
input.constellation,
2,
1,
threshold(convertedSources, 3, equal(condNsBlessing, 'on', 1), 1)
)
const geoSourcePossible = lessThan(convertedSources, 3, 1)
const skill_enemyRes_ = subscript(input.total.skillIndex, dm.skill.enemyRes_, {
unit: '%',
})
const sourceActive_geo_enemyRes_ = equal(
condSourceActive,
'on',
const sourceActive_geo_enemyRes_ = greaterEq(
sum(equal(condSourceActive, 'on', 1), equal(condNsBlessing, 'on', 1)),
1,
equal(geoSourcePossible, 1, skill_enemyRes_)
)
const sourceActive_other_enemyRes_ = objKeyValMap(buffableEle, (ele) => [
Expand Down Expand Up @@ -158,13 +152,21 @@ const c2_sourceActive_geo_all_dmg_ = greaterEq(
equal(
condSourceActive,
'on',
equal(target.charEle, 'geo', dm.constellation2.geo_critDMG_)
equal(
geoSourcePossible,
1,
equal(target.charEle, 'geo', dm.constellation2.geo_critDMG_)
)
)
)
const c2_sourceActive_pyro_atk_disp = greaterEq(
input.constellation,
2,
equal(condSourceActive, 'on', dm.constellation2.pyro_atk_),
greaterEq(
tally.pyro,
1,
equal(condSourceActive, 'on', dm.constellation2.pyro_atk_)
),
{ path: 'atk_', isTeamBuff: true }
)
const c2_sourceActive_pyro_atk_ = equal(
Expand All @@ -175,7 +177,11 @@ const c2_sourceActive_pyro_atk_ = equal(
const c2_sourceActive_hydro_hp_disp = greaterEq(
input.constellation,
2,
equal(condSourceActive, 'on', dm.constellation2.hydro_hp_),
greaterEq(
tally.hydro,
1,
equal(condSourceActive, 'on', dm.constellation2.hydro_hp_)
),
{ path: 'hp_', isTeamBuff: true }
)
const c2_sourceActive_hydro_hp_ = equal(
Expand All @@ -186,7 +192,11 @@ const c2_sourceActive_hydro_hp_ = equal(
const c2_sourceActive_cryo_critDMG_disp = greaterEq(
input.constellation,
2,
equal(condSourceActive, 'on', dm.constellation2.cryo_critDMG_),
greaterEq(
tally.cryo,
1,
equal(condSourceActive, 'on', dm.constellation2.cryo_critDMG_)
),
{ path: 'critDMG_', isTeamBuff: true }
)
const c2_sourceActive_cryo_critDMG_ = equal(
Expand Down Expand Up @@ -367,6 +377,17 @@ const sheet: TalentSheet = {
},
],
},
ct.headerTem('passive1', {
canShow: lessThan(convertedSources, 2, 1),
fields: [
{
node: a1_normal_dmg_,
},
{
node: a1_plunging_dmg_,
},
],
}),
]),

skill: ct.talentTem('skill', [
Expand Down Expand Up @@ -402,14 +423,12 @@ const sheet: TalentSheet = {
on: {
fields: [
{
node: sourceActive_geo_enemyRes_,
text: ct.ch('sourceActive'),
},
...Object.values(sourceActive_other_enemyRes_).map((node) => ({
node,
})),
{
text: stg('duration'),
value: dm.skill.sourceDuration,
unit: 's',
},
],
},
Expand All @@ -419,6 +438,7 @@ const sheet: TalentSheet = {
path: condNsBlessingPath,
value: condNsBlessing,
name: st('nightsoul.blessing'),
canShow: equal(geoSourcePossible, 1, 1),
teamBuff: true,
states: {
on: {
Expand All @@ -430,34 +450,53 @@ const sheet: TalentSheet = {
},
},
}),
ct.headerTem('passive1', {
ct.headerTem('skill', {
teamBuff: true,
fields: [
{
node: a1_normal_dmg_,
},
{
node: a1_plunging_dmg_,
node: sourceActive_geo_enemyRes_,
},
...Object.values(sourceActive_other_enemyRes_).map((node) => ({
node,
})),
],
}),
ct.headerTem('constellation2', {
canShow: equal(condSourceActive, 'on', 1),
teamBuff: true,
// Only show when any Source Sample is active
canShow: greaterEq(
sum(equal(geoSourcePossible, 1, 1), equal(condSourceActive, 'on', 1)),
1,
1
),
fields: [
{
canShow: (data) => data.get(geoSourcePossible).value === 1,
text: ct.ch('geoSourceActive'),
},
{
node: c2_sourceActive_geo_all_dmg_,
node: infoMut(
{ ...c2_sourceActive_geo_all_dmg_ },
{ variant: 'geo' }
),
},
{
node: c2_sourceActive_pyro_atk_disp,
node: infoMut(
{ ...c2_sourceActive_pyro_atk_disp },
{ variant: 'pyro' }
),
},
{
node: c2_sourceActive_hydro_hp_disp,
node: infoMut(
{ ...c2_sourceActive_hydro_hp_disp },
{ variant: 'hydro' }
),
},
{
node: c2_sourceActive_cryo_critDMG_disp,
node: infoMut(
{ ...c2_sourceActive_cryo_critDMG_disp },
{ variant: 'cryo' }
),
},
],
}),
Expand Down
11 changes: 8 additions & 3 deletions libs/gi/ui/src/components/FieldDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import type { ReactNode } from 'react'
import React, { Suspense, useCallback, useContext, useMemo } from 'react'
import { DataContext, FormulaDataContext } from '../context'
import { getCalcDisplay, resolveInfo } from '../util'
import { GetCalcDisplay, resolveInfo } from '../util'
import { AmpReactionModeText } from './AmpReactionModeText'

export function FieldsDisplay({
Expand Down Expand Up @@ -87,7 +87,12 @@ export function BasicFieldDisplay({
return (
<Box
width="100%"
sx={{ display: 'flex', justifyContent: 'space-between', gap: 1 }}
sx={{
display: 'flex',
justifyContent: 'space-between',
gap: 1,
py: 0.25,
}}
component={component}
>
<Typography color={`${variant}.main`}>
Expand Down Expand Up @@ -136,7 +141,7 @@ export function NodeFieldDisplay({
const { unit, fixed, variant, subVariant } = resolveInfo(
(calcRes?.info ?? compareCalcRes?.info)!
)
const calcDisplay = getCalcDisplay((calcRes ?? compareCalcRes)!)
const calcDisplay = GetCalcDisplay((calcRes ?? compareCalcRes)!)

const diff = calcValue - compareCalcValue
const pctDiff =
Expand Down
Loading

0 comments on commit eb9f26a

Please sign in to comment.