GANG: Fix Gang UI to correctly report the bonus time multiplier as 25x

Add Tooltop to Corporation UI to explain bonus time (matching the one in
Gang UI)
Move corporation.process to the correct location
This commit is contained in:
TheMas3212 2022-11-25 00:41:24 +11:00
parent e7fc0fbb03
commit 533d8a4332
4 changed files with 23 additions and 10 deletions

@ -296,10 +296,21 @@ function BonusTime(): React.ReactElement {
const storedTime = corp.storedCycles * CONSTANTS.MilliPerCycle; const storedTime = corp.storedCycles * CONSTANTS.MilliPerCycle;
if (storedTime <= 15000) return <></>; if (storedTime <= 15000) return <></>;
return ( return (
<Typography> <Box display="flex">
Bonus time: {convertTimeMsToTimeElapsedString(storedTime)} <Tooltip
<br /> title={
<br /> <Typography>
</Typography> You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by the
browser). Bonus time makes the Corporation mechanic progress faster, up to 10x the normal speed.
</Typography>
}
>
<Typography>
Bonus time: {convertTimeMsToTimeElapsedString(storedTime)}
<br />
<br />
</Typography>
</Tooltip>
</Box>
); );
} }

@ -81,6 +81,7 @@ export class Gang {
} }
process(numCycles = 1): void { process(numCycles = 1): void {
// Run every cycle
const CyclesPerSecond = 1000 / CONSTANTS._idleSpeed; const CyclesPerSecond = 1000 / CONSTANTS._idleSpeed;
if (isNaN(numCycles)) { if (isNaN(numCycles)) {
@ -89,6 +90,7 @@ export class Gang {
this.storedCycles += numCycles; this.storedCycles += numCycles;
// Only process if there are at least 2 seconds, and at most 5 seconds // Only process if there are at least 2 seconds, and at most 5 seconds
// works out as 5 * 5 for 25x per cycle during bonus time
if (this.storedCycles < 2 * CyclesPerSecond) return; if (this.storedCycles < 2 * CyclesPerSecond) return;
const cycles = Math.min(this.storedCycles, 5 * CyclesPerSecond); const cycles = Math.min(this.storedCycles, 5 * CyclesPerSecond);

@ -21,7 +21,7 @@ export function BonusTime(props: IProps): React.ReactElement {
title={ title={
<Typography> <Typography>
You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by the You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by the
browser). Bonus time makes the Gang mechanic progress faster, up to 5x the normal speed. browser). Bonus time makes the Gang mechanic progress faster, up to 25x the normal speed.
</Typography> </Typography>
} }
> >

@ -104,7 +104,10 @@ const Engine: {
staneksGift.process(numCycles); staneksGift.process(numCycles);
// Corporation // Corporation
if (Player.corporation) Player.corporation.storeCycles(numCycles); if (Player.corporation) {
Player.corporation.storeCycles(numCycles);
Player.corporation.process();
}
// Bladeburner // Bladeburner
if (Player.bladeburner) Player.bladeburner.storeCycles(numCycles); if (Player.bladeburner) Player.bladeburner.storeCycles(numCycles);
@ -192,9 +195,6 @@ const Engine: {
Engine.Counters.messages = 150; Engine.Counters.messages = 150;
} }
} }
if (Player.corporation) {
Player.corporation.process();
}
if (Engine.Counters.mechanicProcess <= 0) { if (Engine.Counters.mechanicProcess <= 0) {
if (Player.bladeburner) { if (Player.bladeburner) {
try { try {