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

@ -34,11 +34,6 @@ export class City {
*/
comms = 0;
/**
* Estimated number of communities in the city.
*/
commsEst = 0;
/**
* Chaos level of the city.
*/
@ -53,8 +48,6 @@ export class City {
// Number of Synthoid communities population and estimate
this.comms = getRandomInt(5, 150);
this.commsEst = this.comms + getRandomInt(-5, 5);
if (this.commsEst < 0) this.commsEst = 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:
* estChange(int): How much the estimate should change by

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

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

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

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