From 9c8cd8fb1ce4c624510341a85b23780f8ea6393d Mon Sep 17 00:00:00 2001 From: Fribbels Date: Sat, 9 Nov 2024 14:41:23 -0800 Subject: [PATCH 01/16] refactor: directory cleanup --- src/App.tsx | 6 +- src/components/BuildsModal.tsx | 20 +-- src/components/ChangelogTab.tsx | 10 +- src/components/CharacterModal.tsx | 6 +- src/components/CharacterPreview.jsx | 20 +-- src/components/CharacterTab.jsx | 77 +++++++---- src/components/EditImageModal.tsx | 14 +- src/components/GettingStartedTab.tsx | 12 +- src/components/LanguageSelector.tsx | 4 +- src/components/LayoutHeader.tsx | 4 +- src/components/MenuDrawer.tsx | 2 +- src/components/OptimizerBuildPreview.tsx | 10 +- src/components/RelicFilterBar.tsx | 12 +- src/components/RelicModal.tsx | 23 ++-- src/components/RelicPreview.tsx | 14 +- src/components/RelicScorerTab.jsx | 12 +- src/components/RelicsTab.jsx | 22 +-- src/components/ScoringModal.tsx | 6 +- src/components/SettingsDrawer.tsx | 2 +- src/components/SwitchRelicsModal.tsx | 4 +- src/components/Tabs.tsx | 6 +- src/components/TooltipImage.tsx | 6 +- .../CharacterScoringSummary.tsx | 10 +- src/components/characterPreview/Rarity.tsx | 2 +- src/components/characterPreview/StatRow.tsx | 6 +- src/components/homeTab/HomeTab.tsx | 6 +- .../importerTab/ClearDataSubmenu.tsx | 4 +- src/components/importerTab/ImportTab.tsx | 10 +- .../importerTab/LoadDataSubmenu.tsx | 10 +- .../importerTab/ScannerImportSubmenu.tsx | 6 +- src/components/metadataTab/MetadataTab.tsx | 130 ++++++++---------- src/components/optimizerTab/OptimizerForm.tsx | 8 +- src/components/optimizerTab/OptimizerGrid.jsx | 8 +- .../OptimizerSuggestionsModal.tsx | 6 +- src/components/optimizerTab/Sidebar.tsx | 35 +++-- .../CharacterConditionalDisplay.tsx | 10 +- .../LightConeConditionalDisplay.tsx | 4 +- .../CardSelectModalComponents.tsx | 4 +- .../optimizerForm/CharacterSelect.tsx | 8 +- .../CharacterSelectorDisplay.tsx | 4 +- .../optimizerForm/ComboFilter.tsx | 2 +- .../EnemyConfigurationsDrawer.tsx | 4 +- .../optimizerForm/FormSetConditionals.jsx | 50 +++++-- .../optimizerForm/FormStatRollSlider.tsx | 2 +- .../optimizerForm/LightConeSelect.tsx | 10 +- .../optimizerForm/OptimizerOptionsDisplay.tsx | 8 +- .../OptimizerTabCharacterPanel.tsx | 2 +- .../optimizerForm/OrnamentSetTagRenderer.tsx | 2 +- .../optimizerForm/OrnamentsOptions.tsx | 4 +- .../RecommendedPresetsButton.tsx | 20 +-- .../optimizerForm/RelicMainSetFilters.tsx | 18 +-- .../optimizerForm/RelicSetTagRenderer.tsx | 4 +- .../optimizerForm/ResultFilters.tsx | 2 +- .../optimizerForm/SetsOptions.tsx | 8 +- .../optimizerForm/SimulatedBuildsGrid.tsx | 8 +- .../optimizerForm/StatSimulationDisplay.tsx | 34 +++-- .../optimizerForm/SubstatWeightFilters.tsx | 4 +- .../optimizerForm/TeammateCard.tsx | 16 +-- .../optimizerTab/optimizerTabConstants.ts | 4 +- .../optimizerTab/rotation/ComboDrawer.tsx | 10 +- src/components/relicPreview/GenerateStat.tsx | 12 +- src/components/webgpuTab/WebgpuTab.tsx | 2 +- src/index.tsx | 48 +++---- src/lib/{ => characters}/characterScorer.ts | 20 ++- src/lib/{ => characters}/characterStats.ts | 0 .../oldCharacterScoringMetadata.ts | 0 .../characterConditionals.ts | 0 .../lightConeConditionals.ts | 0 .../optimizerTabController.ts | 18 +-- .../statSimulationController.tsx | 16 +-- src/lib/gpu/injection/injectConditionals.ts | 24 ++-- src/lib/gpu/tests/webgpuTestGenerator.ts | 6 +- src/lib/gpu/webgpuDevice.ts | 4 +- src/lib/gpu/webgpuInternals.ts | 2 +- src/lib/gpu/webgpuOptimizer.ts | 6 +- src/lib/gpu/webgpuTypes.d.ts | 2 +- src/lib/i18n.ts | 2 +- src/lib/{ => importer}/characterConverter.ts | 4 +- src/lib/importer/hoyoLabFormatParser.tsx | 4 +- src/lib/importer/kelzFormatParser.tsx | 18 +-- .../arrowKeyGridNavigation.ts | 0 src/lib/{ => interactions}/hint.tsx | 0 src/lib/{ => interactions}/message.ts | 0 src/lib/{ => interactions}/notifications.tsx | 28 ++-- src/lib/{ => optimizer}/bufferPacker.ts | 2 +- src/lib/optimizer/calculateBuild.ts | 2 +- src/lib/optimizer/calculateConditionals.ts | 13 +- src/lib/optimizer/context/calculateContext.ts | 16 +-- src/lib/{ => optimizer}/defaultForm.ts | 2 +- .../{ => optimizer}/fixedSizePriorityQueue.ts | 0 src/lib/optimizer/optimizer.ts | 14 +- src/lib/optimizer/optimizerUtils.ts | 2 +- .../rotation/comboDrawerController.tsx | 18 +-- .../optimizer/rotation/comboStateTransform.ts | 6 +- src/lib/{ => relics}/relicAugmenter.ts | 4 +- src/lib/{ => relics}/relicFilters.ts | 8 +- src/lib/{ => relics}/relicModalController.ts | 12 +- src/lib/{ => relics}/relicRollFixer.ts | 8 +- src/lib/{ => relics}/relicRollGrader.test.ts | 6 +- src/lib/{ => relics}/relicRollGrader.ts | 2 +- src/lib/{ => relics}/relicScorer.test.ts | 12 +- src/lib/{ => relics}/relicScorerPotential.ts | 4 +- src/lib/{ => relics}/statCalculator.ts | 2 +- src/lib/{ => relics}/substatRollTable.ts | 0 src/lib/{ => rendering}/assets.ts | 2 +- src/lib/{ => rendering}/displayUtils.tsx | 2 +- src/lib/{ => rendering}/gradient.ts | 8 +- src/lib/{ => rendering}/renderer.tsx | 4 +- src/lib/{ => rendering}/scrollController.ts | 0 src/lib/{ => rendering}/theme.ts | 0 src/lib/{ => state}/dataParser.ts | 4 +- src/lib/{ => state}/db.ts | 16 +-- src/lib/{ => state}/saveState.ts | 2 +- src/lib/utils.js | 9 +- src/lib/worker/optimizerWorker.ts | 6 +- src/lib/{ => worker}/workerPool.ts | 2 +- src/types/Form.d.ts | 2 +- src/types/LightCone.d.ts | 2 +- src/types/Relic.d.ts | 2 +- src/types/store.ts | 4 +- src/window.d.ts | 42 +++--- 121 files changed, 650 insertions(+), 581 deletions(-) rename src/lib/{ => characters}/characterScorer.ts (98%) rename src/lib/{ => characters}/characterStats.ts (100%) rename src/lib/{ => characters}/oldCharacterScoringMetadata.ts (100%) rename src/lib/{ => conditionals}/characterConditionals.ts (100%) rename src/lib/{ => conditionals}/lightConeConditionals.ts (100%) rename src/lib/{ => controllers}/optimizerTabController.ts (98%) rename src/lib/{ => controllers}/statSimulationController.tsx (97%) rename src/lib/{ => importer}/characterConverter.ts (98%) rename src/lib/{ => interactions}/arrowKeyGridNavigation.ts (100%) rename src/lib/{ => interactions}/hint.tsx (100%) rename src/lib/{ => interactions}/message.ts (100%) rename src/lib/{ => interactions}/notifications.tsx (85%) rename src/lib/{ => optimizer}/bufferPacker.ts (98%) rename src/lib/{ => optimizer}/defaultForm.ts (99%) rename src/lib/{ => optimizer}/fixedSizePriorityQueue.ts (100%) rename src/lib/{ => relics}/relicAugmenter.ts (95%) rename src/lib/{ => relics}/relicFilters.ts (99%) rename src/lib/{ => relics}/relicModalController.ts (96%) rename src/lib/{ => relics}/relicRollFixer.ts (99%) rename src/lib/{ => relics}/relicRollGrader.test.ts (95%) rename src/lib/{ => relics}/relicRollGrader.ts (98%) rename src/lib/{ => relics}/relicScorer.test.ts (97%) rename src/lib/{ => relics}/relicScorerPotential.ts (99%) rename src/lib/{ => relics}/statCalculator.ts (98%) rename src/lib/{ => relics}/substatRollTable.ts (100%) rename src/lib/{ => rendering}/assets.ts (99%) rename src/lib/{ => rendering}/displayUtils.tsx (97%) rename src/lib/{ => rendering}/gradient.ts (95%) rename src/lib/{ => rendering}/renderer.tsx (98%) rename src/lib/{ => rendering}/scrollController.ts (100%) rename src/lib/{ => rendering}/theme.ts (100%) rename src/lib/{ => state}/dataParser.ts (99%) rename src/lib/{ => state}/db.ts (98%) rename src/lib/{ => state}/saveState.ts (98%) rename src/lib/{ => worker}/workerPool.ts (98%) diff --git a/src/App.tsx b/src/App.tsx index bd733e9aa..746f7f90b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,9 +3,9 @@ import { LayoutHeader } from 'components/LayoutHeader' import { LayoutSider } from 'components/LayoutSider' import { SettingsDrawer } from 'components/SettingsDrawer' import Tabs from 'components/Tabs' -import DB from 'lib/db' -import { Gradient } from 'lib/gradient' -import { checkForUpdatesNotification } from 'lib/notifications' +import { checkForUpdatesNotification } from 'lib/interactions/notifications' +import { Gradient } from 'lib/rendering/gradient' +import DB from 'lib/state/db' import React, { useEffect } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/BuildsModal.tsx b/src/components/BuildsModal.tsx index 6ee54ebbc..243f15156 100644 --- a/src/components/BuildsModal.tsx +++ b/src/components/BuildsModal.tsx @@ -1,16 +1,16 @@ -import * as React from 'react' -import { useEffect, useMemo } from 'react' -import { Button, Card, Flex, Modal } from 'antd' -import StatText from './characterPreview/StatText' -import { HeaderText } from 'components/HeaderText' import { DeleteOutlined, ExclamationCircleOutlined } from '@ant-design/icons' -import DB from 'lib/db' -import { SaveState } from 'lib/saveState' -import { Message } from 'lib/message' -import { Character, SavedBuild } from 'types/Character' +import { Button, Card, Flex, Modal } from 'antd' import { CharacterPreview } from 'components/CharacterPreview' -import { RelicScorer } from 'lib/relicScorerPotential' +import { HeaderText } from 'components/HeaderText' +import { Message } from 'lib/interactions/message' +import { RelicScorer } from 'lib/relics/relicScorerPotential' +import DB from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' +import * as React from 'react' +import { useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' +import { Character, SavedBuild } from 'types/Character' +import StatText from './characterPreview/StatText' interface BuildsModalProps { open: boolean diff --git a/src/components/ChangelogTab.tsx b/src/components/ChangelogTab.tsx index 20ffbcf68..0c88f7ef3 100644 --- a/src/components/ChangelogTab.tsx +++ b/src/components/ChangelogTab.tsx @@ -1,9 +1,9 @@ -import React, { ReactElement, useMemo } from 'react' import { Flex, List, theme, Typography } from 'antd' -import { AppPages } from 'lib/db' -import { Assets } from 'lib/assets' -import { ColorizedLinkWithIcon } from './common/ColorizedLink' import { officialOnly } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' +import { AppPages } from 'lib/state/db' +import React, { ReactElement, useMemo } from 'react' +import { ColorizedLinkWithIcon } from './common/ColorizedLink' const { useToken } = theme const { Text } = Typography @@ -127,7 +127,7 @@ function getChangelogContent() { `Balance: DPS score overvalued ATK boots in certain situations with large amount of speed buffs, mostly affects ATK boots Kafka S1 builds`, `Balance: Jiaoqiu is now recommended ATK / ERR rope by default`, `Balance: Ruan Mei can now use all mains stats for feet`, - `Balance: Shadowed by Night light cone now has SPD buff enabled by default` + `Balance: Shadowed by Night light cone now has SPD buff enabled by default`, ], }, { diff --git a/src/components/CharacterModal.tsx b/src/components/CharacterModal.tsx index 588d55ae5..b46b8b80e 100644 --- a/src/components/CharacterModal.tsx +++ b/src/components/CharacterModal.tsx @@ -1,9 +1,9 @@ -import React, { useEffect, useState } from 'react' import { Button, Flex, Form as AntDForm, Modal, Radio } from 'antd' import { HeaderText } from 'components/HeaderText' -import LightConeSelect from 'components/optimizerTab/optimizerForm/LightConeSelect' import CharacterSelect from 'components/optimizerTab/optimizerForm/CharacterSelect' -import DB from 'lib/db' +import LightConeSelect from 'components/optimizerTab/optimizerForm/LightConeSelect' +import DB from 'lib/state/db' +import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Character } from 'types/Character' import { Form } from 'types/Form' diff --git a/src/components/CharacterPreview.jsx b/src/components/CharacterPreview.jsx index ca1d79c09..e751b944d 100644 --- a/src/components/CharacterPreview.jsx +++ b/src/components/CharacterPreview.jsx @@ -14,8 +14,7 @@ import { HeaderText } from 'components/HeaderText' import { LoadingBlurredImage } from 'components/LoadingBlurredImage' import RelicModal from 'components/RelicModal.tsx' import { RelicPreview } from 'components/RelicPreview' -import { Assets } from 'lib/assets' -import { getSimScoreGrade, scoreCharacterSimulation } from 'lib/characterScorer' +import { getSimScoreGrade, scoreCharacterSimulation } from 'lib/characters/characterScorer' import { CHARACTER_SCORE, COMBAT_STATS, @@ -39,15 +38,16 @@ import { parentH, parentW, } from 'lib/constantsUi' -import { AppPages, DB } from 'lib/db' -import { Message } from 'lib/message' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { Message } from 'lib/interactions/message' import { calculateBuild } from 'lib/optimizer/calculateBuild' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { RelicFilters } from 'lib/relicFilters' -import { RelicModalController } from 'lib/relicModalController' -import { RelicScorer } from 'lib/relicScorerPotential' -import { SaveState } from 'lib/saveState' -import { StatCalculator } from 'lib/statCalculator' +import { RelicFilters } from 'lib/relics/relicFilters' +import { RelicModalController } from 'lib/relics/relicModalController' +import { RelicScorer } from 'lib/relics/relicScorerPotential' +import { StatCalculator } from 'lib/relics/statCalculator' +import { Assets } from 'lib/rendering/assets' +import { AppPages, DB } from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { Utils } from 'lib/utils' import PropTypes from 'prop-types' import React, { useEffect, useRef, useState } from 'react' diff --git a/src/components/CharacterTab.jsx b/src/components/CharacterTab.jsx index 6dc4602ba..73ce42c4a 100644 --- a/src/components/CharacterTab.jsx +++ b/src/components/CharacterTab.jsx @@ -1,29 +1,39 @@ -import React, { useCallback, useMemo, useRef, useState } from 'react' - -import { Button, Dropdown, Flex, Image, Input, Modal, theme, Typography } from 'antd' +import { + CameraOutlined, + DownloadOutlined, + DownOutlined, + ExclamationCircleOutlined, + UserOutlined, +} from '@ant-design/icons' import { AgGridReact } from 'ag-grid-react' import 'ag-grid-community/styles/ag-grid.css' import 'ag-grid-community/styles/ag-theme-balham.css' -import DB, { AppPages } from 'lib/db' -import { RelicScorer } from 'lib/relicScorerPotential' -import { CharacterPreview } from './CharacterPreview' -import { Assets } from 'lib/assets' -import { SaveState } from 'lib/saveState' -import { Message } from 'lib/message' -import PropTypes from 'prop-types' -import { useSubscribe } from 'hooks/useSubscribe' -import { CameraOutlined, DownloadOutlined, DownOutlined, ExclamationCircleOutlined, UserOutlined } from '@ant-design/icons' + +import { Button, Dropdown, Flex, Image, Input, Modal, theme, Typography } from 'antd' import CharacterModal from 'components/CharacterModal' -import { Utils } from 'lib/utils' +import { + generateElementTags, + generatePathTags, + SegmentedFilterRow, +} from 'components/optimizerTab/optimizerForm/CardSelectModalComponents.tsx' import NameBuild from 'components/SaveBuildModal' -import BuildsModal from './BuildsModal' -import { arrowKeyGridNavigation } from 'lib/arrowKeyGridNavigation' -import { OptimizerTabController } from 'lib/optimizerTabController' import SwitchRelicsModal from 'components/SwitchRelicsModal' -import { getGridTheme } from 'lib/theme' -import { generateElementTags, generatePathTags, SegmentedFilterRow } from 'components/optimizerTab/optimizerForm/CardSelectModalComponents.tsx' +import { useSubscribe } from 'hooks/useSubscribe' import i18next from 'i18next' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { arrowKeyGridNavigation } from 'lib/interactions/arrowKeyGridNavigation' +import { Message } from 'lib/interactions/message' +import { RelicScorer } from 'lib/relics/relicScorerPotential' +import { Assets } from 'lib/rendering/assets' +import { getGridTheme } from 'lib/rendering/theme' +import DB, { AppPages } from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' +import { Utils } from 'lib/utils' +import PropTypes from 'prop-types' +import React, { useCallback, useMemo, useRef, useState } from 'react' import { Trans, useTranslation } from 'react-i18next' +import BuildsModal from './BuildsModal' +import { CharacterPreview } from './CharacterPreview' const { useToken } = theme const { Text } = Typography @@ -64,17 +74,18 @@ function cellNameRenderer(params) { return ( - {characterName} @@ -216,7 +227,13 @@ export default function CharacterTab() { const columnDefs = useMemo(() => [ { field: '', headerName: t('GridHeaders.Icon')/* Icon */, cellRenderer: cellImageRenderer, width: 52 }, - { field: '', headerName: t('GridHeaders.Priority')/* Priority */, cellRenderer: cellRankRenderer, width: 50, rowDrag: true }, + { + field: '', + headerName: t('GridHeaders.Priority')/* Priority */, + cellRenderer: cellRankRenderer, + width: 50, + rowDrag: true, + }, { field: '', headerName: t('GridHeaders.Character')/* Character */, flex: 1, cellRenderer: cellNameRenderer }, ], [t]) diff --git a/src/components/EditImageModal.tsx b/src/components/EditImageModal.tsx index 8a8294f24..8cdd9b230 100644 --- a/src/components/EditImageModal.tsx +++ b/src/components/EditImageModal.tsx @@ -1,13 +1,13 @@ -import * as React from 'react' -import { Button, Flex, Form, Input, Modal, Radio, RadioChangeEvent, Slider, Spin, Steps, Typography } from 'antd' -import Cropper from 'react-easy-crop' -import { CroppedArea, CustomImageConfig, CustomImageParams, CustomImagePayload, ImageDimensions } from 'types/CustomImage' import { DragOutlined, InboxOutlined, ZoomInOutlined } from '@ant-design/icons' -import Dragger from 'antd/es/upload/Dragger' -import { Message } from 'lib/message' +import { Button, Flex, Form, Input, Modal, Radio, RadioChangeEvent, Slider, Spin, Steps, Typography } from 'antd' import { RcFile } from 'antd/es/upload' -import { useTranslation } from 'react-i18next' +import Dragger from 'antd/es/upload/Dragger' import i18next from 'i18next' +import { Message } from 'lib/interactions/message' +import * as React from 'react' +import Cropper from 'react-easy-crop' +import { useTranslation } from 'react-i18next' +import { CroppedArea, CustomImageConfig, CustomImageParams, CustomImagePayload, ImageDimensions } from 'types/CustomImage' const { Text } = Typography diff --git a/src/components/GettingStartedTab.tsx b/src/components/GettingStartedTab.tsx index 040617012..5d53fd1e8 100644 --- a/src/components/GettingStartedTab.tsx +++ b/src/components/GettingStartedTab.tsx @@ -1,14 +1,14 @@ +import { ImportOutlined } from '@ant-design/icons' import { Button, Flex, Popconfirm, Typography } from 'antd' -import { Message } from 'lib/message' - -import sampleSave from '../data/sample-save.json' -import DB from 'lib/db' import { ColorizedLinkWithIcon } from 'components/common/ColorizedLink' +import { Message } from 'lib/interactions/message' +import DB from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { useTranslation } from 'react-i18next' -import { SaveState } from 'lib/saveState' -import { ImportOutlined } from '@ant-design/icons' import { HsrOptimizerSaveFormat } from 'types/store' +import sampleSave from '../data/sample-save.json' + const { Text } = Typography export default function GettingStartedTab() { diff --git a/src/components/LanguageSelector.tsx b/src/components/LanguageSelector.tsx index 08b954ca8..e717782f2 100644 --- a/src/components/LanguageSelector.tsx +++ b/src/components/LanguageSelector.tsx @@ -1,8 +1,8 @@ import { Button, Flex, Select } from 'antd' -import { useTranslation } from 'react-i18next' import { languages } from 'lib/i18n' +import { Assets } from 'lib/rendering/assets' import React, { ReactElement } from 'react' -import { Assets } from 'lib/assets' +import { useTranslation } from 'react-i18next' type placementOptions = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight' diff --git a/src/components/LayoutHeader.tsx b/src/components/LayoutHeader.tsx index 814cc78fb..7ce93134c 100644 --- a/src/components/LayoutHeader.tsx +++ b/src/components/LayoutHeader.tsx @@ -1,8 +1,8 @@ import { CloseOutlined, MenuOutlined } from '@ant-design/icons' import { Button, Flex, Layout, theme, Typography } from 'antd' import { LanguageSelector } from 'components/LanguageSelector' -import { Assets } from 'lib/assets' -import { BASE_PATH } from 'lib/db' +import { Assets } from 'lib/rendering/assets' +import { BASE_PATH } from 'lib/state/db' const { useToken } = theme const { Header } = Layout diff --git a/src/components/MenuDrawer.tsx b/src/components/MenuDrawer.tsx index f6c36d48c..ed61ce9dd 100644 --- a/src/components/MenuDrawer.tsx +++ b/src/components/MenuDrawer.tsx @@ -18,7 +18,7 @@ import { CoffeeIcon } from 'icons/CoffeeIcon' import { DiscordIcon } from 'icons/DiscordIcon' import { GithubIcon } from 'icons/GithubIcon' import { officialOnly } from 'lib/constants' -import { AppPages } from 'lib/db' +import { AppPages } from 'lib/state/db' import React, { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { ReactElement } from 'types/Components' diff --git a/src/components/OptimizerBuildPreview.tsx b/src/components/OptimizerBuildPreview.tsx index ecbb0f04a..e8812f8d0 100644 --- a/src/components/OptimizerBuildPreview.tsx +++ b/src/components/OptimizerBuildPreview.tsx @@ -1,12 +1,12 @@ -import React, { useState } from 'react' import { Flex } from 'antd' import RelicModal from 'components/RelicModal' import { RelicPreview } from 'components/RelicPreview' -import DB from 'lib/db' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { RelicScorer } from 'lib/relicScorerPotential' -import { RelicModalController } from 'lib/relicModalController' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { RelicModalController } from 'lib/relics/relicModalController' +import { RelicScorer } from 'lib/relics/relicScorerPotential' +import DB from 'lib/state/db' +import React, { useState } from 'react' import { Relic } from 'types/Relic' export default function OptimizerBuildPreview() { diff --git a/src/components/RelicFilterBar.tsx b/src/components/RelicFilterBar.tsx index 76071076b..a62252553 100644 --- a/src/components/RelicFilterBar.tsx +++ b/src/components/RelicFilterBar.tsx @@ -5,13 +5,13 @@ import { HeaderText } from 'components/HeaderText' import CharacterSelect from 'components/optimizerTab/optimizerForm/CharacterSelect' import { SettingOptions } from 'components/SettingsDrawer' import { useSubscribe } from 'hooks/useSubscribe' -import { Assets } from 'lib/assets' import { Constants, Sets, SetsRelics, setToId, Stats, UnreleasedSets } from 'lib/constants' -import DB, { DBMetadataCharacter } from 'lib/db' -import { Hint } from 'lib/hint' -import { RelicScorer } from 'lib/relicScorerPotential' -import { Renderer } from 'lib/renderer' -import { SaveState } from 'lib/saveState' +import { Hint } from 'lib/interactions/hint' +import { RelicScorer } from 'lib/relics/relicScorerPotential' +import { Assets } from 'lib/rendering/assets' +import { Renderer } from 'lib/rendering/renderer' +import DB, { DBMetadataCharacter } from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { TsUtils } from 'lib/TsUtils' import { Utils } from 'lib/utils' import React, { useEffect, useMemo, useState } from 'react' diff --git a/src/components/RelicModal.tsx b/src/components/RelicModal.tsx index a7ef78c12..104f1143e 100644 --- a/src/components/RelicModal.tsx +++ b/src/components/RelicModal.tsx @@ -3,11 +3,11 @@ import { Button, Flex, Form, Image, Input, InputNumber, Modal, Radio, Select, th import { FormInstance } from 'antd/es/form/hooks/useForm' import { HeaderText } from 'components/HeaderText' import i18next from 'i18next' -import { Assets } from 'lib/assets' import { Constants, setToId, Stats, UnreleasedSets } from 'lib/constants' -import { generateCharacterList } from 'lib/displayUtils' -import { Message } from 'lib/message' -import { calculateUpgradeValues, RelicForm, RelicUpgradeValues, validateRelic } from 'lib/relicModalController' +import { Message } from 'lib/interactions/message' +import { calculateUpgradeValues, RelicForm, RelicUpgradeValues, validateRelic } from 'lib/relics/relicModalController' +import { Assets } from 'lib/rendering/assets' +import { generateCharacterList } from 'lib/rendering/displayUtils' import { TsUtils } from 'lib/TsUtils' import { Utils } from 'lib/utils' import PropTypes from 'prop-types' @@ -386,13 +386,14 @@ export default function RelicModal(props: { /> -
( { diff --git a/src/components/homeTab/HomeTab.tsx b/src/components/homeTab/HomeTab.tsx index fe2621d5c..1d9d027fe 100644 --- a/src/components/homeTab/HomeTab.tsx +++ b/src/components/homeTab/HomeTab.tsx @@ -2,9 +2,9 @@ import { ExportOutlined, SearchOutlined } from '@ant-design/icons' import { RightOutlined } from '@ant-design/icons/lib/icons' import { Button, Card, Collapse, Divider, Flex, Input } from 'antd' import { ColorizedLinkWithIcon } from 'components/common/ColorizedLink' -import { Assets } from 'lib/assets' -import { AppPages } from 'lib/db.js' -import { Message } from 'lib/message' +import { Message } from 'lib/interactions/message' +import { Assets } from 'lib/rendering/assets' +import { AppPages } from 'lib/state/db.js' import { TsUtils } from 'lib/TsUtils' import React from 'react' diff --git a/src/components/importerTab/ClearDataSubmenu.tsx b/src/components/importerTab/ClearDataSubmenu.tsx index 3e3db5b36..23e1c7361 100644 --- a/src/components/importerTab/ClearDataSubmenu.tsx +++ b/src/components/importerTab/ClearDataSubmenu.tsx @@ -1,7 +1,7 @@ import { DeleteOutlined } from '@ant-design/icons' import { Button, Flex, Popconfirm, Typography } from 'antd' -import DB from 'lib/db' -import { Message } from 'lib/message' +import { Message } from 'lib/interactions/message' +import DB from 'lib/state/db' import { useState } from 'react' import { useTranslation } from 'react-i18next' import { importerTabButtonWidth, importerTabSpinnerMs } from './importerTabUiConstants' diff --git a/src/components/importerTab/ImportTab.tsx b/src/components/importerTab/ImportTab.tsx index eaa5def27..ac86879cc 100644 --- a/src/components/importerTab/ImportTab.tsx +++ b/src/components/importerTab/ImportTab.tsx @@ -1,13 +1,13 @@ -import React from 'react' import { DownloadOutlined } from '@ant-design/icons' import { Button, Flex, Tabs, Typography } from 'antd' -import { Message } from 'lib/message' -import { SaveState } from 'lib/saveState' -import { ClearDataSubmenu } from './ClearDataSubmenu' import { LoadDataSubmenu } from 'components/importerTab/LoadDataSubmenu' import { ScannerImportSubmenu } from 'components/importerTab/ScannerImportSubmenu' -import { useTranslation } from 'react-i18next' +import { Message } from 'lib/interactions/message' +import { SaveState } from 'lib/state/saveState' import { TsUtils } from 'lib/TsUtils' +import React from 'react' +import { useTranslation } from 'react-i18next' +import { ClearDataSubmenu } from './ClearDataSubmenu' const { Text } = Typography diff --git a/src/components/importerTab/LoadDataSubmenu.tsx b/src/components/importerTab/LoadDataSubmenu.tsx index e7cdda0c7..2f1cc5d7d 100644 --- a/src/components/importerTab/LoadDataSubmenu.tsx +++ b/src/components/importerTab/LoadDataSubmenu.tsx @@ -1,10 +1,10 @@ -import { useState } from 'react' -import { Button, Flex, Steps, Typography, Upload } from 'antd' import { ImportOutlined, UploadOutlined } from '@ant-design/icons' -import { importerTabButtonWidth, importerTabSpinnerMs } from './importerTabUiConstants' -import DB from 'lib/db' +import { Button, Flex, Steps, Typography, Upload } from 'antd' +import DB from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' +import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { SaveState } from 'lib/saveState' +import { importerTabButtonWidth, importerTabSpinnerMs } from './importerTabUiConstants' const { Text } = Typography diff --git a/src/components/importerTab/ScannerImportSubmenu.tsx b/src/components/importerTab/ScannerImportSubmenu.tsx index a89a72b30..93cc56def 100644 --- a/src/components/importerTab/ScannerImportSubmenu.tsx +++ b/src/components/importerTab/ScannerImportSubmenu.tsx @@ -3,11 +3,11 @@ import { Button, Divider, Flex, Input, Popconfirm, Steps, Typography, Upload } f import { ColorizedLinkWithIcon } from 'components/common/ColorizedLink' import { importerTabButtonWidth, importerTabSpinnerMs } from 'components/importerTab/importerTabUiConstants' import { ReliquaryDescription } from 'components/importerTab/ReliquaryDescription' -import DB, { AppPages } from 'lib/db' import { hoyolabParser } from 'lib/importer/hoyoLabFormatParser' import { KelzScannerConfig, ScannerSourceToParser, ValidScannerSources } from 'lib/importer/importConfig' -import { Message } from 'lib/message' -import { SaveState } from 'lib/saveState' +import { Message } from 'lib/interactions/message' +import DB, { AppPages } from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { useState } from 'react' import { useTranslation } from 'react-i18next' import { Relic } from 'types/Relic' diff --git a/src/components/metadataTab/MetadataTab.tsx b/src/components/metadataTab/MetadataTab.tsx index b1226877f..67f11d129 100644 --- a/src/components/metadataTab/MetadataTab.tsx +++ b/src/components/metadataTab/MetadataTab.tsx @@ -1,11 +1,11 @@ -import React, { useState } from 'react' -import { AppPages, DB } from 'lib/db' -import { Assets } from 'lib/assets' -import { StringToNumberMap } from 'types/Common' -import { ReactElement } from 'types/Components' import { Collapse, Flex } from 'antd' import gameData from 'data/game_data.json' import { Sets, Stats } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' +import { AppPages, DB } from 'lib/state/db' +import React, { useState } from 'react' +import { StringToNumberMap } from 'types/Common' +import { ReactElement } from 'types/Components' // Fake type for metadata type MetadataObject = { @@ -26,7 +26,6 @@ type MetadataObject = { const setToIndex: StringToNumberMap = {} const iconSize = 40 - export default function MetadataTab(): React.JSX.Element { const activeKey = window.store((s) => s.activeKey) @@ -63,10 +62,8 @@ export default function MetadataTab(): React.JSX.Element { ) } - // =========================================== SubstatWeightDashboard =========================================== - function SubstatWeightDashboard() { // @ts-ignore const sets: MetadataObject[] = gameData.relics.slice().reverse() @@ -78,13 +75,13 @@ function SubstatWeightDashboard() { return ( - x.path == 'Destruction'), sets)}/> - x.path == 'Hunt'), sets)}/> - x.path == 'Erudition'), sets)}/> - x.path == 'Nihility'), sets)}/> - x.path == 'Preservation'), sets)}/> - x.path == 'Harmony'), sets)}/> - x.path == 'Abundance'), sets)}/> + x.path == 'Destruction'), sets)}/> + x.path == 'Hunt'), sets)}/> + x.path == 'Erudition'), sets)}/> + x.path == 'Nihility'), sets)}/> + x.path == 'Preservation'), sets)}/> + x.path == 'Harmony'), sets)}/> + x.path == 'Abundance'), sets)}/> ) } @@ -114,7 +111,7 @@ function generateSubstatWeightGrid(characters: MetadataObject[], sets: MetadataO Stats.Imaginary_DMG, ] - const substatAssets = weightedStats.map(x => Assets.getStatIcon(x)) + const substatAssets = weightedStats.map((x) => Assets.getStatIcon(x)) substatAssets.unshift(Assets.getBlank()) const assetByCharacterThenStat: ReactElement[][] = [[]] @@ -137,10 +134,8 @@ function generateSubstatWeightGrid(characters: MetadataObject[], sets: MetadataO return assetByCharacterThenStat } - // =========================================== ConditionalSetsPresetsDashboard =========================================== - const presetToSetMapping = { fnAshblazingSet: Sets.TheAshblazingGrandDuke, fnPioneerSet: Sets.PioneerDiverOfDeadWaters, @@ -162,19 +157,19 @@ function ConditionalSetsPresetsDashboard() { return ( - x.path == 'Destruction'), sets)}/> - x.path == 'Hunt'), sets)}/> - x.path == 'Erudition'), sets)}/> - x.path == 'Nihility'), sets)}/> - x.path == 'Preservation'), sets)}/> - x.path == 'Harmony'), sets)}/> - x.path == 'Abundance'), sets)}/> + x.path == 'Destruction'), sets)}/> + x.path == 'Hunt'), sets)}/> + x.path == 'Erudition'), sets)}/> + x.path == 'Nihility'), sets)}/> + x.path == 'Preservation'), sets)}/> + x.path == 'Harmony'), sets)}/> + x.path == 'Abundance'), sets)}/> ) } function generateConditionalSetsGrid(characters: MetadataObject[], sets: MetadataObject[]) { - const relicAssets = sets.map(x => Assets.getSetImage(x.name)) + const relicAssets = sets.map((x) => Assets.getSetImage(x.name)) relicAssets.unshift(Assets.getBlank()) const assetByCharacterThenSet: ReactElement[][] = [[]] @@ -200,16 +195,13 @@ function generateConditionalSetsGrid(characters: MetadataObject[], sets: Metadat return assetByCharacterThenSet } - // =========================================== SimulationEquivalentSetsDashboard =========================================== - function SimulationEquivalentSetsDashboard() { // @ts-ignore const sets: MetadataObject[] = gameData.relics.slice().reverse() const characters: MetadataObject[] = Object.values(DB.getMetadata().characters) - const simulationCharacters: MetadataObject[] = characters.filter(x => x.scoringMetadata.simulation) - + const simulationCharacters: MetadataObject[] = characters.filter((x) => x.scoringMetadata.simulation) for (let i = 0; i < sets.length; i++) { setToIndex[sets[i].name] = i @@ -217,19 +209,19 @@ function SimulationEquivalentSetsDashboard() { return ( - x.path == 'Destruction'), sets)}/> - x.path == 'Hunt'), sets)}/> - x.path == 'Erudition'), sets)}/> - x.path == 'Nihility'), sets)}/> - x.path == 'Preservation'), sets)}/> - x.path == 'Harmony'), sets)}/> - x.path == 'Abundance'), sets)}/> + x.path == 'Destruction'), sets)}/> + x.path == 'Hunt'), sets)}/> + x.path == 'Erudition'), sets)}/> + x.path == 'Nihility'), sets)}/> + x.path == 'Preservation'), sets)}/> + x.path == 'Harmony'), sets)}/> + x.path == 'Abundance'), sets)}/> ) } function generateEquivalentSetsGrid(characters: MetadataObject[], sets: MetadataObject[]) { - const relicAssets = sets.map(x => Assets.getSetImage(x.name)) + const relicAssets = sets.map((x) => Assets.getSetImage(x.name)) relicAssets.unshift(Assets.getBlank()) const assetByCharacterThenSet: ReactElement[][] = [[]] @@ -267,10 +259,8 @@ function generateEquivalentSetsGrid(characters: MetadataObject[], sets: Metadata return assetByCharacterThenSet } - // =========================================== Utils =========================================== - function Icon(props: { src: string }): ReactElement { return ( @@ -278,7 +268,7 @@ function Icon(props: { src: string }): ReactElement { } function GridDisplay(props: { grid: ReactElement[][] }) { - const [hoveredColumn, setHoveredColumn] = useState(null); + const [hoveredColumn, setHoveredColumn] = useState(null) for (const row of props.grid) { for (let i = 0; i < Object.values(setToIndex).length + 1; i++) { @@ -292,34 +282,34 @@ function GridDisplay(props: { grid: ReactElement[][] }) { return ( - {props.grid.map((row, rowIndex) => ( - (e.currentTarget.style.backgroundColor = 'rgba(255,255,255,0.11)')} - onMouseLeave={(e) => (e.currentTarget.style.backgroundColor = '')} - > - {row.map((cell, colIndex) => ( - - ))} - - ))} + {props.grid.map((row, rowIndex) => ( + (e.currentTarget.style.backgroundColor = 'rgba(255,255,255,0.11)')} + onMouseLeave={(e) => (e.currentTarget.style.backgroundColor = '')} + > + {row.map((cell, colIndex) => ( + + ))} + + ))}
setHoveredColumn(colIndex)} - onMouseLeave={() => setHoveredColumn(null)} - > -
- {cell || ''} -
-
setHoveredColumn(colIndex)} + onMouseLeave={() => setHoveredColumn(null)} + > +
+ {cell || ''} +
+
- ); -} \ No newline at end of file + ) +} diff --git a/src/components/optimizerTab/OptimizerForm.tsx b/src/components/optimizerTab/OptimizerForm.tsx index adca2ea3c..adab913ef 100644 --- a/src/components/optimizerTab/OptimizerForm.tsx +++ b/src/components/optimizerTab/OptimizerForm.tsx @@ -17,13 +17,13 @@ import { MinMaxRatingFilters, MinMaxStatFilters } from 'components/optimizerTab/ import { StatSimulationDisplay } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' import { SubstatWeightFilters } from 'components/optimizerTab/optimizerForm/SubstatWeightFilters' import TeammateCard from 'components/optimizerTab/optimizerForm/TeammateCard' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { SavedSessionKeys } from 'lib/constantsSession' -import DB from 'lib/db' -import { LightConeConditionals } from 'lib/lightConeConditionals' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { Optimizer } from 'lib/optimizer/optimizer' import { updateConditionalChange } from 'lib/optimizer/rotation/comboDrawerController' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { SaveState } from 'lib/saveState' +import DB from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { Utils } from 'lib/utils' import React, { useEffect } from 'react' import { Form } from 'types/Form' diff --git a/src/components/optimizerTab/OptimizerGrid.jsx b/src/components/optimizerTab/OptimizerGrid.jsx index d2b4cde34..bf208ad3b 100644 --- a/src/components/optimizerTab/OptimizerGrid.jsx +++ b/src/components/optimizerTab/OptimizerGrid.jsx @@ -6,10 +6,10 @@ import { getCombatColumnDefs, gridOptions, } from 'components/optimizerTab/optimizerTabConstants' -import { arrowKeyGridNavigation } from 'lib/arrowKeyGridNavigation' -import DB from 'lib/db' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { getGridTheme } from 'lib/theme' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { arrowKeyGridNavigation } from 'lib/interactions/arrowKeyGridNavigation' +import { getGridTheme } from 'lib/rendering/theme' +import DB from 'lib/state/db' import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/OptimizerSuggestionsModal.tsx b/src/components/optimizerTab/OptimizerSuggestionsModal.tsx index fda8d40bb..d4e74d9f4 100644 --- a/src/components/optimizerTab/OptimizerSuggestionsModal.tsx +++ b/src/components/optimizerTab/OptimizerSuggestionsModal.tsx @@ -2,10 +2,10 @@ import { Button, Flex, Modal, Typography } from 'antd' import { HorizontalDivider } from 'components/Dividers' import { TFunction } from 'i18next' import { Parts } from 'lib/constants' -import DB, { AppPages } from 'lib/db' -import { Message } from 'lib/message' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { Message } from 'lib/interactions/message' import { Optimizer } from 'lib/optimizer/optimizer' -import { OptimizerTabController } from 'lib/optimizerTabController' +import DB, { AppPages } from 'lib/state/db' import { Utils } from 'lib/utils' import { ReactElement } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/Sidebar.tsx b/src/components/optimizerTab/Sidebar.tsx index 784a2a225..d13f49156 100644 --- a/src/components/optimizerTab/Sidebar.tsx +++ b/src/components/optimizerTab/Sidebar.tsx @@ -1,21 +1,21 @@ +import { DownOutlined, ThunderboltFilled } from '@ant-design/icons' import { Button, Divider, Dropdown, Flex, Grid, Modal, Popconfirm, Progress, Radio, theme, Typography } from 'antd' -import React, { useState } from 'react' import { HeaderText } from 'components/HeaderText' -import { TooltipImage } from '../TooltipImage' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { Hint } from 'lib/hint' -import { DownOutlined, ThunderboltFilled } from '@ant-design/icons' -import { Optimizer } from 'lib/optimizer/optimizer' import { defaultPadding } from 'components/optimizerTab/optimizerTabConstants' import { SettingOptions } from 'components/SettingsDrawer' -import DB from 'lib/db' -import { Utils } from 'lib/utils' -import { SavedSessionKeys } from 'lib/constantsSession' +import i18next from 'i18next' import { COMPUTE_ENGINE_CPU, COMPUTE_ENGINE_GPU_EXPERIMENTAL, COMPUTE_ENGINE_GPU_STABLE, ComputeEngine } from 'lib/constants' +import { SavedSessionKeys } from 'lib/constantsSession' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { verifyWebgpuSupport } from 'lib/gpu/webgpuDevice' +import { Hint } from 'lib/interactions/hint' +import { Message } from 'lib/interactions/message' +import { Optimizer } from 'lib/optimizer/optimizer' +import DB from 'lib/state/db' +import { Utils } from 'lib/utils' +import React, { useState } from 'react' import { useTranslation } from 'react-i18next' -import i18next from 'i18next' -import { Message } from 'lib/message' +import { TooltipImage } from '../TooltipImage' const { useToken } = theme const { useBreakpoint } = Grid @@ -169,7 +169,12 @@ function filterClicked() { OptimizerTabController.applyRowFilters() } -function calculateProgressText(startTime: number | null, optimizerEndTime: number | null, permutations: number, permutationsSearched: number, optimizationInProgress: boolean, optimizerRunningEngine: ComputeEngine) { +function calculateProgressText(startTime: number | null, + optimizerEndTime: number | null, + permutations: number, + permutationsSearched: number, + optimizationInProgress: boolean, + optimizerRunningEngine: ComputeEngine) { if (!startTime) { return i18next.t('optimizerTab:Sidebar.ProgressText.Progress') // Progress } @@ -407,7 +412,11 @@ function OptimizerControlsGroup(props: { isFullSize: boolean }) { } return ( - + {t('ControlsGroup.Header')/* Controls */} diff --git a/src/components/optimizerTab/conditionals/CharacterConditionalDisplay.tsx b/src/components/optimizerTab/conditionals/CharacterConditionalDisplay.tsx index f6be40489..96af9b71f 100644 --- a/src/components/optimizerTab/conditionals/CharacterConditionalDisplay.tsx +++ b/src/components/optimizerTab/conditionals/CharacterConditionalDisplay.tsx @@ -1,13 +1,13 @@ import { Flex } from 'antd' -import { memo } from 'react' import { HeaderText } from 'components/HeaderText' -import { TooltipImage } from 'components/TooltipImage' -import { Hint } from 'lib/hint' import DisplayFormControl from 'components/optimizerTab/conditionals/DisplayFormControl' -import { characterOptionMapping } from 'lib/characterConditionals' +import { TooltipImage } from 'components/TooltipImage' +import { characterOptionMapping } from 'lib/conditionals/characterConditionals' +import { Hint } from 'lib/interactions/hint' +import { memo } from 'react' +import { useTranslation } from 'react-i18next' import { Eidolon } from 'types/Character' import { DataMineId } from 'types/Common' -import { useTranslation } from 'react-i18next' export interface CharacterConditionalDisplayProps { id?: DataMineId diff --git a/src/components/optimizerTab/conditionals/LightConeConditionalDisplay.tsx b/src/components/optimizerTab/conditionals/LightConeConditionalDisplay.tsx index 470d29d7b..ff253ab0d 100644 --- a/src/components/optimizerTab/conditionals/LightConeConditionalDisplay.tsx +++ b/src/components/optimizerTab/conditionals/LightConeConditionalDisplay.tsx @@ -2,8 +2,8 @@ import { Flex, Typography } from 'antd' import { HeaderText } from 'components/HeaderText' import DisplayFormControl from 'components/optimizerTab/conditionals/DisplayFormControl' import { TooltipImage } from 'components/TooltipImage' -import { Hint } from 'lib/hint' -import { lightConeOptionMapping } from 'lib/lightConeConditionals' +import { lightConeOptionMapping } from 'lib/conditionals/lightConeConditionals' +import { Hint } from 'lib/interactions/hint' import { memo } from 'react' import { useTranslation } from 'react-i18next' import { SuperImpositionLevel } from 'types/LightCone' diff --git a/src/components/optimizerTab/optimizerForm/CardSelectModalComponents.tsx b/src/components/optimizerTab/optimizerForm/CardSelectModalComponents.tsx index ae27ac9bb..ef528fc5f 100644 --- a/src/components/optimizerTab/optimizerForm/CardSelectModalComponents.tsx +++ b/src/components/optimizerTab/optimizerForm/CardSelectModalComponents.tsx @@ -1,8 +1,8 @@ import { Flex, theme, Typography } from 'antd' -import { Utils } from 'lib/utils' -import { Assets } from 'lib/assets' import CheckableTag from 'antd/lib/tag/CheckableTag' import { ElementToDamage, PathNames } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' +import { Utils } from 'lib/utils' import { ReactElement } from 'react' const { useToken } = theme diff --git a/src/components/optimizerTab/optimizerForm/CharacterSelect.tsx b/src/components/optimizerTab/optimizerForm/CharacterSelect.tsx index c4b27c1ef..acb0e38bf 100644 --- a/src/components/optimizerTab/optimizerForm/CharacterSelect.tsx +++ b/src/components/optimizerTab/optimizerForm/CharacterSelect.tsx @@ -1,9 +1,9 @@ -import * as React from 'react' -import { useEffect, useMemo, useRef, useState } from 'react' import { Button, Card, Flex, Input, InputRef, Modal, Select } from 'antd' -import { Utils } from 'lib/utils' -import { Assets } from 'lib/assets' import { CardGridItemContent, generateElementTags, generatePathTags, SegmentedFilterRow } from 'components/optimizerTab/optimizerForm/CardSelectModalComponents' +import { Assets } from 'lib/rendering/assets' +import { Utils } from 'lib/utils' +import * as React from 'react' +import { useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' interface CharacterSelectProps { diff --git a/src/components/optimizerTab/optimizerForm/CharacterSelectorDisplay.tsx b/src/components/optimizerTab/optimizerForm/CharacterSelectorDisplay.tsx index ae50fdd1b..fb9774eab 100644 --- a/src/components/optimizerTab/optimizerForm/CharacterSelectorDisplay.tsx +++ b/src/components/optimizerTab/optimizerForm/CharacterSelectorDisplay.tsx @@ -5,9 +5,9 @@ import LightConeSelect from 'components/optimizerTab/optimizerForm/LightConeSele import RecommendedPresetsButton from 'components/optimizerTab/optimizerForm/RecommendedPresetsButton' import { optimizerTabDefaultGap, panelWidth } from 'components/optimizerTab/optimizerTabConstants' import { TooltipImage } from 'components/TooltipImage' -import { Hint } from 'lib/hint' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { Hint } from 'lib/interactions/hint' import { SortOption } from 'lib/optimizer/sortOptions' -import { OptimizerTabController } from 'lib/optimizerTabController' import { Utils } from 'lib/utils' import { useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/ComboFilter.tsx b/src/components/optimizerTab/optimizerForm/ComboFilter.tsx index 84cb5ff8a..f8125d870 100644 --- a/src/components/optimizerTab/optimizerForm/ComboFilter.tsx +++ b/src/components/optimizerTab/optimizerForm/ComboFilter.tsx @@ -5,7 +5,7 @@ import { HeaderText } from 'components/HeaderText' import InputNumberStyled from 'components/optimizerTab/optimizerForm/InputNumberStyled' import { optimizerTabDefaultGap } from 'components/optimizerTab/optimizerTabConstants' import { ComboDrawer } from 'components/optimizerTab/rotation/ComboDrawer' -import DB from 'lib/db' +import DB from 'lib/state/db' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/EnemyConfigurationsDrawer.tsx b/src/components/optimizerTab/optimizerForm/EnemyConfigurationsDrawer.tsx index ba902657a..b70b0fb8b 100644 --- a/src/components/optimizerTab/optimizerForm/EnemyConfigurationsDrawer.tsx +++ b/src/components/optimizerTab/optimizerForm/EnemyConfigurationsDrawer.tsx @@ -1,9 +1,9 @@ +import { CheckOutlined, CloseOutlined } from '@ant-design/icons' import { Drawer, Flex, Form, Select, Switch, Typography } from 'antd' import { HeaderText } from 'components/HeaderText' import { TooltipImage } from 'components/TooltipImage' -import { Hint } from 'lib/hint' +import { Hint } from 'lib/interactions/hint' import { Utils } from 'lib/utils' -import { CheckOutlined, CloseOutlined } from '@ant-design/icons' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/FormSetConditionals.jsx b/src/components/optimizerTab/optimizerForm/FormSetConditionals.jsx index 0540aa8cb..a00f9f211 100644 --- a/src/components/optimizerTab/optimizerForm/FormSetConditionals.jsx +++ b/src/components/optimizerTab/optimizerForm/FormSetConditionals.jsx @@ -1,11 +1,11 @@ import { Drawer, Flex, Form, Popover, Select, Switch, Typography } from 'antd' import ColorizeNumbers from 'components/common/ColorizeNumbers' -import { Constants, setToId } from 'lib/constants' -import { useMemo } from 'react' +import { VerticalDivider } from 'components/Dividers' import { HeaderText } from 'components/HeaderText' +import { Constants, setToId } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' import PropTypes from 'prop-types' -import { Assets } from 'lib/assets' -import { VerticalDivider } from 'components/Dividers' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' const { Text } = Typography @@ -468,11 +468,26 @@ function ConditionalSetOption(props) { > - + + - {t('SetName', { id: setToId[props.set] })} + {t('SetName', { id: setToId[props.set] })} + - + {inputType} @@ -505,11 +520,26 @@ function ConditionalSetOption(props) { > - + + - {t('SetName', { id: setToId[props.set] })} + {t('SetName', { id: setToId[props.set] })} + - + {inputType} diff --git a/src/components/optimizerTab/optimizerForm/FormStatRollSlider.tsx b/src/components/optimizerTab/optimizerForm/FormStatRollSlider.tsx index dbab1a775..0a342c63f 100644 --- a/src/components/optimizerTab/optimizerForm/FormStatRollSlider.tsx +++ b/src/components/optimizerTab/optimizerForm/FormStatRollSlider.tsx @@ -1,6 +1,6 @@ import { Flex, Form, InputNumber, Slider, Typography } from 'antd' -import { Assets } from 'lib/assets' import { Constants, Parts } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' import { Utils } from 'lib/utils' import React, { ReactElement, useState } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/LightConeSelect.tsx b/src/components/optimizerTab/optimizerForm/LightConeSelect.tsx index f300aec74..978cb66b3 100644 --- a/src/components/optimizerTab/optimizerForm/LightConeSelect.tsx +++ b/src/components/optimizerTab/optimizerForm/LightConeSelect.tsx @@ -1,10 +1,10 @@ -import * as React from 'react' -import { useEffect, useMemo, useRef, useState } from 'react' import { Card, Flex, Input, InputRef, Modal, Select } from 'antd' -import { Utils } from 'lib/utils' -import { Assets } from 'lib/assets' -import DB from 'lib/db' import { CardGridItemContent, generatePathTags, generateRarityTags, SegmentedFilterRow } from 'components/optimizerTab/optimizerForm/CardSelectModalComponents' +import { Assets } from 'lib/rendering/assets' +import DB from 'lib/state/db' +import { Utils } from 'lib/utils' +import * as React from 'react' +import { useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' interface LightConeSelectProps { diff --git a/src/components/optimizerTab/optimizerForm/OptimizerOptionsDisplay.tsx b/src/components/optimizerTab/optimizerForm/OptimizerOptionsDisplay.tsx index 48f0db261..885e0eedf 100644 --- a/src/components/optimizerTab/optimizerForm/OptimizerOptionsDisplay.tsx +++ b/src/components/optimizerTab/optimizerForm/OptimizerOptionsDisplay.tsx @@ -4,11 +4,11 @@ import { Flex, Form, Select, Switch, Typography } from 'antd' import { HeaderText } from 'components/HeaderText' import { optimizerTabDefaultGap, panelWidth } from 'components/optimizerTab/optimizerTabConstants' import { TooltipImage } from 'components/TooltipImage' -import { Assets } from 'lib/assets' -import DB from 'lib/db' -import { generateCharacterList } from 'lib/displayUtils' -import { Hint } from 'lib/hint' +import { Hint } from 'lib/interactions/hint' +import { Assets } from 'lib/rendering/assets' +import { generateCharacterList } from 'lib/rendering/displayUtils' +import DB from 'lib/state/db' import { Utils } from 'lib/utils' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/OptimizerTabCharacterPanel.tsx b/src/components/optimizerTab/optimizerForm/OptimizerTabCharacterPanel.tsx index d820c6158..ef3974694 100644 --- a/src/components/optimizerTab/optimizerForm/OptimizerTabCharacterPanel.tsx +++ b/src/components/optimizerTab/optimizerForm/OptimizerTabCharacterPanel.tsx @@ -1,4 +1,4 @@ -import { Assets } from 'lib/assets' +import { Assets } from 'lib/rendering/assets' const parentW = 233 const parentH = 350 diff --git a/src/components/optimizerTab/optimizerForm/OrnamentSetTagRenderer.tsx b/src/components/optimizerTab/optimizerForm/OrnamentSetTagRenderer.tsx index dfc1c0b18..cdee1b667 100644 --- a/src/components/optimizerTab/optimizerForm/OrnamentSetTagRenderer.tsx +++ b/src/components/optimizerTab/optimizerForm/OrnamentSetTagRenderer.tsx @@ -1,6 +1,6 @@ import { Flex, Tag } from 'antd' -import { Assets } from 'lib/assets' import { Constants } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' import React from 'react' // NOTE: Be careful hot-reloading with this file, can cause Db to wipe. Unsure why yet diff --git a/src/components/optimizerTab/optimizerForm/OrnamentsOptions.tsx b/src/components/optimizerTab/optimizerForm/OrnamentsOptions.tsx index 17157eed2..a684e45a6 100644 --- a/src/components/optimizerTab/optimizerForm/OrnamentsOptions.tsx +++ b/src/components/optimizerTab/optimizerForm/OrnamentsOptions.tsx @@ -1,9 +1,9 @@ import { Flex } from 'antd' import i18next from 'i18next' - -import { Assets } from 'lib/assets' import { Constants, setToId, UnreleasedSets } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' + // This should be memoised with either the t function or resolved language as a dependency const GenerateOrnamentsOptions = (): { value: string; label: JSX.Element }[] => { return Object.values(Constants.SetsOrnaments) diff --git a/src/components/optimizerTab/optimizerForm/RecommendedPresetsButton.tsx b/src/components/optimizerTab/optimizerForm/RecommendedPresetsButton.tsx index be46e7c3c..273c49b17 100644 --- a/src/components/optimizerTab/optimizerForm/RecommendedPresetsButton.tsx +++ b/src/components/optimizerTab/optimizerForm/RecommendedPresetsButton.tsx @@ -1,18 +1,18 @@ -import React, { useMemo } from 'react' -import { Button, Dropdown } from 'antd' import { DownOutlined } from '@ant-design/icons' -import DB from 'lib/db' -import { Message } from 'lib/message' -import { Constants, Sets } from 'lib/constants' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { defaultSetConditionals, getDefaultForm } from 'lib/defaultForm' import { ApplyColumnStateParams } from 'ag-grid-community' +import { Button, Dropdown } from 'antd' +import { ScoringMetadata } from 'lib/characters/characterScorer' +import { Constants, Sets } from 'lib/constants' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { Message } from 'lib/interactions/message' +import { defaultSetConditionals, getDefaultForm } from 'lib/optimizer/defaultForm' +import DB from 'lib/state/db' +import { TsUtils } from 'lib/TsUtils' import { Utils } from 'lib/utils' +import React, { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Form } from 'types/Form' import { ReactElement } from 'types/Components' -import { TsUtils } from 'lib/TsUtils' -import { ScoringMetadata } from 'lib/characterScorer' +import { Form } from 'types/Form' /* * 111.11 (5 actions in first four cycles) diff --git a/src/components/optimizerTab/optimizerForm/RelicMainSetFilters.tsx b/src/components/optimizerTab/optimizerForm/RelicMainSetFilters.tsx index a685a6ea3..bb77515e6 100644 --- a/src/components/optimizerTab/optimizerForm/RelicMainSetFilters.tsx +++ b/src/components/optimizerTab/optimizerForm/RelicMainSetFilters.tsx @@ -1,17 +1,17 @@ +import { SettingOutlined } from '@ant-design/icons' import { Button, Cascader, Flex, Form, Select } from 'antd' import { HeaderText } from 'components/HeaderText' -import { TooltipImage } from 'components/TooltipImage' -import { Hint } from 'lib/hint' -import { optimizerTabDefaultGap, panelWidth } from 'components/optimizerTab/optimizerTabConstants' -import { Constants, Parts } from 'lib/constants' -import GenerateSetsOptions from 'components/optimizerTab/optimizerForm/SetsOptions' +import { OrnamentSetTagRenderer } from 'components/optimizerTab/optimizerForm/OrnamentSetTagRenderer' import GenerateOrnamentsOptions from 'components/optimizerTab/optimizerForm/OrnamentsOptions' -import { SettingOutlined } from '@ant-design/icons' -import { Assets } from 'lib/assets' import { RelicSetTagRenderer } from 'components/optimizerTab/optimizerForm/RelicSetTagRenderer' -import { OrnamentSetTagRenderer } from 'components/optimizerTab/optimizerForm/OrnamentSetTagRenderer' -import { useTranslation } from 'react-i18next' +import GenerateSetsOptions from 'components/optimizerTab/optimizerForm/SetsOptions' +import { optimizerTabDefaultGap, panelWidth } from 'components/optimizerTab/optimizerTabConstants' +import { TooltipImage } from 'components/TooltipImage' +import { Constants, Parts } from 'lib/constants' +import { Hint } from 'lib/interactions/hint' +import { Assets } from 'lib/rendering/assets' import { useMemo } from 'react' +import { useTranslation } from 'react-i18next' const { SHOW_CHILD } = Cascader diff --git a/src/components/optimizerTab/optimizerForm/RelicSetTagRenderer.tsx b/src/components/optimizerTab/optimizerForm/RelicSetTagRenderer.tsx index 34d56613c..fb59c27ef 100644 --- a/src/components/optimizerTab/optimizerForm/RelicSetTagRenderer.tsx +++ b/src/components/optimizerTab/optimizerForm/RelicSetTagRenderer.tsx @@ -1,7 +1,7 @@ +import { Flex, Tag } from 'antd' import { Constants, RelicSetFilterOptions } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' import React from 'react' -import { Assets } from 'lib/assets' -import { Flex, Tag } from 'antd' // NOTE: Be careful hot-reloading with this file, can cause Db to wipe. Unsure why yet export function RelicSetTagRenderer(props: { diff --git a/src/components/optimizerTab/optimizerForm/ResultFilters.tsx b/src/components/optimizerTab/optimizerForm/ResultFilters.tsx index 0a9435f5c..4a100a53f 100644 --- a/src/components/optimizerTab/optimizerForm/ResultFilters.tsx +++ b/src/components/optimizerTab/optimizerForm/ResultFilters.tsx @@ -3,7 +3,7 @@ import { HeaderText } from 'components/HeaderText' import FilterRow from 'components/optimizerTab/optimizerForm/FilterRow' import { optimizerTabDefaultGap } from 'components/optimizerTab/optimizerTabConstants' import { TooltipImage } from 'components/TooltipImage' -import { Hint } from 'lib/hint' +import { Hint } from 'lib/interactions/hint' import { useTranslation } from 'react-i18next' export const MinMaxStatFilters = () => { diff --git a/src/components/optimizerTab/optimizerForm/SetsOptions.tsx b/src/components/optimizerTab/optimizerForm/SetsOptions.tsx index 239ec8687..80d3055b3 100644 --- a/src/components/optimizerTab/optimizerForm/SetsOptions.tsx +++ b/src/components/optimizerTab/optimizerForm/SetsOptions.tsx @@ -1,12 +1,12 @@ import { Flex } from 'antd' import i18next from 'i18next' -import { Assets } from 'lib/assets' import { Constants, RelicSetFilterOptions, setToId, UnreleasedSets } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' // This should be memoised with either the t function or resolved language as a dependency const GenerateSetsOptions = () => { - const t = i18next.getFixedT(null,'optimizerTab','RelicSetSelector') - const tGameData = i18next.getFixedT(null,'gameData', 'RelicSets') + const t = i18next.getFixedT(null, 'optimizerTab', 'RelicSetSelector') + const tGameData = i18next.getFixedT(null, 'gameData', 'RelicSets') const result: { value: string label: string @@ -76,7 +76,7 @@ const GenerateSetsOptions = () => { // This should be memoised with either the t function or resolved language as a dependency export const GenerateBasicSetsOptions = (): { value: string; label: JSX.Element }[] => { - const tGameData = i18next.getFixedT(null,'gameData', 'RelicSets') + const tGameData = i18next.getFixedT(null, 'gameData', 'RelicSets') return Object.values(Constants.SetsRelics) .filter((x) => !UnreleasedSets[x]) .map((x) => { diff --git a/src/components/optimizerTab/optimizerForm/SimulatedBuildsGrid.tsx b/src/components/optimizerTab/optimizerForm/SimulatedBuildsGrid.tsx index e11e5b2cf..1efe6baaf 100644 --- a/src/components/optimizerTab/optimizerForm/SimulatedBuildsGrid.tsx +++ b/src/components/optimizerTab/optimizerForm/SimulatedBuildsGrid.tsx @@ -1,10 +1,10 @@ -import { Empty, Flex, Table, TableColumnsType } from 'antd' import { CloseOutlined } from '@ant-design/icons' -import { STAT_SIMULATION_GRID_WIDTH } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' -import { deleteStatSimulationBuild, renderDefaultSimulationName } from 'lib/statSimulationController' import { IRowNode } from 'ag-grid-community' -import { useEffect } from 'react' +import { Empty, Flex, Table, TableColumnsType } from 'antd' +import { STAT_SIMULATION_GRID_WIDTH } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' +import { deleteStatSimulationBuild, renderDefaultSimulationName } from 'lib/controllers/statSimulationController' import { Utils } from 'lib/utils' +import { useEffect } from 'react' import { useTranslation } from 'react-i18next' interface DataType { diff --git a/src/components/optimizerTab/optimizerForm/StatSimulationDisplay.tsx b/src/components/optimizerTab/optimizerForm/StatSimulationDisplay.tsx index 007256ef5..59e9b2ec9 100644 --- a/src/components/optimizerTab/optimizerForm/StatSimulationDisplay.tsx +++ b/src/components/optimizerTab/optimizerForm/StatSimulationDisplay.tsx @@ -1,18 +1,18 @@ -import FormCard from '../FormCard' +import { DeleteOutlined, DoubleLeftOutlined, DownOutlined, SettingOutlined, UpOutlined } from '@ant-design/icons' import { Button, Flex, Form, Input, InputNumber, Popconfirm, Radio, Select, Typography } from 'antd' -import { VerticalDivider } from '../../Dividers' -import { SimulatedBuildsGrid } from 'components/optimizerTab/optimizerForm/SimulatedBuildsGrid' import { HeaderText } from 'components/HeaderText' -import { DeleteOutlined, DoubleLeftOutlined, DownOutlined, SettingOutlined, UpOutlined } from '@ant-design/icons' -import { useMemo } from 'react' -import { deleteAllStatSimulationBuilds, importOptimizerBuild, saveStatSimulationBuildFromForm, startOptimizerStatSimulation } from 'lib/statSimulationController' -import { Parts, Stats, SubStats } from 'lib/constants' -import { Assets } from 'lib/assets' +import { OrnamentSetTagRenderer } from 'components/optimizerTab/optimizerForm/OrnamentSetTagRenderer' import GenerateOrnamentsOptions from 'components/optimizerTab/optimizerForm/OrnamentsOptions' import { GenerateBasicSetsOptions } from 'components/optimizerTab/optimizerForm/SetsOptions' +import { SimulatedBuildsGrid } from 'components/optimizerTab/optimizerForm/SimulatedBuildsGrid' +import { Parts, Stats, SubStats } from 'lib/constants' +import { deleteAllStatSimulationBuilds, importOptimizerBuild, saveStatSimulationBuildFromForm, startOptimizerStatSimulation } from 'lib/controllers/statSimulationController' +import { Assets } from 'lib/rendering/assets' import { Utils } from 'lib/utils' -import { OrnamentSetTagRenderer } from 'components/optimizerTab/optimizerForm/OrnamentSetTagRenderer' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' +import { VerticalDivider } from '../../Dividers' +import FormCard from '../FormCard' const { Text } = Typography @@ -267,22 +267,30 @@ function MainStatsSection(props: { simType: string }) { const { t } = useTranslation('optimizerTab', { keyPrefix: 'StatSimulation.MainStatsSelection' }) const BodyStatOptions = useMemo(() => { return [Stats.HP_P, Stats.ATK_P, Stats.DEF_P, Stats.CR, Stats.CD, Stats.EHR, Stats.OHB] - .map((x) => { return { value: x, short: t('ShortStat', { stat: x }), label: t('LabelStat', { stat: x }) } }) + .map((x) => { + return { value: x, short: t('ShortStat', { stat: x }), label: t('LabelStat', { stat: x }) } + }) }, [t]) const FeetStatOptions = useMemo(() => { return [Stats.HP_P, Stats.ATK_P, Stats.DEF_P, Stats.SPD] - .map((x) => { return { value: x, short: t('ShortStat', { stat: x }), label: t('LabelStat', { stat: x }) } }) + .map((x) => { + return { value: x, short: t('ShortStat', { stat: x }), label: t('LabelStat', { stat: x }) } + }) }, [t]) const LinkRopeStatOptions = useMemo(() => { return [Stats.HP_P, Stats.ATK_P, Stats.DEF_P, Stats.BE, Stats.ERR] - .map((x) => { return { value: x, short: t('ShortStat', { stat: x }), label: t('LabelStat', { stat: x }) } }) + .map((x) => { + return { value: x, short: t('ShortStat', { stat: x }), label: t('LabelStat', { stat: x }) } + }) }, [t]) const PlanarSphereStatOptions = useMemo(() => { return [Stats.HP_P, Stats.ATK_P, Stats.DEF_P, Stats.Physical_DMG, Stats.Fire_DMG, Stats.Ice_DMG, Stats.Lightning_DMG, Stats.Wind_DMG, Stats.Quantum_DMG, Stats.Imaginary_DMG] - .map((x) => { return { value: x, short: t('ShortStat', { stat: x }), label: t('LabelStat', { stat: x }) } }) + .map((x) => { + return { value: x, short: t('ShortStat', { stat: x }), label: t('LabelStat', { stat: x }) } + }) }, [t]) return ( diff --git a/src/components/optimizerTab/optimizerForm/SubstatWeightFilters.tsx b/src/components/optimizerTab/optimizerForm/SubstatWeightFilters.tsx index 4e7d339b6..ec499b6d4 100644 --- a/src/components/optimizerTab/optimizerForm/SubstatWeightFilters.tsx +++ b/src/components/optimizerTab/optimizerForm/SubstatWeightFilters.tsx @@ -1,8 +1,8 @@ import { Flex } from 'antd' import { HeaderText } from 'components/HeaderText' -import { TooltipImage } from 'components/TooltipImage' -import { Hint } from 'lib/hint' import { FormStatRollSliders, FormStatRollSliderTopPercent } from 'components/optimizerTab/optimizerForm/FormStatRollSlider' +import { TooltipImage } from 'components/TooltipImage' +import { Hint } from 'lib/interactions/hint' import { useTranslation } from 'react-i18next' export const SubstatWeightFilters = () => { diff --git a/src/components/optimizerTab/optimizerForm/TeammateCard.tsx b/src/components/optimizerTab/optimizerForm/TeammateCard.tsx index f6fe91bfc..01a6ad40f 100644 --- a/src/components/optimizerTab/optimizerForm/TeammateCard.tsx +++ b/src/components/optimizerTab/optimizerForm/TeammateCard.tsx @@ -5,13 +5,13 @@ import { LightConeConditionalDisplay } from 'components/optimizerTab/conditional import FormCard from 'components/optimizerTab/FormCard' import CharacterSelect from 'components/optimizerTab/optimizerForm/CharacterSelect' import LightConeSelect from 'components/optimizerTab/optimizerForm/LightConeSelect' -import { Assets } from 'lib/assets' -import { CharacterConditionals } from 'lib/characterConditionals' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { Constants, SACERDOS_RELIVED_ORDEAL_1_STACK, SACERDOS_RELIVED_ORDEAL_2_STACK, Sets } from 'lib/constants' -import DB from 'lib/db' -import { LightConeConditionals } from 'lib/lightConeConditionals' -import { Message } from 'lib/message' -import { OptimizerTabController } from 'lib/optimizerTabController' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { Message } from 'lib/interactions/message' +import { Assets } from 'lib/rendering/assets' +import DB from 'lib/state/db' import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { Character } from 'types/Character' @@ -202,7 +202,7 @@ const TeammateCard = (props: { index: number }) => { return } - const displayFormValues = OptimizerTabController.getDisplayFormValues(OptimizerTabController.getForm()) as Form + const displayFormValues = OptimizerTabController.getDisplayFormValues(OptimizerTabController.getForm()) const teammateValues = displayFormValues[teammateProperty] const teammateCharacter = DB.getCharacterById(teammateCharacterId) if (teammateCharacter) { @@ -237,7 +237,7 @@ const TeammateCard = (props: { index: number }) => { useEffect(() => { if (!teammateLightConeId) return - const displayFormValues = OptimizerTabController.getDisplayFormValues(OptimizerTabController.getForm()) as Form + const displayFormValues = OptimizerTabController.getDisplayFormValues(OptimizerTabController.getForm()) const lightConeConditionals = LightConeConditionals.get({ lightCone: teammateLightConeId, lightConeSuperimposition: teammateSuperimposition, diff --git a/src/components/optimizerTab/optimizerTabConstants.ts b/src/components/optimizerTab/optimizerTabConstants.ts index 088bfa74c..eae7684a5 100644 --- a/src/components/optimizerTab/optimizerTabConstants.ts +++ b/src/components/optimizerTab/optimizerTabConstants.ts @@ -1,8 +1,8 @@ import { GetRowIdParams } from 'ag-grid-community' import { TFunction } from 'i18next' import { Constants } from 'lib/constants' -import { Gradient } from 'lib/gradient' -import { Renderer } from 'lib/renderer' +import { Gradient } from 'lib/rendering/gradient' +import { Renderer } from 'lib/rendering/renderer' import { Utils } from 'lib/utils' export const DIGITS_3 = 46 diff --git a/src/components/optimizerTab/rotation/ComboDrawer.tsx b/src/components/optimizerTab/rotation/ComboDrawer.tsx index b296c5689..e75f9dd28 100644 --- a/src/components/optimizerTab/rotation/ComboDrawer.tsx +++ b/src/components/optimizerTab/rotation/ComboDrawer.tsx @@ -8,10 +8,10 @@ import { FormSwitchWithPopover } from 'components/optimizerTab/conditionals/Form import { OrnamentSetTagRenderer } from 'components/optimizerTab/optimizerForm/OrnamentSetTagRenderer' import GenerateOrnamentsOptions from 'components/optimizerTab/optimizerForm/OrnamentsOptions' import { GenerateBasicSetsOptions } from 'components/optimizerTab/optimizerForm/SetsOptions' -import { Assets } from 'lib/assets' -import { CharacterConditionals } from 'lib/characterConditionals' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { ConditionalDataType, setToId } from 'lib/constants' -import { LightConeConditionals } from 'lib/lightConeConditionals' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { ComboBooleanConditional, ComboCharacter, @@ -34,8 +34,8 @@ import { updateSelectedSets, } from 'lib/optimizer/rotation/comboDrawerController' import { ConditionalSetMetadata, generateSetConditionalContent } from 'lib/optimizer/rotation/setConditionalContent' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { lockScroll, unlockScroll } from 'lib/scrollController' +import { Assets } from 'lib/rendering/assets' +import { lockScroll, unlockScroll } from 'lib/rendering/scrollController' import React, { useEffect, useMemo, useRef } from 'react' import { useTranslation } from 'react-i18next' import Selecto from 'react-selecto' diff --git a/src/components/relicPreview/GenerateStat.tsx b/src/components/relicPreview/GenerateStat.tsx index b4a5a69af..56ca13320 100644 --- a/src/components/relicPreview/GenerateStat.tsx +++ b/src/components/relicPreview/GenerateStat.tsx @@ -1,13 +1,13 @@ import { Flex } from 'antd' -import { Renderer } from 'lib/renderer' -import { Assets } from 'lib/assets' -import { Utils } from 'lib/utils' -import { iconSize } from 'lib/constantsUi' import RelicStatText from 'components/relicPreview/RelicStatText' -import { Relic, StatRolls } from 'types/Relic' -import { ReactElement } from 'react' import { RightIcon } from 'icons/RightIcon' +import { iconSize } from 'lib/constantsUi' +import { Assets } from 'lib/rendering/assets' +import { Renderer } from 'lib/rendering/renderer' +import { Utils } from 'lib/utils' +import { ReactElement } from 'react' import { useTranslation } from 'react-i18next' +import { Relic, StatRolls } from 'types/Relic' type Substat = { stat: string diff --git a/src/components/webgpuTab/WebgpuTab.tsx b/src/components/webgpuTab/WebgpuTab.tsx index 5ca8c7abc..122034386 100644 --- a/src/components/webgpuTab/WebgpuTab.tsx +++ b/src/components/webgpuTab/WebgpuTab.tsx @@ -1,8 +1,8 @@ import { CheckCircleFilled, CloseCircleFilled, QuestionOutlined } from '@ant-design/icons' import { Button, Collapse, Flex, Table, TableProps } from 'antd' -import { AppPages } from 'lib/db' import { generateAllTests, WebgpuTest } from 'lib/gpu/tests/webgpuTestGenerator' import { StatDelta, StatDeltas } from 'lib/gpu/tests/webgpuTestUtils' +import { AppPages } from 'lib/state/db' import React, { useState } from 'react' export default function WebgpuTab(): React.JSX.Element { diff --git a/src/index.tsx b/src/index.tsx index 253fe548b..515626daa 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,33 +1,33 @@ -import ReactDOM from 'react-dom/client' -import { ErrorBoundary } from 'react-error-boundary' -import 'style/style.css' -import 'style/hsro.css' +import { Typography } from 'antd' import WrappedApp from 'App' import 'lib/i18n' - -import { WorkerPool } from 'lib/workerPool' +import { CharacterStats } from 'lib/characters/characterStats' import { Constants } from 'lib/constants' -import { DataParser } from 'lib/dataParser' -import { DB } from 'lib/db' -import { CharacterStats } from 'lib/characterStats' -import { Assets } from 'lib/assets' -import { RelicAugmenter } from 'lib/relicAugmenter' -import { StatCalculator } from 'lib/statCalculator' -import { Gradient } from 'lib/gradient' -import { SaveState } from 'lib/saveState' -import { RelicFilters } from 'lib/relicFilters' -import { Renderer } from 'lib/renderer' -import { Message } from 'lib/message' -import { Hint } from 'lib/hint' -import { CharacterConverter } from 'lib/characterConverter' -import { RelicScorer } from 'lib/relicScorerPotential' -import { BufferPacker } from 'lib/bufferPacker' -import { Typography } from 'antd' -import { RelicRollFixer } from 'lib/relicRollFixer' -import { Themes } from 'lib/theme' import { verifyWebgpuSupport } from 'lib/gpu/webgpuDevice' import 'overlayscrollbars/overlayscrollbars.css' +import { CharacterConverter } from 'lib/importer/characterConverter' +import { Hint } from 'lib/interactions/hint' +import { Message } from 'lib/interactions/message' +import { BufferPacker } from 'lib/optimizer/bufferPacker' +import { RelicAugmenter } from 'lib/relics/relicAugmenter' +import { RelicFilters } from 'lib/relics/relicFilters' +import { RelicRollFixer } from 'lib/relics/relicRollFixer' +import { RelicScorer } from 'lib/relics/relicScorerPotential' +import { StatCalculator } from 'lib/relics/statCalculator' +import { Assets } from 'lib/rendering/assets' +import { Gradient } from 'lib/rendering/gradient' +import { Renderer } from 'lib/rendering/renderer' +import { Themes } from 'lib/rendering/theme' +import { DataParser } from 'lib/state/dataParser' +import { DB } from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' + +import { WorkerPool } from 'lib/worker/workerPool' import { OverlayScrollbars } from 'overlayscrollbars' +import ReactDOM from 'react-dom/client' +import { ErrorBoundary } from 'react-error-boundary' +import 'style/style.css' +import 'style/hsro.css' window.WorkerPool = WorkerPool window.Constants = Constants diff --git a/src/lib/characterScorer.ts b/src/lib/characters/characterScorer.ts similarity index 98% rename from src/lib/characterScorer.ts rename to src/lib/characters/characterScorer.ts index b580bf706..d88a4da77 100644 --- a/src/lib/characterScorer.ts +++ b/src/lib/characters/characterScorer.ts @@ -1,15 +1,23 @@ import { StatSimTypes } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' -import { CharacterConditionals } from 'lib/characterConditionals' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' import { ComputedStatsObject } from 'lib/conditionals/conditionalConstants' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { CUSTOM_TEAM, Parts, Sets, Stats, SubStats } from 'lib/constants' -import DB from 'lib/db' -import { getDefaultForm } from 'lib/defaultForm' -import { LightConeConditionals } from 'lib/lightConeConditionals' +import { + calculateOrnamentSets, + calculateRelicSets, + convertRelicsToSimulation, + runSimulations, + Simulation, + SimulationRequest, + SimulationStats, +} from 'lib/controllers/statSimulationController' import { generateContext } from 'lib/optimizer/context/calculateContext' +import { getDefaultForm } from 'lib/optimizer/defaultForm' import { emptyRelic } from 'lib/optimizer/optimizerUtils' import { SortOptionProperties } from 'lib/optimizer/sortOptions' -import { StatCalculator } from 'lib/statCalculator' -import { calculateOrnamentSets, calculateRelicSets, convertRelicsToSimulation, runSimulations, Simulation, SimulationRequest, SimulationStats } from 'lib/statSimulationController' +import { StatCalculator } from 'lib/relics/statCalculator' +import DB from 'lib/state/db' import { TsUtils } from 'lib/TsUtils' import { Utils } from 'lib/utils' import { Character } from 'types/Character' diff --git a/src/lib/characterStats.ts b/src/lib/characters/characterStats.ts similarity index 100% rename from src/lib/characterStats.ts rename to src/lib/characters/characterStats.ts diff --git a/src/lib/oldCharacterScoringMetadata.ts b/src/lib/characters/oldCharacterScoringMetadata.ts similarity index 100% rename from src/lib/oldCharacterScoringMetadata.ts rename to src/lib/characters/oldCharacterScoringMetadata.ts diff --git a/src/lib/characterConditionals.ts b/src/lib/conditionals/characterConditionals.ts similarity index 100% rename from src/lib/characterConditionals.ts rename to src/lib/conditionals/characterConditionals.ts diff --git a/src/lib/lightConeConditionals.ts b/src/lib/conditionals/lightConeConditionals.ts similarity index 100% rename from src/lib/lightConeConditionals.ts rename to src/lib/conditionals/lightConeConditionals.ts diff --git a/src/lib/optimizerTabController.ts b/src/lib/controllers/optimizerTabController.ts similarity index 98% rename from src/lib/optimizerTabController.ts rename to src/lib/controllers/optimizerTabController.ts index 11e23f570..4ade6de01 100644 --- a/src/lib/optimizerTabController.ts +++ b/src/lib/controllers/optimizerTabController.ts @@ -1,20 +1,20 @@ import { CellClickedEvent, IGetRowsParams, IRowNode } from 'ag-grid-community' import { applyMetadataPresetToForm } from 'components/optimizerTab/optimizerForm/RecommendedPresetsButton' import { inPlaceSort } from 'fast-sort' -import { OptimizerDisplayData, OptimizerDisplayDataStatSim } from 'lib/bufferPacker' -import { CharacterConditionals } from 'lib/characterConditionals' -import { CharacterStats } from 'lib/characterStats' +import { CharacterStats } from 'lib/characters/characterStats' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { CombatBuffs, ConditionalDataType, Constants, DamageKeys, DEFAULT_STAT_DISPLAY, Stats } from 'lib/constants' import { SavedSessionKeys } from 'lib/constantsSession' -import DB from 'lib/db' -import { defaultEnemyOptions, defaultSetConditionals, defaultTeammate, getDefaultForm, getDefaultWeights } from 'lib/defaultForm' import { RelicsByPart } from 'lib/gpu/webgpuTypes' -import { GridAggregations } from 'lib/gradient' -import { LightConeConditionals } from 'lib/lightConeConditionals' -import { Message } from 'lib/message' +import { Message } from 'lib/interactions/message' +import { OptimizerDisplayData, OptimizerDisplayDataStatSim } from 'lib/optimizer/bufferPacker' +import { defaultEnemyOptions, defaultSetConditionals, defaultTeammate, getDefaultForm, getDefaultWeights } from 'lib/optimizer/defaultForm' import { initializeComboState } from 'lib/optimizer/rotation/comboDrawerController' import { ConditionalSetMetadata } from 'lib/optimizer/rotation/setConditionalContent' -import { SaveState } from 'lib/saveState' +import { GridAggregations } from 'lib/rendering/gradient' +import DB from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { TsUtils } from 'lib/TsUtils' import { Utils } from 'lib/utils' import { CharacterConditionalMap } from 'types/CharacterConditional' diff --git a/src/lib/statSimulationController.tsx b/src/lib/controllers/statSimulationController.tsx similarity index 97% rename from src/lib/statSimulationController.tsx rename to src/lib/controllers/statSimulationController.tsx index 4c10fdfdc..abd622292 100644 --- a/src/lib/statSimulationController.tsx +++ b/src/lib/controllers/statSimulationController.tsx @@ -2,19 +2,19 @@ import { Flex, Tag } from 'antd' import { setSortColumn } from 'components/optimizerTab/optimizerForm/RecommendedPresetsButton' import { StatSimTypes } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' import i18next from 'i18next' -import { Assets } from 'lib/assets' -import { SimulationResult } from 'lib/characterScorer' +import { SimulationResult } from 'lib/characters/characterScorer' import { Constants, Parts, SetsOrnamentsNames, SetsRelicsNames, Stats, SubStats } from 'lib/constants' -import DB from 'lib/db' -import { Message } from 'lib/message' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { Message } from 'lib/interactions/message' import { calculateBuild } from 'lib/optimizer/calculateBuild' import { calculateCurrentlyEquippedRow, renameFields } from 'lib/optimizer/optimizer' import { emptyRelic } from 'lib/optimizer/optimizerUtils' import { SortOption } from 'lib/optimizer/sortOptions' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { RelicFilters } from 'lib/relicFilters' -import { SaveState } from 'lib/saveState' -import { StatCalculator } from 'lib/statCalculator' +import { RelicFilters } from 'lib/relics/relicFilters' +import { StatCalculator } from 'lib/relics/statCalculator' +import { Assets } from 'lib/rendering/assets' +import DB from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { Utils } from 'lib/utils' import { useTranslation } from 'react-i18next' import { Form } from 'types/Form' diff --git a/src/lib/gpu/injection/injectConditionals.ts b/src/lib/gpu/injection/injectConditionals.ts index c52b4d6e9..5cf5f40a2 100644 --- a/src/lib/gpu/injection/injectConditionals.ts +++ b/src/lib/gpu/injection/injectConditionals.ts @@ -1,22 +1,22 @@ +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { BASIC_TYPE, FUA_TYPE, SKILL_TYPE, ULT_TYPE } from 'lib/conditionals/conditionalConstants' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { Stats } from 'lib/constants' +import { DynamicConditional } from 'lib/gpu/conditionals/dynamicConditionals' +import { injectPrecomputedStatsContext } from 'lib/gpu/injection/injectPrecomputedStats' import { indent } from 'lib/gpu/injection/wgslUtils' -import { Form } from 'types/Form' -import { CharacterConditionals } from 'lib/characterConditionals' -import { LightConeConditionals } from 'lib/lightConeConditionals' +import { GpuConstants } from 'lib/gpu/webgpuTypes' import { ConditionalRegistry } from 'lib/optimizer/calculateConditionals' -import { LightConeConditional } from 'types/LightConeConditionals' +import { SortOption } from 'lib/optimizer/sortOptions' import { CharacterConditional } from 'types/CharacterConditional' -import { injectPrecomputedStatsContext } from 'lib/gpu/injection/injectPrecomputedStats' -import { OptimizerAction, OptimizerContext } from 'types/Optimizer' -import { BASIC_TYPE, FUA_TYPE, SKILL_TYPE, ULT_TYPE } from 'lib/conditionals/conditionalConstants' import { StringToNumberMap } from 'types/Common' -import { SortOption } from 'lib/optimizer/sortOptions' -import { GpuConstants } from 'lib/gpu/webgpuTypes' -import { DynamicConditional } from 'lib/gpu/conditionals/dynamicConditionals' +import { Form } from 'types/Form' +import { LightConeConditional } from 'types/LightConeConditionals' +import { OptimizerAction, OptimizerContext } from 'types/Optimizer' export function injectConditionals(wgsl: string, request: Form, context: OptimizerContext, gpuParams: GpuConstants) { - const characterConditionals: CharacterConditional = CharacterConditionals.get(request) as CharacterConditional - const lightConeConditionals: LightConeConditional = LightConeConditionals.get(request) as LightConeConditional + const characterConditionals: CharacterConditional = CharacterConditionals.get(request) + const lightConeConditionals: LightConeConditional = LightConeConditionals.get(request) // Actions const actionLength = context.resultSort == SortOption.COMBO.key ? context.actions.length : 1 diff --git a/src/lib/gpu/tests/webgpuTestGenerator.ts b/src/lib/gpu/tests/webgpuTestGenerator.ts index 8b76f8de3..c0c320e2d 100644 --- a/src/lib/gpu/tests/webgpuTestGenerator.ts +++ b/src/lib/gpu/tests/webgpuTestGenerator.ts @@ -1,11 +1,11 @@ -import { generateFullDefaultForm } from 'lib/characterScorer' +import { generateFullDefaultForm } from 'lib/characters/characterScorer' import { SetsOrnamentsNames, SetsRelicsNames } from 'lib/constants' -import DB, { DBMetadata, DBMetadataLightCone } from 'lib/db' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { generateTestRelics, StatDeltaAnalysis, testWrapper } from 'lib/gpu/tests/webgpuTestUtils' import { getWebgpuDevice } from 'lib/gpu/webgpuDevice' import { RelicsByPart } from 'lib/gpu/webgpuTypes' import { SortOption } from 'lib/optimizer/sortOptions' -import { OptimizerTabController } from 'lib/optimizerTabController' +import DB, { DBMetadata, DBMetadataLightCone } from 'lib/state/db' import { Form } from 'types/Form' export type WebgpuTest = { diff --git a/src/lib/gpu/webgpuDevice.ts b/src/lib/gpu/webgpuDevice.ts index a395dfa76..6118b2df3 100644 --- a/src/lib/gpu/webgpuDevice.ts +++ b/src/lib/gpu/webgpuDevice.ts @@ -1,6 +1,6 @@ -import { SavedSessionKeys } from 'lib/constantsSession' import { COMPUTE_ENGINE_CPU } from 'lib/constants' -import { webgpuNotSupportedNotification } from 'lib/notifications' +import { SavedSessionKeys } from 'lib/constantsSession' +import { webgpuNotSupportedNotification } from 'lib/interactions/notifications' export async function getWebgpuDevice(warn?: boolean) { const adapter: GPUAdapter | null = await navigator?.gpu?.requestAdapter() diff --git a/src/lib/gpu/webgpuInternals.ts b/src/lib/gpu/webgpuInternals.ts index bbe3f7119..77d8e53e5 100644 --- a/src/lib/gpu/webgpuInternals.ts +++ b/src/lib/gpu/webgpuInternals.ts @@ -1,9 +1,9 @@ import { COMPUTE_ENGINE_GPU_EXPERIMENTAL } from 'lib/constants' -import { FixedSizePriorityQueue } from 'lib/fixedSizePriorityQueue' import { generateWgsl } from 'lib/gpu/injection/generateWgsl' import { generateBaseParamsArray, generateParamsMatrix, mergeRelicsIntoArray } from 'lib/gpu/webgpuDataTransform' import { GpuExecutionContext, GpuResult, RelicsByPart } from 'lib/gpu/webgpuTypes' import postComputeShader from 'lib/gpu/wgsl/postComputeShader.wgsl?raw' +import { FixedSizePriorityQueue } from 'lib/optimizer/fixedSizePriorityQueue' import { Form } from 'types/Form' import { OptimizerContext } from 'types/Optimizer' diff --git a/src/lib/gpu/webgpuOptimizer.ts b/src/lib/gpu/webgpuOptimizer.ts index f0d1c2325..679db93f1 100644 --- a/src/lib/gpu/webgpuOptimizer.ts +++ b/src/lib/gpu/webgpuOptimizer.ts @@ -1,15 +1,15 @@ import { setSortColumn } from 'components/optimizerTab/optimizerForm/RecommendedPresetsButton' -import { OptimizerDisplayData } from 'lib/bufferPacker' import { COMPUTE_ENGINE_GPU_EXPERIMENTAL, ComputeEngine } from 'lib/constants' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { debugWebgpuOutput } from 'lib/gpu/webgpuDebugger' import { getWebgpuDevice } from 'lib/gpu/webgpuDevice' import { destroyPipeline, generateExecutionPass, initializeGpuPipeline } from 'lib/gpu/webgpuInternals' import { GpuExecutionContext, RelicsByPart } from 'lib/gpu/webgpuTypes' -import { Message } from 'lib/message' +import { Message } from 'lib/interactions/message' +import { OptimizerDisplayData } from 'lib/optimizer/bufferPacker' import { calculateBuild } from 'lib/optimizer/calculateBuild' import { renameFields } from 'lib/optimizer/optimizer' import { SortOption } from 'lib/optimizer/sortOptions' -import { OptimizerTabController } from 'lib/optimizerTabController' import { Form } from 'types/Form' import { OptimizerContext } from 'types/Optimizer' diff --git a/src/lib/gpu/webgpuTypes.d.ts b/src/lib/gpu/webgpuTypes.d.ts index e418c5561..3e922efae 100644 --- a/src/lib/gpu/webgpuTypes.d.ts +++ b/src/lib/gpu/webgpuTypes.d.ts @@ -1,4 +1,4 @@ -import { FixedSizePriorityQueue } from 'lib/fixedSizePriorityQueue' +import { FixedSizePriorityQueue } from 'lib/optimizer/fixedSizePriorityQueue' import { Form } from 'types/Form' import { OptimizerContext } from 'types/Optimizer' import { Relic } from 'types/Relic' diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts index 6e36f42d1..bab91b27c 100644 --- a/src/lib/i18n.ts +++ b/src/lib/i18n.ts @@ -2,7 +2,7 @@ import i18next from 'i18next' import LanguageDetector from 'i18next-browser-languagedetector' import Backend from 'i18next-http-backend' import yaml from 'js-yaml' -import { BASE_PATH } from 'lib/db' +import { BASE_PATH } from 'lib/state/db' import { initReactI18next } from 'react-i18next' window.yaml = yaml diff --git a/src/lib/characterConverter.ts b/src/lib/importer/characterConverter.ts similarity index 98% rename from src/lib/characterConverter.ts rename to src/lib/importer/characterConverter.ts index 36d368348..96ac801ac 100644 --- a/src/lib/characterConverter.ts +++ b/src/lib/importer/characterConverter.ts @@ -1,7 +1,7 @@ -import { RelicAugmenter } from 'lib/relicAugmenter' import { Constants } from 'lib/constants' +import { RelicAugmenter } from 'lib/relics/relicAugmenter' +import DB from 'lib/state/db' import { Utils } from 'lib/utils' -import DB from 'lib/db' const partConversion = { 1: Constants.Parts.Head, diff --git a/src/lib/importer/hoyoLabFormatParser.tsx b/src/lib/importer/hoyoLabFormatParser.tsx index ae5516166..0b2250269 100644 --- a/src/lib/importer/hoyoLabFormatParser.tsx +++ b/src/lib/importer/hoyoLabFormatParser.tsx @@ -1,7 +1,7 @@ import { Constants, Parts, SubStats } from 'lib/constants' +import { RelicAugmenter } from 'lib/relics/relicAugmenter' +import DB from 'lib/state/db' import { Utils } from 'lib/utils' -import { RelicAugmenter } from 'lib/relicAugmenter' -import DB from 'lib/db' /* diff --git a/src/lib/importer/kelzFormatParser.tsx b/src/lib/importer/kelzFormatParser.tsx index b8c4cb882..550f85c67 100644 --- a/src/lib/importer/kelzFormatParser.tsx +++ b/src/lib/importer/kelzFormatParser.tsx @@ -1,16 +1,16 @@ -import stringSimilarity from 'string-similarity' -import { Constants, Parts, Sets } from '../constants' -import { RelicAugmenter } from 'lib/relicAugmenter' +import { Typography } from 'antd' import gameData from 'data/game_data.json' -import DB from 'lib/db' -import { Utils } from '../utils' -import semver from 'semver' -import { Typography } from 'antd' -import { Message } from 'lib/message' import { ScannerConfig } from 'lib/importer/importConfig' -import { Relic } from 'types/Relic' +import { Message } from 'lib/interactions/message' +import { RelicAugmenter } from 'lib/relics/relicAugmenter' +import DB from 'lib/state/db' +import semver from 'semver' +import stringSimilarity from 'string-similarity' import { Character } from 'types/Character' +import { Relic } from 'types/Relic' +import { Constants, Parts, Sets } from '../constants' +import { Utils } from '../utils' const { Text } = Typography diff --git a/src/lib/arrowKeyGridNavigation.ts b/src/lib/interactions/arrowKeyGridNavigation.ts similarity index 100% rename from src/lib/arrowKeyGridNavigation.ts rename to src/lib/interactions/arrowKeyGridNavigation.ts diff --git a/src/lib/hint.tsx b/src/lib/interactions/hint.tsx similarity index 100% rename from src/lib/hint.tsx rename to src/lib/interactions/hint.tsx diff --git a/src/lib/message.ts b/src/lib/interactions/message.ts similarity index 100% rename from src/lib/message.ts rename to src/lib/interactions/message.ts diff --git a/src/lib/notifications.tsx b/src/lib/interactions/notifications.tsx similarity index 85% rename from src/lib/notifications.tsx rename to src/lib/interactions/notifications.tsx index f77f78061..8c802deba 100644 --- a/src/lib/notifications.tsx +++ b/src/lib/interactions/notifications.tsx @@ -1,11 +1,11 @@ -import { Button, Flex, Space } from 'antd' -import semver from 'semver' -import { AppPages } from 'lib/db' -import { CURRENT_OPTIMIZER_VERSION } from 'lib/constants' import { DiscordOutlined, UnorderedListOutlined } from '@ant-design/icons' +import { Button, Flex, Space } from 'antd' import { ColorizedLinkWithIcon } from 'components/common/ColorizedLink' -import { Trans } from 'react-i18next' import i18next from 'i18next' +import { CURRENT_OPTIMIZER_VERSION } from 'lib/constants' +import { AppPages } from 'lib/state/db' +import { Trans } from 'react-i18next' +import semver from 'semver' export function checkForUpdatesNotification(version: string) { // Errors checking for versions shouldn't crash the app @@ -20,9 +20,9 @@ export function checkForUpdatesNotification(version: string) { @@ -92,7 +92,11 @@ export function webgpuNotSupportedNotification() {
  • {i18next.t('notifications:GPU.Description.l2')/* Windows & Mac — Chrome, Opera, Edge */}
  • {/* @ts-ignore colorized link takes text prop from translation */} - }}/> + }} + /> {/* Linux — */}
  • diff --git a/src/lib/bufferPacker.ts b/src/lib/optimizer/bufferPacker.ts similarity index 98% rename from src/lib/bufferPacker.ts rename to src/lib/optimizer/bufferPacker.ts index 437f18f72..b2863b91f 100644 --- a/src/lib/bufferPacker.ts +++ b/src/lib/optimizer/bufferPacker.ts @@ -1,6 +1,6 @@ import { Stats } from 'lib/constants' -import { FixedSizePriorityQueue } from 'lib/fixedSizePriorityQueue' import { ComputedStatsArray, Key } from 'lib/optimizer/computedStatsArray' +import { FixedSizePriorityQueue } from 'lib/optimizer/fixedSizePriorityQueue' const SIZE = 40 diff --git a/src/lib/optimizer/calculateBuild.ts b/src/lib/optimizer/calculateBuild.ts index 70aa038ab..4958813d2 100644 --- a/src/lib/optimizer/calculateBuild.ts +++ b/src/lib/optimizer/calculateBuild.ts @@ -7,7 +7,7 @@ import { ComputedStatsArray, ComputedStatsArrayCore, Key, Source } from 'lib/opt import { generateContext } from 'lib/optimizer/context/calculateContext' import { emptyRelic } from 'lib/optimizer/optimizerUtils' import { transformComboState } from 'lib/optimizer/rotation/comboStateTransform' -import { RelicFilters } from 'lib/relicFilters' +import { RelicFilters } from 'lib/relics/relicFilters' import { Utils } from 'lib/utils' import { Form } from 'types/Form' import { OptimizerContext } from 'types/Optimizer' diff --git a/src/lib/optimizer/calculateConditionals.ts b/src/lib/optimizer/calculateConditionals.ts index a0a1bd76c..1714b5699 100644 --- a/src/lib/optimizer/calculateConditionals.ts +++ b/src/lib/optimizer/calculateConditionals.ts @@ -1,5 +1,5 @@ -import { CharacterConditionals } from 'lib/characterConditionals' -import { LightConeConditionals } from 'lib/lightConeConditionals' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { Stats } from 'lib/constants' import { DynamicConditional } from 'lib/gpu/conditionals/dynamicConditionals' import { ConditionalSets } from 'lib/gpu/conditionals/setConditionals' @@ -25,11 +25,14 @@ export function calculateContextConditionalRegistry(action: OptimizerAction, con action.conditionalState = {} } -export function registerTeammateConditionals(conditionalRegistry: { [key: string]: DynamicConditional[] }, teammateMetadata: CharacterMetadata, action: OptimizerAction, index: number) { +export function registerTeammateConditionals(conditionalRegistry: { [key: string]: DynamicConditional[] }, + teammateMetadata: CharacterMetadata, + action: OptimizerAction, + index: number) { if (teammateMetadata) { const teammateCharacterConditionals: CharacterConditional = CharacterConditionals.get(teammateMetadata) const dynamicConditionals = (teammateCharacterConditionals.teammateDynamicConditionals ?? []) - .map(dynamicConditional => { + .map((dynamicConditional) => { const wrapped = wrapTeammateDynamicConditional(dynamicConditional, index) action.teammateDynamicConditionals.push(wrapped) return wrapped @@ -41,7 +44,7 @@ export function registerTeammateConditionals(conditionalRegistry: { [key: string export function wrapTeammateDynamicConditional(dynamicConditional: DynamicConditional, index: number) { return { ...dynamicConditional, - teammateIndex: index + teammateIndex: index, } } diff --git a/src/lib/optimizer/context/calculateContext.ts b/src/lib/optimizer/context/calculateContext.ts index f6978b87f..3d8438839 100644 --- a/src/lib/optimizer/context/calculateContext.ts +++ b/src/lib/optimizer/context/calculateContext.ts @@ -1,12 +1,12 @@ -import { Form, Teammate } from 'types/Form' -import { CharacterMetadata, CharacterStatsBreakdown, OptimizerContext } from 'types/Optimizer' -import DB from 'lib/db' -import { emptyLightCone } from 'lib/optimizer/optimizerUtils' +import { CharacterStats } from 'lib/characters/characterStats' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { ElementToDamage, ElementToResPenType, Stats } from 'lib/constants' -import { CharacterStats } from 'lib/characterStats' +import { emptyLightCone } from 'lib/optimizer/optimizerUtils' import { transformComboState } from 'lib/optimizer/rotation/comboStateTransform' -import { CharacterConditionals } from 'lib/characterConditionals' -import { LightConeConditionals } from 'lib/lightConeConditionals' +import DB from 'lib/state/db' +import { Form, Teammate } from 'types/Form' +import { CharacterMetadata, CharacterStatsBreakdown, OptimizerContext } from 'types/Optimizer' export function generateContext(request: Form): OptimizerContext { const context: OptimizerContext = {} as OptimizerContext @@ -45,7 +45,7 @@ function generateCombatBuffsContext(request: Form, context: OptimizerContext) { } function generateFiltersContext(request: Form, context: OptimizerContext) { - context.resultSort = request.resultSort as string + context.resultSort = request.resultSort! } function calculateConditionals(request: Form, context: OptimizerContext) { diff --git a/src/lib/defaultForm.ts b/src/lib/optimizer/defaultForm.ts similarity index 99% rename from src/lib/defaultForm.ts rename to src/lib/optimizer/defaultForm.ts index 9ff476064..17cbac144 100644 --- a/src/lib/defaultForm.ts +++ b/src/lib/optimizer/defaultForm.ts @@ -1,5 +1,5 @@ import { CombatBuffs, Constants, DEFAULT_STAT_DISPLAY, Sets } from 'lib/constants' -import DB from 'lib/db' +import DB from 'lib/state/db' import { TsUtils } from 'lib/TsUtils' import { Form, Teammate } from 'types/Form' diff --git a/src/lib/fixedSizePriorityQueue.ts b/src/lib/optimizer/fixedSizePriorityQueue.ts similarity index 100% rename from src/lib/fixedSizePriorityQueue.ts rename to src/lib/optimizer/fixedSizePriorityQueue.ts diff --git a/src/lib/optimizer/optimizer.ts b/src/lib/optimizer/optimizer.ts index 77ec87b71..4c4701821 100644 --- a/src/lib/optimizer/optimizer.ts +++ b/src/lib/optimizer/optimizer.ts @@ -1,23 +1,23 @@ import { setSortColumn } from 'components/optimizerTab/optimizerForm/RecommendedPresetsButton' import { activateZeroPermutationsSuggestionsModal, activateZeroResultSuggestionsModal } from 'components/optimizerTab/OptimizerSuggestionsModal' -import { BufferPacker, OptimizerDisplayData } from 'lib/bufferPacker' import { BasicStatsObject } from 'lib/conditionals/conditionalConstants' import { COMPUTE_ENGINE_CPU, Constants, ElementToDamage, Stats } from 'lib/constants' import { SavedSessionKeys } from 'lib/constantsSession' -import DB from 'lib/db' -import { FixedSizePriorityQueue } from 'lib/fixedSizePriorityQueue' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { getWebgpuDevice } from 'lib/gpu/webgpuDevice' import { gpuOptimize } from 'lib/gpu/webgpuOptimizer' -import { Message } from 'lib/message' +import { Message } from 'lib/interactions/message' +import { BufferPacker, OptimizerDisplayData } from 'lib/optimizer/bufferPacker' import { calculateBuild } from 'lib/optimizer/calculateBuild' import { ComputedStatsObjectExternal } from 'lib/optimizer/computedStatsArray' import { generateContext } from 'lib/optimizer/context/calculateContext' +import { FixedSizePriorityQueue } from 'lib/optimizer/fixedSizePriorityQueue' import { generateOrnamentSetSolutions, generateRelicSetSolutions } from 'lib/optimizer/relicSetSolver' import { SortOption } from 'lib/optimizer/sortOptions' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { RelicFilters } from 'lib/relicFilters' +import { RelicFilters } from 'lib/relics/relicFilters' +import DB from 'lib/state/db' import { Utils } from 'lib/utils' -import { WorkerPool } from 'lib/workerPool' +import { WorkerPool } from 'lib/worker/workerPool' import { Form } from 'types/Form' let CANCEL = false diff --git a/src/lib/optimizer/optimizerUtils.ts b/src/lib/optimizer/optimizerUtils.ts index 8b1a65c73..8edcffaa6 100644 --- a/src/lib/optimizer/optimizerUtils.ts +++ b/src/lib/optimizer/optimizerUtils.ts @@ -1,5 +1,5 @@ import { Constants, Stats } from 'lib/constants' -import { AugmentedStats } from 'lib/relicAugmenter' +import { AugmentedStats } from 'lib/relics/relicAugmenter' export function p4(set: number) { return set >> 2 diff --git a/src/lib/optimizer/rotation/comboDrawerController.tsx b/src/lib/optimizer/rotation/comboDrawerController.tsx index 8024d76ba..82ce9a99b 100644 --- a/src/lib/optimizer/rotation/comboDrawerController.tsx +++ b/src/lib/optimizer/rotation/comboDrawerController.tsx @@ -1,16 +1,16 @@ +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' +import { ConditionalDataType, SetsOrnaments, SetsOrnamentsNames, SetsRelics, SetsRelicsNames } from 'lib/constants' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { defaultSetConditionals, getDefaultForm } from 'lib/optimizer/defaultForm' +import { precomputeConditionalActivations } from 'lib/optimizer/rotation/rotationPreprocessor' +import { ConditionalSetMetadata } from 'lib/optimizer/rotation/setConditionalContent' +import DB from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { CharacterConditional, CharacterConditionalMap } from 'types/CharacterConditional' import { ConditionalMap, ContentItem } from 'types/Conditionals' import { Form, Teammate } from 'types/Form' -import { CharacterConditionals } from 'lib/characterConditionals' import { LightConeConditional, LightConeConditionalMap } from 'types/LightConeConditionals' -import { LightConeConditionals } from 'lib/lightConeConditionals' -import { defaultSetConditionals, getDefaultForm } from 'lib/defaultForm' -import { ConditionalDataType, SetsOrnaments, SetsOrnamentsNames, SetsRelics, SetsRelicsNames } from 'lib/constants' -import { SaveState } from 'lib/saveState' -import DB from 'lib/db' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { ConditionalSetMetadata } from 'lib/optimizer/rotation/setConditionalContent' -import { precomputeConditionalActivations } from 'lib/optimizer/rotation/rotationPreprocessor' export type ComboConditionals = { [key: string]: ComboConditionalCategory diff --git a/src/lib/optimizer/rotation/comboStateTransform.ts b/src/lib/optimizer/rotation/comboStateTransform.ts index c01670c29..5f2c778c4 100644 --- a/src/lib/optimizer/rotation/comboStateTransform.ts +++ b/src/lib/optimizer/rotation/comboStateTransform.ts @@ -1,7 +1,7 @@ -import { CharacterConditionals } from 'lib/characterConditionals' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { SACERDOS_RELIVED_ORDEAL_1_STACK, SACERDOS_RELIVED_ORDEAL_2_STACK, Sets } from 'lib/constants' import { DynamicConditional } from 'lib/gpu/conditionals/dynamicConditionals' -import { LightConeConditionals } from 'lib/lightConeConditionals' import { calculateContextConditionalRegistry } from 'lib/optimizer/calculateConditionals' import { baseComputedStatsArray, ComputedStatsArray, ComputedStatsArrayCore, Key, Source } from 'lib/optimizer/computedStatsArray' import { ComboConditionalCategory, ComboConditionals, ComboSelectConditional, ComboState, initializeComboState } from 'lib/optimizer/rotation/comboDrawerController' @@ -114,7 +114,7 @@ function precomputeConditionals(action: OptimizerAction, comboState: ComboState, } as OptimizerAction const teammateCharacterConditionals = CharacterConditionals.get(teammate.metadata) - const teammateLightConeConditionals = LightConeConditionals.get(teammate.metadata) as LightConeConditional + const teammateLightConeConditionals = LightConeConditionals.get(teammate.metadata) teammateCharacterConditionals.initializeTeammateConfigurations?.(x, teammateAction, context) teammateLightConeConditionals.initializeTeammateConfigurations?.(x, teammateAction, context) diff --git a/src/lib/relicAugmenter.ts b/src/lib/relics/relicAugmenter.ts similarity index 95% rename from src/lib/relicAugmenter.ts rename to src/lib/relics/relicAugmenter.ts index 88e733660..386ded9dc 100644 --- a/src/lib/relicAugmenter.ts +++ b/src/lib/relics/relicAugmenter.ts @@ -1,6 +1,6 @@ import { Constants, Stats } from 'lib/constants' -import { RelicRollFixer } from 'lib/relicRollFixer' -import { RelicRollGrader } from 'lib/relicRollGrader' +import { RelicRollFixer } from 'lib/relics/relicRollFixer' +import { RelicRollGrader } from 'lib/relics/relicRollGrader' import { Utils } from 'lib/utils' import { Relic } from 'types/Relic' diff --git a/src/lib/relicFilters.ts b/src/lib/relics/relicFilters.ts similarity index 99% rename from src/lib/relicFilters.ts rename to src/lib/relics/relicFilters.ts index dfebac229..23a285092 100644 --- a/src/lib/relicFilters.ts +++ b/src/lib/relics/relicFilters.ts @@ -1,10 +1,10 @@ import { Constants, Parts, RelicSetFilterOptions } from 'lib/constants' -import DB from 'lib/db' -import { Utils } from 'lib/utils' +import { RelicsByPart } from 'lib/gpu/webgpuTypes' +import DB from 'lib/state/db' import { TsUtils } from 'lib/TsUtils' -import { Relic } from 'types/Relic' +import { Utils } from 'lib/utils' import { Form } from 'types/Form' -import { RelicsByPart } from 'lib/gpu/webgpuTypes' +import { Relic } from 'types/Relic' export const RelicFilters = { calculateWeightScore: (request: Form, relics: Relic[]) => { diff --git a/src/lib/relicModalController.ts b/src/lib/relics/relicModalController.ts similarity index 96% rename from src/lib/relicModalController.ts rename to src/lib/relics/relicModalController.ts index fcbdd04b7..0c6460211 100644 --- a/src/lib/relicModalController.ts +++ b/src/lib/relics/relicModalController.ts @@ -1,11 +1,11 @@ import i18next from 'i18next' import { Constants, Stats, SubStats, SubStatValues } from 'lib/constants' -import DB from 'lib/db' -import { Message } from 'lib/message' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { RelicAugmenter } from 'lib/relicAugmenter' -import { RelicRollFixer } from 'lib/relicRollFixer' -import { SaveState } from 'lib/saveState' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { Message } from 'lib/interactions/message' +import { RelicAugmenter } from 'lib/relics/relicAugmenter' +import { RelicRollFixer } from 'lib/relics/relicRollFixer' +import DB from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { Utils } from 'lib/utils' import { Relic, RelicEnhance, RelicGrade, Stat } from 'types/Relic' diff --git a/src/lib/relicRollFixer.ts b/src/lib/relics/relicRollFixer.ts similarity index 99% rename from src/lib/relicRollFixer.ts rename to src/lib/relics/relicRollFixer.ts index 00d2e4aa1..8c087f5cb 100644 --- a/src/lib/relicRollFixer.ts +++ b/src/lib/relics/relicRollFixer.ts @@ -1,9 +1,9 @@ -import DB from 'lib/db' -import { Utils } from 'lib/utils' import { Constants } from 'lib/constants' -import { CharacterConverter } from './characterConverter' -import { Relic } from 'types/Relic' +import { CharacterConverter } from 'lib/importer/characterConverter' +import DB from 'lib/state/db' import { TsUtils } from 'lib/TsUtils' +import { Utils } from 'lib/utils' +import { Relic } from 'types/Relic' let optimizerStatToJsonSubStat: Record let optimizerStatToAffixStat: Record diff --git a/src/lib/relicRollGrader.test.ts b/src/lib/relics/relicRollGrader.test.ts similarity index 95% rename from src/lib/relicRollGrader.test.ts rename to src/lib/relics/relicRollGrader.test.ts index c9005dccd..be5555572 100644 --- a/src/lib/relicRollGrader.test.ts +++ b/src/lib/relics/relicRollGrader.test.ts @@ -1,7 +1,7 @@ import { Constants } from 'lib/constants' -import { DataParser } from 'lib/dataParser' -import DB from 'lib/db' -import { RelicRollGrader } from 'lib/relicRollGrader' +import { RelicRollGrader } from 'lib/relics/relicRollGrader' +import { DataParser } from 'lib/state/dataParser' +import DB from 'lib/state/db' import { Relic } from 'types/Relic' import { expect, test } from 'vitest' diff --git a/src/lib/relicRollGrader.ts b/src/lib/relics/relicRollGrader.ts similarity index 98% rename from src/lib/relicRollGrader.ts rename to src/lib/relics/relicRollGrader.ts index dd1160009..1a784dab9 100644 --- a/src/lib/relicRollGrader.ts +++ b/src/lib/relics/relicRollGrader.ts @@ -1,5 +1,5 @@ +import { SubStatValues } from 'lib/constants' import { Relic, StatRolls } from 'types/Relic' -import { SubStatValues } from './constants' // non exported interface, the number are float interface IncrementOptions { diff --git a/src/lib/relicScorer.test.ts b/src/lib/relics/relicScorer.test.ts similarity index 97% rename from src/lib/relicScorer.test.ts rename to src/lib/relics/relicScorer.test.ts index cf993b2d4..22cf13211 100644 --- a/src/lib/relicScorer.test.ts +++ b/src/lib/relics/relicScorer.test.ts @@ -1,10 +1,10 @@ -import { expect, test } from 'vitest' - -import { DataParser } from './dataParser' import { Constants, PartsMainStats } from 'lib/constants' -import { RelicScorer } from './relicScorerPotential' +import { RelicScorer } from 'lib/relics/relicScorerPotential' + +import { DataParser } from 'lib/state/dataParser' +import DB from 'lib/state/db' import { Relic } from 'types/Relic' -import DB from 'lib/db' +import { expect, test } from 'vitest' DataParser.parse() @@ -162,7 +162,7 @@ test('ideal-mainstats-includes-best-mainstats', () => { if (!PartsMainStats[part].includes(name)) { continue } - if (weight > best) { + if (weight > best) { // The best ideal mainstats is missing a possible mainstat that's higher weighted // than everything else didfail = true diff --git a/src/lib/relicScorerPotential.ts b/src/lib/relics/relicScorerPotential.ts similarity index 99% rename from src/lib/relicScorerPotential.ts rename to src/lib/relics/relicScorerPotential.ts index c94b5343f..7dd747eab 100644 --- a/src/lib/relicScorerPotential.ts +++ b/src/lib/relics/relicScorerPotential.ts @@ -1,11 +1,11 @@ import i18next from 'i18next' import { Constants, MainStats, MainStatsValues, Parts, PartsMainStats, Stats, StatsValues, SubStats, SubStatValues } from 'lib/constants' -import DB from 'lib/db' +import DB from 'lib/state/db' import { TsUtils } from 'lib/TsUtils' import { Utils } from 'lib/utils' import { Character, CharacterId } from 'types/Character' +import { GUID } from 'types/Common' import { Relic, RelicEnhance, RelicGrade, Stat } from 'types/Relic' -import { GUID } from '../types/Common' enum relicPotentialCases { SINGLE_STAT, diff --git a/src/lib/statCalculator.ts b/src/lib/relics/statCalculator.ts similarity index 98% rename from src/lib/statCalculator.ts rename to src/lib/relics/statCalculator.ts index 173192054..907b2b458 100644 --- a/src/lib/statCalculator.ts +++ b/src/lib/relics/statCalculator.ts @@ -1,5 +1,5 @@ import { Constants, SubStatValues } from 'lib/constants' -import { Utils } from './utils' +import { Utils } from 'lib/utils' import { Relic } from 'types/Relic' const maxedMainStats = { diff --git a/src/lib/substatRollTable.ts b/src/lib/relics/substatRollTable.ts similarity index 100% rename from src/lib/substatRollTable.ts rename to src/lib/relics/substatRollTable.ts diff --git a/src/lib/assets.ts b/src/lib/rendering/assets.ts similarity index 99% rename from src/lib/assets.ts rename to src/lib/rendering/assets.ts index 1d6480969..28ed578a6 100644 --- a/src/lib/assets.ts +++ b/src/lib/rendering/assets.ts @@ -1,5 +1,5 @@ import { Constants, Parts, SACERDOS_RELIVED_ORDEAL_1_STACK, SACERDOS_RELIVED_ORDEAL_2_STACK, Sets, setToId, Stats } from 'lib/constants' -import { BASE_PATH } from 'lib/db' +import { BASE_PATH } from 'lib/state/db' // let baseUrl = process.env.PUBLIC_URL // Local testing; // const baseUrl = 'https://d28ecrnsw8u0fj.cloudfront.net' diff --git a/src/lib/displayUtils.tsx b/src/lib/rendering/displayUtils.tsx similarity index 97% rename from src/lib/displayUtils.tsx rename to src/lib/rendering/displayUtils.tsx index 9c101438f..d23046ec8 100644 --- a/src/lib/displayUtils.tsx +++ b/src/lib/rendering/displayUtils.tsx @@ -1,6 +1,6 @@ import { Flex } from 'antd' import i18next from 'i18next' -import { Assets } from 'lib/assets' +import { Assets } from 'lib/rendering/assets' import { Character } from 'types/Character' import { ReactElement } from 'types/Components' diff --git a/src/lib/gradient.ts b/src/lib/rendering/gradient.ts similarity index 95% rename from src/lib/gradient.ts rename to src/lib/rendering/gradient.ts index 66d133fed..0f66f78ba 100644 --- a/src/lib/gradient.ts +++ b/src/lib/rendering/gradient.ts @@ -1,7 +1,7 @@ -import tinygradient from 'tinygradient' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { ColorThemeOverrides } from 'lib/theme' import type { GlobalToken } from 'antd/es/theme/interface' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { ColorThemeOverrides } from 'lib/rendering/theme' +import tinygradient from 'tinygradient' const optimizerGridGradient = tinygradient([ { color: '#5A1A06', pos: 0 }, // red @@ -48,7 +48,7 @@ export const Gradient = { }, getOptimizerColumnGradient: (params: GridParams) => { - const aggs = OptimizerTabController.getAggs() as GridAggregations + const aggs = OptimizerTabController.getAggs() try { const colId = params.column.colId diff --git a/src/lib/renderer.tsx b/src/lib/rendering/renderer.tsx similarity index 98% rename from src/lib/renderer.tsx rename to src/lib/rendering/renderer.tsx index f24ed73f2..01dad0a3b 100644 --- a/src/lib/renderer.tsx +++ b/src/lib/rendering/renderer.tsx @@ -1,10 +1,10 @@ import { CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons' import { Flex, Image, Tooltip } from 'antd' import i18next from 'i18next' -import { Assets } from 'lib/assets' import { Constants } from 'lib/constants' +import { Assets } from 'lib/rendering/assets' +import { Utils } from 'lib/utils' import { Relic, Stat } from 'types/Relic' -import { Utils } from './utils' export const Renderer = { floor: (x: { value: number }) => { diff --git a/src/lib/scrollController.ts b/src/lib/rendering/scrollController.ts similarity index 100% rename from src/lib/scrollController.ts rename to src/lib/rendering/scrollController.ts diff --git a/src/lib/theme.ts b/src/lib/rendering/theme.ts similarity index 100% rename from src/lib/theme.ts rename to src/lib/rendering/theme.ts diff --git a/src/lib/dataParser.ts b/src/lib/state/dataParser.ts similarity index 99% rename from src/lib/dataParser.ts rename to src/lib/state/dataParser.ts index 241044028..abc2cbd30 100644 --- a/src/lib/dataParser.ts +++ b/src/lib/state/dataParser.ts @@ -2,10 +2,10 @@ import { PresetEffects } from 'components/optimizerTab/optimizerForm/Recommended import gameData from 'data/game_data.json' with { type: 'json' } import relicMainAffixes from 'data/relic_main_affixes.json' with { type: 'json' } import relicSubAffixes from 'data/relic_sub_affixes.json' with { type: 'json' } -import { ScoringMetadata } from 'lib/characterScorer' +import { ScoringMetadata } from 'lib/characters/characterScorer' import { Constants, Parts, PartsMainStats, Sets, SetsRelics, Stats } from 'lib/constants' -import DB, { DBMetadata } from 'lib/db' import { SortOption } from 'lib/optimizer/sortOptions' +import DB, { DBMetadata } from 'lib/state/db' import { MetadataCharacter } from 'types/Character' import { LightCone } from 'types/LightCone' diff --git a/src/lib/db.ts b/src/lib/state/db.ts similarity index 98% rename from src/lib/db.ts rename to src/lib/state/db.ts index 7472e662a..d6ea433f5 100644 --- a/src/lib/db.ts +++ b/src/lib/state/db.ts @@ -2,17 +2,17 @@ import { OptimizerMenuIds } from 'components/optimizerTab/FormRow' import { StatSimTypes } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' import { DefaultSettingOptions, SettingOptions } from 'components/SettingsDrawer' import i18next from 'i18next' -import { ScoringMetadata, SimulationMetadata } from 'lib/characterScorer' +import { ScoringMetadata, SimulationMetadata } from 'lib/characters/characterScorer' +import { oldCharacterScoringMetadata } from 'lib/characters/oldCharacterScoringMetadata' import { COMPUTE_ENGINE_GPU_STABLE, ComputeEngine, Constants, CURRENT_OPTIMIZER_VERSION, DAMAGE_UPGRADES, DEFAULT_STAT_DISPLAY, Parts, Sets, SIMULATION_SCORE } from 'lib/constants' import { SavedSessionKeys } from 'lib/constantsSession' -import { getDefaultForm } from 'lib/defaultForm' -import { Message } from 'lib/message' -import { oldCharacterScoringMetadata } from 'lib/oldCharacterScoringMetadata' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { Message } from 'lib/interactions/message' +import { getDefaultForm } from 'lib/optimizer/defaultForm' import { ComboState } from 'lib/optimizer/rotation/comboDrawerController' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { RelicAugmenter } from 'lib/relicAugmenter' -import { SaveState } from 'lib/saveState' -import { Themes } from 'lib/theme' +import { RelicAugmenter } from 'lib/relics/relicAugmenter' +import { Themes } from 'lib/rendering/theme' +import { SaveState } from 'lib/state/saveState' import { TsUtils } from 'lib/TsUtils' import { Utils } from 'lib/utils' import { Character } from 'types/Character' diff --git a/src/lib/saveState.ts b/src/lib/state/saveState.ts similarity index 98% rename from src/lib/saveState.ts rename to src/lib/state/saveState.ts index 05d2a1a38..55749dd96 100644 --- a/src/lib/saveState.ts +++ b/src/lib/state/saveState.ts @@ -1,5 +1,5 @@ import { CURRENT_OPTIMIZER_VERSION } from 'lib/constants' -import DB from 'lib/db' +import DB from 'lib/state/db' import { HsrOptimizerSaveFormat } from 'types/store' let saveTimeout: NodeJS.Timeout | null diff --git a/src/lib/utils.js b/src/lib/utils.js index cc32209b9..cbe9d6f3e 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -1,10 +1,9 @@ -import DB from 'lib/db' -import { Constants } from 'lib/constants' -import { v4 as uuidv4 } from 'uuid' -import stringify from 'json-stable-stringify' - import * as htmlToImage from 'html-to-image' import i18next from 'i18next' +import stringify from 'json-stable-stringify' +import { Constants } from 'lib/constants' +import DB from 'lib/state/db' +import { v4 as uuidv4 } from 'uuid' console.debug = (...args) => { let messageConfig = '%c%s ' diff --git a/src/lib/worker/optimizerWorker.ts b/src/lib/worker/optimizerWorker.ts index 6527aca88..eb1a0f657 100644 --- a/src/lib/worker/optimizerWorker.ts +++ b/src/lib/worker/optimizerWorker.ts @@ -1,10 +1,10 @@ -import { BufferPacker } from 'lib/bufferPacker' -import { CharacterConditionals } from 'lib/characterConditionals' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' import { BasicStatsObject } from 'lib/conditionals/conditionalConstants' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { Constants, OrnamentSetToIndex, RelicSetToIndex, SetsOrnaments, SetsRelics, Stats, StatsValues } from 'lib/constants' import { DynamicConditional } from 'lib/gpu/conditionals/dynamicConditionals' import { RelicsByPart } from 'lib/gpu/webgpuTypes' -import { LightConeConditionals } from 'lib/lightConeConditionals' +import { BufferPacker } from 'lib/optimizer/bufferPacker' import { calculateContextConditionalRegistry, wrapTeammateDynamicConditional } from 'lib/optimizer/calculateConditionals' import { calculateBaseMultis, calculateDamage } from 'lib/optimizer/calculateDamage' import { baseCharacterStats, calculateBaseStats, calculateComputedStats, calculateElementalStats, calculateRelicStats, calculateSetCounts } from 'lib/optimizer/calculateStats' diff --git a/src/lib/workerPool.ts b/src/lib/worker/workerPool.ts similarity index 98% rename from src/lib/workerPool.ts rename to src/lib/worker/workerPool.ts index 590bd2810..020fbe26b 100644 --- a/src/lib/workerPool.ts +++ b/src/lib/worker/workerPool.ts @@ -1,6 +1,6 @@ -import { BufferPacker } from 'lib/bufferPacker' import { Constants } from 'lib/constants' import { RelicsByPart } from 'lib/gpu/webgpuTypes' +import { BufferPacker } from 'lib/optimizer/bufferPacker' import OptimizerWorker from 'lib/worker/optimizerWorker.ts?worker&inline' import { Form } from 'types/Form' import { OptimizerContext } from 'types/Optimizer' diff --git a/src/types/Form.d.ts b/src/types/Form.d.ts index 25d79b9df..67a1423b4 100644 --- a/src/types/Form.d.ts +++ b/src/types/Form.d.ts @@ -1,6 +1,6 @@ // import { } from "./Common"; import { SetsOrnaments } from 'lib/constants' -import { Simulation } from 'lib/statSimulationController' +import { Simulation } from 'lib/controllers/statSimulationController' import { CharacterId, Eidolon } from 'types/Character' import { CharacterConditionalMap } from 'types/CharacterConditional' import { SuperImpositionLevel } from 'types/LightCone' diff --git a/src/types/LightCone.d.ts b/src/types/LightCone.d.ts index 40060e6f2..9e3d345d9 100644 --- a/src/types/LightCone.d.ts +++ b/src/types/LightCone.d.ts @@ -1,7 +1,7 @@ import { StatsValues } from 'lib/constants' +import { PreconvertStatKey } from 'lib/importer/characterConverter' import { DataMineId } from './Common' import { LightConeRanksDescriptions } from './LightConeConditionals' -import { PreconvertStatKey } from 'lib/characterConverter' // TODO: We do a SuperImpositionLevel - 1 which requires this to be a number instead of 1 | 2 | 3... export type SuperImpositionLevel = number diff --git a/src/types/Relic.d.ts b/src/types/Relic.d.ts index 9f1576399..7ee597511 100644 --- a/src/types/Relic.d.ts +++ b/src/types/Relic.d.ts @@ -1,6 +1,6 @@ import { RelicScoringWeights } from 'components/RelicFilterBar' import { MainStats, Parts, Sets, StatsValues } from 'lib/constants' -import { AugmentedStats } from 'lib/relicAugmenter' +import { AugmentedStats } from 'lib/relics/relicAugmenter' import { GUID } from './Common' export type RelicGrade = 2 | 3 | 4 | 5 diff --git a/src/types/store.ts b/src/types/store.ts index b9048ecc9..434ebc4bb 100644 --- a/src/types/store.ts +++ b/src/types/store.ts @@ -1,7 +1,7 @@ import { StatSimTypes } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' -import { ScoringMetadata } from 'lib/characterScorer' +import { ScoringMetadata } from 'lib/characters/characterScorer' import { ComboState } from 'lib/optimizer/rotation/comboDrawerController' -import { ColorThemeOverrides } from 'lib/theme' +import { ColorThemeOverrides } from 'lib/rendering/theme' import { Form } from 'types/Form' import { ComputeEngine } from '../lib/constants' import { Build, Character, CharacterId } from './Character' diff --git a/src/window.d.ts b/src/window.d.ts index b23e982c0..08f9f467b 100644 --- a/src/window.d.ts +++ b/src/window.d.ts @@ -3,29 +3,29 @@ import { FormInstance } from 'antd/es/form/hooks/useForm' import { MessageInstance } from 'antd/es/message/interface' import { NotificationInstance } from 'antd/es/notification/interface' import { HookAPI } from 'antd/lib/modal/useModal' -import { Assets } from 'lib/assets' -import { BufferPacker } from 'lib/bufferPacker' -import { CharacterConditionals } from 'lib/characterConditionals' -import { CharacterConverter } from 'lib/characterConverter' -import { CharacterStats } from 'lib/characterStats' +import { CharacterStats } from 'lib/characters/characterStats' +import { CharacterConditionals } from 'lib/conditionals/characterConditionals' +import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { Constants } from 'lib/constants' -import { DataParser } from 'lib/dataParser' -import { DB } from 'lib/db' -import { Gradient } from 'lib/gradient' -import { Hint } from 'lib/hint' -import { LightConeConditionals } from 'lib/lightConeConditionals' -import { Message } from 'lib/message' -import { OptimizerTabController } from 'lib/optimizerTabController' -import { RelicAugmenter } from 'lib/relicAugmenter' -import { RelicFilters } from 'lib/relicFilters' -import { RelicRollFixer } from 'lib/relicRollFixer' -import { RelicScorer } from 'lib/relicScorerPotential' -import { Renderer } from 'lib/renderer' -import { SaveState } from 'lib/saveState' -import { StatCalculator } from 'lib/statCalculator' -import { ColorThemeOverrides } from 'lib/theme' +import { OptimizerTabController } from 'lib/controllers/optimizerTabController' +import { CharacterConverter } from 'lib/importer/characterConverter' +import { Hint } from 'lib/interactions/hint' +import { Message } from 'lib/interactions/message' +import { BufferPacker } from 'lib/optimizer/bufferPacker' +import { RelicAugmenter } from 'lib/relics/relicAugmenter' +import { RelicFilters } from 'lib/relics/relicFilters' +import { RelicRollFixer } from 'lib/relics/relicRollFixer' +import { RelicScorer } from 'lib/relics/relicScorerPotential' +import { StatCalculator } from 'lib/relics/statCalculator' +import { Assets } from 'lib/rendering/assets' +import { Gradient } from 'lib/rendering/gradient' +import { Renderer } from 'lib/rendering/renderer' +import { ColorThemeOverrides } from 'lib/rendering/theme' +import { DataParser } from 'lib/state/dataParser' +import { DB } from 'lib/state/db' +import { SaveState } from 'lib/state/saveState' import { Utils } from 'lib/utils' -import { WorkerPool } from 'lib/workerPool' +import { WorkerPool } from 'lib/worker/workerPool' import { DispatchWithoutAction, RefObject } from 'react' import { Build, Character } from 'types/Character' import { Form } from 'types/Form' From 1cc39619eb77ef92861cf9dc4633d5bb3cd19115 Mon Sep 17 00:00:00 2001 From: Fribbels Date: Sat, 9 Nov 2024 15:23:31 -0800 Subject: [PATCH 02/16] refactor: directory cleanup --- src/App.tsx | 8 ++--- src/components/CharacterCustomPortrait.tsx | 9 ++--- src/components/CharacterPreview.jsx | 22 ++++++------ src/components/{ => common}/Dividers.tsx | 0 src/components/{ => common}/HeaderText.tsx | 0 .../{ => common}/LoadingBlurredImage.tsx | 0 src/components/{ => common}/TooltipImage.tsx | 0 .../CharacterScoringSummary.tsx | 10 +++--- .../characterPreview/CharacterStatSummary.tsx | 2 +- .../characterPreview/Rarity.tsx | 0 .../characterPreview/StatRow.tsx | 2 +- .../characterPreview/StatText.tsx | 0 src/lib/characters/characterScorer.ts | 2 +- src/lib/controllers/optimizerTabController.ts | 2 +- .../controllers/statSimulationController.tsx | 4 +-- src/lib/gpu/webgpuOptimizer.ts | 2 +- .../layout}/LayoutHeader.tsx | 0 .../layout}/LayoutSider.tsx | 2 +- src/lib/optimizer/optimizer.ts | 4 +-- .../overlays/drawers}/MenuDrawer.tsx | 0 .../overlays/drawers}/SettingsDrawer.tsx | 0 .../overlays/modals}/BuildsModal.tsx | 4 +-- .../overlays/modals}/CharacterModal.tsx | 6 ++-- .../overlays/modals}/EditImageModal.tsx | 0 .../overlays/modals}/RelicModal.tsx | 2 +- .../overlays/modals}/SaveBuildModal.tsx | 0 .../overlays/modals}/ScoringModal.tsx | 2 +- .../overlays/modals}/SwitchRelicsModal.tsx | 2 +- src/lib/state/dataParser.ts | 2 +- src/lib/state/db.ts | 6 ++-- src/{components => lib/tabs}/Tabs.tsx | 24 ++++++------- .../tabs/changelog}/ChangelogTab.tsx | 2 +- .../tabs/characters}/CharacterTab.jsx | 20 +++++------ .../gettingStarted}/GettingStartedTab.tsx | 4 +-- .../homeTab => lib/tabs/home}/HomeTab.tsx | 0 .../tabs/import}/ClearDataSubmenu.tsx | 0 .../tabs/import}/ImportTab.tsx | 4 +-- .../tabs/import}/LoadDataSubmenu.tsx | 0 .../tabs/import}/ReliquaryDescription.tsx | 0 .../tabs/import}/ScannerImportSubmenu.tsx | 4 +-- .../tabs/import}/importerTabUiConstants.ts | 0 .../tabs/metadata}/MetadataTab.tsx | 0 .../tabs/optimizer}/FilterContainer.tsx | 0 .../tabs/optimizer}/FormCard.tsx | 2 +- .../tabs/optimizer}/FormRow.tsx | 0 .../tabs/optimizer}/OptimizerBuildPreview.tsx | 6 ++-- .../tabs/optimizer}/OptimizerForm.tsx | 36 +++++++++---------- .../tabs/optimizer}/OptimizerGrid.jsx | 10 +++--- .../optimizer}/OptimizerSuggestionsModal.tsx | 2 +- .../tabs/optimizer}/OptimizerTab.tsx | 12 +++---- .../tabs/optimizer}/Sidebar.tsx | 8 ++--- .../CharacterConditionalDisplay.tsx | 6 ++-- .../conditionals/DisplayFormControl.tsx | 6 ++-- .../conditionals/DisplayFullPassives.tsx | 0 .../optimizer}/conditionals/FormSelect.tsx | 2 +- .../optimizer}/conditionals/FormSlider.tsx | 2 +- .../optimizer}/conditionals/FormSwitch.tsx | 4 +-- .../LightConeConditionalDisplay.tsx | 6 ++-- .../optimizerForm/AdvancedOptionsPanel.tsx | 6 ++-- .../CardSelectModalComponents.tsx | 0 .../optimizerForm/CharacterSelect.tsx | 2 +- .../CharacterSelectorDisplay.tsx | 12 +++---- .../optimizerForm/CombatBuffsDrawer.tsx | 8 ++--- .../optimizer}/optimizerForm/ComboFilter.tsx | 8 ++--- .../EnemyConfigurationsDrawer.tsx | 4 +-- .../optimizer}/optimizerForm/FilterRow.tsx | 4 +-- .../optimizerForm/FormSetConditionals.jsx | 4 +-- .../optimizerForm/FormStatRollSlider.tsx | 0 .../optimizerForm/FormStatTextStyled.tsx | 0 .../optimizerForm/InputNumberStyled.tsx | 0 .../optimizerForm/LightConeSelect.tsx | 2 +- .../optimizerForm/OptimizerOptionsDisplay.tsx | 6 ++-- .../OptimizerTabCharacterPanel.tsx | 0 .../optimizerForm/OrnamentSetTagRenderer.tsx | 0 .../optimizerForm/OrnamentsOptions.tsx | 0 .../RecommendedPresetsButton.tsx | 0 .../optimizerForm/RelicMainSetFilters.tsx | 14 ++++---- .../optimizerForm/RelicSetTagRenderer.tsx | 0 .../optimizerForm/ResultFilters.tsx | 8 ++--- .../optimizer}/optimizerForm/SetsOptions.tsx | 0 .../optimizerForm/SimulatedBuildsGrid.tsx | 2 +- .../optimizerForm/StatSimulationDisplay.tsx | 14 ++++---- .../optimizerForm/SubstatWeightFilters.tsx | 6 ++-- .../optimizer}/optimizerForm/TeammateCard.tsx | 10 +++--- .../tabs/optimizer}/optimizerTabConstants.ts | 0 .../tabs/optimizer}/rotation/ComboDrawer.tsx | 12 +++---- .../tabs/relics}/RelicFilterBar.tsx | 8 ++--- .../tabs/relics}/RelicPreview.tsx | 0 .../tabs/relics}/RelicsTab.jsx | 12 +++---- .../tabs/showcase}/RelicScorerTab.jsx | 4 +-- .../tabs/webgpu}/WebgpuTab.tsx | 0 src/types/Conditionals.d.ts | 6 ++-- src/types/Relic.d.ts | 2 +- src/types/store.ts | 2 +- 94 files changed, 205 insertions(+), 204 deletions(-) rename src/components/{ => common}/Dividers.tsx (100%) rename src/components/{ => common}/HeaderText.tsx (100%) rename src/components/{ => common}/LoadingBlurredImage.tsx (100%) rename src/components/{ => common}/TooltipImage.tsx (100%) rename src/{components => lib}/characterPreview/CharacterScoringSummary.tsx (98%) rename src/{components => lib}/characterPreview/CharacterStatSummary.tsx (96%) rename src/{components => lib}/characterPreview/Rarity.tsx (100%) rename src/{components => lib}/characterPreview/StatRow.tsx (98%) rename src/{components => lib}/characterPreview/StatText.tsx (100%) rename src/{components => lib/layout}/LayoutHeader.tsx (100%) rename src/{components => lib/layout}/LayoutSider.tsx (91%) rename src/{components => lib/overlays/drawers}/MenuDrawer.tsx (100%) rename src/{components => lib/overlays/drawers}/SettingsDrawer.tsx (100%) rename src/{components => lib/overlays/modals}/BuildsModal.tsx (98%) rename src/{components => lib/overlays/modals}/CharacterModal.tsx (96%) rename src/{components => lib/overlays/modals}/EditImageModal.tsx (100%) rename src/{components => lib/overlays/modals}/RelicModal.tsx (99%) rename src/{components => lib/overlays/modals}/SaveBuildModal.tsx (100%) rename src/{components => lib/overlays/modals}/ScoringModal.tsx (99%) rename src/{components => lib/overlays/modals}/SwitchRelicsModal.tsx (98%) rename src/{components => lib/tabs}/Tabs.tsx (84%) rename src/{components => lib/tabs/changelog}/ChangelogTab.tsx (99%) rename src/{components => lib/tabs/characters}/CharacterTab.jsx (98%) rename src/{components => lib/tabs/gettingStarted}/GettingStartedTab.tsx (97%) rename src/{components/homeTab => lib/tabs/home}/HomeTab.tsx (100%) rename src/{components/importerTab => lib/tabs/import}/ClearDataSubmenu.tsx (100%) rename src/{components/importerTab => lib/tabs/import}/ImportTab.tsx (95%) rename src/{components/importerTab => lib/tabs/import}/LoadDataSubmenu.tsx (100%) rename src/{components/importerTab => lib/tabs/import}/ReliquaryDescription.tsx (100%) rename src/{components/importerTab => lib/tabs/import}/ScannerImportSubmenu.tsx (98%) rename src/{components/importerTab => lib/tabs/import}/importerTabUiConstants.ts (100%) rename src/{components/metadataTab => lib/tabs/metadata}/MetadataTab.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/FilterContainer.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/FormCard.tsx (93%) rename src/{components/optimizerTab => lib/tabs/optimizer}/FormRow.tsx (100%) rename src/{components => lib/tabs/optimizer}/OptimizerBuildPreview.tsx (96%) rename src/{components/optimizerTab => lib/tabs/optimizer}/OptimizerForm.tsx (83%) rename src/{components/optimizerTab => lib/tabs/optimizer}/OptimizerGrid.jsx (98%) rename src/{components/optimizerTab => lib/tabs/optimizer}/OptimizerSuggestionsModal.tsx (99%) rename src/{components/optimizerTab => lib/tabs/optimizer}/OptimizerTab.tsx (65%) rename src/{components/optimizerTab => lib/tabs/optimizer}/Sidebar.tsx (98%) rename src/{components/optimizerTab => lib/tabs/optimizer}/conditionals/CharacterConditionalDisplay.tsx (89%) rename src/{components/optimizerTab => lib/tabs/optimizer}/conditionals/DisplayFormControl.tsx (87%) rename src/{components/optimizerTab => lib/tabs/optimizer}/conditionals/DisplayFullPassives.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/conditionals/FormSelect.tsx (96%) rename src/{components/optimizerTab => lib/tabs/optimizer}/conditionals/FormSlider.tsx (98%) rename src/{components/optimizerTab => lib/tabs/optimizer}/conditionals/FormSwitch.tsx (92%) rename src/{components/optimizerTab => lib/tabs/optimizer}/conditionals/LightConeConditionalDisplay.tsx (90%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/AdvancedOptionsPanel.tsx (91%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/CardSelectModalComponents.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/CharacterSelect.tsx (98%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/CharacterSelectorDisplay.tsx (93%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/CombatBuffsDrawer.tsx (88%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/ComboFilter.tsx (95%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/EnemyConfigurationsDrawer.tsx (97%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/FilterRow.tsx (77%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/FormSetConditionals.jsx (99%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/FormStatRollSlider.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/FormStatTextStyled.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/InputNumberStyled.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/LightConeSelect.tsx (98%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/OptimizerOptionsDisplay.tsx (97%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/OptimizerTabCharacterPanel.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/OrnamentSetTagRenderer.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/OrnamentsOptions.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/RecommendedPresetsButton.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/RelicMainSetFilters.tsx (93%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/RelicSetTagRenderer.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/ResultFilters.tsx (88%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/SetsOptions.tsx (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/SimulatedBuildsGrid.tsx (97%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/StatSimulationDisplay.tsx (96%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/SubstatWeightFilters.tsx (84%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerForm/TeammateCard.tsx (97%) rename src/{components/optimizerTab => lib/tabs/optimizer}/optimizerTabConstants.ts (100%) rename src/{components/optimizerTab => lib/tabs/optimizer}/rotation/ComboDrawer.tsx (98%) rename src/{components => lib/tabs/relics}/RelicFilterBar.tsx (98%) rename src/{components => lib/tabs/relics}/RelicPreview.tsx (100%) rename src/{components => lib/tabs/relics}/RelicsTab.jsx (99%) rename src/{components => lib/tabs/showcase}/RelicScorerTab.jsx (99%) rename src/{components/webgpuTab => lib/tabs/webgpu}/WebgpuTab.tsx (100%) diff --git a/src/App.tsx b/src/App.tsx index 746f7f90b..d6ea3cbb8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,11 +1,11 @@ import { ConfigProvider, Layout, message, Modal, notification, theme } from 'antd' -import { LayoutHeader } from 'components/LayoutHeader' -import { LayoutSider } from 'components/LayoutSider' -import { SettingsDrawer } from 'components/SettingsDrawer' -import Tabs from 'components/Tabs' import { checkForUpdatesNotification } from 'lib/interactions/notifications' +import { LayoutHeader } from 'lib/layout/LayoutHeader' +import { LayoutSider } from 'lib/layout/LayoutSider' +import { SettingsDrawer } from 'lib/overlays/drawers/SettingsDrawer' import { Gradient } from 'lib/rendering/gradient' import DB from 'lib/state/db' +import Tabs from 'lib/tabs/Tabs' import React, { useEffect } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/CharacterCustomPortrait.tsx b/src/components/CharacterCustomPortrait.tsx index 0d2c8a3c8..1eb45d568 100644 --- a/src/components/CharacterCustomPortrait.tsx +++ b/src/components/CharacterCustomPortrait.tsx @@ -1,5 +1,5 @@ +import { LoadingBlurredImage } from 'components/common/LoadingBlurredImage' import { CustomImageConfig } from 'types/CustomImage' -import { LoadingBlurredImage } from 'components/LoadingBlurredImage' interface CharacterCustomPortraitProps { customPortrait: CustomImageConfig @@ -13,9 +13,10 @@ const CharacterCustomPortrait: React.FC = ({ const scaleWidth = parentW / customPortrait.customImageParams.croppedAreaPixels.width return ( -
    { diff --git a/src/components/optimizerTab/optimizerForm/CardSelectModalComponents.tsx b/src/lib/tabs/optimizer/optimizerForm/CardSelectModalComponents.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/CardSelectModalComponents.tsx rename to src/lib/tabs/optimizer/optimizerForm/CardSelectModalComponents.tsx diff --git a/src/components/optimizerTab/optimizerForm/CharacterSelect.tsx b/src/lib/tabs/optimizer/optimizerForm/CharacterSelect.tsx similarity index 98% rename from src/components/optimizerTab/optimizerForm/CharacterSelect.tsx rename to src/lib/tabs/optimizer/optimizerForm/CharacterSelect.tsx index acb0e38bf..18b1b6110 100644 --- a/src/components/optimizerTab/optimizerForm/CharacterSelect.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/CharacterSelect.tsx @@ -1,6 +1,6 @@ import { Button, Card, Flex, Input, InputRef, Modal, Select } from 'antd' -import { CardGridItemContent, generateElementTags, generatePathTags, SegmentedFilterRow } from 'components/optimizerTab/optimizerForm/CardSelectModalComponents' import { Assets } from 'lib/rendering/assets' +import { CardGridItemContent, generateElementTags, generatePathTags, SegmentedFilterRow } from 'lib/tabs/optimizer/optimizerForm/CardSelectModalComponents' import { Utils } from 'lib/utils' import * as React from 'react' import { useEffect, useMemo, useRef, useState } from 'react' diff --git a/src/components/optimizerTab/optimizerForm/CharacterSelectorDisplay.tsx b/src/lib/tabs/optimizer/optimizerForm/CharacterSelectorDisplay.tsx similarity index 93% rename from src/components/optimizerTab/optimizerForm/CharacterSelectorDisplay.tsx rename to src/lib/tabs/optimizer/optimizerForm/CharacterSelectorDisplay.tsx index fb9774eab..a892e81a8 100644 --- a/src/components/optimizerTab/optimizerForm/CharacterSelectorDisplay.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/CharacterSelectorDisplay.tsx @@ -1,13 +1,13 @@ import { Flex, Form, Select } from 'antd' -import { HeaderText } from 'components/HeaderText' -import CharacterSelect from 'components/optimizerTab/optimizerForm/CharacterSelect' -import LightConeSelect from 'components/optimizerTab/optimizerForm/LightConeSelect' -import RecommendedPresetsButton from 'components/optimizerTab/optimizerForm/RecommendedPresetsButton' -import { optimizerTabDefaultGap, panelWidth } from 'components/optimizerTab/optimizerTabConstants' -import { TooltipImage } from 'components/TooltipImage' +import { HeaderText } from 'components/common/HeaderText' +import { TooltipImage } from 'components/common/TooltipImage' import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { Hint } from 'lib/interactions/hint' import { SortOption } from 'lib/optimizer/sortOptions' +import CharacterSelect from 'lib/tabs/optimizer/optimizerForm/CharacterSelect' +import LightConeSelect from 'lib/tabs/optimizer/optimizerForm/LightConeSelect' +import RecommendedPresetsButton from 'lib/tabs/optimizer/optimizerForm/RecommendedPresetsButton' +import { optimizerTabDefaultGap, panelWidth } from 'lib/tabs/optimizer/optimizerTabConstants' import { Utils } from 'lib/utils' import { useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/CombatBuffsDrawer.tsx b/src/lib/tabs/optimizer/optimizerForm/CombatBuffsDrawer.tsx similarity index 88% rename from src/components/optimizerTab/optimizerForm/CombatBuffsDrawer.tsx rename to src/lib/tabs/optimizer/optimizerForm/CombatBuffsDrawer.tsx index 55f1b6681..a71e0faf4 100644 --- a/src/components/optimizerTab/optimizerForm/CombatBuffsDrawer.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/CombatBuffsDrawer.tsx @@ -1,9 +1,9 @@ import { Drawer, Flex, Form, Typography } from 'antd' -import { useMemo } from 'react' -import { defaultGap } from 'lib/constantsUi' -import { optimizerTabDefaultGap } from 'components/optimizerTab/optimizerTabConstants' -import InputNumberStyled from 'components/optimizerTab/optimizerForm/InputNumberStyled' import { CombatBuffs } from 'lib/constants' +import { defaultGap } from 'lib/constantsUi' +import InputNumberStyled from 'lib/tabs/optimizer/optimizerForm/InputNumberStyled' +import { optimizerTabDefaultGap } from 'lib/tabs/optimizer/optimizerTabConstants' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' const { Text } = Typography diff --git a/src/components/optimizerTab/optimizerForm/ComboFilter.tsx b/src/lib/tabs/optimizer/optimizerForm/ComboFilter.tsx similarity index 95% rename from src/components/optimizerTab/optimizerForm/ComboFilter.tsx rename to src/lib/tabs/optimizer/optimizerForm/ComboFilter.tsx index f8125d870..713c0d09b 100644 --- a/src/components/optimizerTab/optimizerForm/ComboFilter.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/ComboFilter.tsx @@ -1,11 +1,11 @@ import { SettingOutlined } from '@ant-design/icons' import { Button, Flex, Form, Input, Popconfirm, Radio, Segmented } from 'antd' import { FormInstance } from 'antd/es/form/hooks/useForm' -import { HeaderText } from 'components/HeaderText' -import InputNumberStyled from 'components/optimizerTab/optimizerForm/InputNumberStyled' -import { optimizerTabDefaultGap } from 'components/optimizerTab/optimizerTabConstants' -import { ComboDrawer } from 'components/optimizerTab/rotation/ComboDrawer' +import { HeaderText } from 'components/common/HeaderText' import DB from 'lib/state/db' +import InputNumberStyled from 'lib/tabs/optimizer/optimizerForm/InputNumberStyled' +import { optimizerTabDefaultGap } from 'lib/tabs/optimizer/optimizerTabConstants' +import { ComboDrawer } from 'lib/tabs/optimizer/rotation/ComboDrawer' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/EnemyConfigurationsDrawer.tsx b/src/lib/tabs/optimizer/optimizerForm/EnemyConfigurationsDrawer.tsx similarity index 97% rename from src/components/optimizerTab/optimizerForm/EnemyConfigurationsDrawer.tsx rename to src/lib/tabs/optimizer/optimizerForm/EnemyConfigurationsDrawer.tsx index b70b0fb8b..4b296108a 100644 --- a/src/components/optimizerTab/optimizerForm/EnemyConfigurationsDrawer.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/EnemyConfigurationsDrawer.tsx @@ -1,7 +1,7 @@ import { CheckOutlined, CloseOutlined } from '@ant-design/icons' import { Drawer, Flex, Form, Select, Switch, Typography } from 'antd' -import { HeaderText } from 'components/HeaderText' -import { TooltipImage } from 'components/TooltipImage' +import { HeaderText } from 'components/common/HeaderText' +import { TooltipImage } from 'components/common/TooltipImage' import { Hint } from 'lib/interactions/hint' import { Utils } from 'lib/utils' import { useMemo } from 'react' diff --git a/src/components/optimizerTab/optimizerForm/FilterRow.tsx b/src/lib/tabs/optimizer/optimizerForm/FilterRow.tsx similarity index 77% rename from src/components/optimizerTab/optimizerForm/FilterRow.tsx rename to src/lib/tabs/optimizer/optimizerForm/FilterRow.tsx index 5559ebd98..4bb975cd5 100644 --- a/src/components/optimizerTab/optimizerForm/FilterRow.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/FilterRow.tsx @@ -1,6 +1,6 @@ import { Flex, Form } from 'antd' -import InputNumberStyled from 'components/optimizerTab/optimizerForm/InputNumberStyled' -import FormStatTextStyled from 'components/optimizerTab/optimizerForm/FormStatTextStyled' +import FormStatTextStyled from 'lib/tabs/optimizer/optimizerForm/FormStatTextStyled' +import InputNumberStyled from 'lib/tabs/optimizer/optimizerForm/InputNumberStyled' const FilterRow = (props: { name: string; label: string }) => { return ( diff --git a/src/components/optimizerTab/optimizerForm/FormSetConditionals.jsx b/src/lib/tabs/optimizer/optimizerForm/FormSetConditionals.jsx similarity index 99% rename from src/components/optimizerTab/optimizerForm/FormSetConditionals.jsx rename to src/lib/tabs/optimizer/optimizerForm/FormSetConditionals.jsx index a00f9f211..afb966844 100644 --- a/src/components/optimizerTab/optimizerForm/FormSetConditionals.jsx +++ b/src/lib/tabs/optimizer/optimizerForm/FormSetConditionals.jsx @@ -1,7 +1,7 @@ import { Drawer, Flex, Form, Popover, Select, Switch, Typography } from 'antd' import ColorizeNumbers from 'components/common/ColorizeNumbers' -import { VerticalDivider } from 'components/Dividers' -import { HeaderText } from 'components/HeaderText' +import { VerticalDivider } from 'components/common/Dividers' +import { HeaderText } from 'components/common/HeaderText' import { Constants, setToId } from 'lib/constants' import { Assets } from 'lib/rendering/assets' import PropTypes from 'prop-types' diff --git a/src/components/optimizerTab/optimizerForm/FormStatRollSlider.tsx b/src/lib/tabs/optimizer/optimizerForm/FormStatRollSlider.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/FormStatRollSlider.tsx rename to src/lib/tabs/optimizer/optimizerForm/FormStatRollSlider.tsx diff --git a/src/components/optimizerTab/optimizerForm/FormStatTextStyled.tsx b/src/lib/tabs/optimizer/optimizerForm/FormStatTextStyled.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/FormStatTextStyled.tsx rename to src/lib/tabs/optimizer/optimizerForm/FormStatTextStyled.tsx diff --git a/src/components/optimizerTab/optimizerForm/InputNumberStyled.tsx b/src/lib/tabs/optimizer/optimizerForm/InputNumberStyled.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/InputNumberStyled.tsx rename to src/lib/tabs/optimizer/optimizerForm/InputNumberStyled.tsx diff --git a/src/components/optimizerTab/optimizerForm/LightConeSelect.tsx b/src/lib/tabs/optimizer/optimizerForm/LightConeSelect.tsx similarity index 98% rename from src/components/optimizerTab/optimizerForm/LightConeSelect.tsx rename to src/lib/tabs/optimizer/optimizerForm/LightConeSelect.tsx index 978cb66b3..eda46f089 100644 --- a/src/components/optimizerTab/optimizerForm/LightConeSelect.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/LightConeSelect.tsx @@ -1,7 +1,7 @@ import { Card, Flex, Input, InputRef, Modal, Select } from 'antd' -import { CardGridItemContent, generatePathTags, generateRarityTags, SegmentedFilterRow } from 'components/optimizerTab/optimizerForm/CardSelectModalComponents' import { Assets } from 'lib/rendering/assets' import DB from 'lib/state/db' +import { CardGridItemContent, generatePathTags, generateRarityTags, SegmentedFilterRow } from 'lib/tabs/optimizer/optimizerForm/CardSelectModalComponents' import { Utils } from 'lib/utils' import * as React from 'react' import { useEffect, useMemo, useRef, useState } from 'react' diff --git a/src/components/optimizerTab/optimizerForm/OptimizerOptionsDisplay.tsx b/src/lib/tabs/optimizer/optimizerForm/OptimizerOptionsDisplay.tsx similarity index 97% rename from src/components/optimizerTab/optimizerForm/OptimizerOptionsDisplay.tsx rename to src/lib/tabs/optimizer/optimizerForm/OptimizerOptionsDisplay.tsx index 885e0eedf..0789683f7 100644 --- a/src/components/optimizerTab/optimizerForm/OptimizerOptionsDisplay.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/OptimizerOptionsDisplay.tsx @@ -1,14 +1,14 @@ /* eslint-disable react/prop-types */ import { CheckOutlined, CloseOutlined } from '@ant-design/icons' import { Flex, Form, Select, Switch, Typography } from 'antd' -import { HeaderText } from 'components/HeaderText' -import { optimizerTabDefaultGap, panelWidth } from 'components/optimizerTab/optimizerTabConstants' -import { TooltipImage } from 'components/TooltipImage' +import { HeaderText } from 'components/common/HeaderText' +import { TooltipImage } from 'components/common/TooltipImage' import { Hint } from 'lib/interactions/hint' import { Assets } from 'lib/rendering/assets' import { generateCharacterList } from 'lib/rendering/displayUtils' import DB from 'lib/state/db' +import { optimizerTabDefaultGap, panelWidth } from 'lib/tabs/optimizer/optimizerTabConstants' import { Utils } from 'lib/utils' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/OptimizerTabCharacterPanel.tsx b/src/lib/tabs/optimizer/optimizerForm/OptimizerTabCharacterPanel.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/OptimizerTabCharacterPanel.tsx rename to src/lib/tabs/optimizer/optimizerForm/OptimizerTabCharacterPanel.tsx diff --git a/src/components/optimizerTab/optimizerForm/OrnamentSetTagRenderer.tsx b/src/lib/tabs/optimizer/optimizerForm/OrnamentSetTagRenderer.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/OrnamentSetTagRenderer.tsx rename to src/lib/tabs/optimizer/optimizerForm/OrnamentSetTagRenderer.tsx diff --git a/src/components/optimizerTab/optimizerForm/OrnamentsOptions.tsx b/src/lib/tabs/optimizer/optimizerForm/OrnamentsOptions.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/OrnamentsOptions.tsx rename to src/lib/tabs/optimizer/optimizerForm/OrnamentsOptions.tsx diff --git a/src/components/optimizerTab/optimizerForm/RecommendedPresetsButton.tsx b/src/lib/tabs/optimizer/optimizerForm/RecommendedPresetsButton.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/RecommendedPresetsButton.tsx rename to src/lib/tabs/optimizer/optimizerForm/RecommendedPresetsButton.tsx diff --git a/src/components/optimizerTab/optimizerForm/RelicMainSetFilters.tsx b/src/lib/tabs/optimizer/optimizerForm/RelicMainSetFilters.tsx similarity index 93% rename from src/components/optimizerTab/optimizerForm/RelicMainSetFilters.tsx rename to src/lib/tabs/optimizer/optimizerForm/RelicMainSetFilters.tsx index bb77515e6..557ce96e1 100644 --- a/src/components/optimizerTab/optimizerForm/RelicMainSetFilters.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/RelicMainSetFilters.tsx @@ -1,15 +1,15 @@ import { SettingOutlined } from '@ant-design/icons' import { Button, Cascader, Flex, Form, Select } from 'antd' -import { HeaderText } from 'components/HeaderText' -import { OrnamentSetTagRenderer } from 'components/optimizerTab/optimizerForm/OrnamentSetTagRenderer' -import GenerateOrnamentsOptions from 'components/optimizerTab/optimizerForm/OrnamentsOptions' -import { RelicSetTagRenderer } from 'components/optimizerTab/optimizerForm/RelicSetTagRenderer' -import GenerateSetsOptions from 'components/optimizerTab/optimizerForm/SetsOptions' -import { optimizerTabDefaultGap, panelWidth } from 'components/optimizerTab/optimizerTabConstants' -import { TooltipImage } from 'components/TooltipImage' +import { HeaderText } from 'components/common/HeaderText' +import { TooltipImage } from 'components/common/TooltipImage' import { Constants, Parts } from 'lib/constants' import { Hint } from 'lib/interactions/hint' import { Assets } from 'lib/rendering/assets' +import { OrnamentSetTagRenderer } from 'lib/tabs/optimizer/optimizerForm/OrnamentSetTagRenderer' +import GenerateOrnamentsOptions from 'lib/tabs/optimizer/optimizerForm/OrnamentsOptions' +import { RelicSetTagRenderer } from 'lib/tabs/optimizer/optimizerForm/RelicSetTagRenderer' +import GenerateSetsOptions from 'lib/tabs/optimizer/optimizerForm/SetsOptions' +import { optimizerTabDefaultGap, panelWidth } from 'lib/tabs/optimizer/optimizerTabConstants' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/RelicSetTagRenderer.tsx b/src/lib/tabs/optimizer/optimizerForm/RelicSetTagRenderer.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/RelicSetTagRenderer.tsx rename to src/lib/tabs/optimizer/optimizerForm/RelicSetTagRenderer.tsx diff --git a/src/components/optimizerTab/optimizerForm/ResultFilters.tsx b/src/lib/tabs/optimizer/optimizerForm/ResultFilters.tsx similarity index 88% rename from src/components/optimizerTab/optimizerForm/ResultFilters.tsx rename to src/lib/tabs/optimizer/optimizerForm/ResultFilters.tsx index 4a100a53f..30dff7520 100644 --- a/src/components/optimizerTab/optimizerForm/ResultFilters.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/ResultFilters.tsx @@ -1,9 +1,9 @@ import { Flex } from 'antd' -import { HeaderText } from 'components/HeaderText' -import FilterRow from 'components/optimizerTab/optimizerForm/FilterRow' -import { optimizerTabDefaultGap } from 'components/optimizerTab/optimizerTabConstants' -import { TooltipImage } from 'components/TooltipImage' +import { HeaderText } from 'components/common/HeaderText' +import { TooltipImage } from 'components/common/TooltipImage' import { Hint } from 'lib/interactions/hint' +import FilterRow from 'lib/tabs/optimizer/optimizerForm/FilterRow' +import { optimizerTabDefaultGap } from 'lib/tabs/optimizer/optimizerTabConstants' import { useTranslation } from 'react-i18next' export const MinMaxStatFilters = () => { diff --git a/src/components/optimizerTab/optimizerForm/SetsOptions.tsx b/src/lib/tabs/optimizer/optimizerForm/SetsOptions.tsx similarity index 100% rename from src/components/optimizerTab/optimizerForm/SetsOptions.tsx rename to src/lib/tabs/optimizer/optimizerForm/SetsOptions.tsx diff --git a/src/components/optimizerTab/optimizerForm/SimulatedBuildsGrid.tsx b/src/lib/tabs/optimizer/optimizerForm/SimulatedBuildsGrid.tsx similarity index 97% rename from src/components/optimizerTab/optimizerForm/SimulatedBuildsGrid.tsx rename to src/lib/tabs/optimizer/optimizerForm/SimulatedBuildsGrid.tsx index 1efe6baaf..f96a1972f 100644 --- a/src/components/optimizerTab/optimizerForm/SimulatedBuildsGrid.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/SimulatedBuildsGrid.tsx @@ -1,8 +1,8 @@ import { CloseOutlined } from '@ant-design/icons' import { IRowNode } from 'ag-grid-community' import { Empty, Flex, Table, TableColumnsType } from 'antd' -import { STAT_SIMULATION_GRID_WIDTH } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' import { deleteStatSimulationBuild, renderDefaultSimulationName } from 'lib/controllers/statSimulationController' +import { STAT_SIMULATION_GRID_WIDTH } from 'lib/tabs/optimizer/optimizerForm/StatSimulationDisplay' import { Utils } from 'lib/utils' import { useEffect } from 'react' import { useTranslation } from 'react-i18next' diff --git a/src/components/optimizerTab/optimizerForm/StatSimulationDisplay.tsx b/src/lib/tabs/optimizer/optimizerForm/StatSimulationDisplay.tsx similarity index 96% rename from src/components/optimizerTab/optimizerForm/StatSimulationDisplay.tsx rename to src/lib/tabs/optimizer/optimizerForm/StatSimulationDisplay.tsx index 59e9b2ec9..da17e678a 100644 --- a/src/components/optimizerTab/optimizerForm/StatSimulationDisplay.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/StatSimulationDisplay.tsx @@ -1,18 +1,18 @@ import { DeleteOutlined, DoubleLeftOutlined, DownOutlined, SettingOutlined, UpOutlined } from '@ant-design/icons' import { Button, Flex, Form, Input, InputNumber, Popconfirm, Radio, Select, Typography } from 'antd' -import { HeaderText } from 'components/HeaderText' -import { OrnamentSetTagRenderer } from 'components/optimizerTab/optimizerForm/OrnamentSetTagRenderer' -import GenerateOrnamentsOptions from 'components/optimizerTab/optimizerForm/OrnamentsOptions' -import { GenerateBasicSetsOptions } from 'components/optimizerTab/optimizerForm/SetsOptions' -import { SimulatedBuildsGrid } from 'components/optimizerTab/optimizerForm/SimulatedBuildsGrid' +import { VerticalDivider } from 'components/common/Dividers' +import { HeaderText } from 'components/common/HeaderText' import { Parts, Stats, SubStats } from 'lib/constants' import { deleteAllStatSimulationBuilds, importOptimizerBuild, saveStatSimulationBuildFromForm, startOptimizerStatSimulation } from 'lib/controllers/statSimulationController' import { Assets } from 'lib/rendering/assets' +import FormCard from 'lib/tabs/optimizer/FormCard' +import { OrnamentSetTagRenderer } from 'lib/tabs/optimizer/optimizerForm/OrnamentSetTagRenderer' +import GenerateOrnamentsOptions from 'lib/tabs/optimizer/optimizerForm/OrnamentsOptions' +import { GenerateBasicSetsOptions } from 'lib/tabs/optimizer/optimizerForm/SetsOptions' +import { SimulatedBuildsGrid } from 'lib/tabs/optimizer/optimizerForm/SimulatedBuildsGrid' import { Utils } from 'lib/utils' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { VerticalDivider } from '../../Dividers' -import FormCard from '../FormCard' const { Text } = Typography diff --git a/src/components/optimizerTab/optimizerForm/SubstatWeightFilters.tsx b/src/lib/tabs/optimizer/optimizerForm/SubstatWeightFilters.tsx similarity index 84% rename from src/components/optimizerTab/optimizerForm/SubstatWeightFilters.tsx rename to src/lib/tabs/optimizer/optimizerForm/SubstatWeightFilters.tsx index ec499b6d4..d4238c83c 100644 --- a/src/components/optimizerTab/optimizerForm/SubstatWeightFilters.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/SubstatWeightFilters.tsx @@ -1,8 +1,8 @@ import { Flex } from 'antd' -import { HeaderText } from 'components/HeaderText' -import { FormStatRollSliders, FormStatRollSliderTopPercent } from 'components/optimizerTab/optimizerForm/FormStatRollSlider' -import { TooltipImage } from 'components/TooltipImage' +import { HeaderText } from 'components/common/HeaderText' +import { TooltipImage } from 'components/common/TooltipImage' import { Hint } from 'lib/interactions/hint' +import { FormStatRollSliders, FormStatRollSliderTopPercent } from 'lib/tabs/optimizer/optimizerForm/FormStatRollSlider' import { useTranslation } from 'react-i18next' export const SubstatWeightFilters = () => { diff --git a/src/components/optimizerTab/optimizerForm/TeammateCard.tsx b/src/lib/tabs/optimizer/optimizerForm/TeammateCard.tsx similarity index 97% rename from src/components/optimizerTab/optimizerForm/TeammateCard.tsx rename to src/lib/tabs/optimizer/optimizerForm/TeammateCard.tsx index 01a6ad40f..722e781a8 100644 --- a/src/components/optimizerTab/optimizerForm/TeammateCard.tsx +++ b/src/lib/tabs/optimizer/optimizerForm/TeammateCard.tsx @@ -1,10 +1,5 @@ import { SyncOutlined } from '@ant-design/icons' import { Button, Flex, Form as AntDForm, Select, Typography } from 'antd' -import { CharacterConditionalDisplay } from 'components/optimizerTab/conditionals/CharacterConditionalDisplay' -import { LightConeConditionalDisplay } from 'components/optimizerTab/conditionals/LightConeConditionalDisplay' -import FormCard from 'components/optimizerTab/FormCard' -import CharacterSelect from 'components/optimizerTab/optimizerForm/CharacterSelect' -import LightConeSelect from 'components/optimizerTab/optimizerForm/LightConeSelect' import { CharacterConditionals } from 'lib/conditionals/characterConditionals' import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { Constants, SACERDOS_RELIVED_ORDEAL_1_STACK, SACERDOS_RELIVED_ORDEAL_2_STACK, Sets } from 'lib/constants' @@ -12,6 +7,11 @@ import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { Message } from 'lib/interactions/message' import { Assets } from 'lib/rendering/assets' import DB from 'lib/state/db' +import { CharacterConditionalDisplay } from 'lib/tabs/optimizer/conditionals/CharacterConditionalDisplay' +import { LightConeConditionalDisplay } from 'lib/tabs/optimizer/conditionals/LightConeConditionalDisplay' +import FormCard from 'lib/tabs/optimizer/FormCard' +import CharacterSelect from 'lib/tabs/optimizer/optimizerForm/CharacterSelect' +import LightConeSelect from 'lib/tabs/optimizer/optimizerForm/LightConeSelect' import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { Character } from 'types/Character' diff --git a/src/components/optimizerTab/optimizerTabConstants.ts b/src/lib/tabs/optimizer/optimizerTabConstants.ts similarity index 100% rename from src/components/optimizerTab/optimizerTabConstants.ts rename to src/lib/tabs/optimizer/optimizerTabConstants.ts diff --git a/src/components/optimizerTab/rotation/ComboDrawer.tsx b/src/lib/tabs/optimizer/rotation/ComboDrawer.tsx similarity index 98% rename from src/components/optimizerTab/rotation/ComboDrawer.tsx rename to src/lib/tabs/optimizer/rotation/ComboDrawer.tsx index e75f9dd28..c5d622075 100644 --- a/src/components/optimizerTab/rotation/ComboDrawer.tsx +++ b/src/lib/tabs/optimizer/rotation/ComboDrawer.tsx @@ -2,12 +2,6 @@ import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons' import { Button, Divider, Drawer, Flex, Select } from 'antd' import { ColorizedLinkWithIcon } from 'components/common/ColorizedLink' import ColorizeNumbers from 'components/common/ColorizeNumbers' -import { FormSelectWithPopover } from 'components/optimizerTab/conditionals/FormSelect' -import { FormSliderWithPopover } from 'components/optimizerTab/conditionals/FormSlider' -import { FormSwitchWithPopover } from 'components/optimizerTab/conditionals/FormSwitch' -import { OrnamentSetTagRenderer } from 'components/optimizerTab/optimizerForm/OrnamentSetTagRenderer' -import GenerateOrnamentsOptions from 'components/optimizerTab/optimizerForm/OrnamentsOptions' -import { GenerateBasicSetsOptions } from 'components/optimizerTab/optimizerForm/SetsOptions' import { CharacterConditionals } from 'lib/conditionals/characterConditionals' import { LightConeConditionals } from 'lib/conditionals/lightConeConditionals' import { ConditionalDataType, setToId } from 'lib/constants' @@ -36,6 +30,12 @@ import { import { ConditionalSetMetadata, generateSetConditionalContent } from 'lib/optimizer/rotation/setConditionalContent' import { Assets } from 'lib/rendering/assets' import { lockScroll, unlockScroll } from 'lib/rendering/scrollController' +import { FormSelectWithPopover } from 'lib/tabs/optimizer/conditionals/FormSelect' +import { FormSliderWithPopover } from 'lib/tabs/optimizer/conditionals/FormSlider' +import { FormSwitchWithPopover } from 'lib/tabs/optimizer/conditionals/FormSwitch' +import { OrnamentSetTagRenderer } from 'lib/tabs/optimizer/optimizerForm/OrnamentSetTagRenderer' +import GenerateOrnamentsOptions from 'lib/tabs/optimizer/optimizerForm/OrnamentsOptions' +import { GenerateBasicSetsOptions } from 'lib/tabs/optimizer/optimizerForm/SetsOptions' import React, { useEffect, useMemo, useRef } from 'react' import { useTranslation } from 'react-i18next' import Selecto from 'react-selecto' diff --git a/src/components/RelicFilterBar.tsx b/src/lib/tabs/relics/RelicFilterBar.tsx similarity index 98% rename from src/components/RelicFilterBar.tsx rename to src/lib/tabs/relics/RelicFilterBar.tsx index a62252553..9c3bcb388 100644 --- a/src/components/RelicFilterBar.tsx +++ b/src/lib/tabs/relics/RelicFilterBar.tsx @@ -1,24 +1,24 @@ import { ClearOutlined } from '@ant-design/icons' import { Button, Flex, Select, theme, Tooltip, Typography } from 'antd' import CheckableTag from 'antd/lib/tag/CheckableTag' -import { HeaderText } from 'components/HeaderText' -import CharacterSelect from 'components/optimizerTab/optimizerForm/CharacterSelect' -import { SettingOptions } from 'components/SettingsDrawer' +import { HeaderText } from 'components/common/HeaderText' +import { TooltipImage } from 'components/common/TooltipImage' import { useSubscribe } from 'hooks/useSubscribe' import { Constants, Sets, SetsRelics, setToId, Stats, UnreleasedSets } from 'lib/constants' import { Hint } from 'lib/interactions/hint' +import { SettingOptions } from 'lib/overlays/drawers/SettingsDrawer' import { RelicScorer } from 'lib/relics/relicScorerPotential' import { Assets } from 'lib/rendering/assets' import { Renderer } from 'lib/rendering/renderer' import DB, { DBMetadataCharacter } from 'lib/state/db' import { SaveState } from 'lib/state/saveState' +import CharacterSelect from 'lib/tabs/optimizer/optimizerForm/CharacterSelect' import { TsUtils } from 'lib/TsUtils' import { Utils } from 'lib/utils' import React, { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { ReactElement } from 'types/Components' import { Relic } from 'types/Relic' -import { TooltipImage } from './TooltipImage' const { useToken } = theme const { Text } = Typography diff --git a/src/components/RelicPreview.tsx b/src/lib/tabs/relics/RelicPreview.tsx similarity index 100% rename from src/components/RelicPreview.tsx rename to src/lib/tabs/relics/RelicPreview.tsx diff --git a/src/components/RelicsTab.jsx b/src/lib/tabs/relics/RelicsTab.jsx similarity index 99% rename from src/components/RelicsTab.jsx rename to src/lib/tabs/relics/RelicsTab.jsx index a4ce9d6e7..bee143a48 100644 --- a/src/components/RelicsTab.jsx +++ b/src/lib/tabs/relics/RelicsTab.jsx @@ -1,14 +1,13 @@ import { SettingOutlined } from '@ant-design/icons' import { AgGridReact } from 'ag-grid-react' import { Button, Flex, InputNumber, Popconfirm, Popover, Select, theme, Typography } from 'antd' -import { HeaderText } from 'components/HeaderText' -import RelicFilterBar from 'components/RelicFilterBar' - -import { RelicPreview } from 'components/RelicPreview' +import { HeaderText } from 'components/common/HeaderText' +import { TooltipImage } from 'components/common/TooltipImage' import { Constants, Stats } from 'lib/constants' import { arrowKeyGridNavigation } from 'lib/interactions/arrowKeyGridNavigation' import { Hint } from 'lib/interactions/hint' import { Message } from 'lib/interactions/message' +import RelicModal from 'lib/overlays/modals/RelicModal.tsx' import { RelicModalController } from 'lib/relics/relicModalController' import { RelicScorer } from 'lib/relics/relicScorerPotential' import { Assets } from 'lib/rendering/assets' @@ -17,12 +16,13 @@ import { Renderer } from 'lib/rendering/renderer' import { getGridTheme } from 'lib/rendering/theme' import DB from 'lib/state/db' import { SaveState } from 'lib/state/saveState' +import RelicFilterBar from 'lib/tabs/relics/RelicFilterBar' + +import { RelicPreview } from 'lib/tabs/relics/RelicPreview' import PropTypes from 'prop-types' import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import Plot from 'react-plotly.js' -import RelicModal from './RelicModal.tsx' -import { TooltipImage } from './TooltipImage' const { useToken } = theme diff --git a/src/components/RelicScorerTab.jsx b/src/lib/tabs/showcase/RelicScorerTab.jsx similarity index 99% rename from src/components/RelicScorerTab.jsx rename to src/lib/tabs/showcase/RelicScorerTab.jsx index 76cdedd24..69b2e6d53 100644 --- a/src/components/RelicScorerTab.jsx +++ b/src/lib/tabs/showcase/RelicScorerTab.jsx @@ -7,18 +7,18 @@ import Icon, { LineChartOutlined, } from '@ant-design/icons' import { Button, Dropdown, Flex, Form, Input, Segmented, theme, Typography } from 'antd' -import CharacterModal from 'components/CharacterModal' import { CharacterPreview } from 'components/CharacterPreview' -import { applySpdPreset } from 'components/optimizerTab/optimizerForm/RecommendedPresetsButton' import { Constants, CURRENT_DATA_VERSION, officialOnly } from 'lib/constants' import { SavedSessionKeys } from 'lib/constantsSession' import { OptimizerTabController } from 'lib/controllers/optimizerTabController' import { CharacterConverter } from 'lib/importer/characterConverter' import { Message } from 'lib/interactions/message' import { calculateBuild } from 'lib/optimizer/calculateBuild' +import CharacterModal from 'lib/overlays/modals/CharacterModal' import { Assets } from 'lib/rendering/assets' import DB, { AppPages, PageToRoute } from 'lib/state/db' import { SaveState } from 'lib/state/saveState' +import { applySpdPreset } from 'lib/tabs/optimizer/optimizerForm/RecommendedPresetsButton' import { Utils } from 'lib/utils' import PropTypes from 'prop-types' import React, { useEffect, useMemo, useRef, useState } from 'react' diff --git a/src/components/webgpuTab/WebgpuTab.tsx b/src/lib/tabs/webgpu/WebgpuTab.tsx similarity index 100% rename from src/components/webgpuTab/WebgpuTab.tsx rename to src/lib/tabs/webgpu/WebgpuTab.tsx diff --git a/src/types/Conditionals.d.ts b/src/types/Conditionals.d.ts index 7fcb2a256..f2d6b8d29 100644 --- a/src/types/Conditionals.d.ts +++ b/src/types/Conditionals.d.ts @@ -1,8 +1,8 @@ -import { FormSelectWithPopoverProps } from 'components/optimizerTab/conditionals/FormSelect' -import { FormSliderWithPopoverProps } from 'components/optimizerTab/conditionals/FormSlider' -import { FormSwitchWithPopoverProps } from 'components/optimizerTab/conditionals/FormSwitch' import { DynamicConditional } from 'lib/gpu/conditionals/dynamicConditionals' import { ComputedStatsArray } from 'lib/optimizer/computedStatsArray' +import { FormSelectWithPopoverProps } from 'lib/tabs/optimizer/conditionals/FormSelect' +import { FormSliderWithPopoverProps } from 'lib/tabs/optimizer/conditionals/FormSlider' +import { FormSwitchWithPopoverProps } from 'lib/tabs/optimizer/conditionals/FormSwitch' import { ComponentProps, ComponentType } from 'react' import { OptimizerAction, OptimizerContext } from 'types/Optimizer' diff --git a/src/types/Relic.d.ts b/src/types/Relic.d.ts index 7ee597511..47fc64f3d 100644 --- a/src/types/Relic.d.ts +++ b/src/types/Relic.d.ts @@ -1,6 +1,6 @@ -import { RelicScoringWeights } from 'components/RelicFilterBar' import { MainStats, Parts, Sets, StatsValues } from 'lib/constants' import { AugmentedStats } from 'lib/relics/relicAugmenter' +import { RelicScoringWeights } from 'lib/tabs/relics/RelicFilterBar' import { GUID } from './Common' export type RelicGrade = 2 | 3 | 4 | 5 diff --git a/src/types/store.ts b/src/types/store.ts index 434ebc4bb..da74bdebd 100644 --- a/src/types/store.ts +++ b/src/types/store.ts @@ -1,7 +1,7 @@ -import { StatSimTypes } from 'components/optimizerTab/optimizerForm/StatSimulationDisplay' import { ScoringMetadata } from 'lib/characters/characterScorer' import { ComboState } from 'lib/optimizer/rotation/comboDrawerController' import { ColorThemeOverrides } from 'lib/rendering/theme' +import { StatSimTypes } from 'lib/tabs/optimizer/optimizerForm/StatSimulationDisplay' import { Form } from 'types/Form' import { ComputeEngine } from '../lib/constants' import { Build, Character, CharacterId } from './Character' From 40f8ec4e6029021e93c19c9754a872b35404434c Mon Sep 17 00:00:00 2001 From: Fribbels Date: Sat, 9 Nov 2024 15:36:41 -0800 Subject: [PATCH 03/16] refactor: directory cleanup --- .../characterPreview}/CharacterCustomPortrait.tsx | 2 +- .../characterPreview}/CharacterPreview.jsx | 6 +++--- src/lib/characterPreview/CharacterScoringSummary.tsx | 6 +++--- .../interactions}/LanguageSelector.tsx | 0 src/lib/interactions/notifications.tsx | 5 +++-- src/lib/layout/LayoutHeader.tsx | 2 +- src/lib/overlays/modals/BuildsModal.tsx | 4 ++-- src/lib/overlays/modals/CharacterModal.tsx | 2 +- src/lib/overlays/modals/RelicModal.tsx | 2 +- src/lib/overlays/modals/ScoringModal.tsx | 2 +- src/lib/overlays/modals/SwitchRelicsModal.tsx | 2 +- src/lib/tabs/Tabs.tsx | 6 +++--- src/lib/tabs/changelog/ChangelogTab.tsx | 2 +- src/lib/tabs/characters/CharacterTab.jsx | 2 +- src/lib/tabs/gettingStarted/GettingStartedTab.tsx | 2 +- src/lib/tabs/home/HomeTab.tsx | 2 +- src/lib/tabs/import/ImportTab.tsx | 4 ++-- src/lib/tabs/import/ReliquaryDescription.tsx | 4 ++-- src/lib/tabs/import/ScannerImportSubmenu.tsx | 12 ++++++------ src/lib/tabs/optimizer/OptimizerSuggestionsModal.tsx | 2 +- src/lib/tabs/optimizer/Sidebar.tsx | 4 ++-- .../conditionals/CharacterConditionalDisplay.tsx | 4 ++-- .../optimizer/conditionals/DisplayFormControl.tsx | 2 +- .../optimizer/conditionals/DisplayFullPassives.tsx | 4 ++-- src/lib/tabs/optimizer/conditionals/FormSelect.tsx | 2 +- src/lib/tabs/optimizer/conditionals/FormSlider.tsx | 2 +- src/lib/tabs/optimizer/conditionals/FormSwitch.tsx | 2 +- .../conditionals/LightConeConditionalDisplay.tsx | 4 ++-- .../optimizer/optimizerForm/AdvancedOptionsPanel.tsx | 2 +- .../optimizerForm/CharacterSelectorDisplay.tsx | 4 ++-- src/lib/tabs/optimizer/optimizerForm/ComboFilter.tsx | 2 +- .../optimizerForm/EnemyConfigurationsDrawer.tsx | 4 ++-- .../optimizer/optimizerForm/FormSetConditionals.jsx | 6 +++--- .../optimizerForm/OptimizerOptionsDisplay.tsx | 4 ++-- .../optimizer/optimizerForm/RelicMainSetFilters.tsx | 4 ++-- .../tabs/optimizer/optimizerForm/ResultFilters.tsx | 4 ++-- .../optimizerForm/StatSimulationDisplay.tsx | 4 ++-- .../optimizer/optimizerForm/SubstatWeightFilters.tsx | 4 ++-- src/lib/tabs/optimizer/rotation/ComboDrawer.tsx | 4 ++-- src/lib/tabs/relics/RelicFilterBar.tsx | 4 ++-- src/lib/tabs/relics/RelicPreview.tsx | 4 ++-- src/lib/tabs/relics/RelicsTab.jsx | 4 ++-- .../tabs/relics}/relicPreview/GenerateStat.tsx | 2 +- .../tabs/relics}/relicPreview/RelicStatText.tsx | 0 src/lib/tabs/showcase/RelicScorerTab.jsx | 2 +- .../common => lib/ui}/ColorizeNumbers.tsx | 0 src/{components/common => lib/ui}/ColorizedLink.tsx | 0 src/{components/common => lib/ui}/Dividers.tsx | 0 src/{components/common => lib/ui}/HeaderText.tsx | 0 .../common => lib/ui}/LoadingBlurredImage.tsx | 0 src/{components/common => lib/ui}/TooltipImage.tsx | 0 src/{components/common => lib/ui}/WithPopover.tsx | 0 52 files changed, 76 insertions(+), 75 deletions(-) rename src/{components => lib/characterPreview}/CharacterCustomPortrait.tsx (92%) rename src/{components => lib/characterPreview}/CharacterPreview.jsx (99%) rename src/{components => lib/interactions}/LanguageSelector.tsx (100%) rename src/{components => lib/tabs/relics}/relicPreview/GenerateStat.tsx (96%) rename src/{components => lib/tabs/relics}/relicPreview/RelicStatText.tsx (100%) rename src/{components/common => lib/ui}/ColorizeNumbers.tsx (100%) rename src/{components/common => lib/ui}/ColorizedLink.tsx (100%) rename src/{components/common => lib/ui}/Dividers.tsx (100%) rename src/{components/common => lib/ui}/HeaderText.tsx (100%) rename src/{components/common => lib/ui}/LoadingBlurredImage.tsx (100%) rename src/{components/common => lib/ui}/TooltipImage.tsx (100%) rename src/{components/common => lib/ui}/WithPopover.tsx (100%) diff --git a/src/components/CharacterCustomPortrait.tsx b/src/lib/characterPreview/CharacterCustomPortrait.tsx similarity index 92% rename from src/components/CharacterCustomPortrait.tsx rename to src/lib/characterPreview/CharacterCustomPortrait.tsx index 1eb45d568..b9716a037 100644 --- a/src/components/CharacterCustomPortrait.tsx +++ b/src/lib/characterPreview/CharacterCustomPortrait.tsx @@ -1,4 +1,4 @@ -import { LoadingBlurredImage } from 'components/common/LoadingBlurredImage' +import { LoadingBlurredImage } from 'lib/ui/LoadingBlurredImage' import { CustomImageConfig } from 'types/CustomImage' interface CharacterCustomPortraitProps { diff --git a/src/components/CharacterPreview.jsx b/src/lib/characterPreview/CharacterPreview.jsx similarity index 99% rename from src/components/CharacterPreview.jsx rename to src/lib/characterPreview/CharacterPreview.jsx index 73576d147..ca5eb7ef4 100644 --- a/src/components/CharacterPreview.jsx +++ b/src/lib/characterPreview/CharacterPreview.jsx @@ -1,7 +1,6 @@ import { EditOutlined, SettingOutlined, SwapOutlined, SyncOutlined } from '@ant-design/icons' import { Button, Card, Flex, Image, Segmented, theme, Typography } from 'antd' -import { HeaderText } from 'components/common/HeaderText' -import { LoadingBlurredImage } from 'components/common/LoadingBlurredImage' +import CharacterCustomPortrait from 'lib/characterPreview/CharacterCustomPortrait' import { CharacterCardCombatStats, CharacterCardScoringStatUpgrades, @@ -49,11 +48,12 @@ import { Assets } from 'lib/rendering/assets' import { AppPages, DB } from 'lib/state/db' import { SaveState } from 'lib/state/saveState' import { RelicPreview } from 'lib/tabs/relics/RelicPreview' +import { HeaderText } from 'lib/ui/HeaderText' +import { LoadingBlurredImage } from 'lib/ui/LoadingBlurredImage' import { Utils } from 'lib/utils' import PropTypes from 'prop-types' import React, { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' -import CharacterCustomPortrait from './CharacterCustomPortrait' const { useToken } = theme const { Text } = Typography diff --git a/src/lib/characterPreview/CharacterScoringSummary.tsx b/src/lib/characterPreview/CharacterScoringSummary.tsx index 6ca239bc9..4698a57b6 100644 --- a/src/lib/characterPreview/CharacterScoringSummary.tsx +++ b/src/lib/characterPreview/CharacterScoringSummary.tsx @@ -1,7 +1,4 @@ import { Divider, Flex } from 'antd' -import { ColorizedLinkWithIcon } from 'components/common/ColorizedLink' -import { VerticalDivider } from 'components/common/Dividers' -import { HeaderText } from 'components/common/HeaderText' import { UpArrow } from 'icons/UpArrow' import { CharacterStatSummary } from 'lib/characterPreview/CharacterStatSummary' import { damageStats } from 'lib/characterPreview/StatRow' @@ -15,6 +12,9 @@ import { StatCalculator } from 'lib/relics/statCalculator' import { Assets } from 'lib/rendering/assets' import DB from 'lib/state/db' import { TsUtils } from 'lib/TsUtils' +import { ColorizedLinkWithIcon } from 'lib/ui/ColorizedLink' +import { VerticalDivider } from 'lib/ui/Dividers' +import { HeaderText } from 'lib/ui/HeaderText' import { Utils } from 'lib/utils' import React, { ReactElement } from 'react' import { Trans, useTranslation } from 'react-i18next' diff --git a/src/components/LanguageSelector.tsx b/src/lib/interactions/LanguageSelector.tsx similarity index 100% rename from src/components/LanguageSelector.tsx rename to src/lib/interactions/LanguageSelector.tsx diff --git a/src/lib/interactions/notifications.tsx b/src/lib/interactions/notifications.tsx index 8c802deba..45bfe753e 100644 --- a/src/lib/interactions/notifications.tsx +++ b/src/lib/interactions/notifications.tsx @@ -1,9 +1,9 @@ import { DiscordOutlined, UnorderedListOutlined } from '@ant-design/icons' import { Button, Flex, Space } from 'antd' -import { ColorizedLinkWithIcon } from 'components/common/ColorizedLink' import i18next from 'i18next' import { CURRENT_OPTIMIZER_VERSION } from 'lib/constants' import { AppPages } from 'lib/state/db' +import { ColorizedLinkWithIcon } from 'lib/ui/ColorizedLink' import { Trans } from 'react-i18next' import semver from 'semver' @@ -41,7 +41,8 @@ export function checkForUpdatesNotification(version: string) { const translationsBtn = ( - - - Damage Buffs - Coming Soon - - - - - - - Actions - */} - ) } diff --git a/src/lib/tabs/tabOptimizer/optimizerForm/OptimizerTabCharacterPanel.tsx b/src/lib/tabs/tabOptimizer/optimizerForm/OptimizerTabCharacterPanel.tsx index ef3974694..4cb1a17ef 100644 --- a/src/lib/tabs/tabOptimizer/optimizerForm/OptimizerTabCharacterPanel.tsx +++ b/src/lib/tabs/tabOptimizer/optimizerForm/OptimizerTabCharacterPanel.tsx @@ -1,5 +1,7 @@ import { Assets } from 'lib/rendering/assets' +// FIXME HIGH + const parentW = 233 const parentH = 350 const innerW = 350 diff --git a/src/lib/tabs/tabOptimizer/optimizerForm/OrnamentsOptions.tsx b/src/lib/tabs/tabOptimizer/optimizerForm/OrnamentsOptions.tsx index ac6af950e..0d0821299 100644 --- a/src/lib/tabs/tabOptimizer/optimizerForm/OrnamentsOptions.tsx +++ b/src/lib/tabs/tabOptimizer/optimizerForm/OrnamentsOptions.tsx @@ -2,22 +2,24 @@ import { Flex } from 'antd' import i18next from 'i18next' import { Constants, setToId, UnreleasedSets } from 'lib/constants/constants' +// FIXME HIGH import { Assets } from 'lib/rendering/assets' -// This should be memoised with either the t function or resolved language as a dependency +// This should be memoized with either the t function or resolved language as a dependency const GenerateOrnamentsOptions = (): { value: string; label: JSX.Element }[] => { return Object.values(Constants.SetsOrnaments) .filter((x) => !UnreleasedSets[x]) .map((x) => { return { value: x, - label: - - -
    - {i18next.t(`common:RelicSets.${setToId[x]}.Name`)} -
    -
    , + label: ( + + +
    + {i18next.t(`common:RelicSets.${setToId[x]}.Name`)} +
    +
    + ), } }) } diff --git a/src/lib/tabs/tabOptimizer/optimizerForm/RecommendedPresetsButton.tsx b/src/lib/tabs/tabOptimizer/optimizerForm/RecommendedPresetsButton.tsx index de9563cfd..328e4377c 100644 --- a/src/lib/tabs/tabOptimizer/optimizerForm/RecommendedPresetsButton.tsx +++ b/src/lib/tabs/tabOptimizer/optimizerForm/RecommendedPresetsButton.tsx @@ -14,6 +14,8 @@ import { useTranslation } from 'react-i18next' import { ReactElement } from 'types/components' import { Form } from 'types/form' +// FIXME HIGH + /* * 111.11 (5 actions in first four cycles) * 114.28 (4 actions in first three cycles) @@ -110,8 +112,8 @@ export function setSortColumn(columnId) { } export type SpdPresets = Record diff --git a/src/lib/tabs/tabOptimizer/optimizerForm/RelicMainSetFilters.tsx b/src/lib/tabs/tabOptimizer/optimizerForm/RelicMainSetFilters.tsx index bf4d2409c..79a783593 100644 --- a/src/lib/tabs/tabOptimizer/optimizerForm/RelicMainSetFilters.tsx +++ b/src/lib/tabs/tabOptimizer/optimizerForm/RelicMainSetFilters.tsx @@ -13,6 +13,8 @@ import { TooltipImage } from 'lib/ui/TooltipImage' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' +// FIXME HIGH + const { SHOW_CHILD } = Cascader type RelicMainSetFiltersProps = {} diff --git a/src/lib/tabs/tabOptimizer/optimizerForm/SetsOptions.tsx b/src/lib/tabs/tabOptimizer/optimizerForm/SetsOptions.tsx index d61fbfd1f..1822b8582 100644 --- a/src/lib/tabs/tabOptimizer/optimizerForm/SetsOptions.tsx +++ b/src/lib/tabs/tabOptimizer/optimizerForm/SetsOptions.tsx @@ -3,6 +3,8 @@ import i18next from 'i18next' import { Constants, RelicSetFilterOptions, setToId, UnreleasedSets } from 'lib/constants/constants' import { Assets } from 'lib/rendering/assets' +// FIXME HIGH + // This should be memoised with either the t function or resolved language as a dependency const GenerateSetsOptions = () => { const t = i18next.getFixedT(null, 'optimizerTab', 'RelicSetSelector') diff --git a/src/lib/tabs/tabOptimizer/optimizerForm/SimulatedBuildsGrid.tsx b/src/lib/tabs/tabOptimizer/optimizerForm/SimulatedBuildsGrid.tsx index c8ea30a59..524f8a16e 100644 --- a/src/lib/tabs/tabOptimizer/optimizerForm/SimulatedBuildsGrid.tsx +++ b/src/lib/tabs/tabOptimizer/optimizerForm/SimulatedBuildsGrid.tsx @@ -4,9 +4,11 @@ import { Empty, Flex, Table, TableColumnsType } from 'antd' import { deleteStatSimulationBuild, renderDefaultSimulationName } from 'lib/simulations/statSimulationController' import { STAT_SIMULATION_GRID_WIDTH } from 'lib/tabs/tabOptimizer/optimizerForm/StatSimulationDisplay' import { Utils } from 'lib/utils/utils' -import { useEffect } from 'react' +import React, { useEffect } from 'react' import { useTranslation } from 'react-i18next' +// FIXME MED + interface DataType { key: React.Key name: string diff --git a/src/lib/tabs/tabOptimizer/optimizerForm/StatSimulationDisplay.tsx b/src/lib/tabs/tabOptimizer/optimizerForm/StatSimulationDisplay.tsx index c25625e22..fb77e22f0 100644 --- a/src/lib/tabs/tabOptimizer/optimizerForm/StatSimulationDisplay.tsx +++ b/src/lib/tabs/tabOptimizer/optimizerForm/StatSimulationDisplay.tsx @@ -1,8 +1,8 @@ import { DeleteOutlined, DoubleLeftOutlined, DownOutlined, SettingOutlined, UpOutlined } from '@ant-design/icons' import { Button, Flex, Form, Input, InputNumber, Popconfirm, Radio, Select, Typography } from 'antd' import { Parts, Stats, SubStats } from 'lib/constants/constants' -import { deleteAllStatSimulationBuilds, importOptimizerBuild, saveStatSimulationBuildFromForm, startOptimizerStatSimulation } from 'lib/simulations/statSimulationController' import { Assets } from 'lib/rendering/assets' +import { deleteAllStatSimulationBuilds, importOptimizerBuild, saveStatSimulationBuildFromForm, startOptimizerStatSimulation } from 'lib/simulations/statSimulationController' import FormCard from 'lib/tabs/tabOptimizer/FormCard' import { OrnamentSetTagRenderer } from 'lib/tabs/tabOptimizer/optimizerForm/OrnamentSetTagRenderer' import GenerateOrnamentsOptions from 'lib/tabs/tabOptimizer/optimizerForm/OrnamentsOptions' @@ -14,6 +14,8 @@ import { Utils } from 'lib/utils/utils' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' +// FIXME HIGH + const { Text } = Typography export enum StatSimTypes { diff --git a/src/lib/tabs/tabOptimizer/optimizerForm/TeammateCard.tsx b/src/lib/tabs/tabOptimizer/optimizerForm/TeammateCard.tsx index 369396f65..807e62ca4 100644 --- a/src/lib/tabs/tabOptimizer/optimizerForm/TeammateCard.tsx +++ b/src/lib/tabs/tabOptimizer/optimizerForm/TeammateCard.tsx @@ -36,7 +36,7 @@ const cardHeight = 480 const optionRender = (option: { data: { - value: string; + value: string desc: string } }) => ( @@ -93,7 +93,7 @@ const teammateOrnamentSets = [ function calculateTeammateSets(teammateCharacter: Character) { const relics = Object.values(teammateCharacter.equipped).map((id) => DB.getRelicById(id)).filter((x) => x) const activeTeammateSets: { - teamRelicSet?: string; + teamRelicSet?: string teamOrnamentSet?: string } = {} for (const set of teammateRelicSets) { @@ -190,7 +190,7 @@ const TeammateCard = (props: { const superimpositionOptions = useMemo(() => { const options: { - value: number; + value: number label: string }[] = [] for (let i = 1; i <= 5; i++) { @@ -201,7 +201,7 @@ const TeammateCard = (props: { const eidolonOptions = useMemo(() => { const options: { - value: number; + value: number label: string }[] = [] for (let i = 0; i <= 6; i++) { diff --git a/src/lib/tabs/tabOptimizer/optimizerTabController.ts b/src/lib/tabs/tabOptimizer/optimizerTabController.ts index 6975ccd40..ddaec0ba3 100644 --- a/src/lib/tabs/tabOptimizer/optimizerTabController.ts +++ b/src/lib/tabs/tabOptimizer/optimizerTabController.ts @@ -22,6 +22,8 @@ import { ConditionalValueMap } from 'types/conditionals' import { Form, Teammate } from 'types/form' import { OptimizerCombatBuffs } from 'types/optimizer' +// FIXME HIGH + let relics: RelicsByPart let consts: OptimizerSizes let aggs: GridAggregations @@ -395,13 +397,13 @@ export const OptimizerTabController = { } if (newForm.characterId) { - const defaultOptions = CharacterConditionalsResolver.get(form).defaults() as ConditionalValueMap + const defaultOptions = CharacterConditionalsResolver.get(form).defaults() if (!newForm.characterConditionals) { newForm.characterConditionals = {} } for (const option of Object.keys(defaultOptions)) { if (newForm.characterConditionals[option] == undefined) { - newForm.characterConditionals[option] = defaultOptions[option] as number + newForm.characterConditionals[option] = defaultOptions[option] } } } @@ -413,7 +415,7 @@ export const OptimizerTabController = { } for (const option of Object.keys(defaultLcOptions)) { if (newForm.lightConeConditionals[option] == undefined) { - newForm.lightConeConditionals[option] = defaultLcOptions[option] as number + newForm.lightConeConditionals[option] = defaultLcOptions[option] } } } else { diff --git a/src/lib/tabs/tabRelics/RelicFilterBar.tsx b/src/lib/tabs/tabRelics/RelicFilterBar.tsx index cdc043d8b..d1bd70f9c 100644 --- a/src/lib/tabs/tabRelics/RelicFilterBar.tsx +++ b/src/lib/tabs/tabRelics/RelicFilterBar.tsx @@ -20,6 +20,8 @@ import { useTranslation } from 'react-i18next' import { ReactElement } from 'types/components' import { Relic } from 'types/relic' +// FIXME MED + const { useToken } = theme const { Text } = Typography @@ -31,7 +33,7 @@ const BLANK = Assets.getBlank() export default function RelicFilterBar(props: { setValueColumns: () => void valueColumnOptions: { - label: string; + label: string options: unknown[] }[] valueColumns: string[] @@ -364,7 +366,7 @@ export default function RelicFilterBar(props: { } type FilterTag = { - key: string | number; + key: string | number display: ReactElement } diff --git a/src/lib/tabs/tabRelics/RelicPreview.tsx b/src/lib/tabs/tabRelics/RelicPreview.tsx index 853cc3dd9..a6dc2f02a 100644 --- a/src/lib/tabs/tabRelics/RelicPreview.tsx +++ b/src/lib/tabs/tabRelics/RelicPreview.tsx @@ -10,6 +10,8 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { Relic } from 'types/relic' +// FIXME HIGH + export function RelicPreview(props: { relic?: Relic source?: string diff --git a/src/lib/tabs/tabRelics/RelicsTab.jsx b/src/lib/tabs/tabRelics/RelicsTab.jsx index 4f40173a5..f1e70dd6d 100644 --- a/src/lib/tabs/tabRelics/RelicsTab.jsx +++ b/src/lib/tabs/tabRelics/RelicsTab.jsx @@ -6,7 +6,7 @@ import { arrowKeyGridNavigation } from 'lib/interactions/arrowKeyGridNavigation' import { Hint } from 'lib/interactions/hint' import { Message } from 'lib/interactions/message' import RelicModal from 'lib/overlays/modals/RelicModal.tsx' -import { RelicModalController } from 'lib/relics/relicModalController' +import { RelicModalController } from 'lib/overlays/modals/relicModalController' import { RelicScorer } from 'lib/relics/relicScorerPotential' import { Assets } from 'lib/rendering/assets' import { Gradient } from 'lib/rendering/gradient' diff --git a/src/lib/tabs/tabRelics/relicPreview/GenerateStat.tsx b/src/lib/tabs/tabRelics/relicPreview/GenerateStat.tsx index 34c9ce91b..bae4e30fa 100644 --- a/src/lib/tabs/tabRelics/relicPreview/GenerateStat.tsx +++ b/src/lib/tabs/tabRelics/relicPreview/GenerateStat.tsx @@ -9,6 +9,8 @@ import { ReactElement } from 'react' import { useTranslation } from 'react-i18next' import { Relic, StatRolls } from 'types/relic' +// FIXME MED + type Substat = { stat: string value: number diff --git a/src/lib/tabs/tabShowcase/RelicScorerTab.jsx b/src/lib/tabs/tabShowcase/RelicScorerTab.jsx index 570b6f5a8..dfa0f7022 100644 --- a/src/lib/tabs/tabShowcase/RelicScorerTab.jsx +++ b/src/lib/tabs/tabShowcase/RelicScorerTab.jsx @@ -10,7 +10,6 @@ import { Button, Dropdown, Flex, Form, Input, Segmented, theme, Typography } fro import { CharacterPreview } from 'lib/characterPreview/CharacterPreview' import { Constants, CURRENT_DATA_VERSION, officialOnly } from 'lib/constants/constants' import { SavedSessionKeys } from 'lib/constants/constantsSession' -import { OptimizerTabController } from 'lib/tabs/tabOptimizer/optimizerTabController' import { CharacterConverter } from 'lib/importer/characterConverter' import { Message } from 'lib/interactions/message' import { calculateBuild } from 'lib/optimizer/calculateBuild' @@ -19,6 +18,7 @@ import { Assets } from 'lib/rendering/assets' import DB, { AppPages, PageToRoute } from 'lib/state/db' import { SaveState } from 'lib/state/saveState' import { applySpdPreset } from 'lib/tabs/tabOptimizer/optimizerForm/RecommendedPresetsButton' +import { OptimizerTabController } from 'lib/tabs/tabOptimizer/optimizerTabController' import { Utils } from 'lib/utils/utils' import PropTypes from 'prop-types' import React, { useEffect, useMemo, useRef, useState } from 'react' diff --git a/src/lib/ui/ColorizedLink.tsx b/src/lib/ui/ColorizedLink.tsx index e818230e8..33474df16 100644 --- a/src/lib/ui/ColorizedLink.tsx +++ b/src/lib/ui/ColorizedLink.tsx @@ -2,14 +2,14 @@ import { ExportOutlined, LinkOutlined } from '@ant-design/icons' import React from 'react' export function ColorizedLinkWithIcon(props: { - text: string; - url?: string; - externalIcon?: boolean; - linkIcon?: boolean; + text: string + url?: string + externalIcon?: boolean + linkIcon?: boolean onClick?: () => void }) { return ( - + {props.text} {props.linkIcon && } @@ -17,4 +17,4 @@ export function ColorizedLinkWithIcon(props: { ) -} \ No newline at end of file +} diff --git a/src/lib/ui/Dividers.tsx b/src/lib/ui/Dividers.tsx index 7f6682063..ccded481d 100644 --- a/src/lib/ui/Dividers.tsx +++ b/src/lib/ui/Dividers.tsx @@ -5,7 +5,7 @@ export function VerticalDivider(props: { width?: number }) { const width = props.width ?? 10 return ( - + ) } diff --git a/src/lib/ui/LoadingBlurredImage.tsx b/src/lib/ui/LoadingBlurredImage.tsx index 5000568e7..3da47006c 100644 --- a/src/lib/ui/LoadingBlurredImage.tsx +++ b/src/lib/ui/LoadingBlurredImage.tsx @@ -1,5 +1,5 @@ -import React, { useEffect, useState } from 'react' import { TsUtils } from 'lib/utils/TsUtils' +import React, { useEffect, useState } from 'react' interface LoadingBlurredImageProps extends React.ImgHTMLAttributes { src: string diff --git a/src/lib/utils/TsUtils.ts b/src/lib/utils/TsUtils.ts index 5cd60eff9..5b6235575 100644 --- a/src/lib/utils/TsUtils.ts +++ b/src/lib/utils/TsUtils.ts @@ -1,7 +1,7 @@ import i18next, { DefaultNamespace, KeyPrefix, Namespace, TFunction } from 'i18next' import stringify from 'json-stable-stringify' -import { v4 as uuidv4 } from 'uuid' import { Constants } from 'lib/constants/constants' +import { v4 as uuidv4 } from 'uuid' export const TsUtils = { // Returns the same object diff --git a/src/types/customImage.d.ts b/src/types/customImage.d.ts index 25dc9f1a0..d0f686ee5 100644 --- a/src/types/customImage.d.ts +++ b/src/types/customImage.d.ts @@ -29,6 +29,8 @@ export type CustomImageConfig = { artistName: string } -export type CustomImagePayload = ({ +export type CustomImagePayload = { type: 'add' -} & CustomImageConfig) | { type: 'delete' } +} & CustomImageConfig | { + type: 'delete' +} From be962153a1e3c49ea82c21dca5c902a8295599fe Mon Sep 17 00:00:00 2001 From: Fribbels Date: Sat, 9 Nov 2024 20:07:56 -0800 Subject: [PATCH 15/16] refactor: fix conditionals syntax --- src/lib/conditionals/character/1000/Arlan.ts | 2 +- src/lib/conditionals/character/1000/Asta.ts | 4 ++-- src/lib/conditionals/character/1000/DanHeng.ts | 2 +- src/lib/conditionals/character/1000/Herta.ts | 4 ++-- src/lib/conditionals/character/1000/Himeko.ts | 2 +- src/lib/conditionals/character/1000/Kafka.ts | 2 +- src/lib/conditionals/character/1000/SilverWolf.ts | 4 ++-- src/lib/conditionals/character/1000/Welt.ts | 4 ++-- src/lib/conditionals/character/1100/Bronya.ts | 8 ++++---- src/lib/conditionals/character/1100/Clara.ts | 6 +++--- src/lib/conditionals/character/1100/Gepard.ts | 2 +- src/lib/conditionals/character/1100/Hook.ts | 2 +- src/lib/conditionals/character/1100/Luka.ts | 4 ++-- src/lib/conditionals/character/1100/Lynx.ts | 10 +++++----- src/lib/conditionals/character/1100/Natasha.ts | 2 +- src/lib/conditionals/character/1100/Pela.ts | 4 ++-- src/lib/conditionals/character/1100/Sampo.ts | 4 ++-- src/lib/conditionals/character/1100/Seele.ts | 6 +++--- src/lib/conditionals/character/1100/Serval.ts | 2 +- src/lib/conditionals/character/1100/Topaz.ts | 8 ++++---- src/lib/conditionals/character/1200/Bailu.ts | 4 ++-- src/lib/conditionals/character/1200/Blade.ts | 6 +++--- src/lib/conditionals/character/1200/Feixiao.ts | 6 +++--- src/lib/conditionals/character/1200/FuXuan.ts | 10 +++++----- src/lib/conditionals/character/1200/Fugue.ts | 8 ++++---- src/lib/conditionals/character/1200/Guinaifen.ts | 4 ++-- src/lib/conditionals/character/1200/Hanya.ts | 10 +++++----- src/lib/conditionals/character/1200/Huohuo.ts | 4 ++-- .../conditionals/character/1200/ImbibitorLunae.ts | 2 +- src/lib/conditionals/character/1200/Jiaoqiu.ts | 4 ++-- src/lib/conditionals/character/1200/JingYuan.ts | 6 +++--- src/lib/conditionals/character/1200/Jingliu.ts | 2 +- src/lib/conditionals/character/1200/Lingsha.ts | 10 +++++----- src/lib/conditionals/character/1200/Luocha.ts | 4 ++-- .../character/1200/March7thImaginary.ts | 4 ++-- src/lib/conditionals/character/1200/Moze.ts | 4 ++-- src/lib/conditionals/character/1200/Qingque.ts | 4 ++-- src/lib/conditionals/character/1200/Sushang.ts | 2 +- src/lib/conditionals/character/1200/Tingyun.ts | 14 +++++++------- src/lib/conditionals/character/1200/Xueyi.ts | 6 +++--- src/lib/conditionals/character/1200/Yanqing.ts | 2 +- src/lib/conditionals/character/1200/Yukong.ts | 4 ++-- src/lib/conditionals/character/1200/Yunli.ts | 6 +++--- src/lib/conditionals/character/1300/Acheron.ts | 6 +++--- src/lib/conditionals/character/1300/Argenti.ts | 2 +- src/lib/conditionals/character/1300/Aventurine.ts | 8 ++++---- src/lib/conditionals/character/1300/BlackSwan.ts | 4 ++-- src/lib/conditionals/character/1300/Boothill.ts | 4 ++-- src/lib/conditionals/character/1300/DrRatio.ts | 4 ++-- src/lib/conditionals/character/1300/Firefly.ts | 8 ++++---- src/lib/conditionals/character/1300/Gallagher.ts | 4 ++-- src/lib/conditionals/character/1300/Jade.ts | 6 +++--- src/lib/conditionals/character/1300/Misha.ts | 4 ++-- src/lib/conditionals/character/1300/Rappa.ts | 6 +++--- src/lib/conditionals/character/1300/Robin.ts | 10 +++++----- src/lib/conditionals/character/1300/RuanMei.ts | 6 +++--- src/lib/conditionals/character/1300/Sparkle.ts | 8 ++++---- src/lib/conditionals/character/1300/Sunday.ts | 8 ++++---- .../character/8000/TrailblazerDestruction.ts | 2 +- .../character/8000/TrailblazerHarmony.ts | 10 +++++----- .../character/8000/TrailblazerPreservation.ts | 8 ++++---- src/lib/conditionals/lightcone/3star/Chorus.ts | 2 +- src/lib/conditionals/lightcone/3star/Mediation.ts | 2 +- .../lightcone/4star/CarveTheMoonWeaveTheClouds.ts | 2 +- .../lightcone/4star/DayOneOfMyNewLife.ts | 2 +- .../lightcone/4star/DreamvilleAdventure.ts | 2 +- .../conditionals/lightcone/4star/PastAndFuture.ts | 2 +- .../conditionals/lightcone/4star/PoisedToBloom.ts | 2 +- .../4star/ResolutionShinesAsPearlsOfSweat.ts | 2 +- .../conditionals/lightcone/4star/WeAreWildfire.ts | 2 +- .../lightcone/5star/AGroundedAscent.ts | 2 +- .../lightcone/5star/ButTheBattleIsntOver.ts | 2 +- .../lightcone/5star/EarthlyEscapade.ts | 2 +- .../lightcone/5star/EchoesOfTheCoffin.ts | 2 +- .../lightcone/5star/FlowingNightglow.ts | 2 +- .../conditionals/lightcone/5star/IncessantRain.ts | 2 +- .../lightcone/5star/InherentlyUnjustDestiny.ts | 2 +- .../lightcone/5star/LongRoadLeadsHome.ts | 2 +- .../conditionals/lightcone/5star/NightOfFright.ts | 2 +- .../lightcone/5star/PastSelfInTheMirror.ts | 2 +- .../lightcone/5star/ScentAloneStaysTrue.ts | 4 ++-- .../lightcone/5star/SheAlreadyShutHerEyes.ts | 2 +- .../lightcone/5star/ThoseManySprings.ts | 2 +- .../lightcone/5star/WorrisomeBlissful.ts | 2 +- src/lib/scoring/characterScorer.ts | 8 ++++---- src/types/conditionals.d.ts | 2 +- 86 files changed, 187 insertions(+), 187 deletions(-) diff --git a/src/lib/conditionals/character/1000/Arlan.ts b/src/lib/conditionals/character/1000/Arlan.ts index 35f4a3da0..701b6524d 100644 --- a/src/lib/conditionals/character/1000/Arlan.ts +++ b/src/lib/conditionals/character/1000/Arlan.ts @@ -42,7 +42,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => ({}), precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ELEMENTAL_DMG.buff(Math.min(talentMissingHpDmgBoostMax, 1 - r.selfCurrentHpPercent), Source.NONE) diff --git a/src/lib/conditionals/character/1000/Asta.ts b/src/lib/conditionals/character/1000/Asta.ts index 680a9a8aa..740b61e81 100644 --- a/src/lib/conditionals/character/1000/Asta.ts +++ b/src/lib/conditionals/character/1000/Asta.ts @@ -78,7 +78,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.DEF_P.buff((r.talentBuffStacks) * talentStacksDefBuff, Source.NONE) @@ -98,7 +98,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.SPD.buff((m.ultSpdBuff) ? ultSpdBuffValue : 0, Source.NONE) x.ATK_P.buff((m.talentBuffStacks) * talentStacksAtkBuff, Source.NONE) diff --git a/src/lib/conditionals/character/1000/DanHeng.ts b/src/lib/conditionals/character/1000/DanHeng.ts index f4f8d8979..68ed47558 100644 --- a/src/lib/conditionals/character/1000/DanHeng.ts +++ b/src/lib/conditionals/character/1000/DanHeng.ts @@ -54,7 +54,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.CR.buff((e >= 1 && r.e1EnemyHp50) ? 0.12 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1000/Herta.ts b/src/lib/conditionals/character/1000/Herta.ts index c04bc78c1..ab1d9d2fa 100644 --- a/src/lib/conditionals/character/1000/Herta.ts +++ b/src/lib/conditionals/character/1000/Herta.ts @@ -56,7 +56,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll } function getHitMulti(action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals const hitMultiStacks = getHitMultiByTargetsAndHits(r.fuaStacks, context) const hitMultiByTargets: NumberToNumberMap = { @@ -134,7 +134,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ATK_P.buff((r.techniqueBuff) ? 0.40 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1000/Himeko.ts b/src/lib/conditionals/character/1000/Himeko.ts index 88eaf4ed1..fa4fdd91c 100644 --- a/src/lib/conditionals/character/1000/Himeko.ts +++ b/src/lib/conditionals/character/1000/Himeko.ts @@ -75,7 +75,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.CR.buff((r.selfCurrentHp80Percent) ? 0.15 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1000/Kafka.ts b/src/lib/conditionals/character/1000/Kafka.ts index 91194e2c1..f69db9ef2 100644 --- a/src/lib/conditionals/character/1000/Kafka.ts +++ b/src/lib/conditionals/character/1000/Kafka.ts @@ -77,7 +77,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.DOT_CHANCE.set(1.30, Source.NONE) }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals buffAbilityVulnerability(x, DOT_TYPE, (e >= 1 && m.e1DotDmgReceivedDebuff) ? 0.30 : 0, Source.NONE) buffAbilityDmg(x, DOT_TYPE, (e >= 2 && m.e2TeamDotBoost) ? 0.25 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1000/SilverWolf.ts b/src/lib/conditionals/character/1000/SilverWolf.ts index 96acf9afe..2c1750064 100644 --- a/src/lib/conditionals/character/1000/SilverWolf.ts +++ b/src/lib/conditionals/character/1000/SilverWolf.ts @@ -85,7 +85,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats @@ -105,7 +105,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.RES_PEN.buff((m.skillWeaknessResShredDebuff) ? 0.20 : 0, Source.NONE) x.RES_PEN.buff((m.skillResShredDebuff) ? skillResShredValue : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1000/Welt.ts b/src/lib/conditionals/character/1000/Welt.ts index 59b85a1d2..b609b84af 100644 --- a/src/lib/conditionals/character/1000/Welt.ts +++ b/src/lib/conditionals/character/1000/Welt.ts @@ -70,7 +70,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ELEMENTAL_DMG.buff((x.a[Key.ENEMY_WEAKNESS_BROKEN]) ? 0.20 : 0, Source.NONE) @@ -96,7 +96,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.VULNERABILITY.buff((m.enemyDmgTakenDebuff) ? 0.12 : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/1100/Bronya.ts b/src/lib/conditionals/character/1100/Bronya.ts index 2cbafdd2d..d2da62ff2 100644 --- a/src/lib/conditionals/character/1100/Bronya.ts +++ b/src/lib/conditionals/character/1100/Bronya.ts @@ -124,7 +124,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.FUA_TOUGHNESS_DMG.buff((e >= 4) ? 30 : 0, Source.NONE) }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.DEF_P.buff((m.battleStartDefBuff) ? 0.20 : 0, Source.NONE) x.SPD_P.buff((m.e2SkillSpdBuff) ? 0.30 : 0, Source.NONE) @@ -135,7 +135,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ELEMENTAL_DMG.buff((m.skillBuff) ? skillDmgBoostValue : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.CD.buff((t.ultBuff) ? ultCdBoostValue * t.teammateCDValue : 0, Source.NONE) x.CD.buff((t.ultBuff) ? ultCdBoostBaseValue : 0, Source.NONE) @@ -157,7 +157,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return true }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (!r.ultBuff) { return } @@ -176,7 +176,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.CD.buffDynamic(finalBuffCd, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.ultBuff)}) { diff --git a/src/lib/conditionals/character/1100/Clara.ts b/src/lib/conditionals/character/1100/Clara.ts index 3a33bb502..0fad8bb68 100644 --- a/src/lib/conditionals/character/1100/Clara.ts +++ b/src/lib/conditionals/character/1100/Clara.ts @@ -72,7 +72,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ATK_P.buff((e >= 2 && r.e2UltAtkBuff) ? 0.30 : 0, Source.NONE) @@ -98,12 +98,12 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals const hitMulti = r.ultBuff ? hitMultiByTargetsBlast[context.enemyCount] : hitMultiSingle standardFuaAtkFinalizer(x, action, context, hitMulti) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals const hitMulti = r.ultBuff ? hitMultiByTargetsBlast[context.enemyCount] : hitMultiSingle return gpuStandardFuaAtkFinalizer(hitMulti) }, diff --git a/src/lib/conditionals/character/1100/Gepard.ts b/src/lib/conditionals/character/1100/Gepard.ts index 610fb6e48..9eceaf69e 100644 --- a/src/lib/conditionals/character/1100/Gepard.ts +++ b/src/lib/conditionals/character/1100/Gepard.ts @@ -58,7 +58,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.RES.buff((e >= 4 && m.e4TeamResBuff) ? 0.20 : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/1100/Hook.ts b/src/lib/conditionals/character/1100/Hook.ts index ccb4c49c1..61393e582 100644 --- a/src/lib/conditionals/character/1100/Hook.ts +++ b/src/lib/conditionals/character/1100/Hook.ts @@ -46,7 +46,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats diff --git a/src/lib/conditionals/character/1100/Luka.ts b/src/lib/conditionals/character/1100/Luka.ts index 3c60f13b7..b367c4520 100644 --- a/src/lib/conditionals/character/1100/Luka.ts +++ b/src/lib/conditionals/character/1100/Luka.ts @@ -82,7 +82,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ATK_P.buff((e >= 4) ? r.e4TalentStacks * 0.05 : 0, Source.NONE) @@ -106,7 +106,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.VULNERABILITY.buff((m.targetUltDebuffed) ? targetUltDebuffDmgTakenValue : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/1100/Lynx.ts b/src/lib/conditionals/character/1100/Lynx.ts index f40701394..21563cd37 100644 --- a/src/lib/conditionals/character/1100/Lynx.ts +++ b/src/lib/conditionals/character/1100/Lynx.ts @@ -87,7 +87,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BASIC_SCALING.buff(basicScaling, Source.NONE) x.SKILL_SCALING.buff(skillScaling, Source.NONE) @@ -114,12 +114,12 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.RES.buff((e >= 6 && m.skillBuff) ? 0.30 : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.HP.buff((t.skillBuff) ? skillHpPercentBuff * t.teammateHPValue : 0, Source.NONE) x.HP.buff((e >= 6 && t.skillBuff) ? 0.06 * t.teammateHPValue : 0, Source.NONE) @@ -145,7 +145,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return true }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (!r.skillBuff) { return } @@ -180,7 +180,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ATK.buffDynamic(finalBuffAtk, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.skillBuff)}) { diff --git a/src/lib/conditionals/character/1100/Natasha.ts b/src/lib/conditionals/character/1100/Natasha.ts index 930bb0e5d..7731c1d03 100644 --- a/src/lib/conditionals/character/1100/Natasha.ts +++ b/src/lib/conditionals/character/1100/Natasha.ts @@ -44,7 +44,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.OHB.buff(0.10, Source.NONE) diff --git a/src/lib/conditionals/character/1100/Pela.ts b/src/lib/conditionals/character/1100/Pela.ts index 873a9347c..bb6cbaab5 100644 --- a/src/lib/conditionals/character/1100/Pela.ts +++ b/src/lib/conditionals/character/1100/Pela.ts @@ -80,7 +80,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.SPD_P.buff((e >= 2 && r.skillRemovedBuff) ? 0.10 : 0, Source.NONE) @@ -100,7 +100,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.EHR.buff((m.teamEhrBuff) ? 0.10 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1100/Sampo.ts b/src/lib/conditionals/character/1100/Sampo.ts index d1f66f2c7..48047a409 100644 --- a/src/lib/conditionals/character/1100/Sampo.ts +++ b/src/lib/conditionals/character/1100/Sampo.ts @@ -65,7 +65,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats @@ -89,7 +89,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals buffAbilityVulnerability(x, DOT_TYPE, (m.targetDotTakenDebuff) ? dotVulnerabilityValue : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/1100/Seele.ts b/src/lib/conditionals/character/1100/Seele.ts index 60c492ff0..f1ea7e544 100644 --- a/src/lib/conditionals/character/1100/Seele.ts +++ b/src/lib/conditionals/character/1100/Seele.ts @@ -61,7 +61,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.CR.buff((e >= 1 && r.e1EnemyHp80CrBoost) ? 0.15 : 0, Source.NONE) @@ -86,7 +86,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll // TODO: Seele's E6 should have a teammate effect but its kinda hard to calc }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BASIC_DMG.buff(x.a[Key.BASIC_SCALING] * x.a[Key.ATK], Source.NONE) x.SKILL_DMG.buff(x.a[Key.SKILL_SCALING] * x.a[Key.ATK], Source.NONE) @@ -97,7 +97,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ULT_DMG.buff((e >= 6 && r.e6UltTargetDebuff) ? 0.15 * x.a[Key.ULT_DMG] : 0, Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return ` x.BASIC_DMG += x.BASIC_SCALING * x.ATK; x.SKILL_DMG += x.SKILL_SCALING * x.ATK; diff --git a/src/lib/conditionals/character/1100/Serval.ts b/src/lib/conditionals/character/1100/Serval.ts index 21e8cad98..9d5778dc4 100644 --- a/src/lib/conditionals/character/1100/Serval.ts +++ b/src/lib/conditionals/character/1100/Serval.ts @@ -43,7 +43,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ATK_P.buff((r.enemyDefeatedBuff) ? 0.20 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1100/Topaz.ts b/src/lib/conditionals/character/1100/Topaz.ts index 9b61fff64..aefd79310 100644 --- a/src/lib/conditionals/character/1100/Topaz.ts +++ b/src/lib/conditionals/character/1100/Topaz.ts @@ -87,7 +87,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.SUMMONS.set(1, Source.NONE) }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals buffAbilityCd(x, SKILL_TYPE | FUA_TYPE, (r.numbyEnhancedState) ? enhancedStateFuaCdBoost : 0, Source.NONE) buffAbilityResPen(x, SKILL_TYPE | FUA_TYPE, (e >= 6) ? 0.10 : 0, Source.NONE) @@ -113,13 +113,13 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals buffAbilityVulnerability(x, FUA_TYPE, (m.enemyProofOfDebtDebuff) ? proofOfDebtFuaVulnerability : 0, Source.NONE) buffAbilityCd(x, FUA_TYPE, (e >= 1 && m.enemyProofOfDebtDebuff) ? 0.25 * m.e1DebtorStacks : 0, Source.NONE) }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals const hitMulti = (r.numbyEnhancedState) ? fuaEnhancedHitCountMulti : fuaHitCountMulti const basicAshblazingAtk = calculateAshblazingSet(x, action, context, basicHitCountMulti) @@ -129,7 +129,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.SKILL_DMG.set(x.a[Key.FUA_DMG], Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals const hitMulti = (r.numbyEnhancedState) ? fuaEnhancedHitCountMulti : fuaHitCountMulti return ` diff --git a/src/lib/conditionals/character/1200/Bailu.ts b/src/lib/conditionals/character/1200/Bailu.ts index fdbbbb4e8..a79e68c78 100644 --- a/src/lib/conditionals/character/1200/Bailu.ts +++ b/src/lib/conditionals/character/1200/Bailu.ts @@ -96,7 +96,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.OHB.buff((e >= 2 && r.e2UltHealingBuff) ? 0.15 : 0, Source.NONE) @@ -127,7 +127,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.HP_P.buff((m.healingMaxHpBuff) ? 0.10 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Blade.ts b/src/lib/conditionals/character/1200/Blade.ts index 9852e57bc..919142b95 100644 --- a/src/lib/conditionals/character/1200/Blade.ts +++ b/src/lib/conditionals/character/1200/Blade.ts @@ -69,7 +69,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.CR.buff((e >= 2 && r.enhancedStateActive) ? 0.15 : 0, Source.NONE) @@ -91,7 +91,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals const a = x.a if (r.enhancedStateActive) { @@ -114,7 +114,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.FUA_DMG.buff((e >= 6) ? 0.50 * a[Key.HP] : 0, Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return ` if (${wgslTrue(r.enhancedStateActive)}) { diff --git a/src/lib/conditionals/character/1200/Feixiao.ts b/src/lib/conditionals/character/1200/Feixiao.ts index 36f0cbd41..0a0390511 100644 --- a/src/lib/conditionals/character/1200/Feixiao.ts +++ b/src/lib/conditionals/character/1200/Feixiao.ts @@ -34,7 +34,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll + 8 * 0.2285) function getUltHitMulti(action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return r.weaknessBrokenUlt ? ASHBLAZING_ATK_STACK * ultBrokenHitCountMulti @@ -99,7 +99,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.ULT_DMG_TYPE.set(ULT_TYPE | FUA_TYPE, Source.NONE) @@ -112,7 +112,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll } }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Special case where we force the weakness break on if the ult break option is enabled if (!r.weaknessBrokenUlt) { diff --git a/src/lib/conditionals/character/1200/FuXuan.ts b/src/lib/conditionals/character/1200/FuXuan.ts index 2ff470ddd..2507f0799 100644 --- a/src/lib/conditionals/character/1200/FuXuan.ts +++ b/src/lib/conditionals/character/1200/FuXuan.ts @@ -86,7 +86,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Scaling x.BASIC_SCALING.buff(basicScaling, Source.NONE) @@ -103,7 +103,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.CR.buff((m.skillActive) ? skillCrBuffValue : 0, Source.NONE) x.CD.buff((e >= 1 && m.skillActive) ? 0.30 : 0, Source.NONE) @@ -112,7 +112,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.DMG_RED_MULTI.multiply((m.talentActive) ? (1 - talentDmgReductionValue) : 1, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.HP.buff((t.skillActive) ? skillHpBuffValue * t.teammateHPValue : 0, Source.NONE) @@ -137,7 +137,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return true }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (!r.skillActive) { return } @@ -156,7 +156,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.HP.buffDynamic(finalBuffHp, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.skillActive)}) { diff --git a/src/lib/conditionals/character/1200/Fugue.ts b/src/lib/conditionals/character/1200/Fugue.ts index f4818eaa5..b0afc38d5 100644 --- a/src/lib/conditionals/character/1200/Fugue.ts +++ b/src/lib/conditionals/character/1200/Fugue.ts @@ -108,14 +108,14 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.superBreakDmg) { x.ENEMY_WEAKNESS_BROKEN.set(1, Source.NONE) } }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BE.buff(0.30, Source.NONE) @@ -128,7 +128,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ULT_TOUGHNESS_DMG.buff(60, Source.NONE) }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.BE.buff((m.foxianPrayer) ? skillBeValue : 0, Source.NONE) @@ -139,7 +139,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll buffAbilityDmg(x, BREAK_TYPE, (e >= 4 && m.e4BreakDmg) ? 0.20 : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.BE.buff(t.weaknessBreakBeStacks * (0.08 + (t.be250Buff ? 0.16 : 0)), Source.NONE) }, diff --git a/src/lib/conditionals/character/1200/Guinaifen.ts b/src/lib/conditionals/character/1200/Guinaifen.ts index fe40ef019..fab8d8c3c 100644 --- a/src/lib/conditionals/character/1200/Guinaifen.ts +++ b/src/lib/conditionals/character/1200/Guinaifen.ts @@ -84,7 +84,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Scaling x.BASIC_SCALING.buff(basicScaling, Source.NONE) @@ -105,7 +105,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.VULNERABILITY.buff(m.talentDebuffStacks * talentDebuffDmgIncreaseValue, Source.NONE) x.EFFECT_RES_PEN.buff(m.e1EffectResShred ? 0.10 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Hanya.ts b/src/lib/conditionals/character/1200/Hanya.ts index bff471a73..ee3380d67 100644 --- a/src/lib/conditionals/character/1200/Hanya.ts +++ b/src/lib/conditionals/character/1200/Hanya.ts @@ -93,7 +93,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats @@ -110,7 +110,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.ATK_P.buff((m.ultBuff) ? ultAtkBuffValue : 0, Source.NONE) x.ATK_P.buff((m.burdenAtkBuff) ? 0.10 : 0, Source.NONE) @@ -118,7 +118,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ELEMENTAL_DMG.buff((m.targetBurdenActive) ? talentDmgBoostValue : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.SPD.buff((t.ultBuff) ? ultSpdBuffValue * t.teammateSPDValue : 0, Source.NONE) }, @@ -135,7 +135,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return true }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (!r.ultBuff) { return } @@ -154,7 +154,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.SPD.buffDynamic(finalBuffSpd, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.ultBuff)}) { diff --git a/src/lib/conditionals/character/1200/Huohuo.ts b/src/lib/conditionals/character/1200/Huohuo.ts index 3fbac219b..7fb25971f 100644 --- a/src/lib/conditionals/character/1200/Huohuo.ts +++ b/src/lib/conditionals/character/1200/Huohuo.ts @@ -90,7 +90,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Scaling x.BASIC_SCALING.buff(basicScaling, Source.NONE) @@ -111,7 +111,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.ATK_P.buff((m.ultBuff) ? ultBuffValue : 0, Source.NONE) x.SPD_P.buff((e >= 1 && m.skillBuff) ? 0.12 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/ImbibitorLunae.ts b/src/lib/conditionals/character/1200/ImbibitorLunae.ts index 15f652786..1addaca26 100644 --- a/src/lib/conditionals/character/1200/ImbibitorLunae.ts +++ b/src/lib/conditionals/character/1200/ImbibitorLunae.ts @@ -77,7 +77,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.CD.buff((context.enemyElementalWeak) ? 0.24 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Jiaoqiu.ts b/src/lib/conditionals/character/1200/Jiaoqiu.ts index 376d28e73..87dce4da1 100644 --- a/src/lib/conditionals/character/1200/Jiaoqiu.ts +++ b/src/lib/conditionals/character/1200/Jiaoqiu.ts @@ -109,7 +109,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BASIC_SCALING.buff(basicScaling, Source.NONE) x.SKILL_SCALING.buff(skillScaling, Source.NONE) @@ -125,7 +125,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals buffAbilityVulnerability(x, ULT_TYPE, (m.ultFieldActive) ? ultVulnerabilityScaling : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/JingYuan.ts b/src/lib/conditionals/character/1200/JingYuan.ts index 859df08a2..112060adc 100644 --- a/src/lib/conditionals/character/1200/JingYuan.ts +++ b/src/lib/conditionals/character/1200/JingYuan.ts @@ -20,7 +20,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll const fuaScaling = talent(e, 0.66, 0.726) function getHitMulti(action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals let hitMulti = 0 const stacks = r.talentHitsPerAction @@ -98,12 +98,12 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.SUMMONS.set(1, Source.NONE) }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals r.talentHitsPerAction = Math.max(r.talentHitsPerAction, r.talentAttacks) diff --git a/src/lib/conditionals/character/1200/Jingliu.ts b/src/lib/conditionals/character/1200/Jingliu.ts index 890df8e6e..3ad807139 100644 --- a/src/lib/conditionals/character/1200/Jingliu.ts +++ b/src/lib/conditionals/character/1200/Jingliu.ts @@ -66,7 +66,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Skills x.CR.buff((r.talentEnhancedState) ? talentCrBuff : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Lingsha.ts b/src/lib/conditionals/character/1200/Lingsha.ts index a76bac916..5c2fae23f 100644 --- a/src/lib/conditionals/character/1200/Lingsha.ts +++ b/src/lib/conditionals/character/1200/Lingsha.ts @@ -118,12 +118,12 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.SUMMONS.set(1, Source.NONE) }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BASIC_SCALING.buff(basicScaling, Source.NONE) x.SKILL_SCALING.buff(skillScaling, Source.NONE) @@ -156,7 +156,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll } }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals if (x.a[Key.ENEMY_WEAKNESS_BROKEN]) { x.DEF_PEN.buff((e >= 1 && m.e1DefShred) ? 0.20 : 0, Source.NONE) @@ -183,7 +183,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return true }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (!r.beConversion) { return } @@ -204,7 +204,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.OHB.buffDynamic(finalBuffOhb, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.beConversion)}) { diff --git a/src/lib/conditionals/character/1200/Luocha.ts b/src/lib/conditionals/character/1200/Luocha.ts index fd7539cda..480086d66 100644 --- a/src/lib/conditionals/character/1200/Luocha.ts +++ b/src/lib/conditionals/character/1200/Luocha.ts @@ -81,7 +81,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Scaling x.BASIC_SCALING.buff(basicScaling, Source.NONE) @@ -105,7 +105,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.ATK_P.buff((e >= 1 && m.fieldActive) ? 0.20 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/March7thImaginary.ts b/src/lib/conditionals/character/1200/March7thImaginary.ts index a8f66fc39..1c28a00c9 100644 --- a/src/lib/conditionals/character/1200/March7thImaginary.ts +++ b/src/lib/conditionals/character/1200/March7thImaginary.ts @@ -109,7 +109,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => (teammateDefaults), precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.SPD_P.buff((e >= 1 && r.selfSpdBuff) ? 0.10 : 0, Source.NONE) buffAbilityDmg(x, BASIC_TYPE, (r.talentDmgBuff) ? talentDmgBuff : 0, Source.NONE) @@ -134,7 +134,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.SPD_P.buff((t.masterBuff) ? skillSpdScaling : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Moze.ts b/src/lib/conditionals/character/1200/Moze.ts index bdca1023e..412ac539a 100644 --- a/src/lib/conditionals/character/1200/Moze.ts +++ b/src/lib/conditionals/character/1200/Moze.ts @@ -82,7 +82,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ULT_DMG_TYPE.set(ULT_TYPE | FUA_TYPE, Source.NONE) }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.ELEMENTAL_DMG.buff((e >= 4 && r.e4DmgBuff) ? 0.30 : 0, Source.NONE) @@ -100,7 +100,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals buffAbilityVulnerability(x, FUA_TYPE, (m.preyMark) ? 0.25 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Qingque.ts b/src/lib/conditionals/character/1200/Qingque.ts index d44d92d29..2feb9e71a 100644 --- a/src/lib/conditionals/character/1200/Qingque.ts +++ b/src/lib/conditionals/character/1200/Qingque.ts @@ -31,7 +31,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll const hitMultiSingle = ASHBLAZING_ATK_STACK * (1 * 1 / 1) function getHitMulti(action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return r.basicEnhanced ? hitMultiByTargetsBlast[context.enemyCount] : hitMultiSingle @@ -70,7 +70,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ATK_P.buff((r.basicEnhanced) ? talentAtkBuff : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Sushang.ts b/src/lib/conditionals/character/1200/Sushang.ts index d9636d172..f22e251d1 100644 --- a/src/lib/conditionals/character/1200/Sushang.ts +++ b/src/lib/conditionals/character/1200/Sushang.ts @@ -75,7 +75,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.BE.buff((e >= 4) ? 0.40 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Tingyun.ts b/src/lib/conditionals/character/1200/Tingyun.ts index 98ef50679..d4b383cb8 100644 --- a/src/lib/conditionals/character/1200/Tingyun.ts +++ b/src/lib/conditionals/character/1200/Tingyun.ts @@ -96,7 +96,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.SPD_P.buff((r.skillSpdBuff) ? 0.20 : 0, Source.NONE) @@ -114,19 +114,19 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.SPD_P.buff((e >= 1 && m.ultSpdBuff) ? 0.20 : 0, Source.NONE) x.ELEMENTAL_DMG.buff((m.ultDmgBuff) ? ultDmgBoost : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.ATK_P.buff((t.benedictionBuff) ? t.teammateAtkBuffValue : 0, Source.NONE) }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // x[Stats.ATK] += (r.benedictionBuff) ? x[Stats.ATK] * skillAtkBoostMax : 0 @@ -143,7 +143,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ULT_DMG.buff(x.a[Key.ULT_SCALING] * x.a[Key.ATK], Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return ` x.BASIC_DMG += x.BASIC_SCALING * x.ATK; if (${wgslTrue(r.benedictionBuff)}) { @@ -165,7 +165,7 @@ x.ULT_DMG += x.ULT_SCALING * x.ATK; return true }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (!r.benedictionBuff) { return } @@ -184,7 +184,7 @@ x.ULT_DMG += x.ULT_SCALING * x.ATK; x.ATK.buffDynamic(finalBuffAtk, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.benedictionBuff)}) { diff --git a/src/lib/conditionals/character/1200/Xueyi.ts b/src/lib/conditionals/character/1200/Xueyi.ts index 1cd17d102..4ca93797b 100644 --- a/src/lib/conditionals/character/1200/Xueyi.ts +++ b/src/lib/conditionals/character/1200/Xueyi.ts @@ -81,7 +81,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.BE.buff((e >= 4 && r.e4BeBuff) ? 0.40 : 0, Source.NONE) @@ -119,7 +119,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll activation: ConditionalActivation.CONTINUOUS, dependsOn: [Stats.BE], condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return r.beToDmgBoost }, @@ -131,7 +131,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ELEMENTAL_DMG.buff(buffValue - stateValue, Source.NONE) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.beToDmgBoost)}) { return; diff --git a/src/lib/conditionals/character/1200/Yanqing.ts b/src/lib/conditionals/character/1200/Yanqing.ts index 4816cccc3..746463f4b 100644 --- a/src/lib/conditionals/character/1200/Yanqing.ts +++ b/src/lib/conditionals/character/1200/Yanqing.ts @@ -74,7 +74,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.CR.buff((r.ultBuffActive) ? 0.60 : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Yukong.ts b/src/lib/conditionals/character/1200/Yukong.ts index 3c32b6e09..55bf784f0 100644 --- a/src/lib/conditionals/character/1200/Yukong.ts +++ b/src/lib/conditionals/character/1200/Yukong.ts @@ -79,7 +79,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Scaling x.BASIC_SCALING.buff(basicScaling, Source.NONE) @@ -96,7 +96,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.ATK_P.buff((m.roaringBowstringsActive) ? skillAtkBuffValue : 0, Source.NONE) x.CR.buff((m.ultBuff && m.roaringBowstringsActive) ? ultCrBuffValue : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1200/Yunli.ts b/src/lib/conditionals/character/1200/Yunli.ts index 65bcbc31b..d60ae8aab 100644 --- a/src/lib/conditionals/character/1200/Yunli.ts +++ b/src/lib/conditionals/character/1200/Yunli.ts @@ -40,7 +40,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll } function getHitMulti(action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return (r.blockActive && r.ultCull) ? cullHitCountMultiByTargets[context.enemyCount] : fuaHitCountMultiByTargets[context.enemyCount] @@ -126,13 +126,13 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.blockActive && r.ultCull) { x.FUA_DMG_TYPE.set(ULT_TYPE | FUA_TYPE, Source.NONE) } }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.blockActive) { if (r.ultCull) { diff --git a/src/lib/conditionals/character/1300/Acheron.ts b/src/lib/conditionals/character/1300/Acheron.ts index 9a56053ff..026655c25 100644 --- a/src/lib/conditionals/character/1300/Acheron.ts +++ b/src/lib/conditionals/character/1300/Acheron.ts @@ -114,7 +114,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (e >= 6 && r.e6UltBuffs) { x.BASIC_DMG_TYPE.set(ULT_TYPE | BASIC_TYPE, Source.NONE) @@ -122,7 +122,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll } }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.CR.buff((e >= 1 && r.e1EnemyDebuffed) ? 0.18 : 0, Source.NONE) @@ -151,7 +151,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals buffAbilityVulnerability(x, ULT_TYPE, (e >= 4 && m.e4UltVulnerability) ? 0.08 : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/1300/Argenti.ts b/src/lib/conditionals/character/1300/Argenti.ts index cc00d7cf5..0db239506 100644 --- a/src/lib/conditionals/character/1300/Argenti.ts +++ b/src/lib/conditionals/character/1300/Argenti.ts @@ -79,7 +79,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Skills x.CR.buff((r.talentStacks) * talentCrStackValue, Source.NONE) diff --git a/src/lib/conditionals/character/1300/Aventurine.ts b/src/lib/conditionals/character/1300/Aventurine.ts index d6569b318..a6978aa5e 100644 --- a/src/lib/conditionals/character/1300/Aventurine.ts +++ b/src/lib/conditionals/character/1300/Aventurine.ts @@ -123,7 +123,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.DEF_P.buff((e >= 4 && r.e4DefBuff) ? 0.40 : 0, Source.NONE) x.ELEMENTAL_DMG.buff((e >= 6) ? Math.min(1.50, 0.50 * r.e6ShieldStacks) : 0, Source.NONE) @@ -148,7 +148,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.RES.buff((m.fortifiedWagerBuff) ? talentResScaling : 0, Source.NONE) x.CD.buff((m.enemyUnnervedDebuff) ? ultCdBoost : 0, Source.NONE) @@ -168,7 +168,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll activation: ConditionalActivation.CONTINUOUS, dependsOn: [Stats.DEF], condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return r.defToCrBoost && x.a[Key.DEF] > 1600 }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { @@ -181,7 +181,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return buffValue }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.defToCrBoost)}) { diff --git a/src/lib/conditionals/character/1300/BlackSwan.ts b/src/lib/conditionals/character/1300/BlackSwan.ts index 693f09acb..eae46b48c 100644 --- a/src/lib/conditionals/character/1300/BlackSwan.ts +++ b/src/lib/conditionals/character/1300/BlackSwan.ts @@ -90,7 +90,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BASIC_SCALING.buff(basicScaling, Source.NONE) x.SKILL_SCALING.buff(skillScaling, Source.NONE) @@ -108,7 +108,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.DOT_STACKS.set(r.arcanaStacks, Source.NONE) }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals // TODO: Technically this isnt a DoT vulnerability but rather vulnerability to damage on the enemy's turn which includes ults/etc. buffAbilityVulnerability(x, DOT_TYPE, (m.epiphanyDebuff) ? epiphanyDmgTakenBoost : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1300/Boothill.ts b/src/lib/conditionals/character/1300/Boothill.ts index cd133fb1b..1b876ffcd 100644 --- a/src/lib/conditionals/character/1300/Boothill.ts +++ b/src/lib/conditionals/character/1300/Boothill.ts @@ -100,14 +100,14 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.talentBreakDmgScaling) { x.ENEMY_WEAKNESS_BROKEN.set(1, Source.NONE) } }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BE.buff((e >= 2 && r.e2BeBuff) ? 0.30 : 0, Source.NONE) x.VULNERABILITY.buff((r.standoffActive) ? standoffVulnerabilityBoost : 0, Source.NONE) diff --git a/src/lib/conditionals/character/1300/DrRatio.ts b/src/lib/conditionals/character/1300/DrRatio.ts index 0fc04a23e..6b62f2cfc 100644 --- a/src/lib/conditionals/character/1300/DrRatio.ts +++ b/src/lib/conditionals/character/1300/DrRatio.ts @@ -38,7 +38,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll } function getHitMulti(action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return e >= 2 ? fuaMultiByDebuffs[Math.min(4, r.enemyDebuffStacks)] : baseHitMulti @@ -72,7 +72,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.CR.buff(r.summationStacks * 0.025, Source.NONE) diff --git a/src/lib/conditionals/character/1300/Firefly.ts b/src/lib/conditionals/character/1300/Firefly.ts index dc1b5d62f..aec647290 100644 --- a/src/lib/conditionals/character/1300/Firefly.ts +++ b/src/lib/conditionals/character/1300/Firefly.ts @@ -98,14 +98,14 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.superBreakDmg) { x.ENEMY_WEAKNESS_BROKEN.set(1, Source.NONE) } }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.RES.buff((r.enhancedStateActive) ? talentResBuff : 0, Source.NONE) x.SPD.buff((r.enhancedStateActive && r.enhancedStateSpdBuff) ? ultSpdBuff : 0, Source.NONE) @@ -126,7 +126,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals buffAbilityVulnerability(x, BREAK_TYPE, (r.enhancedStateActive && x.a[Key.ENEMY_WEAKNESS_BROKEN]) ? ultWeaknessBrokenBreakVulnerability : 0, Source.NONE) @@ -143,7 +143,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.SKILL_DMG.buff(x.a[Key.SKILL_SCALING] * x.a[Key.ATK], Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return ` buffAbilityVulnerability(p_x, BREAK_TYPE, ${ultWeaknessBrokenBreakVulnerability}, select(0, 1, ${wgslTrue(r.enhancedStateActive)} && x.ENEMY_WEAKNESS_BROKEN >= 1)); diff --git a/src/lib/conditionals/character/1300/Gallagher.ts b/src/lib/conditionals/character/1300/Gallagher.ts index 0e8292e99..22d76089c 100644 --- a/src/lib/conditionals/character/1300/Gallagher.ts +++ b/src/lib/conditionals/character/1300/Gallagher.ts @@ -100,7 +100,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.RES.buff((e >= 1 && r.e1ResBuff) ? 0.50 : 0, Source.NONE) x.RES.buff((e >= 2 && r.e2ResBuff) ? 0.30 : 0, Source.NONE) @@ -126,7 +126,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals buffAbilityVulnerability(x, BREAK_TYPE, (m.targetBesotted) ? talentBesottedScaling : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/1300/Jade.ts b/src/lib/conditionals/character/1300/Jade.ts index 45bfb3d48..5bcfed385 100644 --- a/src/lib/conditionals/character/1300/Jade.ts +++ b/src/lib/conditionals/character/1300/Jade.ts @@ -34,7 +34,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll } function getHitMulti(action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return r.enhancedFollowUp ? enhancedHitMultiByTargets[context.enemyCount] : unenhancedHitMultiByTargets[context.enemyCount] @@ -113,7 +113,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => (teammateDefaults), precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.CD.buff(r.pawnedAssetStacks * pawnedAssetCdScaling, Source.NONE) x.ATK_P.buff(r.pawnedAssetStacks * 0.005, Source.NONE) @@ -137,7 +137,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.SPD.buff((t.debtCollectorSpdBuff) ? 30 : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/1300/Misha.ts b/src/lib/conditionals/character/1300/Misha.ts index c8550447c..3128f406f 100644 --- a/src/lib/conditionals/character/1300/Misha.ts +++ b/src/lib/conditionals/character/1300/Misha.ts @@ -69,7 +69,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.CD.buff((r.enemyFrozen) ? 0.30 : 0, Source.NONE) @@ -86,7 +86,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.DEF_PEN.buff((e >= 2 && m.e2DefReduction) ? 0.16 : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/1300/Rappa.ts b/src/lib/conditionals/character/1300/Rappa.ts index 0a1751608..9d6313ee7 100644 --- a/src/lib/conditionals/character/1300/Rappa.ts +++ b/src/lib/conditionals/character/1300/Rappa.ts @@ -107,14 +107,14 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.sealformActive) { x.ENEMY_WEAKNESS_BROKEN.set(1, Source.NONE) } }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BE.buff((r.sealformActive) ? ultBeBuff : 0, Source.NONE) x.BREAK_EFFICIENCY_BOOST.buff((r.sealformActive) ? 0.50 : 0, Source.NONE) @@ -138,7 +138,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.BREAK_VULNERABILITY.buff(t.teammateBreakVulnerability, Source.NONE) diff --git a/src/lib/conditionals/character/1300/Robin.ts b/src/lib/conditionals/character/1300/Robin.ts index da0dec3ae..eb8ec2094 100644 --- a/src/lib/conditionals/character/1300/Robin.ts +++ b/src/lib/conditionals/character/1300/Robin.ts @@ -126,7 +126,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.BASIC_SCALING.buff(basicScaling, Source.NONE) x.ULT_ADDITIONAL_DMG_SCALING.buff((r.concertoActive) ? ultScaling : 0, Source.NONE) @@ -136,7 +136,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.CD.buff((m.talentCdBuff) ? talentCdBuffValue : 0, Source.NONE) x.RES.buff((e >= 4 && m.concertoActive && m.e4TeamResBuff) ? 0.50 : 0, Source.NONE) @@ -145,7 +145,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.RES_PEN.buff((e >= 1 && m.concertoActive && m.e1UltResPen) ? 0.24 : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.ATK.buff((t.concertoActive) ? t.teammateATKValue * ultAtkBuffScalingValue + ultAtkBuffFlatValue : 0, Source.NONE) x.RATIO_BASED_ATK_BUFF.buff((t.concertoActive) ? t.teammateATKValue * ultAtkBuffScalingValue : 0, Source.NONE) @@ -155,7 +155,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll buffAbilityCd(x, FUA_TYPE, t.traceFuaCdBoost && t.concertoActive ? 0.25 : 0, Source.NONE) }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals x.ATK.buff((r.concertoActive) ? x.a[Key.ATK] * ultAtkBuffScalingValue + ultAtkBuffFlatValue : 0, Source.NONE) @@ -166,7 +166,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ULT_ADDITIONAL_DMG.buff(x.a[Key.ULT_ADDITIONAL_DMG_SCALING] * x.a[Key.ATK], Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return ` if (${wgslTrue(r.concertoActive)}) { buffDynamicATK(x.ATK * ${ultAtkBuffScalingValue} + ${ultAtkBuffFlatValue}, p_x, p_state); diff --git a/src/lib/conditionals/character/1300/RuanMei.ts b/src/lib/conditionals/character/1300/RuanMei.ts index d525552b4..91a34bda3 100644 --- a/src/lib/conditionals/character/1300/RuanMei.ts +++ b/src/lib/conditionals/character/1300/RuanMei.ts @@ -97,7 +97,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ATK_P.buff((e >= 2 && r.e2AtkBoost) ? 0.40 : 0, Source.NONE) @@ -111,7 +111,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.BE.buff((m.teamBEBuff) ? 0.20 : 0, Source.NONE) @@ -122,7 +122,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.DEF_PEN.buff((e >= 1 && m.ultFieldActive) ? 0.20 : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.SPD_P.buff((t.teamSpdBuff) ? talentSpdScaling : 0, Source.NONE) x.ELEMENTAL_DMG.buff(t.teamDmgBuff, Source.NONE) diff --git a/src/lib/conditionals/character/1300/Sparkle.ts b/src/lib/conditionals/character/1300/Sparkle.ts index 531ad7579..f85b1668d 100644 --- a/src/lib/conditionals/character/1300/Sparkle.ts +++ b/src/lib/conditionals/character/1300/Sparkle.ts @@ -114,7 +114,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals // Main damage type x.ATK_P.buff( @@ -132,7 +132,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.DEF_PEN.buff((e >= 2) ? 0.08 * m.talentStacks : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.CD.buff( (t.skillCdBuff) @@ -153,7 +153,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return true }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (!r.skillCdBuff) { return } @@ -174,7 +174,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.CD.buffDynamic(finalBuffCd, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals const buffScalingValue = (skillCdBuffScaling + (e >= 6 ? 0.30 : 0)) return conditionalWgslWrapper(this, ` diff --git a/src/lib/conditionals/character/1300/Sunday.ts b/src/lib/conditionals/character/1300/Sunday.ts index 97f19c154..9183dc70f 100644 --- a/src/lib/conditionals/character/1300/Sunday.ts +++ b/src/lib/conditionals/character/1300/Sunday.ts @@ -119,7 +119,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.BASIC_TOUGHNESS_DMG.set(30, Source.NONE) }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.CR.buff(m.talentCrBuffStacks * talentCrBuffValue, Source.NONE) x.ELEMENTAL_DMG.buff((m.skillDmgBuff) ? skillDmgBoostValue : 0, Source.NONE) @@ -132,7 +132,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.ELEMENTAL_DMG.buff((e >= 2 && m.e2DmgBuff) ? 0.30 : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.CD.buff((t.beatified) ? ultCdBoostValue * t.teammateCDValue : 0, Source.NONE) x.CD.buff((t.beatified) ? ultCdBoostBaseValue : 0, Source.NONE) @@ -154,7 +154,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x.a[Key.CR] > 1.00 }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (!(e >= 6 && r.e6CrToCdConversion)) { return } @@ -166,7 +166,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.CD.buffDynamic(buffValue - stateValue, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(e >= 6 && r.e6CrToCdConversion)}) { diff --git a/src/lib/conditionals/character/8000/TrailblazerDestruction.ts b/src/lib/conditionals/character/8000/TrailblazerDestruction.ts index 62402503c..a18e73c9f 100644 --- a/src/lib/conditionals/character/8000/TrailblazerDestruction.ts +++ b/src/lib/conditionals/character/8000/TrailblazerDestruction.ts @@ -51,7 +51,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ATK_P.buff(r.talentStacks * talentAtkScalingValue, Source.NONE) diff --git a/src/lib/conditionals/character/8000/TrailblazerHarmony.ts b/src/lib/conditionals/character/8000/TrailblazerHarmony.ts index 1533c5bcc..8f95ad423 100644 --- a/src/lib/conditionals/character/8000/TrailblazerHarmony.ts +++ b/src/lib/conditionals/character/8000/TrailblazerHarmony.ts @@ -87,19 +87,19 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, initializeConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.superBreakDmg) { x.ENEMY_WEAKNESS_BROKEN.set(1, Source.NONE) } }, initializeTeammateConfigurations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.superBreakDmg) { x.ENEMY_WEAKNESS_BROKEN.set(1, Source.NONE) } }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.ERR.buff((e >= 2 && r.e2EnergyRegenBuff) ? 0.25 : 0, Source.NONE) @@ -115,7 +115,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals x.BE.buff((m.backupDancer) ? ultBeScaling : 0, Source.NONE) x.SUPER_BREAK_HMC_MODIFIER.buff( @@ -125,7 +125,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.characterConditionals + const t = action.characterConditionals as Conditionals x.BE.buff((e >= 4) ? 0.15 * t.teammateBeValue : 0, Source.NONE) }, diff --git a/src/lib/conditionals/character/8000/TrailblazerPreservation.ts b/src/lib/conditionals/character/8000/TrailblazerPreservation.ts index 3bfaf1205..55c714259 100644 --- a/src/lib/conditionals/character/8000/TrailblazerPreservation.ts +++ b/src/lib/conditionals/character/8000/TrailblazerPreservation.ts @@ -76,7 +76,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals // Stats x.DEF_P.buff((e >= 6) ? r.e6DefStacks * 0.10 : 0, Source.NONE) @@ -98,13 +98,13 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll return x }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.characterConditionals + const m = action.characterConditionals as Conditionals // This EHR buff applies to all x.DMG_RED_MULTI.multiply((m.skillActive) ? (1 - 0.15) : 1, Source.NONE) }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals if (r.enhancedBasic) { x.BASIC_DMG.buff(basicEnhancedAtkScaling * x.a[Key.ATK], Source.NONE) @@ -122,7 +122,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll standardDefShieldFinalizer(x) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.characterConditionals + const r = action.characterConditionals as Conditionals return ` if (${wgslTrue(r.enhancedBasic)}) { diff --git a/src/lib/conditionals/lightcone/3star/Chorus.ts b/src/lib/conditionals/lightcone/3star/Chorus.ts index 5f1248526..c9981516e 100644 --- a/src/lib/conditionals/lightcone/3star/Chorus.ts +++ b/src/lib/conditionals/lightcone/3star/Chorus.ts @@ -41,7 +41,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.ATK_P.buff((m.inBattleAtkBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/Mediation.ts b/src/lib/conditionals/lightcone/3star/Mediation.ts index c52493a2e..f25b1f7db 100644 --- a/src/lib/conditionals/lightcone/3star/Mediation.ts +++ b/src/lib/conditionals/lightcone/3star/Mediation.ts @@ -40,7 +40,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.SPD.buff((m.initialSpdBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/CarveTheMoonWeaveTheClouds.ts b/src/lib/conditionals/lightcone/4star/CarveTheMoonWeaveTheClouds.ts index 399a30bde..9c09fd81d 100644 --- a/src/lib/conditionals/lightcone/4star/CarveTheMoonWeaveTheClouds.ts +++ b/src/lib/conditionals/lightcone/4star/CarveTheMoonWeaveTheClouds.ts @@ -75,7 +75,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.ATK_P.buff((m.atkBuffActive) ? sValuesAtk[s] : 0, Source.NONE) x.CD.buff((m.cdBuffActive) ? sValuesCd[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/DayOneOfMyNewLife.ts b/src/lib/conditionals/lightcone/4star/DayOneOfMyNewLife.ts index 9b489aae6..38c9ba180 100644 --- a/src/lib/conditionals/lightcone/4star/DayOneOfMyNewLife.ts +++ b/src/lib/conditionals/lightcone/4star/DayOneOfMyNewLife.ts @@ -40,7 +40,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals // TODO: This is technically a DMG RES buff not a DMG Reduction buff x.DMG_RED_MULTI.multiply((m.dmgResBuff) ? (1 - sValues[s]) : 1, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/DreamvilleAdventure.ts b/src/lib/conditionals/lightcone/4star/DreamvilleAdventure.ts index c5789a940..774b5b363 100644 --- a/src/lib/conditionals/lightcone/4star/DreamvilleAdventure.ts +++ b/src/lib/conditionals/lightcone/4star/DreamvilleAdventure.ts @@ -62,7 +62,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals buffAbilityDmg(x, BASIC_TYPE, (m.basicDmgBuff) ? sValues[s] : 0, Source.NONE) buffAbilityDmg(x, SKILL_TYPE, (m.skillDmgBuff) ? sValues[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/PastAndFuture.ts b/src/lib/conditionals/lightcone/4star/PastAndFuture.ts index f9993b683..8a039c2b1 100644 --- a/src/lib/conditionals/lightcone/4star/PastAndFuture.ts +++ b/src/lib/conditionals/lightcone/4star/PastAndFuture.ts @@ -32,7 +32,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.lightConeConditionals + const t = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((t.postSkillDmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/PoisedToBloom.ts b/src/lib/conditionals/lightcone/4star/PoisedToBloom.ts index 023861d1a..391342623 100644 --- a/src/lib/conditionals/lightcone/4star/PoisedToBloom.ts +++ b/src/lib/conditionals/lightcone/4star/PoisedToBloom.ts @@ -39,7 +39,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.CD.buff((m.cdBuff) ? sValuesCd[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/ResolutionShinesAsPearlsOfSweat.ts b/src/lib/conditionals/lightcone/4star/ResolutionShinesAsPearlsOfSweat.ts index be5768f04..5ea4903f6 100644 --- a/src/lib/conditionals/lightcone/4star/ResolutionShinesAsPearlsOfSweat.ts +++ b/src/lib/conditionals/lightcone/4star/ResolutionShinesAsPearlsOfSweat.ts @@ -40,7 +40,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.DEF_PEN.buff((m.targetEnsnared) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/WeAreWildfire.ts b/src/lib/conditionals/lightcone/4star/WeAreWildfire.ts index d3720326e..261331f14 100644 --- a/src/lib/conditionals/lightcone/4star/WeAreWildfire.ts +++ b/src/lib/conditionals/lightcone/4star/WeAreWildfire.ts @@ -44,7 +44,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.DMG_RED_MULTI.multiply((m.initialDmgReductionBuff) ? (1 - sValues[s]) : 1, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/AGroundedAscent.ts b/src/lib/conditionals/lightcone/5star/AGroundedAscent.ts index 77a9d0a62..b8a986bf1 100644 --- a/src/lib/conditionals/lightcone/5star/AGroundedAscent.ts +++ b/src/lib/conditionals/lightcone/5star/AGroundedAscent.ts @@ -42,7 +42,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff(m.dmgBuffStacks * sValuesDmg[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/ButTheBattleIsntOver.ts b/src/lib/conditionals/lightcone/5star/ButTheBattleIsntOver.ts index 862e8c197..e11512b20 100644 --- a/src/lib/conditionals/lightcone/5star/ButTheBattleIsntOver.ts +++ b/src/lib/conditionals/lightcone/5star/ButTheBattleIsntOver.ts @@ -32,7 +32,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.lightConeConditionals + const t = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((t.postSkillDmgBuff) ? sValuesDmg[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/EarthlyEscapade.ts b/src/lib/conditionals/lightcone/5star/EarthlyEscapade.ts index c2bedd3e1..50fc970a2 100644 --- a/src/lib/conditionals/lightcone/5star/EarthlyEscapade.ts +++ b/src/lib/conditionals/lightcone/5star/EarthlyEscapade.ts @@ -44,7 +44,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.lightConeConditionals + const t = action.lightConeConditionals as Conditionals x.CR.buff((t.maskActive) ? sValuesCr[s] : 0, Source.NONE) x.CD.buff((t.maskActive) ? sValuesCd[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/EchoesOfTheCoffin.ts b/src/lib/conditionals/lightcone/5star/EchoesOfTheCoffin.ts index d37f54814..6fe0bcf3c 100644 --- a/src/lib/conditionals/lightcone/5star/EchoesOfTheCoffin.ts +++ b/src/lib/conditionals/lightcone/5star/EchoesOfTheCoffin.ts @@ -44,7 +44,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.SPD.buff((m.postUltSpdBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/FlowingNightglow.ts b/src/lib/conditionals/lightcone/5star/FlowingNightglow.ts index b438daed6..ccb5b9284 100644 --- a/src/lib/conditionals/lightcone/5star/FlowingNightglow.ts +++ b/src/lib/conditionals/lightcone/5star/FlowingNightglow.ts @@ -58,7 +58,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.lightConeConditionals + const t = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((t.cadenzaActive) ? sValuesDmgBuff[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/IncessantRain.ts b/src/lib/conditionals/lightcone/5star/IncessantRain.ts index f0799990a..35a9809ec 100644 --- a/src/lib/conditionals/lightcone/5star/IncessantRain.ts +++ b/src/lib/conditionals/lightcone/5star/IncessantRain.ts @@ -52,7 +52,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi x.CR.buff((r.enemy3DebuffsCrBoost) ? sValuesCr[s] : 0, Source.NONE) }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.VULNERABILITY.buff((m.targetCodeDebuff) ? sValuesDmg[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/InherentlyUnjustDestiny.ts b/src/lib/conditionals/lightcone/5star/InherentlyUnjustDestiny.ts index 0b4d8f437..3d8638cba 100644 --- a/src/lib/conditionals/lightcone/5star/InherentlyUnjustDestiny.ts +++ b/src/lib/conditionals/lightcone/5star/InherentlyUnjustDestiny.ts @@ -52,7 +52,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi x.CD.buff((r.shieldCdBuff) ? sValuesCd[s] : 0, Source.NONE) }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.VULNERABILITY.buff((m.targetVulnerability) ? sValuesVulnerability[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/LongRoadLeadsHome.ts b/src/lib/conditionals/lightcone/5star/LongRoadLeadsHome.ts index 6af0e14f7..cb39c30a6 100644 --- a/src/lib/conditionals/lightcone/5star/LongRoadLeadsHome.ts +++ b/src/lib/conditionals/lightcone/5star/LongRoadLeadsHome.ts @@ -42,7 +42,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.BREAK_VULNERABILITY.buff(m.breakVulnerabilityStacks * sValuesBreakVulnerability[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/NightOfFright.ts b/src/lib/conditionals/lightcone/5star/NightOfFright.ts index d1c9af858..9b49aa11f 100644 --- a/src/lib/conditionals/lightcone/5star/NightOfFright.ts +++ b/src/lib/conditionals/lightcone/5star/NightOfFright.ts @@ -42,7 +42,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.ATK_P.buff(m.atkBuffStacks * sValues[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/PastSelfInTheMirror.ts b/src/lib/conditionals/lightcone/5star/PastSelfInTheMirror.ts index e9474e6dd..e64894a2a 100644 --- a/src/lib/conditionals/lightcone/5star/PastSelfInTheMirror.ts +++ b/src/lib/conditionals/lightcone/5star/PastSelfInTheMirror.ts @@ -40,7 +40,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((m.postUltDmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/ScentAloneStaysTrue.ts b/src/lib/conditionals/lightcone/5star/ScentAloneStaysTrue.ts index 3c5226cd7..62e9efbcc 100644 --- a/src/lib/conditionals/lightcone/5star/ScentAloneStaysTrue.ts +++ b/src/lib/conditionals/lightcone/5star/ScentAloneStaysTrue.ts @@ -56,12 +56,12 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.VULNERABILITY.buff((m.woefreeState) ? sValuesVulnerability[s] : 0, Source.NONE) }, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const t: Conditionals = action.lightConeConditionals + const t = action.lightConeConditionals as Conditionals x.VULNERABILITY.buff((t.woefreeState && t.additionalVulnerability) ? sValuesVulnerabilityAdditional[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/SheAlreadyShutHerEyes.ts b/src/lib/conditionals/lightcone/5star/SheAlreadyShutHerEyes.ts index eff2f3e9d..baae11394 100644 --- a/src/lib/conditionals/lightcone/5star/SheAlreadyShutHerEyes.ts +++ b/src/lib/conditionals/lightcone/5star/SheAlreadyShutHerEyes.ts @@ -40,7 +40,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((m.hpLostDmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/ThoseManySprings.ts b/src/lib/conditionals/lightcone/5star/ThoseManySprings.ts index 518eb502d..78a96f9c8 100644 --- a/src/lib/conditionals/lightcone/5star/ThoseManySprings.ts +++ b/src/lib/conditionals/lightcone/5star/ThoseManySprings.ts @@ -57,7 +57,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.VULNERABILITY.buff(m.unarmoredVulnerability || m.corneredVulnerability ? sValuesVulnerability[s] : 0, Source.NONE) x.VULNERABILITY.buff(m.corneredVulnerability ? sValuesVulnerabilityEnhanced[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/WorrisomeBlissful.ts b/src/lib/conditionals/lightcone/5star/WorrisomeBlissful.ts index 4c704f3af..4a420db56 100644 --- a/src/lib/conditionals/lightcone/5star/WorrisomeBlissful.ts +++ b/src/lib/conditionals/lightcone/5star/WorrisomeBlissful.ts @@ -46,7 +46,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi buffAbilityDmg(x, FUA_TYPE, sValuesFuaDmg[s], Source.NONE) }, precomputeMutualEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const m: Conditionals = action.lightConeConditionals + const m = action.lightConeConditionals as Conditionals x.CD.buff(m.targetTameStacks * sValuesCd[s], Source.NONE) }, diff --git a/src/lib/scoring/characterScorer.ts b/src/lib/scoring/characterScorer.ts index 7d8bd38ef..bb38919e1 100644 --- a/src/lib/scoring/characterScorer.ts +++ b/src/lib/scoring/characterScorer.ts @@ -21,7 +21,7 @@ import { StatSimTypes } from 'lib/tabs/tabOptimizer/optimizerForm/StatSimulation import { TsUtils } from 'lib/utils/TsUtils' import { Utils } from 'lib/utils/utils' import { Character } from 'types/character' -import { ConditionalsController } from 'types/conditionals' +import { CharacterConditionalsController, LightConeConditionalsController } from 'types/conditionals' import { Form } from 'types/form' import { OptimizerContext } from 'types/optimizer' import { Relic } from 'types/relic' @@ -671,7 +671,7 @@ export function generateFullDefaultForm( if (!characterId) return null const characterConditionalsRequest = { characterId: characterId, characterEidolon: characterEidolon } - const lightConeConditionalsRequest = { lightCone: lightCone, eidolon: lightConeSuperimposition } + const lightConeConditionalsRequest = { lightCone: lightCone, lightConeSuperimposition: lightConeSuperimposition } const simulationForm: Form = getDefaultForm({ id: characterId }) @@ -683,8 +683,8 @@ export function generateFullDefaultForm( simulationForm.characterConditionals = {} simulationForm.lightConeConditionals = {} - const characterConditionals: ConditionalsController = CharacterConditionalsResolver.get(characterConditionalsRequest) - const lightConeConditionals: ConditionalsController = LightConeConditionalsResolver.get(lightConeConditionalsRequest) + const characterConditionals: CharacterConditionalsController = CharacterConditionalsResolver.get(characterConditionalsRequest) + const lightConeConditionals: LightConeConditionalsController = LightConeConditionalsResolver.get(lightConeConditionalsRequest) if (teammate) { if (characterConditionals.teammateDefaults) Utils.mergeUndefinedValues(simulationForm.characterConditionals, characterConditionals.teammateDefaults()) diff --git a/src/types/conditionals.d.ts b/src/types/conditionals.d.ts index 4ab437cff..f6cf47451 100644 --- a/src/types/conditionals.d.ts +++ b/src/types/conditionals.d.ts @@ -53,7 +53,7 @@ export interface LightConeConditionalsController extends ConditionalsController export interface CharacterConditionalsController extends ConditionalsController { } -export type ConditionalValueMap = Record +export type ConditionalValueMap = Record export type ContentComponentMap = { switch: ComponentType From a63a18dcfd15be475b6c16c2512055992b4b2e47 Mon Sep 17 00:00:00 2001 From: Fribbels Date: Sat, 9 Nov 2024 20:14:22 -0800 Subject: [PATCH 16/16] refactor: move dynamic conditionals into specific files --- .../conditionals/character/1200/Jiaoqiu.ts | 39 +++- .../conditionals/character/1300/BlackSwan.ts | 44 +++- .../conditionals/character/1300/Boothill.ts | 4 +- .../conditionals/character/1300/Firefly.ts | 46 +++- .../conditionals/character/1300/Gallagher.ts | 38 ++- src/lib/conditionals/character/1300/Rappa.ts | 47 +++- .../conditionals/character/1300/RuanMei.ts | 40 +++- .../lightcone/3star/Adversarial.ts | 2 +- src/lib/conditionals/lightcone/3star/Amber.ts | 2 +- .../conditionals/lightcone/3star/Arrows.ts | 2 +- .../lightcone/3star/CollapsingSky.ts | 2 +- .../lightcone/3star/Cornucopia.ts | 2 +- .../lightcone/3star/DartingArrow.ts | 2 +- .../conditionals/lightcone/3star/DataBank.ts | 2 +- .../lightcone/3star/HiddenShadow.ts | 2 +- src/lib/conditionals/lightcone/3star/Loop.ts | 2 +- .../lightcone/3star/MutualDemise.ts | 2 +- .../conditionals/lightcone/3star/Sagacity.ts | 2 +- .../lightcone/3star/ShatteredHome.ts | 2 +- src/lib/conditionals/lightcone/3star/Void.ts | 2 +- .../lightcone/4star/ASecretVow.ts | 2 +- .../lightcone/4star/AfterTheCharmonyFall.ts | 2 +- .../lightcone/4star/BoundlessChoreo.ts | 2 +- .../lightcone/4star/ConcertForTwo.ts | 2 +- .../conditionals/lightcone/4star/Fermata.ts | 2 +- .../lightcone/4star/FinalVictor.ts | 2 +- .../lightcone/4star/FlamesAfar.ts | 2 +- .../lightcone/4star/ForTomorrowsJourney.ts | 2 +- .../lightcone/4star/GeniusesRepose.ts | 2 +- .../lightcone/4star/GoodNightAndSleepWell.ts | 2 +- .../lightcone/4star/HeyOverHere.ts | 2 +- .../lightcone/4star/IndeliblePromise.ts | 2 +- .../lightcone/4star/ItsShowtime.ts | 4 +- .../lightcone/4star/MakeTheWorldClamor.ts | 2 +- .../lightcone/4star/NinjaRecordSoundHunt.ts | 2 +- .../lightcone/4star/OnlySilenceRemains.ts | 2 +- .../lightcone/4star/PerfectTiming.ts | 2 +- .../lightcone/4star/PlanetaryRendezvous.ts | 4 +- .../lightcone/4star/PostOpConversation.ts | 2 +- .../lightcone/4star/RiverFlowsInSpring.ts | 2 +- .../lightcone/4star/ShadowedByNight.ts | 2 +- .../lightcone/4star/SubscribeForMore.ts | 2 +- .../conditionals/lightcone/4star/Swordplay.ts | 2 +- .../lightcone/4star/TheBirthOfTheSelf.ts | 2 +- .../lightcone/4star/TheDayTheCosmosFell.ts | 2 +- .../lightcone/4star/TheMolesWelcomeYou.ts | 2 +- .../4star/TheSeriousnessOfBreakfast.ts | 2 +- .../4star/TodayIsAnotherPeacefulDay.ts | 5 +- .../lightcone/4star/UnderTheBlueSky.ts | 2 +- .../lightcone/4star/WeWillMeetAgain.ts | 2 +- .../lightcone/4star/WoofWalkTime.ts | 2 +- .../lightcone/5star/AlongThePassingShore.ts | 2 +- .../lightcone/5star/AnInstantBeforeAGaze.ts | 2 +- .../lightcone/5star/BaptismOfPureThought.ts | 2 +- .../lightcone/5star/BeforeDawn.ts | 2 +- .../lightcone/5star/BrighterThanTheSun.ts | 2 +- .../5star/CruisingInTheStellarSea.ts | 2 +- .../lightcone/5star/DanceAtSunset.ts | 2 +- .../lightcone/5star/EternalCalculus.ts | 2 +- .../lightcone/5star/FlowingNightglow.ts | 2 +- .../lightcone/5star/IShallBeMyOwnSword.ts | 2 +- .../lightcone/5star/IVentureForthToHunt.ts | 2 +- .../lightcone/5star/InTheNameOfTheWorld.ts | 2 +- .../lightcone/5star/InTheNight.ts | 4 +- .../lightcone/5star/IncessantRain.ts | 2 +- .../5star/InherentlyUnjustDestiny.ts | 2 +- .../lightcone/5star/MomentOfVictory.ts | 2 +- .../lightcone/5star/NightOnTheMilkyWay.ts | 2 +- .../lightcone/5star/OnTheFallOfAnAeon.ts | 2 +- .../lightcone/5star/PatienceIsAllYouNeed.ts | 2 +- .../lightcone/5star/ReforgedRemembrance.ts | 2 +- .../5star/SailingTowardsASecondLife.ts | 4 +- .../lightcone/5star/ScentAloneStaysTrue.ts | 4 +- .../lightcone/5star/SleepLikeTheDead.ts | 2 +- .../lightcone/5star/SolitaryHealing.ts | 2 +- .../lightcone/5star/SomethingIrreplaceable.ts | 2 +- .../lightcone/5star/TextureOfMemories.ts | 2 +- .../lightcone/5star/TheUnreachableSide.ts | 2 +- .../5star/WhereaboutsShouldDreamsRest.ts | 2 +- .../lightcone/5star/YetHopeIsPriceless.ts | 6 +- .../gpu/conditionals/dynamicConditionals.ts | 217 +----------------- 81 files changed, 322 insertions(+), 316 deletions(-) diff --git a/src/lib/conditionals/character/1200/Jiaoqiu.ts b/src/lib/conditionals/character/1200/Jiaoqiu.ts index 87dce4da1..12a3300d6 100644 --- a/src/lib/conditionals/character/1200/Jiaoqiu.ts +++ b/src/lib/conditionals/character/1200/Jiaoqiu.ts @@ -1,9 +1,10 @@ import { ULT_TYPE } from 'lib/conditionals/conditionalConstants' import { gpuStandardAtkFinalizer, standardAtkFinalizer } from 'lib/conditionals/conditionalFinalizers' import { AbilityEidolon, Conditionals, ContentDefinition } from 'lib/conditionals/conditionalUtils' -import { JiaoqiuConversionConditional } from 'lib/gpu/conditionals/dynamicConditionals' +import { ConditionalActivation, ConditionalType, Stats } from 'lib/constants/constants' +import { conditionalWgslWrapper } from 'lib/gpu/conditionals/dynamicConditionals' import { buffAbilityVulnerability } from 'lib/optimizer/calculateBuffs' -import { ComputedStatsArray, Source } from 'lib/optimizer/computedStatsArray' +import { ComputedStatsArray, Key, Source } from 'lib/optimizer/computedStatsArray' import { TsUtils } from 'lib/utils/TsUtils' import { Eidolon } from 'types/character' @@ -140,6 +141,38 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => standardAtkFinalizer(x), gpuFinalizeCalculations: () => gpuStandardAtkFinalizer(), - dynamicConditionals: [JiaoqiuConversionConditional], + dynamicConditionals: [ + { + id: 'JiaoqiuConversionConditional', + type: ConditionalType.ABILITY, + activation: ConditionalActivation.CONTINUOUS, + dependsOn: [Stats.EHR], + condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + return true + }, + effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + if (!r.ehrToAtkBoost || x.a[Key.EHR] <= 0.80) { + return + } + + const stateValue = action.conditionalState[this.id] || 0 + const buffValue = Math.min(2.40, 0.60 * Math.floor((x.a[Key.EHR] - 0.80) / 0.15)) * context.baseATK + + action.conditionalState[this.id] = buffValue + x.ATK.buffDynamic(buffValue - stateValue, Source.NONE, action, context) + }, + gpu: function (action: OptimizerAction, context: OptimizerContext) { + return conditionalWgslWrapper(this, ` +let ehr = (*p_x).EHR; +let stateValue: f32 = (*p_state).JiaoqiuConversionConditional; +let buffValue: f32 = min(2.40, 0.60 * floor(((*p_x).EHR - 0.80) / 0.15)); + +(*p_state).JiaoqiuConversionConditional = buffValue; +buffDynamicATK_P(buffValue - stateValue, p_x, p_state); + `) + }, + }, + ], } } diff --git a/src/lib/conditionals/character/1300/BlackSwan.ts b/src/lib/conditionals/character/1300/BlackSwan.ts index eae46b48c..0ad2bf88e 100644 --- a/src/lib/conditionals/character/1300/BlackSwan.ts +++ b/src/lib/conditionals/character/1300/BlackSwan.ts @@ -1,9 +1,11 @@ import { DOT_TYPE } from 'lib/conditionals/conditionalConstants' import { gpuStandardAtkFinalizer, standardAtkFinalizer } from 'lib/conditionals/conditionalFinalizers' import { AbilityEidolon, Conditionals, ContentDefinition } from 'lib/conditionals/conditionalUtils' -import { BlackSwanConversionConditional } from 'lib/gpu/conditionals/dynamicConditionals' +import { ConditionalActivation, ConditionalType, Stats } from 'lib/constants/constants' +import { conditionalWgslWrapper } from 'lib/gpu/conditionals/dynamicConditionals' +import { wgslFalse } from 'lib/gpu/injection/wgslUtils' import { buffAbilityDefPen, buffAbilityVulnerability } from 'lib/optimizer/calculateBuffs' -import { ComputedStatsArray, Source } from 'lib/optimizer/computedStatsArray' +import { ComputedStatsArray, Key, Source } from 'lib/optimizer/computedStatsArray' import { TsUtils } from 'lib/utils/TsUtils' import { Eidolon } from 'types/character' @@ -121,6 +123,42 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll }, finalizeCalculations: (x: ComputedStatsArray) => standardAtkFinalizer(x), gpuFinalizeCalculations: () => gpuStandardAtkFinalizer(), - dynamicConditionals: [BlackSwanConversionConditional], + dynamicConditionals: [ + { + id: 'BlackSwanConversionConditional', + type: ConditionalType.ABILITY, + activation: ConditionalActivation.CONTINUOUS, + dependsOn: [Stats.EHR], + condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + return true + }, + effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + if (!r.ehrToDmgBoost) { + return + } + const stateValue = action.conditionalState[this.id] || 0 + const buffValue = Math.min(0.72, 0.60 * x.a[Key.EHR]) + + action.conditionalState[this.id] = buffValue + x.ELEMENTAL_DMG.buff(buffValue - stateValue, Source.NONE) + }, + gpu: function (action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + + return conditionalWgslWrapper(this, ` +if (${wgslFalse(r.ehrToDmgBoost)}) { + return; +} +let ehr = (*p_x).EHR; +let stateValue: f32 = (*p_state).BlackSwanConversionConditional; +let buffValue: f32 = min(0.72, 0.60 * ehr); + +(*p_state).BlackSwanConversionConditional = buffValue; +(*p_x).ELEMENTAL_DMG += buffValue - stateValue; + `) + }, + }, + ], } } diff --git a/src/lib/conditionals/character/1300/Boothill.ts b/src/lib/conditionals/character/1300/Boothill.ts index 1b876ffcd..19affd298 100644 --- a/src/lib/conditionals/character/1300/Boothill.ts +++ b/src/lib/conditionals/character/1300/Boothill.ts @@ -145,7 +145,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll activation: ConditionalActivation.CONTINUOUS, dependsOn: [Stats.BE], condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals + const r = action.characterConditionals as Conditionals return r.beToCritBoost }, @@ -164,7 +164,7 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll x.CD.buffDynamic(cdBuffValue - stateCdBuffValue, Source.NONE, action, context) }, gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals + const r = action.characterConditionals as Conditionals return conditionalWgslWrapper(this, ` if (${wgslFalse(r.beToCritBoost)}) { diff --git a/src/lib/conditionals/character/1300/Firefly.ts b/src/lib/conditionals/character/1300/Firefly.ts index aec647290..ab989fb9f 100644 --- a/src/lib/conditionals/character/1300/Firefly.ts +++ b/src/lib/conditionals/character/1300/Firefly.ts @@ -1,7 +1,8 @@ import { BREAK_TYPE } from 'lib/conditionals/conditionalConstants' import { AbilityEidolon, Conditionals, ContentDefinition } from 'lib/conditionals/conditionalUtils' -import { FireflyConversionConditional } from 'lib/gpu/conditionals/dynamicConditionals' -import { wgslTrue } from 'lib/gpu/injection/wgslUtils' +import { ConditionalActivation, ConditionalType, Stats } from 'lib/constants/constants' +import { conditionalWgslWrapper } from 'lib/gpu/conditionals/dynamicConditionals' +import { wgslFalse, wgslTrue } from 'lib/gpu/injection/wgslUtils' import { buffAbilityVulnerability } from 'lib/optimizer/calculateBuffs' import { ComputedStatsArray, Key, Source } from 'lib/optimizer/computedStatsArray' import { TsUtils } from 'lib/utils/TsUtils' @@ -164,6 +165,45 @@ x.BASIC_DMG += x.BASIC_SCALING * x.ATK; x.SKILL_DMG += x.SKILL_SCALING * x.ATK; ` }, - dynamicConditionals: [FireflyConversionConditional], + dynamicConditionals: [ + { + id: 'FireflyConversionConditional', + type: ConditionalType.ABILITY, + activation: ConditionalActivation.CONTINUOUS, + dependsOn: [Stats.ATK], + condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + return x.a[Key.ATK] > 1800 + }, + effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + const stateValue = action.conditionalState[this.id] || 0 + const trueAtk = x.a[Key.ATK] - x.a[Key.RATIO_BASED_ATK_BUFF] - x.a[Key.RATIO_BASED_ATK_P_BUFF] * context.baseATK + const buffValue = 0.008 * Math.floor((trueAtk - 1800) / 10) + + action.conditionalState[this.id] = buffValue + x.BE.buffDynamic(buffValue - stateValue, Source.NONE, action, context) + + return buffValue + }, + gpu: function (action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + + return conditionalWgslWrapper(this, ` +if (${wgslFalse(r.atkToBeConversion)}) { + return; +} +let atk = (*p_x).ATK; +let stateValue = (*p_state).FireflyConversionConditional; +let trueAtk = atk - (*p_x).RATIO_BASED_ATK_BUFF - (*p_x).RATIO_BASED_ATK_P_BUFF * baseATK; + +if (trueAtk > 1800) { + let buffValue: f32 = 0.008 * floor((trueAtk - 1800) / 10); + + (*p_state).FireflyConversionConditional = buffValue; + buffDynamicBE(buffValue - stateValue, p_x, p_state); +} + `) + }, + }, + ], } } diff --git a/src/lib/conditionals/character/1300/Gallagher.ts b/src/lib/conditionals/character/1300/Gallagher.ts index 22d76089c..681641026 100644 --- a/src/lib/conditionals/character/1300/Gallagher.ts +++ b/src/lib/conditionals/character/1300/Gallagher.ts @@ -1,9 +1,10 @@ import { BREAK_TYPE, NONE_TYPE, SKILL_TYPE } from 'lib/conditionals/conditionalConstants' import { gpuStandardAtkFinalizer, gpuStandardFlatHealFinalizer, standardAtkFinalizer, standardFlatHealFinalizer } from 'lib/conditionals/conditionalFinalizers' import { AbilityEidolon, Conditionals, ContentDefinition } from 'lib/conditionals/conditionalUtils' -import { GallagherConversionConditional } from 'lib/gpu/conditionals/dynamicConditionals' +import { ConditionalActivation, ConditionalType, Stats } from 'lib/constants/constants' +import { conditionalWgslWrapper } from 'lib/gpu/conditionals/dynamicConditionals' import { buffAbilityVulnerability } from 'lib/optimizer/calculateBuffs' -import { ComputedStatsArray, Source } from 'lib/optimizer/computedStatsArray' +import { ComputedStatsArray, Key, Source } from 'lib/optimizer/computedStatsArray' import { TsUtils } from 'lib/utils/TsUtils' import { Eidolon } from 'types/character' @@ -135,6 +136,37 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll standardFlatHealFinalizer(x) }, gpuFinalizeCalculations: () => gpuStandardAtkFinalizer() + gpuStandardFlatHealFinalizer(), - dynamicConditionals: [GallagherConversionConditional], + dynamicConditionals: [ + { + id: 'GallagherConversionConditional', + type: ConditionalType.ABILITY, + activation: ConditionalActivation.CONTINUOUS, + dependsOn: [Stats.BE], + condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + return true + }, + effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + + const stateValue = action.conditionalState[this.id] || 0 + const buffValue = Math.min(0.75, 0.50 * x.a[Key.BE]) + + action.conditionalState[this.id] = buffValue + x.OHB.buffDynamic(buffValue - stateValue, Source.NONE, action, context) + }, + gpu: function (action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + + return conditionalWgslWrapper(this, ` +let be = (*p_x).BE; +let stateValue: f32 = (*p_state).GallagherConversionConditional; +let buffValue: f32 = min(0.75, 0.50 * (*p_x).BE); + +(*p_state).GallagherConversionConditional = buffValue; +buffDynamicOHB(buffValue - stateValue, p_x, p_state); + `) + }, + }, + ], } } diff --git a/src/lib/conditionals/character/1300/Rappa.ts b/src/lib/conditionals/character/1300/Rappa.ts index 9d6313ee7..b248aac73 100644 --- a/src/lib/conditionals/character/1300/Rappa.ts +++ b/src/lib/conditionals/character/1300/Rappa.ts @@ -1,7 +1,9 @@ import { gpuStandardAtkFinalizer, standardAtkFinalizer } from 'lib/conditionals/conditionalFinalizers' import { AbilityEidolon, Conditionals, ContentDefinition } from 'lib/conditionals/conditionalUtils' -import { RappaConversionConditional } from 'lib/gpu/conditionals/dynamicConditionals' -import { ComputedStatsArray, Source } from 'lib/optimizer/computedStatsArray' +import { ConditionalActivation, ConditionalType, Stats } from 'lib/constants/constants' +import { conditionalWgslWrapper } from 'lib/gpu/conditionals/dynamicConditionals' +import { wgslFalse } from 'lib/gpu/injection/wgslUtils' +import { ComputedStatsArray, Key, Source } from 'lib/optimizer/computedStatsArray' import { TsUtils } from 'lib/utils/TsUtils' import { Eidolon } from 'types/character' @@ -146,6 +148,45 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll }, finalizeCalculations: (x: ComputedStatsArray) => standardAtkFinalizer(x), gpuFinalizeCalculations: () => gpuStandardAtkFinalizer(), - dynamicConditionals: [RappaConversionConditional], + dynamicConditionals: [ + { + id: 'RappaConversionConditional', + type: ConditionalType.ABILITY, + activation: ConditionalActivation.CONTINUOUS, + dependsOn: [Stats.ATK], + condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + return true + }, + effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + if (!r.atkToBreakVulnerability) { + return + } + + const stateValue = action.conditionalState[this.id] || 0 + const atkOverStacks = Math.floor(TsUtils.precisionRound((x.a[Key.ATK] - 2400) / 100)) + const buffValue = Math.min(0.08, Math.max(0, atkOverStacks) * 0.01) + 0.02 + + action.conditionalState[this.id] = buffValue + x.BREAK_VULNERABILITY.buff(buffValue - stateValue, Source.NONE) + }, + gpu: function (action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + + return conditionalWgslWrapper(this, ` +if (${wgslFalse(r.atkToBreakVulnerability)}) { + return; +} +let atk = (*p_x).ATK; +let stateValue: f32 = (*p_state).RappaConversionConditional; +let atkOverStacks: f32 = floor((x.ATK - 2400) / 100); +let buffValue: f32 = min(0.08, max(0, atkOverStacks) * 0.01) + 0.02; + +(*p_state).RappaConversionConditional = buffValue; +(*p_x).BREAK_VULNERABILITY += buffValue - stateValue; + `) + }, + }, + ], } } diff --git a/src/lib/conditionals/character/1300/RuanMei.ts b/src/lib/conditionals/character/1300/RuanMei.ts index 91a34bda3..804738147 100644 --- a/src/lib/conditionals/character/1300/RuanMei.ts +++ b/src/lib/conditionals/character/1300/RuanMei.ts @@ -1,7 +1,8 @@ import { gpuStandardAtkFinalizer, standardAtkFinalizer } from 'lib/conditionals/conditionalFinalizers' import { AbilityEidolon, Conditionals, ContentDefinition } from 'lib/conditionals/conditionalUtils' -import { RuanMeiConversionConditional } from 'lib/gpu/conditionals/dynamicConditionals' -import { ComputedStatsArray, Source } from 'lib/optimizer/computedStatsArray' +import { ConditionalActivation, ConditionalType, Stats } from 'lib/constants/constants' +import { conditionalWgslWrapper } from 'lib/gpu/conditionals/dynamicConditionals' +import { ComputedStatsArray, Key, Source } from 'lib/optimizer/computedStatsArray' import { TsUtils } from 'lib/utils/TsUtils' import { Eidolon } from 'types/character' @@ -132,6 +133,39 @@ export default (e: Eidolon, withContent: boolean): CharacterConditionalsControll }, finalizeCalculations: (x: ComputedStatsArray) => standardAtkFinalizer(x), gpuFinalizeCalculations: () => gpuStandardAtkFinalizer(), - dynamicConditionals: [RuanMeiConversionConditional], + dynamicConditionals: [ + { + id: 'RuanMeiConversionConditional', + type: ConditionalType.ABILITY, + activation: ConditionalActivation.CONTINUOUS, + dependsOn: [Stats.BE], + condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + return true + }, + effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + + const stateValue = action.conditionalState[this.id] || 0 + const beOver = Math.floor(TsUtils.precisionRound((x.a[Key.BE] * 100 - 120) / 10)) + const buffValue = Math.min(0.36, Math.max(0, beOver) * 0.06) + + action.conditionalState[this.id] = buffValue + x.ELEMENTAL_DMG.buff(buffValue - stateValue, Source.NONE) + }, + gpu: function (action: OptimizerAction, context: OptimizerContext) { + const r = action.characterConditionals as Conditionals + + return conditionalWgslWrapper(this, ` +let be = (*p_x).BE; +let stateValue: f32 = (*p_state).RuanMeiConversionConditional; +let beOver = ((*p_x).BE * 100 - 120) / 10; +let buffValue: f32 = floor(max(0, beOver)) * 0.06; + +(*p_state).RuanMeiConversionConditional = buffValue; +(*p_x).ELEMENTAL_DMG += buffValue - stateValue; + `) + }, + }, + ], } } diff --git a/src/lib/conditionals/lightcone/3star/Adversarial.ts b/src/lib/conditionals/lightcone/3star/Adversarial.ts index 27f875132..2d17f2fc8 100644 --- a/src/lib/conditionals/lightcone/3star/Adversarial.ts +++ b/src/lib/conditionals/lightcone/3star/Adversarial.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.SPD_P.buff((r.defeatedEnemySpdBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/Amber.ts b/src/lib/conditionals/lightcone/3star/Amber.ts index 9cd667963..c9b79b028 100644 --- a/src/lib/conditionals/lightcone/3star/Amber.ts +++ b/src/lib/conditionals/lightcone/3star/Amber.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.DEF_P.buff((r.hp50DefBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/Arrows.ts b/src/lib/conditionals/lightcone/3star/Arrows.ts index 391ecb7a3..532c02ba5 100644 --- a/src/lib/conditionals/lightcone/3star/Arrows.ts +++ b/src/lib/conditionals/lightcone/3star/Arrows.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CR.buff((r.critBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/CollapsingSky.ts b/src/lib/conditionals/lightcone/3star/CollapsingSky.ts index b78469c08..1b9ae2def 100644 --- a/src/lib/conditionals/lightcone/3star/CollapsingSky.ts +++ b/src/lib/conditionals/lightcone/3star/CollapsingSky.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, BASIC_TYPE | SKILL_TYPE, (r.basicSkillDmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/Cornucopia.ts b/src/lib/conditionals/lightcone/3star/Cornucopia.ts index 6604c951e..c77e70f1c 100644 --- a/src/lib/conditionals/lightcone/3star/Cornucopia.ts +++ b/src/lib/conditionals/lightcone/3star/Cornucopia.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.SKILL_OHB.buff((r.healingBuff) ? sValues[s] : 0, Source.NONE) x.ULT_OHB.buff((r.healingBuff) ? sValues[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/3star/DartingArrow.ts b/src/lib/conditionals/lightcone/3star/DartingArrow.ts index 33f23244f..4d19bd12b 100644 --- a/src/lib/conditionals/lightcone/3star/DartingArrow.ts +++ b/src/lib/conditionals/lightcone/3star/DartingArrow.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff((r.defeatedEnemyAtkBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/DataBank.ts b/src/lib/conditionals/lightcone/3star/DataBank.ts index 755e8b688..aa24a0982 100644 --- a/src/lib/conditionals/lightcone/3star/DataBank.ts +++ b/src/lib/conditionals/lightcone/3star/DataBank.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, ULT_TYPE, (r.ultDmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/HiddenShadow.ts b/src/lib/conditionals/lightcone/3star/HiddenShadow.ts index eaf5f0b47..29f2a0774 100644 --- a/src/lib/conditionals/lightcone/3star/HiddenShadow.ts +++ b/src/lib/conditionals/lightcone/3star/HiddenShadow.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.BASIC_SCALING.buff((r.basicAtkBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/Loop.ts b/src/lib/conditionals/lightcone/3star/Loop.ts index ad0480392..565ac2cb3 100644 --- a/src/lib/conditionals/lightcone/3star/Loop.ts +++ b/src/lib/conditionals/lightcone/3star/Loop.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.enemySlowedDmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/MutualDemise.ts b/src/lib/conditionals/lightcone/3star/MutualDemise.ts index a402cfc8a..1006cfa2a 100644 --- a/src/lib/conditionals/lightcone/3star/MutualDemise.ts +++ b/src/lib/conditionals/lightcone/3star/MutualDemise.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CR.buff((r.selfHp80CrBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/Sagacity.ts b/src/lib/conditionals/lightcone/3star/Sagacity.ts index 7571b98d2..cb9dba184 100644 --- a/src/lib/conditionals/lightcone/3star/Sagacity.ts +++ b/src/lib/conditionals/lightcone/3star/Sagacity.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff((r.postUltAtkBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/ShatteredHome.ts b/src/lib/conditionals/lightcone/3star/ShatteredHome.ts index 137924d31..6f4e9aed2 100644 --- a/src/lib/conditionals/lightcone/3star/ShatteredHome.ts +++ b/src/lib/conditionals/lightcone/3star/ShatteredHome.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.enemyHp50Buff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/3star/Void.ts b/src/lib/conditionals/lightcone/3star/Void.ts index ec6fce24a..c68b220b7 100644 --- a/src/lib/conditionals/lightcone/3star/Void.ts +++ b/src/lib/conditionals/lightcone/3star/Void.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.EHR.buff((r.initialEhrBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/ASecretVow.ts b/src/lib/conditionals/lightcone/4star/ASecretVow.ts index c937a2bf2..6bb114650 100644 --- a/src/lib/conditionals/lightcone/4star/ASecretVow.ts +++ b/src/lib/conditionals/lightcone/4star/ASecretVow.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff(sValues[s], Source.NONE) x.ELEMENTAL_DMG.buff((r.enemyHpHigherDmgBoost) ? sValues[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/AfterTheCharmonyFall.ts b/src/lib/conditionals/lightcone/4star/AfterTheCharmonyFall.ts index 4f88b78d5..6f94d0019 100644 --- a/src/lib/conditionals/lightcone/4star/AfterTheCharmonyFall.ts +++ b/src/lib/conditionals/lightcone/4star/AfterTheCharmonyFall.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.SPD_P.buff((r.spdBuff) ? sValuesSpd[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/BoundlessChoreo.ts b/src/lib/conditionals/lightcone/4star/BoundlessChoreo.ts index d227df9cd..db69c8991 100644 --- a/src/lib/conditionals/lightcone/4star/BoundlessChoreo.ts +++ b/src/lib/conditionals/lightcone/4star/BoundlessChoreo.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CD.buff((r.enemyDefReducedSlowed) ? sValuesCd[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/ConcertForTwo.ts b/src/lib/conditionals/lightcone/4star/ConcertForTwo.ts index 178dfe80e..3b435503f 100644 --- a/src/lib/conditionals/lightcone/4star/ConcertForTwo.ts +++ b/src/lib/conditionals/lightcone/4star/ConcertForTwo.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.teammateShieldStacks) * sValuesStackDmg[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/Fermata.ts b/src/lib/conditionals/lightcone/4star/Fermata.ts index 36ee300c3..541cd99a7 100644 --- a/src/lib/conditionals/lightcone/4star/Fermata.ts +++ b/src/lib/conditionals/lightcone/4star/Fermata.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.enemyShockWindShear) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/FinalVictor.ts b/src/lib/conditionals/lightcone/4star/FinalVictor.ts index 3b74a3e53..9b3815639 100644 --- a/src/lib/conditionals/lightcone/4star/FinalVictor.ts +++ b/src/lib/conditionals/lightcone/4star/FinalVictor.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CD.buff(r.goodFortuneStacks * sValues[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/FlamesAfar.ts b/src/lib/conditionals/lightcone/4star/FlamesAfar.ts index e23a46619..e40be4577 100644 --- a/src/lib/conditionals/lightcone/4star/FlamesAfar.ts +++ b/src/lib/conditionals/lightcone/4star/FlamesAfar.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.dmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/ForTomorrowsJourney.ts b/src/lib/conditionals/lightcone/4star/ForTomorrowsJourney.ts index 5706dddc6..7568fb12b 100644 --- a/src/lib/conditionals/lightcone/4star/ForTomorrowsJourney.ts +++ b/src/lib/conditionals/lightcone/4star/ForTomorrowsJourney.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.ultDmgBuff) ? sValuesDmgBoost[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/GeniusesRepose.ts b/src/lib/conditionals/lightcone/4star/GeniusesRepose.ts index 44614e904..059aa2165 100644 --- a/src/lib/conditionals/lightcone/4star/GeniusesRepose.ts +++ b/src/lib/conditionals/lightcone/4star/GeniusesRepose.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CD.buff((r.defeatedEnemyCdBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/GoodNightAndSleepWell.ts b/src/lib/conditionals/lightcone/4star/GoodNightAndSleepWell.ts index 49b4fc06c..294f5154e 100644 --- a/src/lib/conditionals/lightcone/4star/GoodNightAndSleepWell.ts +++ b/src/lib/conditionals/lightcone/4star/GoodNightAndSleepWell.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff(r.debuffStacksDmgIncrease * sValues[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/HeyOverHere.ts b/src/lib/conditionals/lightcone/4star/HeyOverHere.ts index 7692c1449..0028264dd 100644 --- a/src/lib/conditionals/lightcone/4star/HeyOverHere.ts +++ b/src/lib/conditionals/lightcone/4star/HeyOverHere.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.OHB.buff((r.postSkillHealBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/IndeliblePromise.ts b/src/lib/conditionals/lightcone/4star/IndeliblePromise.ts index 27d717fa9..2e6b124c4 100644 --- a/src/lib/conditionals/lightcone/4star/IndeliblePromise.ts +++ b/src/lib/conditionals/lightcone/4star/IndeliblePromise.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CR.buff((r.crBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/ItsShowtime.ts b/src/lib/conditionals/lightcone/4star/ItsShowtime.ts index 24e710025..9c9543b5c 100644 --- a/src/lib/conditionals/lightcone/4star/ItsShowtime.ts +++ b/src/lib/conditionals/lightcone/4star/ItsShowtime.ts @@ -36,7 +36,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff(r.trickStacks * sValuesDmg[s], Source.NONE) }, @@ -52,7 +52,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi return x.a[Key.EHR] >= 0.80 }, effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals const stateValue = action.conditionalState[this.id] || 0 const buffValue = sValuesAtkBuff[s] * context.baseATK diff --git a/src/lib/conditionals/lightcone/4star/MakeTheWorldClamor.ts b/src/lib/conditionals/lightcone/4star/MakeTheWorldClamor.ts index ecb8d39a6..43272f566 100644 --- a/src/lib/conditionals/lightcone/4star/MakeTheWorldClamor.ts +++ b/src/lib/conditionals/lightcone/4star/MakeTheWorldClamor.ts @@ -34,7 +34,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, ULT_TYPE, (r.ultDmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/NinjaRecordSoundHunt.ts b/src/lib/conditionals/lightcone/4star/NinjaRecordSoundHunt.ts index 0ea8383dd..786cc6b50 100644 --- a/src/lib/conditionals/lightcone/4star/NinjaRecordSoundHunt.ts +++ b/src/lib/conditionals/lightcone/4star/NinjaRecordSoundHunt.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CD.buff((r.cdBuff) ? sValuesCd[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/OnlySilenceRemains.ts b/src/lib/conditionals/lightcone/4star/OnlySilenceRemains.ts index df53e1a9b..34ad7f816 100644 --- a/src/lib/conditionals/lightcone/4star/OnlySilenceRemains.ts +++ b/src/lib/conditionals/lightcone/4star/OnlySilenceRemains.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CR.buff((r.enemies2CrBuff && context.enemyCount <= 2) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/PerfectTiming.ts b/src/lib/conditionals/lightcone/4star/PerfectTiming.ts index 3b83e5d39..cc354de15 100644 --- a/src/lib/conditionals/lightcone/4star/PerfectTiming.ts +++ b/src/lib/conditionals/lightcone/4star/PerfectTiming.ts @@ -44,7 +44,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi activation: ConditionalActivation.SINGLE, dependsOn: [Stats.RES], condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals return r.resToHealingBoost }, diff --git a/src/lib/conditionals/lightcone/4star/PlanetaryRendezvous.ts b/src/lib/conditionals/lightcone/4star/PlanetaryRendezvous.ts index d9eb5759a..ee44843b0 100644 --- a/src/lib/conditionals/lightcone/4star/PlanetaryRendezvous.ts +++ b/src/lib/conditionals/lightcone/4star/PlanetaryRendezvous.ts @@ -38,12 +38,12 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeTeammateEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.alliesSameElement) ? sValues[s] : 0, Source.NONE) }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.alliesSameElement) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/PostOpConversation.ts b/src/lib/conditionals/lightcone/4star/PostOpConversation.ts index e6c9bfa63..c27867b7f 100644 --- a/src/lib/conditionals/lightcone/4star/PostOpConversation.ts +++ b/src/lib/conditionals/lightcone/4star/PostOpConversation.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ULT_OHB.buff((r.postUltHealingBoost) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/RiverFlowsInSpring.ts b/src/lib/conditionals/lightcone/4star/RiverFlowsInSpring.ts index 644f45a46..76eff7245 100644 --- a/src/lib/conditionals/lightcone/4star/RiverFlowsInSpring.ts +++ b/src/lib/conditionals/lightcone/4star/RiverFlowsInSpring.ts @@ -32,7 +32,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.SPD_P.buff((r.spdDmgBuff) ? sValuesSpd[s] : 0, Source.NONE) x.ELEMENTAL_DMG.buff((r.spdDmgBuff) ? sValuesDmg[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/ShadowedByNight.ts b/src/lib/conditionals/lightcone/4star/ShadowedByNight.ts index c7138d471..d4d515853 100644 --- a/src/lib/conditionals/lightcone/4star/ShadowedByNight.ts +++ b/src/lib/conditionals/lightcone/4star/ShadowedByNight.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.SPD_P.buff((r.spdBuff) ? sValuesSpdBuff[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/SubscribeForMore.ts b/src/lib/conditionals/lightcone/4star/SubscribeForMore.ts index 3382a89c5..2079af5db 100644 --- a/src/lib/conditionals/lightcone/4star/SubscribeForMore.ts +++ b/src/lib/conditionals/lightcone/4star/SubscribeForMore.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, BASIC_TYPE | SKILL_TYPE, sValues[s], Source.NONE) buffAbilityDmg(x, BASIC_TYPE | SKILL_TYPE, (r.maxEnergyDmgBoost) ? sValues[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/Swordplay.ts b/src/lib/conditionals/lightcone/4star/Swordplay.ts index 547658b93..d0636e693 100644 --- a/src/lib/conditionals/lightcone/4star/Swordplay.ts +++ b/src/lib/conditionals/lightcone/4star/Swordplay.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.sameTargetHitStacks) * sValues[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/TheBirthOfTheSelf.ts b/src/lib/conditionals/lightcone/4star/TheBirthOfTheSelf.ts index 9fa999337..48b0d8e04 100644 --- a/src/lib/conditionals/lightcone/4star/TheBirthOfTheSelf.ts +++ b/src/lib/conditionals/lightcone/4star/TheBirthOfTheSelf.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, FUA_TYPE, sValues[s], Source.NONE) buffAbilityDmg(x, FUA_TYPE, (r.enemyHp50FuaBuff) ? sValues[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/TheDayTheCosmosFell.ts b/src/lib/conditionals/lightcone/4star/TheDayTheCosmosFell.ts index 7c1cad9b8..f8b29e35c 100644 --- a/src/lib/conditionals/lightcone/4star/TheDayTheCosmosFell.ts +++ b/src/lib/conditionals/lightcone/4star/TheDayTheCosmosFell.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CD.buff((r.cdBuffActive) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/TheMolesWelcomeYou.ts b/src/lib/conditionals/lightcone/4star/TheMolesWelcomeYou.ts index 1e0514fe8..9a563a4cb 100644 --- a/src/lib/conditionals/lightcone/4star/TheMolesWelcomeYou.ts +++ b/src/lib/conditionals/lightcone/4star/TheMolesWelcomeYou.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff((r.atkBuffStacks) * sValues[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/TheSeriousnessOfBreakfast.ts b/src/lib/conditionals/lightcone/4star/TheSeriousnessOfBreakfast.ts index fd62efa56..5e4cd62df 100644 --- a/src/lib/conditionals/lightcone/4star/TheSeriousnessOfBreakfast.ts +++ b/src/lib/conditionals/lightcone/4star/TheSeriousnessOfBreakfast.ts @@ -39,7 +39,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff(r.defeatedEnemyAtkStacks * sValuesStacks[s], Source.NONE) x.ELEMENTAL_DMG.buff((r.dmgBoost) ? sValuesDmgBoost[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/TodayIsAnotherPeacefulDay.ts b/src/lib/conditionals/lightcone/4star/TodayIsAnotherPeacefulDay.ts index 667dc4b62..b6e4b73f2 100644 --- a/src/lib/conditionals/lightcone/4star/TodayIsAnotherPeacefulDay.ts +++ b/src/lib/conditionals/lightcone/4star/TodayIsAnotherPeacefulDay.ts @@ -1,8 +1,7 @@ -import { ComputedStatsObject } from 'lib/conditionals/conditionalConstants' import { Conditionals, ContentDefinition } from 'lib/conditionals/conditionalUtils' import { ComputedStatsArray, Source } from 'lib/optimizer/computedStatsArray' import { TsUtils } from 'lib/utils/TsUtils' -import { ContentItem, LightConeConditionalsController } from 'types/conditionals' +import { LightConeConditionalsController } from 'types/conditionals' import { SuperImpositionLevel } from 'types/lightCone' import { OptimizerAction, OptimizerContext } from 'types/optimizer' @@ -32,7 +31,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff(r.maxEnergyStacks * sValues[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/UnderTheBlueSky.ts b/src/lib/conditionals/lightcone/4star/UnderTheBlueSky.ts index ebc89d5ce..343ef5420 100644 --- a/src/lib/conditionals/lightcone/4star/UnderTheBlueSky.ts +++ b/src/lib/conditionals/lightcone/4star/UnderTheBlueSky.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CR.buff((r.defeatedEnemyCrBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/4star/WeWillMeetAgain.ts b/src/lib/conditionals/lightcone/4star/WeWillMeetAgain.ts index 8da8f5809..248ea9864 100644 --- a/src/lib/conditionals/lightcone/4star/WeWillMeetAgain.ts +++ b/src/lib/conditionals/lightcone/4star/WeWillMeetAgain.ts @@ -29,7 +29,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.BASIC_SCALING.buff((r.extraDmgProc) ? sValues[s] : 0, Source.NONE) x.SKILL_SCALING.buff((r.extraDmgProc) ? sValues[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/4star/WoofWalkTime.ts b/src/lib/conditionals/lightcone/4star/WoofWalkTime.ts index 60524e546..ac216740e 100644 --- a/src/lib/conditionals/lightcone/4star/WoofWalkTime.ts +++ b/src/lib/conditionals/lightcone/4star/WoofWalkTime.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.enemyBurnedBleeding) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/AlongThePassingShore.ts b/src/lib/conditionals/lightcone/5star/AlongThePassingShore.ts index 2bef1f778..75cc18854 100644 --- a/src/lib/conditionals/lightcone/5star/AlongThePassingShore.ts +++ b/src/lib/conditionals/lightcone/5star/AlongThePassingShore.ts @@ -34,7 +34,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.emptyBubblesDebuff) ? sValuesDmgBoost[s] : 0, Source.NONE) buffAbilityDmg(x, ULT_TYPE, (r.emptyBubblesDebuff) ? sValuesUltDmgBoost[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/AnInstantBeforeAGaze.ts b/src/lib/conditionals/lightcone/5star/AnInstantBeforeAGaze.ts index b2305b5e2..2537d8fd5 100644 --- a/src/lib/conditionals/lightcone/5star/AnInstantBeforeAGaze.ts +++ b/src/lib/conditionals/lightcone/5star/AnInstantBeforeAGaze.ts @@ -32,7 +32,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, ULT_TYPE, r.maxEnergyUltDmgStacks * sValues[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/BaptismOfPureThought.ts b/src/lib/conditionals/lightcone/5star/BaptismOfPureThought.ts index 8637cd7c5..26c67c898 100644 --- a/src/lib/conditionals/lightcone/5star/BaptismOfPureThought.ts +++ b/src/lib/conditionals/lightcone/5star/BaptismOfPureThought.ts @@ -44,7 +44,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CD.buff(r.debuffCdStacks * sValuesCd[s], Source.NONE) x.ELEMENTAL_DMG.buff(r.postUltBuff ? sValuesDmg[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/BeforeDawn.ts b/src/lib/conditionals/lightcone/5star/BeforeDawn.ts index c388522bd..291c6f6a8 100644 --- a/src/lib/conditionals/lightcone/5star/BeforeDawn.ts +++ b/src/lib/conditionals/lightcone/5star/BeforeDawn.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, SKILL_TYPE | ULT_TYPE, sValuesSkillUltDmg[s], Source.NONE) buffAbilityDmg(x, FUA_TYPE, (r.fuaDmgBoost) ? sValuesFuaDmg[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/BrighterThanTheSun.ts b/src/lib/conditionals/lightcone/5star/BrighterThanTheSun.ts index 00cdc1986..74708e7de 100644 --- a/src/lib/conditionals/lightcone/5star/BrighterThanTheSun.ts +++ b/src/lib/conditionals/lightcone/5star/BrighterThanTheSun.ts @@ -34,7 +34,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff(r.dragonsCallStacks * sValuesAtk[s], Source.NONE) x.ERR.buff(r.dragonsCallStacks * sValuesErr[s], Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/CruisingInTheStellarSea.ts b/src/lib/conditionals/lightcone/5star/CruisingInTheStellarSea.ts index 51bcd59ca..7bd8e91b9 100644 --- a/src/lib/conditionals/lightcone/5star/CruisingInTheStellarSea.ts +++ b/src/lib/conditionals/lightcone/5star/CruisingInTheStellarSea.ts @@ -37,7 +37,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CR.buff((r.enemyHp50CrBoost) ? sValuesCr[s] : 0, Source.NONE) x.ATK_P.buff((r.enemyDefeatedAtkBuff) ? sValuesAtk[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/DanceAtSunset.ts b/src/lib/conditionals/lightcone/5star/DanceAtSunset.ts index bdb537fba..e0d389929 100644 --- a/src/lib/conditionals/lightcone/5star/DanceAtSunset.ts +++ b/src/lib/conditionals/lightcone/5star/DanceAtSunset.ts @@ -32,7 +32,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, FUA_TYPE, r.fuaDmgStacks * sValuesFuaDmg[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/EternalCalculus.ts b/src/lib/conditionals/lightcone/5star/EternalCalculus.ts index 06f784e4e..0e759161a 100644 --- a/src/lib/conditionals/lightcone/5star/EternalCalculus.ts +++ b/src/lib/conditionals/lightcone/5star/EternalCalculus.ts @@ -39,7 +39,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff(r.atkBuffStacks * sValuesAtkBuff[s], Source.NONE) x.SPD_P.buff((r.spdBuff) ? sValuesSpdBuff[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/FlowingNightglow.ts b/src/lib/conditionals/lightcone/5star/FlowingNightglow.ts index ccb5b9284..32b2d269b 100644 --- a/src/lib/conditionals/lightcone/5star/FlowingNightglow.ts +++ b/src/lib/conditionals/lightcone/5star/FlowingNightglow.ts @@ -63,7 +63,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi x.ELEMENTAL_DMG.buff((t.cadenzaActive) ? sValuesDmgBuff[s] : 0, Source.NONE) }, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ERR.buff(r.cantillationStacks * sValuesErr[s], Source.NONE) x.ATK_P.buff((r.cadenzaActive) ? sValuesAtkBuff[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/IShallBeMyOwnSword.ts b/src/lib/conditionals/lightcone/5star/IShallBeMyOwnSword.ts index d302b03a4..c13a684f9 100644 --- a/src/lib/conditionals/lightcone/5star/IShallBeMyOwnSword.ts +++ b/src/lib/conditionals/lightcone/5star/IShallBeMyOwnSword.ts @@ -39,7 +39,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff(r.eclipseStacks * sValuesStackDmg[s], Source.NONE) x.DEF_PEN.buff((r.maxStackDefPen && r.eclipseStacks == 3) ? sValuesDefPen[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/IVentureForthToHunt.ts b/src/lib/conditionals/lightcone/5star/IVentureForthToHunt.ts index 3112ae1f1..73ecba21c 100644 --- a/src/lib/conditionals/lightcone/5star/IVentureForthToHunt.ts +++ b/src/lib/conditionals/lightcone/5star/IVentureForthToHunt.ts @@ -32,7 +32,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDefPen(x, ULT_TYPE, r.luminfluxUltStacks * sValuesDefShred[s], Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/InTheNameOfTheWorld.ts b/src/lib/conditionals/lightcone/5star/InTheNameOfTheWorld.ts index 5f59bb608..b9e3ac692 100644 --- a/src/lib/conditionals/lightcone/5star/InTheNameOfTheWorld.ts +++ b/src/lib/conditionals/lightcone/5star/InTheNameOfTheWorld.ts @@ -41,7 +41,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.enemyDebuffedDmgBoost) ? sValuesDmg[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/InTheNight.ts b/src/lib/conditionals/lightcone/5star/InTheNight.ts index 0c189e962..b0c99581c 100644 --- a/src/lib/conditionals/lightcone/5star/InTheNight.ts +++ b/src/lib/conditionals/lightcone/5star/InTheNight.ts @@ -37,14 +37,14 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi precomputeEffects: () => { }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals const stacks = Math.max(0, Math.min(6, Math.floor((x.a[Key.SPD] - 100) / 10))) buffAbilityDmg(x, BASIC_TYPE | SKILL_TYPE, (r.spdScalingBuffs) ? stacks * sValuesDmg[s] : 0, Source.NONE) buffAbilityCd(x, ULT_TYPE, (r.spdScalingBuffs) ? stacks * sValuesCd[s] : 0, Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals return ` if (${wgslTrue(r.spdScalingBuffs)}) { diff --git a/src/lib/conditionals/lightcone/5star/IncessantRain.ts b/src/lib/conditionals/lightcone/5star/IncessantRain.ts index 35a9809ec..600a5f4e0 100644 --- a/src/lib/conditionals/lightcone/5star/IncessantRain.ts +++ b/src/lib/conditionals/lightcone/5star/IncessantRain.ts @@ -47,7 +47,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CR.buff((r.enemy3DebuffsCrBoost) ? sValuesCr[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/InherentlyUnjustDestiny.ts b/src/lib/conditionals/lightcone/5star/InherentlyUnjustDestiny.ts index 3d8638cba..1a89e18d5 100644 --- a/src/lib/conditionals/lightcone/5star/InherentlyUnjustDestiny.ts +++ b/src/lib/conditionals/lightcone/5star/InherentlyUnjustDestiny.ts @@ -47,7 +47,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi defaults: () => defaults, teammateDefaults: () => teammateDefaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CD.buff((r.shieldCdBuff) ? sValuesCd[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/MomentOfVictory.ts b/src/lib/conditionals/lightcone/5star/MomentOfVictory.ts index a1426a3b9..feb257ea8 100644 --- a/src/lib/conditionals/lightcone/5star/MomentOfVictory.ts +++ b/src/lib/conditionals/lightcone/5star/MomentOfVictory.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.DEF_P.buff((r.selfAttackedDefBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/NightOnTheMilkyWay.ts b/src/lib/conditionals/lightcone/5star/NightOnTheMilkyWay.ts index 80246146e..418c64a41 100644 --- a/src/lib/conditionals/lightcone/5star/NightOnTheMilkyWay.ts +++ b/src/lib/conditionals/lightcone/5star/NightOnTheMilkyWay.ts @@ -37,7 +37,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff((r.enemyCountAtkBuff) ? context.enemyCount * sValuesAtk[s] : 0, Source.NONE) x.ELEMENTAL_DMG.buff((r.enemyWeaknessBreakDmgBuff) ? sValuesDmg[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/OnTheFallOfAnAeon.ts b/src/lib/conditionals/lightcone/5star/OnTheFallOfAnAeon.ts index 6fec3fcf7..727184dcd 100644 --- a/src/lib/conditionals/lightcone/5star/OnTheFallOfAnAeon.ts +++ b/src/lib/conditionals/lightcone/5star/OnTheFallOfAnAeon.ts @@ -39,7 +39,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff(r.atkBoostStacks * sValuesAtkStacks[s], Source.NONE) x.ELEMENTAL_DMG.buff((r.weaknessBreakDmgBuff) ? sValuesDmgBuff[s] : 0, Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/PatienceIsAllYouNeed.ts b/src/lib/conditionals/lightcone/5star/PatienceIsAllYouNeed.ts index 7066cafeb..f9b7ac76b 100644 --- a/src/lib/conditionals/lightcone/5star/PatienceIsAllYouNeed.ts +++ b/src/lib/conditionals/lightcone/5star/PatienceIsAllYouNeed.ts @@ -40,7 +40,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.SPD_P.buff(r.spdStacks * sValuesSpd[s], Source.NONE) x.ELEMENTAL_DMG.buff(sValuesDmg[s], Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/ReforgedRemembrance.ts b/src/lib/conditionals/lightcone/5star/ReforgedRemembrance.ts index 59513ad3a..da65c5619 100644 --- a/src/lib/conditionals/lightcone/5star/ReforgedRemembrance.ts +++ b/src/lib/conditionals/lightcone/5star/ReforgedRemembrance.ts @@ -36,7 +36,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ATK_P.buff(r.prophetStacks * sValuesAtk[s], Source.NONE) diff --git a/src/lib/conditionals/lightcone/5star/SailingTowardsASecondLife.ts b/src/lib/conditionals/lightcone/5star/SailingTowardsASecondLife.ts index c36ae3b18..cba561bd3 100644 --- a/src/lib/conditionals/lightcone/5star/SailingTowardsASecondLife.ts +++ b/src/lib/conditionals/lightcone/5star/SailingTowardsASecondLife.ts @@ -41,7 +41,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDefPen(x, BREAK_TYPE, (r.breakDmgDefShred) ? sValuesDefShred[s] : 0, Source.NONE) }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { @@ -53,7 +53,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi activation: ConditionalActivation.SINGLE, dependsOn: [Stats.BE], condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals return r.spdBuffConditional && x.a[Key.BE] >= 1.50 }, diff --git a/src/lib/conditionals/lightcone/5star/ScentAloneStaysTrue.ts b/src/lib/conditionals/lightcone/5star/ScentAloneStaysTrue.ts index 62e9efbcc..cd0e82997 100644 --- a/src/lib/conditionals/lightcone/5star/ScentAloneStaysTrue.ts +++ b/src/lib/conditionals/lightcone/5star/ScentAloneStaysTrue.ts @@ -66,12 +66,12 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi x.VULNERABILITY.buff((t.woefreeState && t.additionalVulnerability) ? sValuesVulnerabilityAdditional[s] : 0, Source.NONE) }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.VULNERABILITY.buff((r.woefreeState && x.a[Key.BE] >= 1.50) ? sValuesVulnerabilityAdditional[s] : 0, Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals return ` if (${wgslTrue(r.woefreeState)} && x.BE >= 1.50) { diff --git a/src/lib/conditionals/lightcone/5star/SleepLikeTheDead.ts b/src/lib/conditionals/lightcone/5star/SleepLikeTheDead.ts index bfcb3f3dc..57adf2d40 100644 --- a/src/lib/conditionals/lightcone/5star/SleepLikeTheDead.ts +++ b/src/lib/conditionals/lightcone/5star/SleepLikeTheDead.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.CR.buff((r.missedCritCrBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/SolitaryHealing.ts b/src/lib/conditionals/lightcone/5star/SolitaryHealing.ts index 8b70ef989..fa280fbd4 100644 --- a/src/lib/conditionals/lightcone/5star/SolitaryHealing.ts +++ b/src/lib/conditionals/lightcone/5star/SolitaryHealing.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, DOT_TYPE, (r.postUltDotDmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/SomethingIrreplaceable.ts b/src/lib/conditionals/lightcone/5star/SomethingIrreplaceable.ts index 58f2c856a..a30ba170f 100644 --- a/src/lib/conditionals/lightcone/5star/SomethingIrreplaceable.ts +++ b/src/lib/conditionals/lightcone/5star/SomethingIrreplaceable.ts @@ -32,7 +32,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.dmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/TextureOfMemories.ts b/src/lib/conditionals/lightcone/5star/TextureOfMemories.ts index 8bea33135..57ac5a7a0 100644 --- a/src/lib/conditionals/lightcone/5star/TextureOfMemories.ts +++ b/src/lib/conditionals/lightcone/5star/TextureOfMemories.ts @@ -32,7 +32,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.DMG_RED_MULTI.multiply((r.activeShieldDmgDecrease) ? (1 - sValues[s]) : 1, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/TheUnreachableSide.ts b/src/lib/conditionals/lightcone/5star/TheUnreachableSide.ts index 90411fe57..4fac31613 100644 --- a/src/lib/conditionals/lightcone/5star/TheUnreachableSide.ts +++ b/src/lib/conditionals/lightcone/5star/TheUnreachableSide.ts @@ -28,7 +28,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.ELEMENTAL_DMG.buff((r.dmgBuff) ? sValues[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/WhereaboutsShouldDreamsRest.ts b/src/lib/conditionals/lightcone/5star/WhereaboutsShouldDreamsRest.ts index 5c3ed5bb0..fb59e0a4e 100644 --- a/src/lib/conditionals/lightcone/5star/WhereaboutsShouldDreamsRest.ts +++ b/src/lib/conditionals/lightcone/5star/WhereaboutsShouldDreamsRest.ts @@ -30,7 +30,7 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals x.VULNERABILITY.buff((r.routedVulnerability) ? sValuesVulnerability[s] : 0, Source.NONE) }, diff --git a/src/lib/conditionals/lightcone/5star/YetHopeIsPriceless.ts b/src/lib/conditionals/lightcone/5star/YetHopeIsPriceless.ts index e0d7dc9d5..b7a46f695 100644 --- a/src/lib/conditionals/lightcone/5star/YetHopeIsPriceless.ts +++ b/src/lib/conditionals/lightcone/5star/YetHopeIsPriceless.ts @@ -42,17 +42,17 @@ export default (s: SuperImpositionLevel, withContent: boolean): LightConeConditi content: () => Object.values(content), defaults: () => defaults, precomputeEffects: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDefPen(x, ULT_TYPE | FUA_TYPE, (r.ultFuaDefShred) ? sValuesUltFuaDefShred[s] : 0, Source.NONE) }, finalizeCalculations: (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals buffAbilityDmg(x, FUA_TYPE, (r.fuaDmgBoost) ? sValuesFuaDmg[s] * Math.min(4, Math.floor(x.a[Key.CD] - 1.20) / 0.20) : 0, Source.NONE) }, gpuFinalizeCalculations: (action: OptimizerAction, context: OptimizerContext) => { - const r: Conditionals = action.lightConeConditionals + const r = action.lightConeConditionals as Conditionals return ` if (${wgslTrue(r.fuaDmgBoost)}) { diff --git a/src/lib/gpu/conditionals/dynamicConditionals.ts b/src/lib/gpu/conditionals/dynamicConditionals.ts index 53f9cd379..49a58196d 100644 --- a/src/lib/gpu/conditionals/dynamicConditionals.ts +++ b/src/lib/gpu/conditionals/dynamicConditionals.ts @@ -1,7 +1,6 @@ -import { ConditionalActivation, ConditionalType, Stats } from 'lib/constants/constants' -import { indent, wgslFalse } from 'lib/gpu/injection/wgslUtils' -import { ComputedStatsArray, Key, Source } from 'lib/optimizer/computedStatsArray' -import { TsUtils } from 'lib/utils/TsUtils' +import { ConditionalActivation } from 'lib/constants/constants' +import { indent } from 'lib/gpu/injection/wgslUtils' +import { ComputedStatsArray } from 'lib/optimizer/computedStatsArray' import { OptimizerAction, OptimizerContext, TeammateAction } from 'types/optimizer' export type DynamicConditional = { @@ -66,213 +65,3 @@ ${indent(wgsl.trim(), 1)} } ` } - -export const FireflyConversionConditional: DynamicConditional = { - id: 'FireflyConversionConditional', - type: ConditionalType.ABILITY, - activation: ConditionalActivation.CONTINUOUS, - dependsOn: [Stats.ATK], - condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - return x.a[Key.ATK] > 1800 - }, - effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const stateValue = action.conditionalState[this.id] || 0 - const trueAtk = x.a[Key.ATK] - x.a[Key.RATIO_BASED_ATK_BUFF] - x.a[Key.RATIO_BASED_ATK_P_BUFF] * context.baseATK - const buffValue = 0.008 * Math.floor((trueAtk - 1800) / 10) - - action.conditionalState[this.id] = buffValue - x.BE.buffDynamic(buffValue - stateValue, Source.NONE, action, context) - - return buffValue - }, - gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - - return conditionalWgslWrapper(this, ` -if (${wgslFalse(r.atkToBeConversion)}) { - return; -} -let atk = (*p_x).ATK; -let stateValue = (*p_state).FireflyConversionConditional; -let trueAtk = atk - (*p_x).RATIO_BASED_ATK_BUFF - (*p_x).RATIO_BASED_ATK_P_BUFF * baseATK; - -if (trueAtk > 1800) { - let buffValue: f32 = 0.008 * floor((trueAtk - 1800) / 10); - - (*p_state).FireflyConversionConditional = buffValue; - buffDynamicBE(buffValue - stateValue, p_x, p_state); -} - `) - }, -} - -export const BlackSwanConversionConditional: DynamicConditional = { - id: 'BlackSwanConversionConditional', - type: ConditionalType.ABILITY, - activation: ConditionalActivation.CONTINUOUS, - dependsOn: [Stats.EHR], - condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - return true - }, - effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - if (!r.ehrToDmgBoost) { - return - } - const stateValue = action.conditionalState[this.id] || 0 - const buffValue = Math.min(0.72, 0.60 * x.a[Key.EHR]) - - action.conditionalState[this.id] = buffValue - x.ELEMENTAL_DMG.buff(buffValue - stateValue, Source.NONE) - }, - gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - - return conditionalWgslWrapper(this, ` -if (${wgslFalse(r.ehrToDmgBoost)}) { - return; -} -let ehr = (*p_x).EHR; -let stateValue: f32 = (*p_state).BlackSwanConversionConditional; -let buffValue: f32 = min(0.72, 0.60 * ehr); - -(*p_state).BlackSwanConversionConditional = buffValue; -(*p_x).ELEMENTAL_DMG += buffValue - stateValue; - `) - }, -} - -export const RappaConversionConditional: DynamicConditional = { - id: 'RappaConversionConditional', - type: ConditionalType.ABILITY, - activation: ConditionalActivation.CONTINUOUS, - dependsOn: [Stats.ATK], - condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - return true - }, - effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - if (!r.atkToBreakVulnerability) { - return - } - - const stateValue = action.conditionalState[this.id] || 0 - const atkOverStacks = Math.floor(TsUtils.precisionRound((x.a[Key.ATK] - 2400) / 100)) - const buffValue = Math.min(0.08, Math.max(0, atkOverStacks) * 0.01) + 0.02 - - action.conditionalState[this.id] = buffValue - x.BREAK_VULNERABILITY.buff(buffValue - stateValue, Source.NONE) - }, - gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - - return conditionalWgslWrapper(this, ` -if (${wgslFalse(r.atkToBreakVulnerability)}) { - return; -} -let atk = (*p_x).ATK; -let stateValue: f32 = (*p_state).RappaConversionConditional; -let atkOverStacks: f32 = floor((x.ATK - 2400) / 100); -let buffValue: f32 = min(0.08, max(0, atkOverStacks) * 0.01) + 0.02; - -(*p_state).RappaConversionConditional = buffValue; -(*p_x).BREAK_VULNERABILITY += buffValue - stateValue; - `) - }, -} - -export const GallagherConversionConditional: DynamicConditional = { - id: 'GallagherConversionConditional', - type: ConditionalType.ABILITY, - activation: ConditionalActivation.CONTINUOUS, - dependsOn: [Stats.BE], - condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - return true - }, - effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - - const stateValue = action.conditionalState[this.id] || 0 - const buffValue = Math.min(0.75, 0.50 * x.a[Key.BE]) - - action.conditionalState[this.id] = buffValue - x.OHB.buffDynamic(buffValue - stateValue, Source.NONE, action, context) - }, - gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - - return conditionalWgslWrapper(this, ` -let be = (*p_x).BE; -let stateValue: f32 = (*p_state).GallagherConversionConditional; -let buffValue: f32 = min(0.75, 0.50 * (*p_x).BE); - -(*p_state).GallagherConversionConditional = buffValue; -buffDynamicOHB(buffValue - stateValue, p_x, p_state); - `) - }, -} - -export const RuanMeiConversionConditional: DynamicConditional = { - id: 'RuanMeiConversionConditional', - type: ConditionalType.ABILITY, - activation: ConditionalActivation.CONTINUOUS, - dependsOn: [Stats.BE], - condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - return true - }, - effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - - const stateValue = action.conditionalState[this.id] || 0 - const beOver = Math.floor(TsUtils.precisionRound((x.a[Key.BE] * 100 - 120) / 10)) - const buffValue = Math.min(0.36, Math.max(0, beOver) * 0.06) - - action.conditionalState[this.id] = buffValue - x.ELEMENTAL_DMG.buff(buffValue - stateValue, Source.NONE) - }, - gpu: function (action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - - return conditionalWgslWrapper(this, ` -let be = (*p_x).BE; -let stateValue: f32 = (*p_state).RuanMeiConversionConditional; -let beOver = ((*p_x).BE * 100 - 120) / 10; -let buffValue: f32 = floor(max(0, beOver)) * 0.06; - -(*p_state).RuanMeiConversionConditional = buffValue; -(*p_x).ELEMENTAL_DMG += buffValue - stateValue; - `) - }, -} - -export const JiaoqiuConversionConditional: DynamicConditional = { - id: 'JiaoqiuConversionConditional', - type: ConditionalType.ABILITY, - activation: ConditionalActivation.CONTINUOUS, - dependsOn: [Stats.EHR], - condition: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - return true - }, - effect: function (x: ComputedStatsArray, action: OptimizerAction, context: OptimizerContext) { - const r = action.characterConditionals - if (!r.ehrToAtkBoost || x.a[Key.EHR] <= 0.80) { - return - } - - const stateValue = action.conditionalState[this.id] || 0 - const buffValue = Math.min(2.40, 0.60 * Math.floor((x.a[Key.EHR] - 0.80) / 0.15)) * context.baseATK - - action.conditionalState[this.id] = buffValue - x.ATK.buffDynamic(buffValue - stateValue, Source.NONE, action, context) - }, - gpu: function (action: OptimizerAction, context: OptimizerContext) { - return conditionalWgslWrapper(this, ` -let ehr = (*p_x).EHR; -let stateValue: f32 = (*p_state).JiaoqiuConversionConditional; -let buffValue: f32 = min(2.40, 0.60 * floor(((*p_x).EHR - 0.80) / 0.15)); - -(*p_state).JiaoqiuConversionConditional = buffValue; -buffDynamicATK_P(buffValue - stateValue, p_x, p_state); - `) - }, -}