GANG: Fix wrong wanted gain rate (#1415)

This commit is contained in:
catloversg 2024-06-21 17:05:33 +07:00 committed by GitHub
parent eff834bfe9
commit 337fa4e274
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 16 deletions

@ -154,9 +154,11 @@ export class Gang {
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;
this.wantedGainRate = (this.wanted - oldWanted) / numCycles;
// Prevent overflow
if (this.wanted < 1 || (wantedLevelGainPerCycle <= 0 && this.wanted > oldWanted)) this.wanted = 1;
if (this.wanted < 1 || (wantedLevelGainPerCycle <= 0 && this.wanted > oldWanted)) {
this.wanted = 1;
}
}
Player.gainMoney(moneyGainPerCycle * numCycles, "gang");
}

@ -27,6 +27,21 @@ export function GangStats(): React.ReactElement {
} else {
territoryStr = formatNumberNoSuffix(territoryMult, 2);
}
const hasEnoughBonusTime = gang.storedCycles > GangConstants.maxCyclesToProcess;
const bonusCyclesInOneSecond = 5 * GangConstants.maxCyclesToProcess;
const respectGainRateInBonusTime = hasEnoughBonusTime
? `[Effective Gain: ${formatRespect(gang.respectGainRate * bonusCyclesInOneSecond)} / sec]`
: "";
const wantedGainRateInBonusTime = hasEnoughBonusTime
? `[Effective Gain: ${formatWanted(gang.wantedGainRate * bonusCyclesInOneSecond)} / sec]`
: "";
const moneyGainRateInBonusTime = hasEnoughBonusTime ? (
<>
[Effective Gain: <MoneyRate money={gang.moneyGainRate * bonusCyclesInOneSecond} />]
</>
) : (
""
);
return (
<>
@ -42,9 +57,7 @@ export function GangStats(): React.ReactElement {
>
<Typography>
Respect: {formatRespect(gang.respect)} ({formatRespect(5 * gang.respectGainRate)} / sec){" "}
{gang.storedCycles > 2 * GangConstants.maxCyclesToProcess
? `[Effective Gain: ${formatRespect(5 * gang.respectGainRate * GangConstants.maxCyclesToProcess)} / sec]`
: ""}
{respectGainRateInBonusTime}
</Typography>
</Tooltip>
</Box>
@ -60,9 +73,7 @@ export function GangStats(): React.ReactElement {
>
<Typography>
Wanted Level: {formatWanted(gang.wanted)} ({formatWanted(5 * gang.wantedGainRate)} / sec){" "}
{gang.storedCycles > 2 * GangConstants.maxCyclesToProcess
? `[Effective Gain: ${formatWanted(5 * gang.wantedGainRate * GangConstants.maxCyclesToProcess)} / sec]`
: ""}
{wantedGainRateInBonusTime}
</Typography>
</Tooltip>
</Box>
@ -76,14 +87,7 @@ export function GangStats(): React.ReactElement {
</Box>
<Typography>
Money gain rate: <MoneyRate money={5 * gang.moneyGainRate} />{" "}
{gang.storedCycles > 2 * GangConstants.maxCyclesToProcess ? "[Effective Gain:" : ""}{" "}
{gang.storedCycles > 2 * GangConstants.maxCyclesToProcess ? (
<MoneyRate money={5 * gang.moneyGainRate * GangConstants.maxCyclesToProcess} />
) : (
""
)}
{gang.storedCycles > 2 * GangConstants.maxCyclesToProcess ? "]" : ""}
Money gain rate: <MoneyRate money={5 * gang.moneyGainRate} /> {moneyGainRateInBonusTime}
</Typography>
<Box display="flex">