feat: statistic gempotion calc

This commit is contained in:
qdzwxe 2025-09-04 22:29:30 +08:00
parent 8b87ca88e5
commit 92319deb0a

View File

@ -17,6 +17,9 @@ export interface StatisticsDataOneFloor {
atkValue: number; atkValue: number;
defValue: number; defValue: number;
mdefValue: number; mdefValue: number;
atkGemCount: number;
defGemCount: number;
mdefGemCount: number;
} }
export interface StatisticsData { export interface StatisticsData {
@ -137,7 +140,10 @@ export function calculateStatisticsOne(
potionValue: 0, potionValue: 0,
atkValue: 0, atkValue: 0,
defValue: 0, defValue: 0,
mdefValue: 0 mdefValue: 0,
atkGemCount: 0,
defGemCount: 0,
mdefGemCount: 0
}; };
if (!diff) return statistics; if (!diff) return statistics;
core.status.maps[floorId].blocks.forEach(v => { core.status.maps[floorId].blocks.forEach(v => {
@ -165,12 +171,15 @@ export function calculateStatisticsOne(
} }
if (atk > 0) { if (atk > 0) {
statistics.atkValue += atk; statistics.atkValue += atk;
statistics.atkGemCount++;
} }
if (def > 0) { if (def > 0) {
statistics.defValue += def; statistics.defValue += def;
statistics.defGemCount++;
} }
if (mdef > 0) { if (mdef > 0) {
statistics.mdefValue += mdef; statistics.mdefValue += mdef;
statistics.mdefGemCount++;
} }
} }
} }
@ -227,6 +236,13 @@ export function calculateStatistics(): StatisticsData {
return prev; return prev;
}); });
const potionGem = floors.values().reduce((prev, curr) => {
prev.atkGemCount += curr.atkGemCount;
prev.defGemCount += curr.defGemCount;
prev.mdefGemCount += curr.mdefGemCount;
return prev;
});
return { return {
total, total,
floors floors