Refactor TypeScript files for improved readability and consistency
Gitea Auto Deploy / Deploy-Container (push) Successful in 3m21s
Gitea Auto Deploy / Deploy-Container (push) Successful in 3m21s
- Cleaned up imports and formatting in localeStore.ts and socketSettingStore.ts. - Standardized interface definitions and formatting in attack.ts, avatar.ts, battle.ts, enemy.ts, entity.ts, error.ts, index.ts, lineup.ts, mics.ts, skill.ts, srtools.ts, team.ts, turn.ts, version.ts, and waveAndCycle.ts. - Ensured consistent use of semicolons and spacing across all modified files. - Updated tsconfig.json for consistency in formatting.
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
import useBattleDataStore from "@/stores/battleDataStore";
|
||||
import { useMemo } from "react";
|
||||
|
||||
export function useCalcTotalDmgAvatar(avatarId: number) {
|
||||
const { skillHistory } = useBattleDataStore.getState();
|
||||
|
||||
return useMemo(() => {
|
||||
return skillHistory
|
||||
.filter(t => t.avatarId === avatarId)
|
||||
.reduce((sum, turn) => sum + turn.totalDamage, 0);
|
||||
}, [avatarId, skillHistory]);
|
||||
}
|
||||
|
||||
|
||||
export function useCalcTotalTurnAvatar(avatarId: number) {
|
||||
const { turnHistory } = useBattleDataStore.getState();
|
||||
|
||||
return useMemo(() => {
|
||||
const uniqueActionValues = new Set<number>();
|
||||
turnHistory.forEach(turn => {
|
||||
if (turn.avatarId === avatarId) {
|
||||
uniqueActionValues.add(turn.actionValue);
|
||||
}
|
||||
});
|
||||
|
||||
return uniqueActionValues.size;
|
||||
}, [avatarId, turnHistory]);
|
||||
import useBattleDataStore from "@/stores/battleDataStore";
|
||||
import { useMemo } from "react";
|
||||
|
||||
export function useCalcTotalDmgAvatar(avatarId: number) {
|
||||
const { skillHistory } = useBattleDataStore.getState();
|
||||
|
||||
return useMemo(() => {
|
||||
return skillHistory
|
||||
.filter(t => t.avatarId === avatarId)
|
||||
.reduce((sum, turn) => sum + turn.totalDamage, 0);
|
||||
}, [avatarId, skillHistory]);
|
||||
}
|
||||
|
||||
|
||||
export function useCalcTotalTurnAvatar(avatarId: number) {
|
||||
const { turnHistory } = useBattleDataStore.getState();
|
||||
|
||||
return useMemo(() => {
|
||||
const uniqueActionValues = new Set<number>();
|
||||
turnHistory.forEach(turn => {
|
||||
if (turn.avatarId === avatarId) {
|
||||
uniqueActionValues.add(turn.actionValue);
|
||||
}
|
||||
});
|
||||
|
||||
return uniqueActionValues.size;
|
||||
}, [avatarId, turnHistory]);
|
||||
}
|
||||
Reference in New Issue
Block a user