feat(FalukantService, CreateBranchDialog): implement dynamic branch cost calculation
All checks were successful
Deploy to production / deploy (push) Successful in 2m8s
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user