feat: statistic gempotion calc

This commit is contained in:
qdzwxe committed 2025-09-04 22:29:30 +08:00
1 parent 8b87ca88e5
commit 92319deb0a
1 file changed
+17 -1
@@ -17,6 +17,9 @@ export interface StatisticsDataOneFloor {
atkValue: number;
defValue: number;
mdefValue: number;
atkGemCount: number;
defGemCount: number;
mdefGemCount: number;
}
export interface StatisticsData {
@@ -137,7 +140,10 @@ export function calculateStatisticsOne(
potionValue: 0,
atkValue: 0,
defValue: 0,
mdefValue: 0
mdefValue: 0,
atkGemCount: 0,
defGemCount: 0,
mdefGemCount: 0
};
if (!diff) return statistics;
core.status.maps[floorId].blocks.forEach(v => {
@@ -165,12 +171,15 @@ export function calculateStatisticsOne(
}
if (atk > 0) {
statistics.atkValue += atk;
statistics.atkGemCount++;
}
if (def > 0) {
statistics.defValue += def;
statistics.defGemCount++;
}
if (mdef > 0) {
statistics.mdefValue += mdef;
statistics.mdefGemCount++;
}
}
}
@@ -227,6 +236,13 @@ export function calculateStatistics(): StatisticsData {
return prev;
});
const potionGem = floors.values().reduce((prev, curr) => {
prev.atkGemCount += curr.atkGemCount;
prev.defGemCount += curr.defGemCount;
prev.mdefGemCount += curr.mdefGemCount;
return prev;
});
return {
total,
floors