2017-08-30 19:44:29 +02:00
import { Player } from "./Player.js" ;
import { BitNode , BitNodes } from "./BitNode.js" ;
2017-08-13 07:01:33 +02:00
2017-08-30 19:44:29 +02:00
/* SourceFile.js */
2017-08-13 07:01:33 +02:00
//Each SourceFile corresponds to a BitNode with the same number
function SourceFile ( number , info = "" ) {
var bitnodeKey = "BitNode" + number ;
var bitnode = BitNodes [ bitnodeKey ] ;
if ( bitnode == null ) {
throw new Error ( "Invalid Bit Node for this Source File" ) ;
}
this . n = number ;
this . name = "Source-File " + number + ": " + bitnode . name ;
this . lvl = 1 ;
this . info = info ;
this . owned = false ;
}
2017-08-30 19:44:29 +02:00
let SourceFiles = { } ;
function initSourceFiles ( ) {
SourceFiles = { } ;
SourceFiles [ "SourceFile1" ] = new SourceFile ( 1 , "This Source-File lets the player start with 32GB of RAM on his/her " +
2017-08-13 07:01:33 +02:00
"home computer. It also increases all of the player's multipliers by:<br><br>" +
"Level 1: 16%<br>" +
"Level 2: 24%<br>" +
2017-08-30 19:44:29 +02:00
"Level 3: 28%" ) ;
SourceFiles [ "SourceFile2" ] = new SourceFile ( 2 , "This Source-File increases the player's crime success rate, crime money, and charisma " +
2017-08-13 07:01:33 +02:00
"multipliers by:<br><br>" +
"Level 1: 20%<br>" +
"Level 2: 30%<br>" +
2017-08-30 19:44:29 +02:00
"Level 3: 35%" ) ;
2017-12-02 04:50:08 +01:00
SourceFiles [ "SourceFile3" ] = new SourceFile ( 3 , "This Source-File lets you create corporations on other BitNodes (although " +
"some BitNodes will disable this mechanic). This Source-File also increases your charisma and company salary multipliers by:<br>" +
"Level 1: 8%<br>" +
"Level 2: 12%<br>" +
"Level 3: 14%" ) ;
2017-08-30 19:44:29 +02:00
SourceFiles [ "SourceFile4" ] = new SourceFile ( 4 , "This Source-File lets you access and use the Singularity Functions in every BitNode. Every " +
"level of this Source-File opens up more of the Singularity Functions you can use." ) ;
2017-09-29 17:02:33 +02:00
SourceFiles [ "SourceFile5" ] = new SourceFile ( 5 , "This Source-File grants a special new stat called Intelligence. Intelligence " +
"is unique because it is permanent and persistent (it never gets reset back to 1). However, " +
"gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't " +
"know when you gain experience and how much). Higher Intelligence levels will boost your production " +
"for many actions in the game. In addition, this Source-File will unlock the getBitNodeMultipliers() " +
"Netscript function, and will raise all of your hacking-related multipliers by:<br><br> " +
"Level 1: 4%<br>" +
"Level 2: 6%<br>" +
"Level 3: 7%" ) ;
2018-05-02 19:38:11 +02:00
SourceFiles [ "SourceFile6" ] = new SourceFile ( 6 , "This Source-File allows you to access the NSA's Bladeburner Division in other " +
"BitNodes. In addition, this Source-File will raise the experience gain rate of all your combat stats by:<br><br>" +
"Level 1: 8%<br>" +
"Level 2: 12%<br>" +
"Level 3: 14%" ) ;
2017-08-30 19:44:29 +02:00
SourceFiles [ "SourceFile7" ] = new SourceFile ( 7 ) ;
2017-10-25 21:47:47 +02:00
SourceFiles [ "SourceFile8" ] = new SourceFile ( 8 , "This Source-File grants the following benefits:<br><br>" +
"Level 1: Permanent access to WSE and TIX API<br>" +
"Level 2: Ability to short stocks in other BitNodes<br>" +
"Level 3: Ability to use limit/stop orders in other BitNodes<br><br>" +
"This Source-File also increases your hacking growth multipliers by: " +
"<br>Level 1: 8%<br>Level 2: 12%<br>Level 3: 14%" ) ;
2017-08-30 19:44:29 +02:00
SourceFiles [ "SourceFile9" ] = new SourceFile ( 9 ) ;
SourceFiles [ "SourceFile10" ] = new SourceFile ( 10 ) ;
2017-10-10 06:56:48 +02:00
SourceFiles [ "SourceFile11" ] = new SourceFile ( 11 , "This Source-File makes it so that company favor increases BOTH the player's salary and reputation gain rate " +
"at that company by 1% per favor (rather than just the reputation gain). This Source-File also " +
" increases the player's company salary and reputation gain multipliers by:<br><br>" +
"Level 1: 24%<br>" +
"Level 2: 36%<br>" +
"Level 3: 42%<br>" ) ;
2018-06-05 07:58:34 +02:00
SourceFiles [ "SourceFile12" ] = new SourceFile ( 12 , "This Source-File increases all your multipliers by 1% per level" ) ;
2017-08-13 07:01:33 +02:00
}
function PlayerOwnedSourceFile ( number , level ) {
this . n = number ;
this . lvl = level ;
}
//Takes in a PlayerOwnedSourceFile as the "srcFile" argument
function applySourceFile ( srcFile ) {
var srcFileKey = "SourceFile" + srcFile . n ;
var sourceFileObject = SourceFiles [ srcFileKey ] ;
if ( sourceFileObject == null ) {
console . log ( "ERROR: Invalid source file number: " + srcFile . n ) ;
return ;
}
switch ( srcFile . n ) {
case 1 : // The Source Genesis
var mult = 0 ;
for ( var i = 0 ; i < srcFile . lvl ; ++ i ) {
mult += ( 16 / ( Math . pow ( 2 , i ) ) ) ;
}
var incMult = 1 + ( mult / 100 ) ;
var decMult = 1 - ( mult / 100 ) ;
Player . hacking _chance _mult *= incMult ;
Player . hacking _speed _mult *= incMult ;
Player . hacking _money _mult *= incMult ;
Player . hacking _grow _mult *= incMult ;
Player . hacking _mult *= incMult ;
Player . strength _mult *= incMult ;
Player . defense _mult *= incMult ;
Player . dexterity _mult *= incMult ;
Player . agility _mult *= incMult ;
Player . charisma _mult *= incMult ;
Player . hacking _exp _mult *= incMult ;
Player . strength _exp _mult *= incMult ;
Player . defense _exp _mult *= incMult ;
Player . dexterity _exp _mult *= incMult ;
Player . agility _exp _mult *= incMult ;
Player . charisma _exp _mult *= incMult ;
Player . company _rep _mult *= incMult ;
Player . faction _rep _mult *= incMult ;
Player . crime _money _mult *= incMult ;
Player . crime _success _mult *= incMult ;
Player . hacknet _node _money _mult *= incMult ;
Player . hacknet _node _purchase _cost _mult *= decMult ;
Player . hacknet _node _ram _cost _mult *= decMult ;
Player . hacknet _node _core _cost _mult *= decMult ;
Player . hacknet _node _level _cost _mult *= decMult ;
Player . work _money _mult *= incMult ;
break ;
case 2 : //Rise of the Underworld
var mult = 0 ;
for ( var i = 0 ; i < srcFile . lvl ; ++ i ) {
mult += ( 20 / ( Math . pow ( 2 , i ) ) ) ;
}
var incMult = 1 + ( mult / 100 ) ;
Player . crime _money _mult *= incMult ;
Player . crime _success _mult *= incMult ;
Player . charisma _mult *= incMult ;
break ;
2017-12-02 04:50:08 +01:00
case 3 : //Corporatocracy
var mult = 0 ;
for ( var i = 0 ; i < srcFile . lvl ; ++ i ) {
mult += ( 8 / ( Math . pow ( 2 , i ) ) ) ;
}
var incMult = 1 + ( mult / 100 ) ;
Player . charisma _mult *= incMult ;
Player . work _money _mult *= incMult ;
break ;
2017-08-30 19:44:29 +02:00
case 4 : //The Singularity
//No effects, just gives access to Singularity functions
break ;
2017-09-29 17:02:33 +02:00
case 5 : //Artificial Intelligence
var mult = 0 ;
for ( var i = 0 ; i < srcFile . lvl ; ++ i ) {
mult += ( 4 / ( Math . pow ( 2 , i ) ) ) ;
}
var incMult = 1 + ( mult / 100 ) ;
Player . hacking _chance _mult *= incMult ;
Player . hacking _speed _mult *= incMult ;
Player . hacking _money _mult *= incMult ;
Player . hacking _grow _mult *= incMult ;
2017-10-10 06:56:48 +02:00
Player . hacking _mult *= incMult ;
Player . hacking _exp _mult *= incMult ;
2017-09-29 17:02:33 +02:00
break ;
2018-05-02 19:38:11 +02:00
case 6 : //Bladeburner
var mult = 0 ;
for ( var i = 0 ; i < srcFile . lvl ; ++ i ) {
mult += ( 8 / ( Math . pow ( 2 , i ) ) ) ;
}
var incMult = 1 + ( mult / 100 ) ;
Player . strength _exp _mult *= incMult ;
Player . defense _exp _mult *= incMult ;
Player . dexterity _exp _mult *= incMult ;
Player . agility _exp _mult *= incMult ;
break ;
2018-06-25 02:13:50 +02:00
case 7 : //Bladeburner 2079
var mult = 0 ;
for ( var i = 0 ; i < srcFile . lvl ; ++ i ) {
mult += ( 8 / ( Math . pow ( 2 , i ) ) ) ;
}
var incMult = 1 + ( mult / 100 ) ;
Player . bladeburner _max _stamina _mult *= incMult ;
Player . bladeburner _stamina _gain _mult *= incMult ;
Player . bladeburner _analysis _mult *= incMult ;
Player . bladeburner _success _chance _mult *= incMult ;
break ;
2017-10-25 21:47:47 +02:00
case 8 : //Ghost of Wall Street
var mult = 0 ;
for ( var i = 0 ; i < srcFile . lvl ; ++ i ) {
mult += ( 8 / ( Math . pow ( 2 , i ) ) ) ;
}
var incMult = 1 + ( mult / 100 ) ;
Player . hacking _grow _mult *= incMult ;
break ;
2017-08-30 19:44:29 +02:00
case 11 : //The Big Crash
var mult = 0 ;
for ( var i = 0 ; i < srcFile . lvl ; ++ i ) {
2017-10-10 06:56:48 +02:00
mult += ( 24 / ( Math . pow ( 2 , i ) ) ) ;
2017-08-30 19:44:29 +02:00
}
var incMult = 1 + ( mult / 100 ) ;
Player . work _money _mult *= incMult ;
Player . company _rep _mult *= incMult ;
break ;
2018-06-05 07:58:34 +02:00
case 12 : //The testing ground
const inc = Math . pow ( 1.01 , srcFile . lvl ) ;
const dec = Math . pow ( 0.99 , srcFile . lvl ) ;
Player . hacking _chance _mult *= inc ;
Player . hacking _speed _mult *= inc ;
Player . hacking _money _mult *= inc ;
Player . hacking _grow _mult *= inc ;
Player . hacking _mult *= inc ;
Player . strength _mult *= inc ;
Player . defense _mult *= inc ;
Player . dexterity _mult *= inc ;
Player . agility _mult *= inc ;
Player . charisma _mult *= inc ;
Player . hacking _exp _mult *= inc ;
Player . strength _exp _mult *= inc ;
Player . defense _exp _mult *= inc ;
Player . dexterity _exp _mult *= inc ;
Player . agility _exp _mult *= inc ;
Player . charisma _exp _mult *= inc ;
Player . company _rep _mult *= inc ;
Player . faction _rep _mult *= inc ;
Player . crime _money _mult *= inc ;
Player . crime _success _mult *= inc ;
2018-06-08 17:51:48 +02:00
2018-06-05 07:58:34 +02:00
Player . hacknet _node _money _mult *= inc ;
Player . hacknet _node _purchase _cost _mult *= dec ;
Player . hacknet _node _ram _cost _mult *= dec ;
Player . hacknet _node _core _cost _mult *= dec ;
Player . hacknet _node _level _cost _mult *= dec ;
Player . work _money _mult *= inc ;
2017-08-13 07:01:33 +02:00
default :
console . log ( "ERROR: Invalid source file number: " + srcFile . n ) ;
break ;
}
sourceFileObject . owned = true ;
}
2017-08-30 19:44:29 +02:00
export { SourceFiles , PlayerOwnedSourceFile , applySourceFile , initSourceFiles } ;