merged from upstream

This commit is contained in:
rderfler
2022-04-14 15:47:00 -04:00
11 changed files with 75 additions and 39 deletions
+30 -27
View File
@@ -5,6 +5,7 @@ import { Programs } from "../Programs/Programs";
import { WHRNG } from "../Casino/RNG";
import React from "react";
import { FactionNames } from "../Faction/data/FactionNames";
import { CONSTANTS } from "../Constants";
function getRandomBonus(): any {
const bonuses = [
@@ -1892,6 +1893,8 @@ export const initChurchOfTheMachineGodAugmentations = (): Augmentation[] => [
];
export function initNeuroFluxGovernor(): Augmentation {
const donationBonus = CONSTANTS.Donations / 1e6 / 100; // 1 millionth of a percent per donation
console.log(donationBonus * 100);
return new Augmentation({
name: AugmentationNames.NeuroFluxGovernor,
repCost: 500,
@@ -1904,35 +1907,35 @@ export function initNeuroFluxGovernor(): Augmentation {
stats: (
<>
This special augmentation can be leveled up infinitely. Each level of this augmentation increases MOST
multipliers by 1%, stacking multiplicatively.
multipliers by 1% (+{donationBonus * 100}% boosted by real life blood donations), stacking multiplicatively.
</>
),
hacking_chance_mult: 1.01,
hacking_speed_mult: 1.01,
hacking_money_mult: 1.01,
hacking_grow_mult: 1.01,
hacking_mult: 1.01,
strength_mult: 1.01,
defense_mult: 1.01,
dexterity_mult: 1.01,
agility_mult: 1.01,
charisma_mult: 1.01,
hacking_exp_mult: 1.01,
strength_exp_mult: 1.01,
defense_exp_mult: 1.01,
dexterity_exp_mult: 1.01,
agility_exp_mult: 1.01,
charisma_exp_mult: 1.01,
company_rep_mult: 1.01,
faction_rep_mult: 1.01,
crime_money_mult: 1.01,
crime_success_mult: 1.01,
hacknet_node_money_mult: 1.01,
hacknet_node_purchase_cost_mult: 0.99,
hacknet_node_ram_cost_mult: 0.99,
hacknet_node_core_cost_mult: 0.99,
hacknet_node_level_cost_mult: 0.99,
work_money_mult: 1.01,
hacking_chance_mult: 1.01 + donationBonus,
hacking_speed_mult: 1.01 + donationBonus,
hacking_money_mult: 1.01 + donationBonus,
hacking_grow_mult: 1.01 + donationBonus,
hacking_mult: 1.01 + donationBonus,
strength_mult: 1.01 + donationBonus,
defense_mult: 1.01 + donationBonus,
dexterity_mult: 1.01 + donationBonus,
agility_mult: 1.01 + donationBonus,
charisma_mult: 1.01 + donationBonus,
hacking_exp_mult: 1.01 + donationBonus,
strength_exp_mult: 1.01 + donationBonus,
defense_exp_mult: 1.01 + donationBonus,
dexterity_exp_mult: 1.01 + donationBonus,
agility_exp_mult: 1.01 + donationBonus,
charisma_exp_mult: 1.01 + donationBonus,
company_rep_mult: 1.01 + donationBonus,
faction_rep_mult: 1.01 + donationBonus,
crime_money_mult: 1.01 + donationBonus,
crime_success_mult: 1.01 + donationBonus,
hacknet_node_money_mult: 1.01 + donationBonus,
hacknet_node_purchase_cost_mult: 1 / (1.01 + donationBonus),
hacknet_node_ram_cost_mult: 1 / (1.01 + donationBonus),
hacknet_node_core_cost_mult: 1 / (1.01 + donationBonus),
hacknet_node_level_cost_mult: 1 / (1.01 + donationBonus),
work_money_mult: 1.01 + donationBonus,
factions: Object.values(FactionNames),
});
}
+3
View File
@@ -114,6 +114,7 @@ export const CONSTANTS: {
AugmentationGraftingTimeBase: number;
EntropyEffect: number;
TotalNumBitNodes: number;
Donations: number; // number of blood/plasma/palette donation the dev have verified., boosts NFG
LatestUpdate: string;
} = {
VersionString: "1.6.4",
@@ -286,6 +287,8 @@ export const CONSTANTS: {
// BitNode/Source-File related stuff
TotalNumBitNodes: 24,
Donations: 2,
LatestUpdate: `
v1.6.3 - 2022-04-01 Few stanek fixes
----------------------------
+3 -2
View File
@@ -40,8 +40,9 @@ export class ActiveFragment {
// These 2 variables converts 'this' local coordinates to world to other local.
const dx: number = other.x - this.x;
const dy: number = other.y - this.y;
for (let j = 0; j < thisFragment.shape.length; j++) {
for (let i = 0; i < thisFragment.shape[j].length; i++) {
const fragSize = Math.max(thisFragment.shape.length, thisFragment.shape[0].length);
for (let j = 0; j < fragSize; j++) {
for (let i = 0; i < fragSize; i++) {
if (thisFragment.fullAt(i, j, this.rotation) && otherFragment.fullAt(i - dx, j - dy, other.rotation))
return true;
}
+7 -4
View File
@@ -59,17 +59,20 @@ export function NetscriptExtra(player: IPlayer, workerScript: WorkerScript, help
player.giveExploit(Exploit.RealityAlteration);
}
},
rainbow: function (guess: unknown): void {
async function tryGuess(): Promise<void> {
const verified = await bcrypt.compare(
rainbow: function (guess: unknown): boolean {
function tryGuess(): boolean {
// eslint-disable-next-line no-sync
const verified = bcrypt.compareSync(
helper.string("rainbow", "guess", guess),
"$2a$10$aertxDEkgor8baVtQDZsLuMwwGYmkRM/ohcA6FjmmzIHQeTCsrCcO",
);
if (verified) {
player.giveExploit(Exploit.INeedARainbow);
return true;
}
return false;
}
tryGuess();
return tryGuess();
},
};
}
+8
View File
@@ -48,6 +48,7 @@ import { FactionInfos } from "../Faction/FactionInfo";
import { InternalAPI, NetscriptContext } from "src/Netscript/APIWrapper";
import { BlackOperationNames } from "../Bladeburner/data/BlackOperationNames";
import { enterBitNode } from "../RedPill";
import { FactionNames } from "../Faction/data/FactionNames";
export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript): InternalAPI<ISingularity> {
const getAugmentation = function (_ctx: NetscriptContext, name: string): Augmentation {
@@ -1173,6 +1174,13 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
);
return false;
}
if (faction.name === FactionNames.ChurchOfTheMachineGod || faction.name === FactionNames.Bladeburners) {
workerScript.log(
"donateToFaction",
() => `You can't donate to '${facName}' because they do not accept donations`,
);
return false;
}
if (typeof amt !== "number" || amt <= 0 || isNaN(amt)) {
workerScript.log("donateToFaction", () => `Invalid donation amount: '${amt}'.`);
return false;
+6 -1
View File
@@ -16,6 +16,7 @@ import {
SleeveSkills,
SleeveTask,
} from "../ScriptEditor/NetscriptDefinitions";
import { checkEnum } from "../utils/helpers/checkEnum";
export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): ISleeve {
const checkSleeveAPIAccess = function (func: string): void {
@@ -99,7 +100,11 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
const cityName = helper.string("travel", "cityName", _cityName);
checkSleeveAPIAccess("travel");
checkSleeveNumber("travel", sleeveNumber);
return player.sleeves[sleeveNumber].travel(player, cityName as CityName);
if (checkEnum(CityName, cityName)) {
return player.sleeves[sleeveNumber].travel(player, cityName);
} else {
throw helper.makeRuntimeErrorMsg("sleeve.setToCompanyWork", `Invalid city name: '${cityName}'.`);
}
},
setToCompanyWork: function (_sleeveNumber: unknown, acompanyName: unknown): boolean {
updateRam("setToCompanyWork");
+4 -2
View File
@@ -38,6 +38,7 @@ import { PlayerAchievement } from "../../Achievements/Achievements";
import { cyrb53 } from "../../utils/StringHelperFunctions";
import { getRandomInt } from "../../utils/helpers/getRandomInt";
import { ITaskTracker } from "../ITaskTracker";
import { CONSTANTS } from "../../Constants";
export class PlayerObject implements IPlayer {
// Class members
@@ -356,7 +357,7 @@ export class PlayerObject implements IPlayer {
this.faction_rep_mult = 1;
//Money
this.money = 1000;
this.money = 1000 + CONSTANTS.Donations;
//Location information
this.city = CityName.Sector12;
@@ -635,7 +636,8 @@ export class PlayerObject implements IPlayer {
return "Player";
}
/**
/**
* Serialize the current object to a JSON save state.
*/
toJSON(): any {
@@ -108,7 +108,7 @@ export function prestigeAugmentation(this: PlayerObject): void {
this.agility_exp = 0;
this.charisma_exp = 0;
this.money = 1000;
this.money = 1000 + CONSTANTS.Donations;
this.city = CityName.Sector12;
this.location = LocationName.TravelAgency;