GANG: Correctly display effects of justice tasks on wanted gain rate (#1144)

This commit is contained in:
LJ
2024-03-07 21:46:25 -07:00
committed by GitHub
parent 33af6685f8
commit 09c5ec7769

View File

@ -149,15 +149,14 @@ export class Gang {
gangFaction.playerReputation +=
(Player.mults.faction_rep * respectGainsTotal * favorMult) / GangConstants.GangRespectToReputationRatio;
if (!(this.wanted === 1 && wantedLevelGainPerCycle < 0)) {
if (this.wanted !== 1 || wantedLevelGainPerCycle >= 0) {
const oldWanted = this.wanted;
let newWanted = oldWanted + wantedLevelGainPerCycle * numCycles;
newWanted = newWanted * (1 - justice * 0.001); // safeguard
const newWanted = oldWanted + wantedLevelGainPerCycle * numCycles;
// Allows recovery when wanted / respect ratio is too high
this.wanted = newWanted * (1 - justice * 0.001);
this.wantedGainRate -= newWanted - this.wanted;
// Prevent overflow
if (wantedLevelGainPerCycle <= 0 && newWanted > oldWanted) newWanted = 1;
this.wanted = newWanted;
if (this.wanted < 1) this.wanted = 1;
if (this.wanted < 1 || (wantedLevelGainPerCycle <= 0 && this.wanted > oldWanted)) this.wanted = 1;
}
Player.gainMoney(moneyGainPerCycle * numCycles, "gang");
}