Merge branch 'dev' into autocomplete

This commit is contained in:
Olivier Gagnon 2021-10-15 00:22:15 -04:00
commit 745fb4fdf6
9 changed files with 61 additions and 22 deletions

32
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -15,7 +15,7 @@ import { Skill } from "./Skill";
import { City } from "./City"; import { City } from "./City";
import { IAction } from "./IAction"; import { IAction } from "./IAction";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
import { IRouter } from "../ui/Router"; import { IRouter, Page } from "../ui/Router";
import { ConsoleHelpText } from "./data/Help"; import { ConsoleHelpText } from "./data/Help";
import { exceptionAlert } from "../utils/helpers/exceptionAlert"; import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRandomInt } from "../utils/helpers/getRandomInt";
@ -26,7 +26,6 @@ import { addOffset } from "../utils/helpers/addOffset";
import { Faction } from "../Faction/Faction"; import { Faction } from "../Faction/Faction";
import { Factions, factionExists } from "../Faction/Factions"; import { Factions, factionExists } from "../Faction/Factions";
import { calculateHospitalizationCost } from "../Hospital/Hospital"; import { calculateHospitalizationCost } from "../Hospital/Hospital";
import { redPillFlag } from "../RedPill";
import { dialogBoxCreate } from "../ui/React/DialogBox"; import { dialogBoxCreate } from "../ui/React/DialogBox";
import { Settings } from "../Settings/Settings"; import { Settings } from "../Settings/Settings";
import { Augmentations } from "../Augmentation/Augmentations"; import { Augmentations } from "../Augmentation/Augmentations";
@ -184,6 +183,7 @@ export class Bladeburner implements IBladeburner {
break; break;
case ActionTypes["Diplomacy"]: case ActionTypes["Diplomacy"]:
case ActionTypes["Hyperbolic Regeneration Chamber"]: case ActionTypes["Hyperbolic Regeneration Chamber"]:
case ActionTypes["Incite Violence"]:
this.actionTimeToComplete = 60; this.actionTimeToComplete = 60;
break; break;
default: default:
@ -339,6 +339,10 @@ export class Bladeburner implements IBladeburner {
action.type = ActionTypes["Hyperbolic Regeneration Chamber"]; action.type = ActionTypes["Hyperbolic Regeneration Chamber"];
action.name = "Hyperbolic Regeneration Chamber"; action.name = "Hyperbolic Regeneration Chamber";
break; break;
case "stir trouble":
action.type = ActionTypes["Incite Violence"];
action.name = "Incite Violence";
break;
default: default:
return null; return null;
} }
@ -1167,6 +1171,8 @@ export class Bladeburner implements IBladeburner {
return GeneralActions["Diplomacy"]; return GeneralActions["Diplomacy"];
case ActionTypes["Hyperbolic Regeneration Chamber"]: case ActionTypes["Hyperbolic Regeneration Chamber"]:
return GeneralActions["Hyperbolic Regeneration Chamber"]; return GeneralActions["Hyperbolic Regeneration Chamber"];
case ActionTypes["Incite Violence"]:
return GeneralActions["Incite Violence"];
default: default:
return null; return null;
} }
@ -1493,6 +1499,23 @@ export class Bladeburner implements IBladeburner {
} }
break; break;
} }
case ActionTypes["Incite Violence"]: {
for (const contract of Object.keys(this.contracts)) {
const growthF = Growths[contract];
if (!growthF) throw new Error("trying to generate count for action that doesn't exist? " + contract);
this.contracts[contract].count += (60 * 3 * growthF()) / BladeburnerConstants.ActionCountGrowthPeriod;
}
for (const operation of Object.keys(this.operations)) {
const growthF = Growths[operation];
if (!growthF) throw new Error("trying to generate count for action that doesn't exist? " + operation);
this.operations[operation].count += (60 * 3 * growthF()) / BladeburnerConstants.ActionCountGrowthPeriod;
}
if (this.logging.general) {
this.log(`Incited violence in the synthoid communities.`);
}
this.startAction(player, this.action);
break;
}
default: default:
console.error(`Bladeburner.completeAction() called for invalid action: ${this.action.type}`); console.error(`Bladeburner.completeAction() called for invalid action: ${this.action.type}`);
break; break;
@ -1847,7 +1870,7 @@ export class Bladeburner implements IBladeburner {
process(router: IRouter, player: IPlayer): void { process(router: IRouter, player: IPlayer): void {
// Edge case condition...if Operation Daedalus is complete trigger the BitNode // Edge case condition...if Operation Daedalus is complete trigger the BitNode
if (redPillFlag === false && this.blackops.hasOwnProperty("Operation Daedalus")) { if (router.page() !== Page.BitVerse && this.blackops.hasOwnProperty("Operation Daedalus")) {
return router.toBitVerse(false, false); return router.toBitVerse(false, false);
} }
@ -1960,6 +1983,7 @@ export class Bladeburner implements IBladeburner {
"Field Analysis", "Field Analysis",
"Diplomacy", "Diplomacy",
"Hyperbolic Regeneration Chamber", "Hyperbolic Regeneration Chamber",
"Incite Violence",
]; ];
if (gen.includes(res.type)) { if (gen.includes(res.type)) {
res.type = "General"; res.type = "General";
@ -2084,6 +2108,7 @@ export class Bladeburner implements IBladeburner {
return this.getRecruitmentTime(player); return this.getRecruitmentTime(player);
case ActionTypes["Diplomacy"]: case ActionTypes["Diplomacy"]:
case ActionTypes["Hyperbolic Regeneration Chamber"]: case ActionTypes["Hyperbolic Regeneration Chamber"]:
case ActionTypes["Incite Violence"]:
return 60; return 60;
default: default:
workerScript.log("bladeburner.getActionTime", errorLogText); workerScript.log("bladeburner.getActionTime", errorLogText);
@ -2121,6 +2146,7 @@ export class Bladeburner implements IBladeburner {
case ActionTypes["FieldAnalysis"]: case ActionTypes["FieldAnalysis"]:
case ActionTypes["Diplomacy"]: case ActionTypes["Diplomacy"]:
case ActionTypes["Hyperbolic Regeneration Chamber"]: case ActionTypes["Hyperbolic Regeneration Chamber"]:
case ActionTypes["Incite Violence"]:
return [1, 1]; return [1, 1];
case ActionTypes["Recruitment"]: { case ActionTypes["Recruitment"]: {
const recChance = this.getRecruitmentSuccessChance(player); const recChance = this.getRecruitmentSuccessChance(player);
@ -2163,6 +2189,7 @@ export class Bladeburner implements IBladeburner {
case ActionTypes["FieldAnalysis"]: case ActionTypes["FieldAnalysis"]:
case ActionTypes["Diplomacy"]: case ActionTypes["Diplomacy"]:
case ActionTypes["Hyperbolic Regeneration Chamber"]: case ActionTypes["Hyperbolic Regeneration Chamber"]:
case ActionTypes["Incite Violence"]:
return Infinity; return Infinity;
default: default:
workerScript.log("bladeburner.getActionCountRemaining", errorLogText); workerScript.log("bladeburner.getActionCountRemaining", errorLogText);

@ -30,4 +30,8 @@ export const GeneralActions: IMap<Action> = {};
GeneralActions[actionName] = new Action({ GeneralActions[actionName] = new Action({
name: actionName, name: actionName,
}); });
actionName = "Incite Violence";
GeneralActions[actionName] = new Action({
name: actionName,
});
})(); })();

@ -12,6 +12,7 @@ export const ActionTypes: {
"Field Analysis": number; "Field Analysis": number;
Diplomacy: number; Diplomacy: number;
"Hyperbolic Regeneration Chamber": number; "Hyperbolic Regeneration Chamber": number;
"Incite Violence": number;
} = { } = {
Idle: 1, Idle: 1,
Contract: 2, Contract: 2,
@ -24,4 +25,5 @@ export const ActionTypes: {
"Field Analysis": 7, "Field Analysis": 7,
Diplomacy: 8, Diplomacy: 8,
"Hyperbolic Regeneration Chamber": 9, "Hyperbolic Regeneration Chamber": 9,
"Incite Violence": 10,
}; };

@ -62,4 +62,7 @@ export const GeneralActions: {
</> </>
), ),
}, },
"Incite Violence": {
desc: <>Purposefully stir trouble in the synthoid community in order to gain a political edge.</>,
},
}; };

@ -37,6 +37,7 @@ export function GeneralActionElem(props: IProps): React.ReactElement {
return 30; return 30;
case "Diplomacy": case "Diplomacy":
case "Hyperbolic Regeneration Chamber": case "Hyperbolic Regeneration Chamber":
case "Incite Violence":
return 60; return 60;
case "Recruitment": case "Recruitment":
return props.bladeburner.getRecruitmentTime(props.player); return props.bladeburner.getRecruitmentTime(props.player);

@ -8,6 +8,8 @@ function makeScriptBlob(code: string): Blob {
return new Blob([code], { type: "text/javascript" }); return new Blob([code], { type: "text/javascript" });
} }
export function compile(script: Script, scripts: Script[]): void {}
// Begin executing a user JS script, and return a promise that resolves // Begin executing a user JS script, and return a promise that resolves
// or rejects when the script finishes. // or rejects when the script finishes.
// - script is a script to execute (see Script.js). We depend only on .filename and .code. // - script is a script to execute (see Script.js). We depend only on .filename and .code.