UPDATE: FIx bug
Gitea Auto Deploy / Deploy-Container (push) Successful in 43s

This commit is contained in:
2026-05-05 20:05:33 +07:00
parent 078ab168ad
commit 8640b62134
12 changed files with 190 additions and 90 deletions
+32 -32
View File
@@ -6,11 +6,11 @@ import { useMemo } from "react";
type Mode = 0 | 1 | 2;
export function useDamagePerCycleForOne(avatarId: number, mode: Mode) {
const { skillHistory, turnHistory, maxCycle } = useBattleDataStore.getState();
const { skillHistory, turnHistory } = useBattleDataStore.getState();
const transI18n = useTranslations("DataAnalysisPage");
return useMemo(() => {
const damageMap = new Map<string, number>();
skillHistory
.filter(s => s.avatarId === avatarId)
.forEach(s => {
@@ -19,9 +19,9 @@ export function useDamagePerCycleForOne(avatarId: number, mode: Mode) {
let key = '';
if (mode === 0) {
key = `${transI18n('cycle')} ${maxCycle-turn.cycleIndex} - ${transI18n('wave')} ${turn.waveIndex}`;
key = `${transI18n('cycle')} ${turn.cycleIndex} - ${transI18n('wave')} ${turn.waveIndex}`;
} else if (mode === 1) {
key = `${transI18n('cycle')} ${maxCycle-turn.cycleIndex}`;
key = `${transI18n('cycle')} ${turn.cycleIndex}`;
} else if (mode === 2) {
key = `${transI18n('wave')} ${turn.waveIndex}`;
}
@@ -39,31 +39,31 @@ export function useDamagePerCycleForOne(avatarId: number, mode: Mode) {
export function useDamagePerCycleForAll(mode: Mode) {
const { skillHistory, turnHistory, maxCycle } = useBattleDataStore.getState();
const transI18n = useTranslations("DataAnalysisPage");
return useMemo(() => {
const damageMap = new Map<string, number>();
skillHistory.forEach(s => {
const turn = turnHistory[s.turnBattleId];
if (!turn) return;
let key = '';
if (mode === 0) {
key = `${transI18n('cycle')} ${maxCycle-turn.cycleIndex} - ${transI18n('wave')} ${turn.waveIndex}`;
} else if (mode === 1) {
key = `${transI18n('cycle')} ${maxCycle-turn.cycleIndex}`;
} else if (mode === 2) {
key = `${transI18n('wave')} ${turn.waveIndex}`;
}
damageMap.set(key, (damageMap.get(key) || 0) + s.totalDamage);
});
const result = Array.from(damageMap.entries())
.map(([x, y]) => ({ x, y }))
.sort((a, b) => a.x.localeCompare(b.x, undefined, { numeric: true }));
return result;
}, [mode, skillHistory, turnHistory, transI18n]);
}
const { skillHistory, turnHistory } = useBattleDataStore.getState();
const transI18n = useTranslations("DataAnalysisPage");
return useMemo(() => {
const damageMap = new Map<string, number>();
skillHistory.forEach(s => {
const turn = turnHistory[s.turnBattleId];
if (!turn) return;
let key = '';
if (mode === 0) {
key = `${transI18n('cycle')} ${turn.cycleIndex} - ${transI18n('wave')} ${turn.waveIndex}`;
} else if (mode === 1) {
key = `${transI18n('cycle')} ${turn.cycleIndex}`;
} else if (mode === 2) {
key = `${transI18n('wave')} ${turn.waveIndex}`;
}
damageMap.set(key, (damageMap.get(key) || 0) + s.totalDamage);
});
const result = Array.from(damageMap.entries())
.map(([x, y]) => ({ x, y }))
.sort((a, b) => a.x.localeCompare(b.x, undefined, { numeric: true }));
return result;
}, [mode, skillHistory, turnHistory, transI18n]);
}