feat(FalukantService, CreateBranchDialog): implement dynamic branch cost calculation
All checks were successful
Deploy to production / deploy (push) Successful in 2m8s

- Added new constants and methods in FalukantService to calculate branch action costs based on owned branch types, enhancing the cost management logic.
- Updated the CreateBranchDialog to utilize the new cost calculation, ensuring accurate display of branch creation costs based on user-owned branches.
- Improved the handling of branch type costs, allowing for a more flexible and responsive user experience when creating and upgrading branches.
This commit is contained in:
Torsten Schulz (local)
2026-04-27 14:35:45 +02:00
parent d854200708
commit 7fc9b55b59
2 changed files with 67 additions and 9 deletions

View File

@@ -257,6 +257,9 @@
},
computeBranchCost(type) {
if (Number.isFinite(Number(type?.createCost))) {
return Math.round(Number(type.createCost) * 100) / 100;
}
const total = this.cities.reduce((sum, city) => sum + city.branches.length, 0);
const factor = Math.pow(Math.max(total, 1), 1.2);
const raw = type.baseCost * factor;