Fix a few bugs and also added the concept of gang power multiplier

This commit is contained in:
Olivier Gagnon 2021-11-05 13:20:52 -04:00
parent 73d0f2074c
commit 362d2eb51d
5 changed files with 21 additions and 2 deletions

@ -24,7 +24,7 @@ import { GangMember } from "./GangMember";
import { WorkerScript } from "../Netscript/WorkerScript"; import { WorkerScript } from "../Netscript/WorkerScript";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { PowerMultiplier } from "./data/power";
export class Gang { export class Gang {
facName: string; facName: string;
@ -171,7 +171,9 @@ export class Gang {
AllGangs[name].power += Math.min(0.85, multiplicativeGain); AllGangs[name].power += Math.min(0.85, multiplicativeGain);
} else { } else {
// Additive gain (50% chance) // Additive gain (50% chance)
const additiveGain = 0.75 * gainRoll * AllGangs[name].territory; const powerMult = PowerMultiplier[name];
if (powerMult === undefined) throw new Error("Should not be undefined");
const additiveGain = 0.75 * gainRoll * AllGangs[name].territory * powerMult;
AllGangs[name].power += additiveGain; AllGangs[name].power += additiveGain;
} }
} }

11
src/Gang/data/power.ts Normal file

@ -0,0 +1,11 @@
export const PowerMultiplier: {
[key: string]: number | undefined;
} = {
"Slum Snakes": 1,
Tetrads: 2,
"The Syndicate": 5,
"The Dark Army": 10,
"Speakers for the Dead": 50,
NiteSec: 10,
"The Black Hand": 50,
};

@ -41,6 +41,8 @@ export function TerritorySubpage(): React.ReactElement {
and wanted level. It is very beneficial to have high territory control. and wanted level. It is very beneficial to have high territory control.
<br /> <br />
<br /> <br />
To increase your chances of winning territory assign gang members to "Territory Warfare", this will build your
gang power. Then enable "Engage in Territory Warfare" to start fighting over territory.
</Typography> </Typography>
<FormControlLabel <FormControlLabel
control={ control={

@ -362,6 +362,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
Player.scriptProdSinceLastAug += moneyGained; Player.scriptProdSinceLastAug += moneyGained;
workerScript.scriptRef.recordHack(server.hostname, moneyGained, threads); workerScript.scriptRef.recordHack(server.hostname, moneyGained, threads);
Player.gainHackingExp(expGainedOnSuccess); Player.gainHackingExp(expGainedOnSuccess);
if (manual) Player.gainIntelligenceExp(expGainedOnSuccess / CONSTANTS.IntelligenceTerminalHackBaseExpGain);
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess; workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
workerScript.log( workerScript.log(
"hack", "hack",

@ -266,6 +266,7 @@ export function NetscriptSingularity(
return false; return false;
} }
Router.toLocation(location); Router.toLocation(location);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 100);
return true; return true;
}, },
universityCourse: function (universityName: any, className: any): any { universityCourse: function (universityName: any, className: any): any {
@ -455,6 +456,7 @@ export function NetscriptSingularity(
player.loseMoney(CONSTANTS.TravelCost, "other"); player.loseMoney(CONSTANTS.TravelCost, "other");
player.city = cityname; player.city = cityname;
workerScript.log("travelToCity", `Traveled to ${cityname}`); workerScript.log("travelToCity", `Traveled to ${cityname}`);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50);
return true; return true;
default: default:
workerScript.log("travelToCity", `Invalid city name: '${cityname}'.`); workerScript.log("travelToCity", `Invalid city name: '${cityname}'.`);
@ -528,6 +530,7 @@ export function NetscriptSingularity(
if (player.hasProgram(item.program)) { if (player.hasProgram(item.program)) {
workerScript.log("purchaseProgram", `You already have the '${item.program}' program`); workerScript.log("purchaseProgram", `You already have the '${item.program}' program`);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50);
return true; return true;
} }