fix blade raid issue

This commit is contained in:
Olivier Gagnon 2021-10-14 17:35:22 -04:00
parent dda6235591
commit 38d915372f
8 changed files with 44 additions and 72 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -145,7 +145,7 @@ export class Bladeburner implements IBladeburner {
if (action.count < 1) { if (action.count < 1) {
return this.resetAction(); return this.resetAction();
} }
if (actionId.name === "Raid" && this.getCurrentCity().commsEst === 0) { if (actionId.name === "Raid" && this.getCurrentCity().comms === 0) {
return this.resetAction(); return this.resetAction();
} }
this.actionTimeToComplete = action.getActionTime(this); this.actionTimeToComplete = action.getActionTime(this);
@ -1088,9 +1088,6 @@ export class Bladeburner implements IBladeburner {
case "Investigation": case "Investigation":
if (success) { if (success) {
city.improvePopulationEstimateByPercentage(0.4 * this.skillMultipliers.successChanceEstimate); city.improvePopulationEstimateByPercentage(0.4 * this.skillMultipliers.successChanceEstimate);
if (Math.random() < 0.02 * this.skillMultipliers.successChanceEstimate) {
city.improveCommunityEstimate(1);
}
} else { } else {
this.triggerPotentialMigration(this.city, 0.1); this.triggerPotentialMigration(this.city, 0.1);
} }
@ -1098,9 +1095,6 @@ export class Bladeburner implements IBladeburner {
case "Undercover Operation": case "Undercover Operation":
if (success) { if (success) {
city.improvePopulationEstimateByPercentage(0.8 * this.skillMultipliers.successChanceEstimate); city.improvePopulationEstimateByPercentage(0.8 * this.skillMultipliers.successChanceEstimate);
if (Math.random() < 0.02 * this.skillMultipliers.successChanceEstimate) {
city.improveCommunityEstimate(1);
}
} else { } else {
this.triggerPotentialMigration(this.city, 0.15); this.triggerPotentialMigration(this.city, 0.15);
} }
@ -1121,7 +1115,6 @@ export class Bladeburner implements IBladeburner {
nonZero: true, nonZero: true,
}); });
--city.comms; --city.comms;
--city.commsEst;
} else { } else {
const change = getRandomInt(-10, -5) / 10; const change = getRandomInt(-10, -5) / 10;
city.changePopulationByPercentage(change, { city.changePopulationByPercentage(change, {

@ -34,11 +34,6 @@ export class City {
*/ */
comms = 0; comms = 0;
/**
* Estimated number of communities in the city.
*/
commsEst = 0;
/** /**
* Chaos level of the city. * Chaos level of the city.
*/ */
@ -53,8 +48,6 @@ export class City {
// Number of Synthoid communities population and estimate // Number of Synthoid communities population and estimate
this.comms = getRandomInt(5, 150); this.comms = getRandomInt(5, 150);
this.commsEst = this.comms + getRandomInt(-5, 5);
if (this.commsEst < 0) this.commsEst = 0;
this.chaos = 0; this.chaos = 0;
} }
@ -113,23 +106,6 @@ export class City {
} }
} }
improveCommunityEstimate(n = 1): void {
if (isNaN(n)) {
throw new Error("NaN passed into City.improveCommunityEstimate()");
}
if (this.commsEst < this.comms) {
this.commsEst += n;
if (this.commsEst > this.comms) {
this.commsEst = this.comms;
}
} else if (this.commsEst > this.comms) {
this.commsEst -= n;
if (this.commsEst < this.comms) {
this.commsEst = this.comms;
}
}
}
/** /**
* @params options: * @params options:
* estChange(int): How much the estimate should change by * estChange(int): How much the estimate should change by

@ -55,14 +55,18 @@ export function ActionLevel({ action, isActive, bladeburner, rerender }: IProps)
</Tooltip> </Tooltip>
</Box> </Box>
<Tooltip title={isActive ? <Typography>WARNING: changing the level will restart the Operation</Typography> : ""}> <Tooltip title={isActive ? <Typography>WARNING: changing the level will restart the Operation</Typography> : ""}>
<IconButton disabled={!canIncrease} onClick={increaseLevel}> <span>
<ArrowDropUpIcon /> <IconButton disabled={!canIncrease} onClick={increaseLevel}>
</IconButton> <ArrowDropUpIcon />
</IconButton>
</span>
</Tooltip> </Tooltip>
<Tooltip title={isActive ? <Typography>WARNING: changing the level will restart the Operation</Typography> : ""}> <Tooltip title={isActive ? <Typography>WARNING: changing the level will restart the Operation</Typography> : ""}>
<IconButton disabled={!canDecrease} onClick={decreaseLevel}> <span>
<ArrowDropDownIcon /> <IconButton disabled={!canDecrease} onClick={decreaseLevel}>
</IconButton> <ArrowDropDownIcon />
</IconButton>
</span>
</Tooltip> </Tooltip>
</Box> </Box>
); );

@ -51,33 +51,35 @@ export function BlackOpElem(props: IProps): React.ReactElement {
return ( return (
<Paper sx={{ my: 1, p: 1 }}> <Paper sx={{ my: 1, p: 1 }}>
<Typography> {isActive ? (
{isActive ? ( <>
<>
<>
<CopyableText value={props.action.name} /> (IN PROGRESS - {formatNumber(computedActionTimeCurrent, 0)} /{" "}
{formatNumber(props.bladeburner.actionTimeToComplete, 0)})
<Typography>
{createProgressBarText({
progress: computedActionTimeCurrent / props.bladeburner.actionTimeToComplete,
})}
</Typography>
</>
</>
) : (
<> <>
<CopyableText value={props.action.name} /> <CopyableText value={props.action.name} />
<Typography>
<StartButton (IN PROGRESS - {formatNumber(computedActionTimeCurrent, 0)} /{" "}
bladeburner={props.bladeburner} {formatNumber(props.bladeburner.actionTimeToComplete, 0)})
type={ActionTypes.BlackOperation} </Typography>
name={props.action.name} <Typography>
rerender={rerender} {createProgressBarText({
/> progress: computedActionTimeCurrent / props.bladeburner.actionTimeToComplete,
<TeamSizeButton action={props.action} bladeburner={props.bladeburner} /> })}
</Typography>
</> </>
)} </>
</Typography> ) : (
<>
<CopyableText value={props.action.name} />
<StartButton
bladeburner={props.bladeburner}
type={ActionTypes.BlackOperation}
name={props.action.name}
rerender={rerender}
/>
<TeamSizeButton action={props.action} bladeburner={props.bladeburner} />
</>
)}
<br /> <br />
<br /> <br />
<Typography>{actionData.desc}</Typography> <Typography>{actionData.desc}</Typography>

@ -57,8 +57,9 @@ export function GeneralActionElem(props: IProps): React.ReactElement {
<Paper sx={{ my: 1, p: 1 }}> <Paper sx={{ my: 1, p: 1 }}>
{isActive ? ( {isActive ? (
<> <>
<CopyableText value={props.action.name} />
<Typography> <Typography>
<CopyableText value={props.action.name} /> (IN PROGRESS - {formatNumber(computedActionTimeCurrent, 0)} /{" "} (IN PROGRESS - {formatNumber(computedActionTimeCurrent, 0)} /{" "}
{formatNumber(props.bladeburner.actionTimeToComplete, 0)}) {formatNumber(props.bladeburner.actionTimeToComplete, 0)})
</Typography> </Typography>
<Typography> <Typography>
@ -69,9 +70,7 @@ export function GeneralActionElem(props: IProps): React.ReactElement {
</> </>
) : ( ) : (
<Box display="flex" flexDirection="row" alignItems="center"> <Box display="flex" flexDirection="row" alignItems="center">
<Typography> <CopyableText value={props.action.name} />
<CopyableText value={props.action.name} />
</Typography>
<StartButton <StartButton
bladeburner={props.bladeburner} bladeburner={props.bladeburner}
type={ActionTypes[props.action.name as string]} type={ActionTypes[props.action.name as string]}

@ -117,9 +117,7 @@ export function Stats(props: IProps): React.ReactElement {
</Typography> </Typography>
} }
> >
<Typography> <Typography>Synthoid Communities: {formatNumber(props.bladeburner.getCurrentCity().comms, 0)}</Typography>
Est. Synthoid Communities: {formatNumber(props.bladeburner.getCurrentCity().comms, 0)}
</Typography>
</Tooltip> </Tooltip>
</Box> </Box>
<br /> <br />