mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-23 08:03:48 +01:00
Combined the offline data maps for scripts into a single object. More nerfs to combat Augmentations
This commit is contained in:
parent
e087af2ab3
commit
8ce228c71f
@ -260,7 +260,7 @@ initAugmentations = function() {
|
|||||||
var CombatRib3 = new Augmentation(AugmentationNames.CombatRib3);
|
var CombatRib3 = new Augmentation(AugmentationNames.CombatRib3);
|
||||||
CombatRib3.setRequirements(12000, 22000000);
|
CombatRib3.setRequirements(12000, 22000000);
|
||||||
CombatRib3.setInfo("This is an upgrade to the Combat Rib II augmentation, and is capable of releasing even more potent combat-enhancing " +
|
CombatRib3.setInfo("This is an upgrade to the Combat Rib II augmentation, and is capable of releasing even more potent combat-enhancing " +
|
||||||
"drugs into the bloodstream<br><br>. This upgrade increases the player's strength and defense by an additional 25%.");
|
"drugs into the bloodstream<br><br>. This upgrade increases the player's strength and defense by an additional 20%.");
|
||||||
CombatRib3.addToFactions(["The Dark Army", "The Syndicate", "OmniTek Incorporated",
|
CombatRib3.addToFactions(["The Dark Army", "The Syndicate", "OmniTek Incorporated",
|
||||||
"KuaiGong International", "Blade Industries", "The Covenant"]);
|
"KuaiGong International", "Blade Industries", "The Covenant"]);
|
||||||
if (augmentationExists(AugmentationNames.CombatRib3)) {
|
if (augmentationExists(AugmentationNames.CombatRib3)) {
|
||||||
@ -315,7 +315,7 @@ initAugmentations = function() {
|
|||||||
GrapheneBoneLacings.setRequirements(450000, 850000000);
|
GrapheneBoneLacings.setRequirements(450000, 850000000);
|
||||||
GrapheneBoneLacings.setInfo("A graphene-based material is grafted and fused into the user's bones, significantly increasing " +
|
GrapheneBoneLacings.setInfo("A graphene-based material is grafted and fused into the user's bones, significantly increasing " +
|
||||||
"their density and tensile strength.<br><br>" +
|
"their density and tensile strength.<br><br>" +
|
||||||
"This augmentation increases the player's strength and defense by 90%.");
|
"This augmentation increases the player's strength and defense by 85%.");
|
||||||
GrapheneBoneLacings.addToFactions(["Fulcrum Secret Technologies", "The Covenant"]);
|
GrapheneBoneLacings.addToFactions(["Fulcrum Secret Technologies", "The Covenant"]);
|
||||||
if (augmentationExists(AugmentationNames.GrapheneBoneLacings)) {
|
if (augmentationExists(AugmentationNames.GrapheneBoneLacings)) {
|
||||||
GrapheneBoneLacings.owned = Augmentations[AugmentationNames.GrapheneBoneLacings].owned;
|
GrapheneBoneLacings.owned = Augmentations[AugmentationNames.GrapheneBoneLacings].owned;
|
||||||
@ -329,7 +329,7 @@ initAugmentations = function() {
|
|||||||
"Not only is the Bionic Spine physically stronger than a human spine, but it is also capable of digitally " +
|
"Not only is the Bionic Spine physically stronger than a human spine, but it is also capable of digitally " +
|
||||||
"stimulating and regulating the neural signals that are sent and received by the spinal cord. This results in " +
|
"stimulating and regulating the neural signals that are sent and received by the spinal cord. This results in " +
|
||||||
"greatly improved senses and reaction speeds.<br><br>" +
|
"greatly improved senses and reaction speeds.<br><br>" +
|
||||||
"This augmentation increases all of the player's combat stats by 20%.");
|
"This augmentation increases all of the player's combat stats by 18%.");
|
||||||
BionicSpine.addToFactions(["Speakers for the Dead", "The Syndicate", "KuaiGong International",
|
BionicSpine.addToFactions(["Speakers for the Dead", "The Syndicate", "KuaiGong International",
|
||||||
"OmniTek Incorporated", "Blade Industries"]);
|
"OmniTek Incorporated", "Blade Industries"]);
|
||||||
if (augmentationExists(AugmentationNames.BionicSpine)) {
|
if (augmentationExists(AugmentationNames.BionicSpine)) {
|
||||||
@ -342,7 +342,7 @@ initAugmentations = function() {
|
|||||||
GrapheneBionicSpine.setRequirements(650000, 1200000000);
|
GrapheneBionicSpine.setRequirements(650000, 1200000000);
|
||||||
GrapheneBionicSpine.setInfo("An upgrade to the Bionic Spine augmentation. It fuses the implant with an advanced graphene " +
|
GrapheneBionicSpine.setInfo("An upgrade to the Bionic Spine augmentation. It fuses the implant with an advanced graphene " +
|
||||||
"material to make it much stronger and lighter.<br><br>" +
|
"material to make it much stronger and lighter.<br><br>" +
|
||||||
"This augmentation increases all of the player's combat stats by 70%.");
|
"This augmentation increases all of the player's combat stats by 65%.");
|
||||||
GrapheneBionicSpine.addToFactions(["Fulcrum Secret Technologies", "ECorp"]);
|
GrapheneBionicSpine.addToFactions(["Fulcrum Secret Technologies", "ECorp"]);
|
||||||
if (augmentationExists(AugmentationNames.GrapheneBionicSpine)) {
|
if (augmentationExists(AugmentationNames.GrapheneBionicSpine)) {
|
||||||
GrapheneBionicSpine.owned = Augmentations[AugmentationNames.GrapheneBionicSpine].owned;
|
GrapheneBionicSpine.owned = Augmentations[AugmentationNames.GrapheneBionicSpine].owned;
|
||||||
@ -1167,7 +1167,7 @@ initAugmentations = function() {
|
|||||||
"and integumentary system. The drug permanently modifies the DNA of the " +
|
"and integumentary system. The drug permanently modifies the DNA of the " +
|
||||||
"body's skin and bone cells, granting them the ability to repair " +
|
"body's skin and bone cells, granting them the ability to repair " +
|
||||||
"and restructure themselves. <br><br>" +
|
"and restructure themselves. <br><br>" +
|
||||||
"This augmentation increases the player's strength and defense by 75%");
|
"This augmentation increases the player's strength and defense by 65%");
|
||||||
Neotra.setRequirements(225000, 550000000);
|
Neotra.setRequirements(225000, 550000000);
|
||||||
Neotra.addToFactions(["Blade Industries"]);
|
Neotra.addToFactions(["Blade Industries"]);
|
||||||
if (augmentationExists(AugmentationNames.Neotra)) {
|
if (augmentationExists(AugmentationNames.Neotra)) {
|
||||||
@ -1231,7 +1231,7 @@ initAugmentations = function() {
|
|||||||
"to the body using a skin graft. The result is photosynthetic " +
|
"to the body using a skin graft. The result is photosynthetic " +
|
||||||
"skin cells, allowing users to generate their own energy " +
|
"skin cells, allowing users to generate their own energy " +
|
||||||
"and nutrition using solar power. <br><br>" +
|
"and nutrition using solar power. <br><br>" +
|
||||||
"This augmentation increases the player's strength, defense, and agility by 50%");
|
"This augmentation increases the player's strength, defense, and agility by 40%");
|
||||||
PhotosyntheticCells.setRequirements(225000, 525000000);
|
PhotosyntheticCells.setRequirements(225000, 525000000);
|
||||||
PhotosyntheticCells.addToFactions(["KuaiGong International"]);
|
PhotosyntheticCells.addToFactions(["KuaiGong International"]);
|
||||||
if (augmentationExists(AugmentationNames.PhotosyntheticCells)) {
|
if (augmentationExists(AugmentationNames.PhotosyntheticCells)) {
|
||||||
@ -1266,7 +1266,7 @@ initAugmentations = function() {
|
|||||||
"with hardware and firmware that lets the user connect to, access and hack " +
|
"with hardware and firmware that lets the user connect to, access and hack " +
|
||||||
"devices and machines just by touching them. <br><br>" +
|
"devices and machines just by touching them. <br><br>" +
|
||||||
"This augmentation: <br>" +
|
"This augmentation: <br>" +
|
||||||
"Increases the player's strength and dexterity by 20%<br>" +
|
"Increases the player's strength and dexterity by 15%<br>" +
|
||||||
"Increases the player's hacking skill by 10%<br>" +
|
"Increases the player's hacking skill by 10%<br>" +
|
||||||
"Increases the player's hacking speed by 2%<br>" +
|
"Increases the player's hacking speed by 2%<br>" +
|
||||||
"Increases the amount of money the player gains from hacking by 10%");
|
"Increases the amount of money the player gains from hacking by 10%");
|
||||||
@ -1380,9 +1380,9 @@ initAugmentations = function() {
|
|||||||
"the retractable blades with an advanced graphene material " +
|
"the retractable blades with an advanced graphene material " +
|
||||||
"to make them much stronger and lighter. <br><br>" +
|
"to make them much stronger and lighter. <br><br>" +
|
||||||
"This augmentation:<br>" +
|
"This augmentation:<br>" +
|
||||||
"Increases the player's strength and defense by 50%<br>" +
|
"Increases the player's strength and defense by 40%<br>" +
|
||||||
"Increases the player's crime success rate by 10%<br>" +
|
"Increases the player's crime success rate by 10%<br>" +
|
||||||
"Increases the amount of money the player gains from crimes by 25%");
|
"Increases the amount of money the player gains from crimes by 30%");
|
||||||
GrapheneBrachiBlades.setRequirements(90000, 500000000);
|
GrapheneBrachiBlades.setRequirements(90000, 500000000);
|
||||||
GrapheneBrachiBlades.addToFactions(["Speakers for the Dead"]);
|
GrapheneBrachiBlades.addToFactions(["Speakers for the Dead"]);
|
||||||
if (augmentationExists(AugmentationNames.GrapheneBrachiBlades)) {
|
if (augmentationExists(AugmentationNames.GrapheneBrachiBlades)) {
|
||||||
@ -1396,7 +1396,7 @@ initAugmentations = function() {
|
|||||||
GrapheneBionicArms.setInfo("An upgrade to the Bionic Arms augmentation. It infuses the " +
|
GrapheneBionicArms.setInfo("An upgrade to the Bionic Arms augmentation. It infuses the " +
|
||||||
"prosthetic arms with an advanced graphene material " +
|
"prosthetic arms with an advanced graphene material " +
|
||||||
"to make them much stronger and lighter. <br><br>" +
|
"to make them much stronger and lighter. <br><br>" +
|
||||||
"This augmentation increases the player's strength and dexterity by 90%");
|
"This augmentation increases the player's strength and dexterity by 85%");
|
||||||
GrapheneBionicArms.setRequirements(200000, 750000000);
|
GrapheneBionicArms.setRequirements(200000, 750000000);
|
||||||
GrapheneBionicArms.addToFactions(["The Dark Army"]);
|
GrapheneBionicArms.addToFactions(["The Dark Army"]);
|
||||||
if (augmentationExists(AugmentationNames.GrapheneBionicArms)) {
|
if (augmentationExists(AugmentationNames.GrapheneBionicArms)) {
|
||||||
@ -1409,9 +1409,9 @@ initAugmentations = function() {
|
|||||||
var BrachiBlades = new Augmentation(AugmentationNames.BrachiBlades);
|
var BrachiBlades = new Augmentation(AugmentationNames.BrachiBlades);
|
||||||
BrachiBlades.setInfo("A set of retractable plasteel blades are implanted in the arm, underneath the skin. " +
|
BrachiBlades.setInfo("A set of retractable plasteel blades are implanted in the arm, underneath the skin. " +
|
||||||
"<br><br>This augmentation: <br>" +
|
"<br><br>This augmentation: <br>" +
|
||||||
"Increases the player's strength and defense by 20%<br>" +
|
"Increases the player's strength and defense by 15%<br>" +
|
||||||
"Increases the player's crime success rate by 10%<br>" +
|
"Increases the player's crime success rate by 10%<br>" +
|
||||||
"Increases the amount of money the player gains from crimes by 10%");
|
"Increases the amount of money the player gains from crimes by 15%");
|
||||||
BrachiBlades.setRequirements(5000, 18000000);
|
BrachiBlades.setRequirements(5000, 18000000);
|
||||||
BrachiBlades.addToFactions(["The Syndicate"]);
|
BrachiBlades.addToFactions(["The Syndicate"]);
|
||||||
if (augmentationExists(AugmentationNames.BrachiBlades)) {
|
if (augmentationExists(AugmentationNames.BrachiBlades)) {
|
||||||
@ -1424,7 +1424,7 @@ initAugmentations = function() {
|
|||||||
var BionicArms = new Augmentation(AugmentationNames.BionicArms);
|
var BionicArms = new Augmentation(AugmentationNames.BionicArms);
|
||||||
BionicArms.setInfo("Cybernetic arms created from plasteel and carbon fibers that completely replace " +
|
BionicArms.setInfo("Cybernetic arms created from plasteel and carbon fibers that completely replace " +
|
||||||
"the user's organic arms. <br><br>" +
|
"the user's organic arms. <br><br>" +
|
||||||
"This augmentation increases the user's strength and dexterity by 50%");
|
"This augmentation increases the user's strength and dexterity by 30%");
|
||||||
BionicArms.setRequirements(25000, 55000000);
|
BionicArms.setRequirements(25000, 55000000);
|
||||||
BionicArms.addToFactions(["Tetrads"]);
|
BionicArms.addToFactions(["Tetrads"]);
|
||||||
if (augmentationExists(AugmentationNames.BionicArms)) {
|
if (augmentationExists(AugmentationNames.BionicArms)) {
|
||||||
@ -1484,8 +1484,8 @@ applyAugmentation = function(aug, reapply=false) {
|
|||||||
Player.defense_mult *= 1.15;
|
Player.defense_mult *= 1.15;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.CombatRib3:
|
case AugmentationNames.CombatRib3:
|
||||||
Player.strength_mult *= 1.25;
|
Player.strength_mult *= 1.20;
|
||||||
Player.defense_mult *= 1.25;
|
Player.defense_mult *= 1.20;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.NanofiberWeave: //Med level
|
case AugmentationNames.NanofiberWeave: //Med level
|
||||||
Player.strength_mult *= 1.25;
|
Player.strength_mult *= 1.25;
|
||||||
@ -1499,20 +1499,20 @@ applyAugmentation = function(aug, reapply=false) {
|
|||||||
Player.dexterity_mult *= 1.05;
|
Player.dexterity_mult *= 1.05;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.GrapheneBoneLacings: //High level
|
case AugmentationNames.GrapheneBoneLacings: //High level
|
||||||
Player.strength_mult *= 1.9;
|
Player.strength_mult *= 1.85;
|
||||||
Player.defense_mult *= 1.9;
|
Player.defense_mult *= 1.85;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.BionicSpine: //Med level
|
case AugmentationNames.BionicSpine: //Med level
|
||||||
Player.strength_mult *= 1.2;
|
Player.strength_mult *= 1.18;
|
||||||
Player.defense_mult *= 1.2;
|
Player.defense_mult *= 1.18;
|
||||||
Player.agility_mult *= 1.2;
|
Player.agility_mult *= 1.18;
|
||||||
Player.dexterity_mult *= 1.2;
|
Player.dexterity_mult *= 1.18;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.GrapheneBionicSpine: //High level
|
case AugmentationNames.GrapheneBionicSpine: //High level
|
||||||
Player.strength_mult *= 1.7;
|
Player.strength_mult *= 1.65;
|
||||||
Player.defense_mult *= 1.7;
|
Player.defense_mult *= 1.65;
|
||||||
Player.agility_mult *= 1.7;
|
Player.agility_mult *= 1.65;
|
||||||
Player.dexterity_mult *= 1.7;
|
Player.dexterity_mult *= 1.65;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.BionicLegs: //Med level
|
case AugmentationNames.BionicLegs: //Med level
|
||||||
Player.agility_mult *= 1.6;
|
Player.agility_mult *= 1.6;
|
||||||
@ -1824,8 +1824,8 @@ applyAugmentation = function(aug, reapply=false) {
|
|||||||
Player.faction_rep_mult *= 1.25;
|
Player.faction_rep_mult *= 1.25;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.Neotra:
|
case AugmentationNames.Neotra:
|
||||||
Player.strength_mult *= 1.75;
|
Player.strength_mult *= 1.65;
|
||||||
Player.defense_mult *= 1.75;
|
Player.defense_mult *= 1.65;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.Xanipher:
|
case AugmentationNames.Xanipher:
|
||||||
Player.hacking_mult *= 1.2;
|
Player.hacking_mult *= 1.2;
|
||||||
@ -1854,9 +1854,9 @@ applyAugmentation = function(aug, reapply=false) {
|
|||||||
Player.hacking_exp_mult *= 1.25;
|
Player.hacking_exp_mult *= 1.25;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.PhotosyntheticCells:
|
case AugmentationNames.PhotosyntheticCells:
|
||||||
Player.strength_mult *= 1.5;
|
Player.strength_mult *= 1.4;
|
||||||
Player.defense_mult *= 1.5;
|
Player.defense_mult *= 1.4;
|
||||||
Player.agility_mult *= 1.5;
|
Player.agility_mult *= 1.4;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.Neurolink:
|
case AugmentationNames.Neurolink:
|
||||||
Player.hacking_mult *= 1.15;
|
Player.hacking_mult *= 1.15;
|
||||||
@ -1865,8 +1865,8 @@ applyAugmentation = function(aug, reapply=false) {
|
|||||||
Player.hacking_speed_mult *= 1.05;
|
Player.hacking_speed_mult *= 1.05;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.TheBlackHand:
|
case AugmentationNames.TheBlackHand:
|
||||||
Player.strength_mult *= 1.2;
|
Player.strength_mult *= 1.15;
|
||||||
Player.dexterity_mult *= 1.2;
|
Player.dexterity_mult *= 1.15;
|
||||||
Player.hacking_mult *= 1.1;
|
Player.hacking_mult *= 1.1;
|
||||||
Player.hacking_speed_mult *= 1.02;
|
Player.hacking_speed_mult *= 1.02;
|
||||||
Player.hacking_money_mult *= 1.1;
|
Player.hacking_money_mult *= 1.1;
|
||||||
@ -1895,24 +1895,24 @@ applyAugmentation = function(aug, reapply=false) {
|
|||||||
Player.defense_mult *= 1.5;
|
Player.defense_mult *= 1.5;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.GrapheneBrachiBlades:
|
case AugmentationNames.GrapheneBrachiBlades:
|
||||||
Player.strength_mult *= 1.5;
|
Player.strength_mult *= 1.4;
|
||||||
Player.defense_mult *= 1.5;
|
Player.defense_mult *= 1.4;
|
||||||
Player.crime_success_mult *= 1.1;
|
Player.crime_success_mult *= 1.1;
|
||||||
Player.crime_money_mult *= 1.25;
|
Player.crime_money_mult *= 1.3;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.GrapheneBionicArms:
|
case AugmentationNames.GrapheneBionicArms:
|
||||||
Player.strength_mult *= 1.9;
|
Player.strength_mult *= 1.85;
|
||||||
Player.dexterity_mult *= 1.9;
|
Player.dexterity_mult *= 1.85;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.BrachiBlades:
|
case AugmentationNames.BrachiBlades:
|
||||||
Player.strength_mult *= 1.2;
|
Player.strength_mult *= 1.15;
|
||||||
Player.defense_mult *= 1.2;
|
Player.defense_mult *= 1.15;
|
||||||
Player.crime_success_mult *= 1.1;
|
Player.crime_success_mult *= 1.1;
|
||||||
Player.crime_money_mult *= 1.1;
|
Player.crime_money_mult *= 1.15;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.BionicArms:
|
case AugmentationNames.BionicArms:
|
||||||
Player.strength_mult *= 1.5;
|
Player.strength_mult *= 1.3;
|
||||||
Player.dexterity_mult *= 1.5;
|
Player.dexterity_mult *= 1.3;
|
||||||
break;
|
break;
|
||||||
case AugmentationNames.SNA:
|
case AugmentationNames.SNA:
|
||||||
Player.work_money_mult *= 1.1;
|
Player.work_money_mult *= 1.1;
|
||||||
|
@ -245,13 +245,15 @@ scriptCalculateOfflineProduction = function(runningScriptObj) {
|
|||||||
var confidence = (runningScriptObj.onlineRunningTime) / 14400;
|
var confidence = (runningScriptObj.onlineRunningTime) / 14400;
|
||||||
if (confidence >= 1) {confidence = 1;}
|
if (confidence >= 1) {confidence = 1;}
|
||||||
|
|
||||||
|
//Data map: [MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
|
||||||
|
|
||||||
//Grow
|
//Grow
|
||||||
for (var ip in runningScriptObj.numTimesGrowMap) {
|
for (var ip in runningScriptObj.dataMap) {
|
||||||
if (runningScriptObj.numTimesGrowMap.hasOwnProperty(ip)) {
|
if (runningScriptObj.dataMap.hasOwnProperty(ip)) {
|
||||||
if (runningScriptObj.numTimesGrowMap[ip] == 0 || runningScriptObj.numTimesGrowMap[ip] == null) {continue;}
|
if (runningScriptObj.dataMap[ip][2] == 0 || runningScriptObj.dataMap[ip][2] == null) {continue;}
|
||||||
var serv = AllServers[ip];
|
var serv = AllServers[ip];
|
||||||
if (serv == null) {continue;}
|
if (serv == null) {continue;}
|
||||||
var timesGrown = Math.round(0.5 * runningScriptObj.numTimesGrowMap[ip] / runningScriptObj.onlineRunningTime * timePassed);
|
var timesGrown = Math.round(0.5 * runningScriptObj.dataMap[ip][2] / runningScriptObj.onlineRunningTime * timePassed);
|
||||||
console.log(runningScriptObj.filename + " called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
|
console.log(runningScriptObj.filename + " called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
|
||||||
runningScriptObj.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
|
runningScriptObj.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
|
||||||
var growth = processSingleServerGrowth(serv, timesGrown * 450);
|
var growth = processSingleServerGrowth(serv, timesGrown * 450);
|
||||||
@ -260,12 +262,12 @@ scriptCalculateOfflineProduction = function(runningScriptObj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var totalOfflineProduction = 0;
|
var totalOfflineProduction = 0;
|
||||||
for (var ip in runningScriptObj.moneyStolenMap) {
|
for (var ip in runningScriptObj.dataMap) {
|
||||||
if (runningScriptObj.moneyStolenMap.hasOwnProperty(ip)) {
|
if (runningScriptObj.dataMap.hasOwnProperty(ip)) {
|
||||||
if (runningScriptObj.moneyStolenMap[ip] == 0 || runningScriptObj.moneyStolenMap[ip] == null) {continue;}
|
if (runningScriptObj.dataMap[ip][0] == 0 || runningScriptObj.dataMap[ip][0] == null) {continue;}
|
||||||
var serv = AllServers[ip];
|
var serv = AllServers[ip];
|
||||||
if (serv == null) {continue;}
|
if (serv == null) {continue;}
|
||||||
var production = 0.5 * runningScriptObj.moneyStolenMap[ip] / runningScriptObj.onlineRunningTime * timePassed;
|
var production = 0.5 * runningScriptObj.dataMap[ip][0] / runningScriptObj.onlineRunningTime * timePassed;
|
||||||
production *= confidence;
|
production *= confidence;
|
||||||
if (production > serv.moneyAvailable) {
|
if (production > serv.moneyAvailable) {
|
||||||
production = serv.moneyAvailable;
|
production = serv.moneyAvailable;
|
||||||
@ -292,12 +294,12 @@ scriptCalculateOfflineProduction = function(runningScriptObj) {
|
|||||||
runningScriptObj.offlineExpGained += expGain;
|
runningScriptObj.offlineExpGained += expGain;
|
||||||
|
|
||||||
//Fortify a server's security based on how many times it was hacked
|
//Fortify a server's security based on how many times it was hacked
|
||||||
for (var ip in runningScriptObj.numTimesHackMap) {
|
for (var ip in runningScriptObj.dataMap) {
|
||||||
if (runningScriptObj.numTimesHackMap.hasOwnProperty(ip)) {
|
if (runningScriptObj.dataMap.hasOwnProperty(ip)) {
|
||||||
if (runningScriptObj.numTimesHackMap[ip] == 0 || runningScriptObj.numTimesHackMap[ip] == null) {continue;}
|
if (runningScriptObj.dataMap[ip][1] == 0 || runningScriptObj.dataMap[ip][1] == null) {continue;}
|
||||||
var serv = AllServers[ip];
|
var serv = AllServers[ip];
|
||||||
if (serv == null) {continue;}
|
if (serv == null) {continue;}
|
||||||
var timesHacked = Math.round(0.5 * runningScriptObj.numTimesHackMap[ip] / runningScriptObj.onlineRunningTime * timePassed);
|
var timesHacked = Math.round(0.5 * runningScriptObj.dataMap[ip][1] / runningScriptObj.onlineRunningTime * timePassed);
|
||||||
console.log(runningScriptObj.filename + " hacked " + serv.hostname + " " + timesHacked + " times while offline");
|
console.log(runningScriptObj.filename + " hacked " + serv.hostname + " " + timesHacked + " times while offline");
|
||||||
runningScriptObj.log("Hacked " + serv.hostname + " " + timesHacked + " times while offline");
|
runningScriptObj.log("Hacked " + serv.hostname + " " + timesHacked + " times while offline");
|
||||||
serv.fortify(CONSTANTS.ServerFortifyAmount * timesHacked);
|
serv.fortify(CONSTANTS.ServerFortifyAmount * timesHacked);
|
||||||
@ -305,12 +307,12 @@ scriptCalculateOfflineProduction = function(runningScriptObj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Weaken
|
//Weaken
|
||||||
for (var ip in runningScriptObj.numTimesWeakenMap) {
|
for (var ip in runningScriptObj.dataMap) {
|
||||||
if (runningScriptObj.numTimesWeakenMap.hasOwnProperty(ip)) {
|
if (runningScriptObj.dataMap.hasOwnProperty(ip)) {
|
||||||
if (runningScriptObj.numTimesWeakenMap[ip] == 0 || runningScriptObj.numTimesWeakenMap[ip] == null) {continue;}
|
if (runningScriptObj.dataMap[ip][3] == 0 || runningScriptObj.dataMap[ip][3] == null) {continue;}
|
||||||
var serv = AllServers[ip];
|
var serv = AllServers[ip];
|
||||||
if (serv == null) {continue;}
|
if (serv == null) {continue;}
|
||||||
var timesWeakened = Math.round(0.5 * runningScriptObj.numTimesWeakenMap[ip] / runningScriptObj.onlineRunningTime * timePassed);
|
var timesWeakened = Math.round(0.5 * runningScriptObj.dataMap[ip][3] / runningScriptObj.onlineRunningTime * timePassed);
|
||||||
console.log(runningScriptObj.filename + " called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline");
|
console.log(runningScriptObj.filename + " called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline");
|
||||||
runningScriptObj.log("Called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline");
|
runningScriptObj.log("Called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline");
|
||||||
serv.weaken(CONSTANTS.ServerWeakenAmount * timesWeakened);
|
serv.weaken(CONSTANTS.ServerWeakenAmount * timesWeakened);
|
||||||
@ -351,10 +353,8 @@ function RunningScript(script, args) {
|
|||||||
|
|
||||||
this.threads = 1;
|
this.threads = 1;
|
||||||
|
|
||||||
this.moneyStolenMap = new AllServersMap();
|
//[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
|
||||||
this.numTimesHackMap = new AllServersMap();
|
this.dataMap = new AllServersMap([0, 0, 0, 0]);
|
||||||
this.numTimesGrowMap = new AllServersMap();
|
|
||||||
this.numTimesWeakenMap = new AllServersMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunningScript.prototype.reset = function() {
|
RunningScript.prototype.reset = function() {
|
||||||
@ -387,30 +387,30 @@ RunningScript.prototype.displayLog = function() {
|
|||||||
|
|
||||||
//Update the moneyStolen and numTimesHack maps when hacking
|
//Update the moneyStolen and numTimesHack maps when hacking
|
||||||
RunningScript.prototype.recordHack = function(serverIp, moneyGained, n=1) {
|
RunningScript.prototype.recordHack = function(serverIp, moneyGained, n=1) {
|
||||||
if (this.moneyStolenMap == null) {
|
if (this.dataMap == null) {
|
||||||
this.moneyStolenMap = new AllServersMap();
|
//[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
|
||||||
|
this.dataMap = new AllServersMap([0, 0, 0, 0]);
|
||||||
}
|
}
|
||||||
if (this.numTimesHackMap == null) {
|
this.dataMap[serverIp][0] += moneyGained;
|
||||||
this.numTimesHackMap = new AllServersMap();
|
this.dataMap[serverIp][1] += n;
|
||||||
}
|
|
||||||
this.moneyStolenMap[serverIp] += moneyGained;
|
|
||||||
this.numTimesHackMap[serverIp] += n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the grow map when calling grow()
|
//Update the grow map when calling grow()
|
||||||
RunningScript.prototype.recordGrow = function(serverIp, n=1) {
|
RunningScript.prototype.recordGrow = function(serverIp, n=1) {
|
||||||
if (this.numTimesGrowMap == null) {
|
if (this.dataMap == null) {
|
||||||
this.numTimesGrowMap = new AllServersMap();
|
//[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
|
||||||
|
this.dataMap = new AllServersMap([0, 0, 0, 0]);
|
||||||
}
|
}
|
||||||
this.numTimesGrowMap[serverIp] += n;
|
this.dataMap[serverIp][2] += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the weaken map when calling weaken() {
|
//Update the weaken map when calling weaken() {
|
||||||
RunningScript.prototype.recordWeaken = function(serverIp, n=1) {
|
RunningScript.prototype.recordWeaken = function(serverIp, n=1) {
|
||||||
if (this.numTimesWeakenMap == null) {
|
if (this.dataMap == null) {
|
||||||
this.numTimesWeakenMap = new AllServersMap();
|
//[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
|
||||||
|
this.dataMap = new AllServersMap([0, 0, 0, 0]);
|
||||||
}
|
}
|
||||||
this.numTimesWeakenMap[serverIp] += n;
|
this.dataMap[serverIp][3] += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
RunningScript.prototype.toJSON = function() {
|
RunningScript.prototype.toJSON = function() {
|
||||||
@ -426,12 +426,14 @@ RunningScript.fromJSON = function(value) {
|
|||||||
//a key. Initializes every key with a specified value that can either by a number or an array
|
//a key. Initializes every key with a specified value that can either by a number or an array
|
||||||
function AllServersMap(init = 0) {
|
function AllServersMap(init = 0) {
|
||||||
if (init.constructor === Array || init instanceof Array) {
|
if (init.constructor === Array || init instanceof Array) {
|
||||||
this.initValue = init.splice();
|
this.initValue = init.splice(); //Make a copy
|
||||||
|
} else {
|
||||||
|
this.initValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var ip in AllServers) {
|
for (var ip in AllServers) {
|
||||||
if (AllServers.hasOwnProperty(ip)) {
|
if (AllServers.hasOwnProperty(ip)) {
|
||||||
this[ip] = init;
|
this[ip] = this.initValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user