bitburner-src/src/SourceFile/applySourceFile.ts

180 lines
5.3 KiB
TypeScript
Raw Normal View History

import { SourceFiles } from "./SourceFiles";
import { Player } from "@player";
export function applySourceFile(bn: number, lvl: number): void {
const srcFileKey = "SourceFile" + bn;
2021-09-05 01:09:30 +02:00
const sourceFileObject = SourceFiles[srcFileKey];
if (sourceFileObject == null) {
console.error(`Invalid source file number: ${bn}`);
2021-09-05 01:09:30 +02:00
return;
}
switch (bn) {
2021-09-05 01:09:30 +02:00
case 1: {
// The Source Genesis
let mult = 0;
for (let i = 0; i < lvl; ++i) {
2021-09-05 01:09:30 +02:00
mult += 16 / Math.pow(2, i);
}
const incMult = 1 + mult / 100;
const decMult = 1 / incMult;
2022-07-15 00:43:33 +02:00
Player.mults.hacking_chance *= incMult;
Player.mults.hacking_speed *= incMult;
Player.mults.hacking_money *= incMult;
Player.mults.hacking_grow *= incMult;
Player.mults.hacking *= incMult;
Player.mults.strength *= incMult;
Player.mults.defense *= incMult;
Player.mults.dexterity *= incMult;
Player.mults.agility *= incMult;
Player.mults.charisma *= incMult;
Player.mults.hacking_exp *= incMult;
Player.mults.strength_exp *= incMult;
Player.mults.defense_exp *= incMult;
Player.mults.dexterity_exp *= incMult;
Player.mults.agility_exp *= incMult;
Player.mults.charisma_exp *= incMult;
Player.mults.company_rep *= incMult;
Player.mults.faction_rep *= incMult;
Player.mults.crime_money *= incMult;
Player.mults.crime_success *= incMult;
Player.mults.hacknet_node_money *= incMult;
Player.mults.hacknet_node_purchase_cost *= decMult;
Player.mults.hacknet_node_ram_cost *= decMult;
Player.mults.hacknet_node_core_cost *= decMult;
Player.mults.hacknet_node_level_cost *= decMult;
Player.mults.work_money *= incMult;
2021-09-05 01:09:30 +02:00
break;
}
case 2: {
// Rise of the Underworld
let mult = 0;
for (let i = 0; i < lvl; ++i) {
2021-09-05 01:09:30 +02:00
mult += 24 / Math.pow(2, i);
}
const incMult = 1 + mult / 100;
2022-07-15 00:43:33 +02:00
Player.mults.crime_money *= incMult;
Player.mults.crime_success *= incMult;
Player.mults.charisma *= incMult;
2021-09-05 01:09:30 +02:00
break;
}
case 3: {
// Corporatocracy
let mult = 0;
for (let i = 0; i < lvl; ++i) {
2021-09-05 01:09:30 +02:00
mult += 8 / Math.pow(2, i);
}
const incMult = 1 + mult / 100;
2022-07-15 00:43:33 +02:00
Player.mults.charisma *= incMult;
Player.mults.work_money *= incMult;
2021-09-05 01:09:30 +02:00
break;
}
case 4: {
// The Singularity
// No effects, just gives access to Singularity functions
break;
}
case 5: {
// Artificial Intelligence
let mult = 0;
for (let i = 0; i < lvl; ++i) {
2021-09-05 01:09:30 +02:00
mult += 8 / Math.pow(2, i);
}
const incMult = 1 + mult / 100;
2022-07-15 00:43:33 +02:00
Player.mults.hacking_chance *= incMult;
Player.mults.hacking_speed *= incMult;
Player.mults.hacking_money *= incMult;
Player.mults.hacking_grow *= incMult;
Player.mults.hacking *= incMult;
Player.mults.hacking_exp *= incMult;
2021-09-05 01:09:30 +02:00
break;
}
case 6: {
// Bladeburner
let mult = 0;
for (let i = 0; i < lvl; ++i) {
2021-09-05 01:09:30 +02:00
mult += 8 / Math.pow(2, i);
}
const incMult = 1 + mult / 100;
2022-07-15 00:43:33 +02:00
Player.mults.strength_exp *= incMult;
Player.mults.defense_exp *= incMult;
Player.mults.dexterity_exp *= incMult;
Player.mults.agility_exp *= incMult;
Player.mults.strength *= incMult;
Player.mults.defense *= incMult;
Player.mults.dexterity *= incMult;
Player.mults.agility *= incMult;
2021-09-05 01:09:30 +02:00
break;
}
case 7: {
// Bladeburner 2079
let mult = 0;
for (let i = 0; i < lvl; ++i) {
2021-09-05 01:09:30 +02:00
mult += 8 / Math.pow(2, i);
}
const incMult = 1 + mult / 100;
2022-07-15 00:43:33 +02:00
Player.mults.bladeburner_max_stamina *= incMult;
Player.mults.bladeburner_stamina_gain *= incMult;
Player.mults.bladeburner_analysis *= incMult;
Player.mults.bladeburner_success_chance *= incMult;
2021-09-05 01:09:30 +02:00
break;
}
case 8: {
// Ghost of Wall Street
let mult = 0;
for (let i = 0; i < lvl; ++i) {
2021-09-05 01:09:30 +02:00
mult += 12 / Math.pow(2, i);
}
const incMult = 1 + mult / 100;
2022-07-15 00:43:33 +02:00
Player.mults.hacking_grow *= incMult;
2021-09-05 01:09:30 +02:00
break;
}
case 9: {
// Hacktocracy
2021-10-02 05:20:44 +02:00
let mult = 0;
for (let i = 0; i < lvl; ++i) {
mult += 12 / Math.pow(2, i);
2021-10-02 05:20:44 +02:00
}
const incMult = 1 + mult / 100;
const decMult = 1 - mult / 100;
2022-07-15 00:43:33 +02:00
Player.mults.hacknet_node_core_cost *= decMult;
Player.mults.hacknet_node_level_cost *= decMult;
Player.mults.hacknet_node_money *= incMult;
Player.mults.hacknet_node_purchase_cost *= decMult;
Player.mults.hacknet_node_ram_cost *= decMult;
2021-09-05 01:09:30 +02:00
break;
}
case 10: {
// Digital Carbon
// No effects, just grants sleeves
break;
}
case 11: {
// The Big Crash
let mult = 0;
for (let i = 0; i < lvl; ++i) {
2021-09-05 01:09:30 +02:00
mult += 32 / Math.pow(2, i);
}
const incMult = 1 + mult / 100;
2022-07-15 00:43:33 +02:00
Player.mults.work_money *= incMult;
Player.mults.company_rep *= incMult;
2021-09-05 01:09:30 +02:00
break;
}
2021-09-05 01:09:30 +02:00
case 12: // The Recursion
2021-10-08 09:16:51 +02:00
// Grants neuroflux.
break;
case 13: // They're Lunatics
// Grants more space on Stanek's Gift.
2021-09-05 01:09:30 +02:00
break;
case 14: // IPvGO
// Grands increased buffs and favor limit from IPvGO
break;
2021-09-05 01:09:30 +02:00
default:
console.error(`Invalid source file number: ${bn}`);
2021-09-05 01:09:30 +02:00
break;
}
2021-09-05 01:09:30 +02:00
sourceFileObject.owned = true;
}