From 6cae65fc0d8dde1e34779ec0efb9659a1849b562 Mon Sep 17 00:00:00 2001 From: TheAimMan <147098375+TheAimMan@users.noreply.github.com> Date: Sat, 27 Jul 2024 18:44:00 -0400 Subject: [PATCH] BUGFIX: Cap Gang recruit member calculation (#1523) --- src/Gang/Gang.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Gang/Gang.ts b/src/Gang/Gang.ts index dc81693d4..358e3c9ba 100644 --- a/src/Gang/Gang.ts +++ b/src/Gang/Gang.ts @@ -320,12 +320,11 @@ export class Gang { if (this.members.length >= GangConstants.MaximumGangMembers) { return 0; } - const numFreeMembers = 3; - const recruitCostBase = 5; - 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 Math.floor(Math.log(this.respect) / Math.log(recruitCostBase)) + numFreeMembers - this.members.length; //else + const numFreeMembers = GangConstants.numFreeMembers; + const recruitCostBase = GangConstants.recruitThresholdBase; + const membersRecruitabile = + Math.floor(Math.max(Math.log(this.respect), 0) / Math.log(recruitCostBase)) + numFreeMembers; + return Math.min(membersRecruitabile, GangConstants.MaximumGangMembers) - this.members.length; } recruitMember(name: string): boolean {