Infiltration can no longer be done programmatically. HP is reset when prestiging

This commit is contained in:
danielyxie 2018-07-07 19:16:58 -05:00
parent f33bc59768
commit fde2b8cbc1
4 changed files with 89 additions and 35 deletions

73
dist/engine.bundle.js vendored

@ -411,6 +411,10 @@ PlayerObject.prototype.prestigeAugmentation = function() {
this.hacknetNodes.length = 0;
this.totalHacknetNodeProduction = 0;
//Re-calculate skills and reset HP
this.updateSkillLevels();
this.hp = this.max_hp;
}
PlayerObject.prototype.prestigeSourceFile = function() {
@ -504,6 +508,9 @@ PlayerObject.prototype.prestigeSourceFile = function() {
this.playtimeSinceLastAug = 0;
this.playtimeSinceLastBitnode = 0;
this.scriptProdSinceLastAug = 0;
this.updateSkillLevels();
this.hp = this.max_hp;
}
PlayerObject.prototype.getCurrentServer = function() {
@ -2468,7 +2475,7 @@ PlayerObject.prototype.queueAugmentation = function(name) {
return;
}
}
this.firstAugPurchased = true;
this.queuedAugmentations.push(new _Augmentations__WEBPACK_IMPORTED_MODULE_0__["PlayerOwnedAugmentation"](name));
}
@ -11454,13 +11461,16 @@ function displayFactionContent(factionName) {
var donateDivWrapper = Object(_utils_HelperFunctions__WEBPACK_IMPORTED_MODULE_11__["createElement"])("div", {class:"faction-work-div-wrapper"});
donateDiv.appendChild(donateDivWrapper);
var donateRepGain = Object(_utils_HelperFunctions__WEBPACK_IMPORTED_MODULE_11__["createElement"])("p", {
innerText:"This donation will result in 0 reputation gain"
innerText:"This donation will result in 0.000 reputation gain"
});
var donateAmountInput = Object(_utils_HelperFunctions__WEBPACK_IMPORTED_MODULE_11__["createElement"])("input", {
placeholder:"Donation amount",
inputListener:()=>{
var amt = parseFloat(donateAmountInput.value);
if (isNaN(amt) || amt < 0) {
let amt = 0;
if(donateAmountInput.value !== "") {
amt = parseFloat(donateAmountInput.value);
}
if (isNaN(amt)) {
donateRepGain.innerText = "Invalid donate amount entered!";
} else {
var repGain = amt / 1e6 * _Player__WEBPACK_IMPORTED_MODULE_7__["Player"].faction_rep_mult;
@ -15586,8 +15596,17 @@ function runScriptsLoop() {
var ip = workerScripts[i].serverIp;
var name = workerScripts[i].name;
//Free RAM
_Server__WEBPACK_IMPORTED_MODULE_7__["AllServers"][ip].ramUsed -= workerScripts[i].ramUsage;
//recalculate ram used
_Server__WEBPACK_IMPORTED_MODULE_7__["AllServers"][ip].ramUsed = 0;
for(let j = 0; j < workerScripts.length; j++) {
if(workerScripts[j].serverIp !== ip) {
continue
}
if(j === i) { // not this one
continue
}
_Server__WEBPACK_IMPORTED_MODULE_7__["AllServers"][ip].ramUsed += workerScripts[j].ramUsage;
}
//Delete script from Active Scripts
Object(_ActiveScriptsUI__WEBPACK_IMPORTED_MODULE_0__["deleteActiveScriptsItem"])(workerScripts[i]);
@ -72784,7 +72803,8 @@ function infiltrationBoxCreate(inst) {
var sellButton = Object(_HelperFunctions__WEBPACK_IMPORTED_MODULE_5__["clearEventListeners"])("infiltration-box-sell");
setTimeout(function() {
sellButton.addEventListener("click", function() {
sellButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
_src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].gainMoney(moneyValue);
Object(_DialogBox__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("You sold the classified information you stole from " + inst.companyName +
" for $" + moneyValue + " on the black market!<br><br>" +
@ -72802,7 +72822,8 @@ function infiltrationBoxCreate(inst) {
var factionButton = Object(_HelperFunctions__WEBPACK_IMPORTED_MODULE_5__["clearEventListeners"])("infiltration-box-faction");
setTimeout(function() {
factionButton.addEventListener("click", function() {
factionButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var facName = selector.options[selector.selectedIndex].value;
lastFac = facName;
var faction = _src_Faction__WEBPACK_IMPORTED_MODULE_2__["Factions"][facName];
@ -73005,7 +73026,8 @@ function nextInfiltrationLevel(inst) {
case 3:
scenario = InfiltrationScenarios.Bots;
killButton.style.display = "block";
killButton.addEventListener("click", function() {
killButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationKill(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY killed the security bots! Unfortunately you alerted the " +
@ -73028,7 +73050,8 @@ function nextInfiltrationLevel(inst) {
updateInfiltrationLevelText(inst);
});
assassinateButton.style.display = "block";
assassinateButton.addEventListener("click", function() {
assassinateButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationAssassinate(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY assassinated the security bots without being detected!");
@ -73050,7 +73073,8 @@ function nextInfiltrationLevel(inst) {
default: //0, 4-5
scenario = InfiltrationScenarios.Guards;
killButton.style.display = "block";
killButton.addEventListener("click", function() {
killButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationKill(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY killed the security guard! Unfortunately you alerted the " +
@ -73076,7 +73100,8 @@ function nextInfiltrationLevel(inst) {
knockoutButton.style.display = "block";
stealthKnockoutButton.style.display = "block";
assassinateButton.style.display = "block";
assassinateButton.addEventListener("click", function() {
assassinateButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationAssassinate(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY assassinated the security guard without being detected!");
@ -73098,7 +73123,8 @@ function nextInfiltrationLevel(inst) {
break;
}
knockoutButton.addEventListener("click", function() {
knockoutButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationKnockout(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY knocked out the security guard! " +
@ -73120,7 +73146,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
stealthKnockoutButton.addEventListener("click", function() {
stealthKnockoutButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationStealthKnockout(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY knocked out the security guard without making " +
@ -73141,7 +73168,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
hackSecurityButton.addEventListener("click", function() {
hackSecurityButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationHack(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY hacked and disabled the security system!");
@ -73157,7 +73185,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
destroySecurityButton.addEventListener("click", function() {
destroySecurityButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationDestroySecurity(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY and violently destroy the security system!");
@ -73173,7 +73202,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
sneakButton.addEventListener("click", function() {
sneakButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationSneak(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY sneak past the security undetected!");
@ -73188,7 +73218,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
pickdoorButton.addEventListener("click", function() {
pickdoorButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationPickLockedDoor(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY pick the locked door!");
@ -73204,7 +73235,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
bribeButton.addEventListener("click", function() {
bribeButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var bribeAmt = _Constants__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].InfiltrationBribeBaseAmount * inst.clearanceLevel;
if (_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].money.lt(bribeAmt)) {
writeInfiltrationStatusText("You do not have enough money to bribe the guard. " +
@ -73228,7 +73260,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
escapeButton.addEventListener("click", function() {
escapeButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationEscape(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY escape from the facility with the stolen classified " +

@ -157,7 +157,8 @@ function nextInfiltrationLevel(inst) {
case 3:
scenario = InfiltrationScenarios.Bots;
killButton.style.display = "block";
killButton.addEventListener("click", function() {
killButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationKill(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY killed the security bots! Unfortunately you alerted the " +
@ -180,7 +181,8 @@ function nextInfiltrationLevel(inst) {
updateInfiltrationLevelText(inst);
});
assassinateButton.style.display = "block";
assassinateButton.addEventListener("click", function() {
assassinateButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationAssassinate(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY assassinated the security bots without being detected!");
@ -202,7 +204,8 @@ function nextInfiltrationLevel(inst) {
default: //0, 4-5
scenario = InfiltrationScenarios.Guards;
killButton.style.display = "block";
killButton.addEventListener("click", function() {
killButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationKill(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY killed the security guard! Unfortunately you alerted the " +
@ -228,7 +231,8 @@ function nextInfiltrationLevel(inst) {
knockoutButton.style.display = "block";
stealthKnockoutButton.style.display = "block";
assassinateButton.style.display = "block";
assassinateButton.addEventListener("click", function() {
assassinateButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationAssassinate(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY assassinated the security guard without being detected!");
@ -250,7 +254,8 @@ function nextInfiltrationLevel(inst) {
break;
}
knockoutButton.addEventListener("click", function() {
knockoutButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationKnockout(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY knocked out the security guard! " +
@ -272,7 +277,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
stealthKnockoutButton.addEventListener("click", function() {
stealthKnockoutButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationStealthKnockout(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY knocked out the security guard without making " +
@ -293,7 +299,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
hackSecurityButton.addEventListener("click", function() {
hackSecurityButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationHack(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY hacked and disabled the security system!");
@ -309,7 +316,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
destroySecurityButton.addEventListener("click", function() {
destroySecurityButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationDestroySecurity(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY and violently destroy the security system!");
@ -325,7 +333,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
sneakButton.addEventListener("click", function() {
sneakButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationSneak(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY sneak past the security undetected!");
@ -340,7 +349,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
pickdoorButton.addEventListener("click", function() {
pickdoorButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationPickLockedDoor(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY pick the locked door!");
@ -356,7 +366,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
bribeButton.addEventListener("click", function() {
bribeButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var bribeAmt = CONSTANTS.InfiltrationBribeBaseAmount * inst.clearanceLevel;
if (Player.money.lt(bribeAmt)) {
writeInfiltrationStatusText("You do not have enough money to bribe the guard. " +
@ -380,7 +391,8 @@ function nextInfiltrationLevel(inst) {
return false;
});
escapeButton.addEventListener("click", function() {
escapeButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var res = attemptInfiltrationEscape(inst);
if (res[0]) {
writeInfiltrationStatusText("You SUCCESSFULLY escape from the facility with the stolen classified " +

@ -300,6 +300,10 @@ PlayerObject.prototype.prestigeAugmentation = function() {
this.hacknetNodes.length = 0;
this.totalHacknetNodeProduction = 0;
//Re-calculate skills and reset HP
this.updateSkillLevels();
this.hp = this.max_hp;
}
PlayerObject.prototype.prestigeSourceFile = function() {
@ -393,6 +397,9 @@ PlayerObject.prototype.prestigeSourceFile = function() {
this.playtimeSinceLastAug = 0;
this.playtimeSinceLastBitnode = 0;
this.scriptProdSinceLastAug = 0;
this.updateSkillLevels();
this.hp = this.max_hp;
}
PlayerObject.prototype.getCurrentServer = function() {
@ -2357,7 +2364,7 @@ PlayerObject.prototype.queueAugmentation = function(name) {
return;
}
}
this.firstAugPurchased = true;
this.queuedAugmentations.push(new PlayerOwnedAugmentation(name));
}

@ -81,7 +81,8 @@ function infiltrationBoxCreate(inst) {
var sellButton = clearEventListeners("infiltration-box-sell");
setTimeout(function() {
sellButton.addEventListener("click", function() {
sellButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
Player.gainMoney(moneyValue);
dialogBoxCreate("You sold the classified information you stole from " + inst.companyName +
" for $" + moneyValue + " on the black market!<br><br>" +
@ -99,7 +100,8 @@ function infiltrationBoxCreate(inst) {
var factionButton = clearEventListeners("infiltration-box-faction");
setTimeout(function() {
factionButton.addEventListener("click", function() {
factionButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;}
var facName = selector.options[selector.selectedIndex].value;
lastFac = facName;
var faction = Factions[facName];