GANG: Fix ns.gang.getRecruitsAvailable (#1442)

This commit is contained in:
catloversg 2024-06-29 10:18:29 +07:00 committed by GitHub
parent b1c1fc24a9
commit 3fafa23f28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -317,10 +317,14 @@ export class Gang {
} }
getRecruitsAvailable(): number { getRecruitsAvailable(): number {
if (this.members.length >= GangConstants.MaximumGangMembers) {
return 0;
}
const numFreeMembers = 3; const numFreeMembers = 3;
const recruitCostBase = 5; const recruitCostBase = 5;
if (this.members.length < numFreeMembers && this.respect < Math.pow(recruitCostBase, numFreeMembers)) if (this.members.length < numFreeMembers && this.respect < Math.pow(recruitCostBase, numFreeMembers)) {
return numFreeMembers - this.members.length; // if the max possible is less than freeMembers return numFreeMembers - this.members.length; // if the max possible is less than freeMembers
}
return Math.floor(Math.log(this.respect) / Math.log(recruitCostBase)) + numFreeMembers - this.members.length; //else return Math.floor(Math.log(this.respect) / Math.log(recruitCostBase)) + numFreeMembers - this.members.length; //else
} }