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; const newWanted = oldWanted + wantedLevelGainPerCycle * numCycles;
// Allows recovery when wanted / respect ratio is too high // Allows recovery when wanted / respect ratio is too high
this.wanted = newWanted * (1 - justice * 0.001); this.wanted = newWanted * (1 - justice * 0.001);
this.wantedGainRate -= newWanted - this.wanted; this.wantedGainRate = (this.wanted - oldWanted) / numCycles;
// Prevent overflow // 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"); Player.gainMoney(moneyGainPerCycle * numCycles, "gang");
} }

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