Consolidate reserve drill assignment counts

This commit is contained in:
2026-07-09 14:02:55 +09:00
parent 280facf1da
commit dd873b211b

View File

@@ -13336,10 +13336,8 @@ export class CampScene extends Phaser.Scene {
const selectedRecruitedCount = recruitedUnits.filter((unit) => selectedIds.has(unit.id)).length;
const reserveUnits = allAllies.filter((unit) => !selectedIds.has(unit.id));
const reserveNames = reserveUnits.map((unit) => unit.name).join(', ');
const individualReserveTrainingCount = reserveUnits.filter((unit) => this.campaign?.reserveTrainingAssignments[unit.id]).length;
const reserveTrainingBondAssignmentCount = reserveUnits.filter(
(unit) => this.campaign?.reserveTrainingAssignments[unit.id] && this.reserveTrainingFocusDefinitionForUnit(unit.id).bondExpGained > 0
).length;
const individualReserveTrainingCount = this.reserveTrainingAssignedUnits(reserveUnits).length;
const reserveTrainingBondAssignmentCount = this.reserveTrainingBondAssignedUnits(reserveUnits).length;
const terrainScores = selectedUnits.map((unit) => this.sortieTerrainScore(unit, scenario));
const terrainScore = terrainScores.length
? Math.round(terrainScores.reduce((sum, score) => sum + score, 0) / terrainScores.length)
@@ -13696,6 +13694,14 @@ export class CampScene extends Phaser.Scene {
return campaignReserveTrainingFocusDefinitions.find((focus) => focus.id === focusId) ?? this.reserveTrainingFocusDefinition();
}
private reserveTrainingAssignedUnits(units: UnitData[]) {
return units.filter((unit) => this.campaign?.reserveTrainingAssignments[unit.id]);
}
private reserveTrainingBondAssignedUnits(units: UnitData[]) {
return this.reserveTrainingAssignedUnits(units).filter((unit) => this.reserveTrainingFocusDefinitionForUnit(unit.id).bondExpGained > 0);
}
private reserveTrainingPreviewUnits() {
const selectedIds = new Set(this.selectedSortieUnits().map((unit) => unit.id));
return this.sortieAllies().filter((unit) => !selectedIds.has(unit.id));
@@ -13704,10 +13710,8 @@ export class CampScene extends Phaser.Scene {
private reserveTrainingPreviewLine(reserveUnits: UnitData[], focus: CampaignReserveTrainingFocusDefinition) {
const previewNames = reserveUnits.slice(0, 2).map((unit) => unit.name).join(', ');
const remaining = reserveUnits.length > 2 ? `${reserveUnits.length - 2}` : '';
const individualCount = reserveUnits.filter((unit) => this.campaign?.reserveTrainingAssignments[unit.id]).length;
const bondIndividualCount = reserveUnits.filter(
(unit) => this.campaign?.reserveTrainingAssignments[unit.id] && this.reserveTrainingFocusDefinitionForUnit(unit.id).bondExpGained > 0
).length;
const individualCount = this.reserveTrainingAssignedUnits(reserveUnits).length;
const bondIndividualCount = this.reserveTrainingBondAssignedUnits(reserveUnits).length;
const bondIndividualLine = bondIndividualCount > 0 ? ` · 공명 ${bondIndividualCount}` : '';
const gainLine = individualCount > 0
? `개별 ${individualCount}${bondIndividualLine} · 기본 ${focus.label}`
@@ -14059,10 +14063,9 @@ export class CampScene extends Phaser.Scene {
const reserveCount = Math.max(0, allies.length - selected.length);
const recentTrainingCount = this.latestReserveTrainingAwards().length;
const selectedIds = new Set(selected.map((unit) => unit.id));
const reserveTrainingAssignmentCount = allies.filter((unit) => !selectedIds.has(unit.id) && this.campaign?.reserveTrainingAssignments[unit.id]).length;
const reserveTrainingBondAssignmentCount = allies.filter(
(unit) => !selectedIds.has(unit.id) && this.campaign?.reserveTrainingAssignments[unit.id] && this.reserveTrainingFocusDefinitionForUnit(unit.id).bondExpGained > 0
).length;
const reserveUnits = allies.filter((unit) => !selectedIds.has(unit.id));
const reserveTrainingAssignmentCount = this.reserveTrainingAssignedUnits(reserveUnits).length;
const reserveTrainingBondAssignmentCount = this.reserveTrainingBondAssignedUnits(reserveUnits).length;
const bg = this.track(this.add.rectangle(x, y, width, 26, 0x0d141c, 0.92));
bg.setOrigin(0);
bg.setStrokeStyle(1, palette.gold, 0.38);
@@ -14388,10 +14391,8 @@ export class CampScene extends Phaser.Scene {
recruitedCount,
averageLevel,
reserveTrainingFocus: this.reserveTrainingFocusDefinition(),
reserveTrainingAssignmentCount: reserveUnits.filter((unit) => this.campaign?.reserveTrainingAssignments[unit.id]).length,
reserveTrainingBondAssignmentCount: reserveUnits.filter(
(unit) => this.campaign?.reserveTrainingAssignments[unit.id] && this.reserveTrainingFocusDefinitionForUnit(unit.id).bondExpGained > 0
).length,
reserveTrainingAssignmentCount: this.reserveTrainingAssignedUnits(reserveUnits).length,
reserveTrainingBondAssignmentCount: this.reserveTrainingBondAssignedUnits(reserveUnits).length,
reserveTrainingCount: reserveTrainingAwards.length,
reserveTrainingExp: reserveTrainingAwards.reduce((sum, entry) => sum + entry.expGained, 0)
};