Merge pull request #186 from danielyxie/dev

0.34.3 Multiple Corporation Management bug fixes and balance changes
This commit is contained in:
danielyxie 2018-01-31 17:43:06 -06:00 committed by GitHub
commit ff3f6da2d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 130 additions and 32 deletions

81
dist/bundle.js vendored

@ -2728,7 +2728,7 @@ function powerOfTwo(n) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONSTANTS; });
let CONSTANTS = {
Version: "0.34.2",
Version: "0.34.3",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@ -3862,11 +3862,18 @@ let CONSTANTS = {
"-Bug fix: (Hopefully) removed an exploit where you could avoid RAM usage for Netscript function calls by assigning functions to a variable (foo = hack(); foo('helios');)<br>" +
"-Bug fix: (Hopefully) removed an exploit where you could run arbitrary Javascript code using the constructor() method<br>" +
"-Thanks to Github user mateon1 and Reddit users havoc_mayhem and spaceglace for notifying me of the above exploits<br>" +
"-The fileExists() Netscript function now works on text files (.txt). Thanks to Github user devoidfury for this<br><br>" +
"-The fileExists() Netscript function now works on text files (.txt). Thanks to Github user devoidfury for this<br><br>" +
"v0.34.3<br>" +
"-Minor balance changes to Corporation. Upgrades are generally cheaper and/or have more powerful effects. " +
"You will receive more funding while your are a private company. " +
"-Accessing the hacknetnodes array in Netscript now costs 4.0GB of RAM (only counts against RAM usage once)<br>"
"-Minor balance changes to Corporations: <br>" +
"---Upgrades are generally cheaper and/or have more powerful effects.<br>" +
"---You will receive more funding while your are a private company.<br>" +
"---Product demand decreases at a slower rate.<br>" +
"---Production multiplier for Industries (receives for owning real estate/hardware/robots/etc.) is slightly higher<br>" +
"-Accessing the hacknetnodes array in Netscript now costs 4.0GB of RAM (only counts against RAM usage once)<br>" +
"-Bug Fix: Corporation oustanding shares should now be numeric rather than a string<br>" +
"-Bug Fix: Corporation production now properly calculated for industries that dont produce materials.<br>" +
"-Bug Fix: Gangs should now properly reset when switching BitNodes<br>" +
"-Bug Fix: Corporation UI should now properly reset when you go public<br>"
}
@ -39828,7 +39835,7 @@ var IndustryUpgrades = {
"Coffee", "Provide your employees with coffee, increasing their energy by 5%."],
"1": [1, 1e9, 1.02, 1.01,
"AdVert.Inc", "Hire AdVert.Inc to advertise your company. Each level of " +
"this upgrade grants your company a static increase of 5 and 1 to its awareness and " +
"this upgrade grants your company a static increase of 4 and 1 to its awareness and " +
"popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " +
"by a random percentage between 5% and 15%. These effects are increased by other upgrades " +
"that increase the power of your advertising."]
@ -39981,6 +39988,7 @@ Industry.prototype.init = function() {
this.robFac = 0.3;
this.aiFac = 0.25;
this.advFac = 0.75;
this.reFac = 0.05;
this.reqMats = {
"Food": 0.5,
"Water": 0.5,
@ -40004,9 +40012,9 @@ Industry.prototype.init = function() {
case Industries.Chemical:
this.reFac = 0.25;
this.sciFac = 0.75;
this.hwFac = 0.15;
this.robFac = 0.2;
this.aiFac = 0.15;
this.hwFac = 0.2;
this.robFac = 0.25;
this.aiFac = 0.2;
this.advFac = 0.1;
this.reqMats = {
"Plants": 1,
@ -40049,6 +40057,7 @@ Industry.prototype.init = function() {
this.sciFac = 0.7;
this.aiFac = 0.4;
this.advFac = 0.6;
this.hwFac = 0.2;
this.reqMats = {
"Hardware": 5,
"Energy": 3,
@ -40173,7 +40182,7 @@ Industry.prototype.process = function(marketCycles=1, state, company) {
//At the start of a cycle, store and reset revenue/expenses
//Then calculate salaries and processs the markets
if (state === "START") {
if (this.thisCycleRevenue.isNaN() || this.thisCycleExpenses.isNaN()) {
if (isNaN(this.thisCycleRevenue) || isNaN(this.thisCycleExpenses)) {
console.log("ERROR: NaN in Corporation's computed revenue/expenses");
console.log(this.thisCycleRevenue.toString());
console.log(this.thisCycleExpenses.toString());
@ -40263,7 +40272,7 @@ Industry.prototype.processProductMarket = function(marketCycles=1) {
for (var name in this.products) {
if (this.products.hasOwnProperty(name)) {
var product = this.products[name];
var change = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(1, 4) * 0.0005;
var change = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(1, 3) * 0.0004;
if (this.type === Industries.Pharmaceutical || this.type === Industries.Software ||
this.type === Industries.Robotics) {
change *= 3;
@ -40398,6 +40407,15 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
for (var fooI = 0; fooI < this.prodMats.length; ++fooI) {
warehouse.materials[this.prodMats[fooI]].prd = fooProd;
}
} else {
//If this doesn't produce any materials, then it only creates
//Products. Creating products will consume materials. The
//Production of all consumed materials must be set to 0
for (var reqMatName in this.reqMats) {
if (this.reqMats.hasOwnProperty(reqMatName)) {
warehouse.materials[reqMatName].prd = 0;
}
}
}
break;
@ -40715,7 +40733,7 @@ Industry.prototype.upgrade = function(upgrade, refs) {
break;
case 1: //AdVert.Inc,
var advMult = corporation.getAdvertisingMultiplier();
this.awareness += (5 * advMult);
this.awareness += (4 * advMult);
this.popularity += (1 * advMult);
this.awareness *= (1.01 * advMult);
this.popularity *= ((1 + Math.random(5, 15) / 100) * advMult);
@ -41958,7 +41976,7 @@ Corporation.prototype.process = function(numCycles=1) {
});
var profit = this.revenue.minus(this.expenses);
var cycleProfit = profit.times(marketCycles * SecsPerMarketCycle);
if (this.funds.isNaN()) {
if (isNaN(this.funds)) {
Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("There was an error calculating your Corporations funds and they got reset to 0. " +
"This is a bug. Please report to game developer.<br><br>" +
"(Your funds have been set to $150b for the inconvenience)");
@ -42053,7 +42071,7 @@ Corporation.prototype.goPublic = function() {
class:"a-link-button",
innerText:"Go Public",
clickListener:()=>{
var numShares = input.value;
var numShares = Math.round(input.value);
var initialSharePrice = this.determineValuation() / (TOTALSHARES);
if (isNaN(numShares)) {
Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for number of issued shares");
@ -42068,6 +42086,7 @@ Corporation.prototype.goPublic = function() {
this.issuedShares = numShares;
this.numShares -= numShares;
this.funds = this.funds.plus(numShares * initialSharePrice);
this.displayCorporationOverviewContent();
Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(goPublicPopupId);
return false;
}
@ -42481,6 +42500,16 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: You don't have this many shares to sell");
} else {
this.numShares -= shares;
if (isNaN(this.issuedShares)) {
console.log("ERROR: Corporation issuedShares is NaN: " + this.issuedShares);
console.log("Converting to number now");
var res = parseInt(this.issuedShares);
if (isNaN(res)) {
this.issuedShares = 0;
} else {
this.issuedShares = res;
}
}
this.issuedShares += shares;
__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].gainMoney(shares * this.sharePrice);
Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId);
@ -42509,7 +42538,8 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
var currentStockPrice = this.sharePrice;
var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", {
innerHTML: "Enter the number of shares you would like to buy back at market price. The current price of your " +
"company's stock is " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a"),
"company's stock is " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a") +
". Your company currently has " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.issuedShares, 3) + " outstanding stock shares",
});
var costIndicator = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", {});
var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", {
@ -42542,6 +42572,16 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
__WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(shares * tempStockPrice).format("$0.000a") + ")");
} else {
this.numShares += shares;
if (isNaN(this.issuedShares)) {
console.log("ERROR: Corporation issuedShares is NaN: " + this.issuedShares);
console.log("Converting to number now");
var res = parseInt(this.issuedShares);
if (isNaN(res)) {
this.issuedShares = 0;
} else {
this.issuedShares = res;
}
}
this.issuedShares -= shares;
__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].loseMoney(shares * tempStockPrice);
//TODO REMOVE from Player money
@ -44072,7 +44112,13 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=fa
var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])();
yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
yesBtn.addEventListener("click", function() {
if (!flume) {giveSourceFile(destroyedBitNode);}
if (!flume) {
giveSourceFile(destroyedBitNode);
} else {
//If player used flume, subtract 5 int exp. The prestigeSourceFile()
//function below grants 5 int exp, so this allows sets net gain to 0
__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].gainIntelligenceExp(-5);
}
redPillFlag = false;
var container = document.getElementById("red-pill-container");
Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["j" /* removeChildrenFromElement */])(container);
@ -44368,6 +44414,9 @@ function prestigeSourceFile() {
//Gain int exp
__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(5);
//Reset gang
__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gang = null;
}

@ -535,7 +535,7 @@ var IndustryUpgrades = {
"Coffee", "Provide your employees with coffee, increasing their energy by 5%."],
"1": [1, 1e9, 1.02, 1.01,
"AdVert.Inc", "Hire AdVert.Inc to advertise your company. Each level of " +
"this upgrade grants your company a static increase of 5 and 1 to its awareness and " +
"this upgrade grants your company a static increase of 4 and 1 to its awareness and " +
"popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " +
"by a random percentage between 5% and 15%. These effects are increased by other upgrades " +
"that increase the power of your advertising."]
@ -688,6 +688,7 @@ Industry.prototype.init = function() {
this.robFac = 0.3;
this.aiFac = 0.25;
this.advFac = 0.75;
this.reFac = 0.05;
this.reqMats = {
"Food": 0.5,
"Water": 0.5,
@ -711,9 +712,9 @@ Industry.prototype.init = function() {
case Industries.Chemical:
this.reFac = 0.25;
this.sciFac = 0.75;
this.hwFac = 0.15;
this.robFac = 0.2;
this.aiFac = 0.15;
this.hwFac = 0.2;
this.robFac = 0.25;
this.aiFac = 0.2;
this.advFac = 0.1;
this.reqMats = {
"Plants": 1,
@ -756,6 +757,7 @@ Industry.prototype.init = function() {
this.sciFac = 0.7;
this.aiFac = 0.4;
this.advFac = 0.6;
this.hwFac = 0.2;
this.reqMats = {
"Hardware": 5,
"Energy": 3,
@ -880,7 +882,7 @@ Industry.prototype.process = function(marketCycles=1, state, company) {
//At the start of a cycle, store and reset revenue/expenses
//Then calculate salaries and processs the markets
if (state === "START") {
if (this.thisCycleRevenue.isNaN() || this.thisCycleExpenses.isNaN()) {
if (isNaN(this.thisCycleRevenue) || isNaN(this.thisCycleExpenses)) {
console.log("ERROR: NaN in Corporation's computed revenue/expenses");
console.log(this.thisCycleRevenue.toString());
console.log(this.thisCycleExpenses.toString());
@ -970,7 +972,7 @@ Industry.prototype.processProductMarket = function(marketCycles=1) {
for (var name in this.products) {
if (this.products.hasOwnProperty(name)) {
var product = this.products[name];
var change = getRandomInt(1, 4) * 0.0005;
var change = getRandomInt(1, 3) * 0.0004;
if (this.type === Industries.Pharmaceutical || this.type === Industries.Software ||
this.type === Industries.Robotics) {
change *= 3;
@ -1105,6 +1107,15 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
for (var fooI = 0; fooI < this.prodMats.length; ++fooI) {
warehouse.materials[this.prodMats[fooI]].prd = fooProd;
}
} else {
//If this doesn't produce any materials, then it only creates
//Products. Creating products will consume materials. The
//Production of all consumed materials must be set to 0
for (var reqMatName in this.reqMats) {
if (this.reqMats.hasOwnProperty(reqMatName)) {
warehouse.materials[reqMatName].prd = 0;
}
}
}
break;
@ -1422,7 +1433,7 @@ Industry.prototype.upgrade = function(upgrade, refs) {
break;
case 1: //AdVert.Inc,
var advMult = corporation.getAdvertisingMultiplier();
this.awareness += (5 * advMult);
this.awareness += (4 * advMult);
this.popularity += (1 * advMult);
this.awareness *= (1.01 * advMult);
this.popularity *= ((1 + Math.random(5, 15) / 100) * advMult);
@ -2665,7 +2676,7 @@ Corporation.prototype.process = function(numCycles=1) {
});
var profit = this.revenue.minus(this.expenses);
var cycleProfit = profit.times(marketCycles * SecsPerMarketCycle);
if (this.funds.isNaN()) {
if (isNaN(this.funds)) {
dialogBoxCreate("There was an error calculating your Corporations funds and they got reset to 0. " +
"This is a bug. Please report to game developer.<br><br>" +
"(Your funds have been set to $150b for the inconvenience)");
@ -2760,7 +2771,7 @@ Corporation.prototype.goPublic = function() {
class:"a-link-button",
innerText:"Go Public",
clickListener:()=>{
var numShares = input.value;
var numShares = Math.round(input.value);
var initialSharePrice = this.determineValuation() / (TOTALSHARES);
if (isNaN(numShares)) {
dialogBoxCreate("Invalid value for number of issued shares");
@ -2775,6 +2786,7 @@ Corporation.prototype.goPublic = function() {
this.issuedShares = numShares;
this.numShares -= numShares;
this.funds = this.funds.plus(numShares * initialSharePrice);
this.displayCorporationOverviewContent();
removeElementById(goPublicPopupId);
return false;
}
@ -3188,6 +3200,16 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
dialogBoxCreate("ERROR: You don't have this many shares to sell");
} else {
this.numShares -= shares;
if (isNaN(this.issuedShares)) {
console.log("ERROR: Corporation issuedShares is NaN: " + this.issuedShares);
console.log("Converting to number now");
var res = parseInt(this.issuedShares);
if (isNaN(res)) {
this.issuedShares = 0;
} else {
this.issuedShares = res;
}
}
this.issuedShares += shares;
Player.gainMoney(shares * this.sharePrice);
removeElementById(popupId);
@ -3216,7 +3238,8 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
var currentStockPrice = this.sharePrice;
var txt = createElement("p", {
innerHTML: "Enter the number of shares you would like to buy back at market price. The current price of your " +
"company's stock is " + numeral(currentStockPrice).format("$0.000a"),
"company's stock is " + numeral(currentStockPrice).format("$0.000a") +
". Your company currently has " + formatNumber(this.issuedShares, 3) + " outstanding stock shares",
});
var costIndicator = createElement("p", {});
var input = createElement("input", {
@ -3249,6 +3272,16 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
numeral(shares * tempStockPrice).format("$0.000a") + ")");
} else {
this.numShares += shares;
if (isNaN(this.issuedShares)) {
console.log("ERROR: Corporation issuedShares is NaN: " + this.issuedShares);
console.log("Converting to number now");
var res = parseInt(this.issuedShares);
if (isNaN(res)) {
this.issuedShares = 0;
} else {
this.issuedShares = res;
}
}
this.issuedShares -= shares;
Player.loseMoney(shares * tempStockPrice);
//TODO REMOVE from Player money

@ -1,5 +1,5 @@
let CONSTANTS = {
Version: "0.34.2",
Version: "0.34.3",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@ -1133,11 +1133,18 @@ let CONSTANTS = {
"-Bug fix: (Hopefully) removed an exploit where you could avoid RAM usage for Netscript function calls by assigning functions to a variable (foo = hack(); foo('helios');)<br>" +
"-Bug fix: (Hopefully) removed an exploit where you could run arbitrary Javascript code using the constructor() method<br>" +
"-Thanks to Github user mateon1 and Reddit users havoc_mayhem and spaceglace for notifying me of the above exploits<br>" +
"-The fileExists() Netscript function now works on text files (.txt). Thanks to Github user devoidfury for this<br><br>" +
"-The fileExists() Netscript function now works on text files (.txt). Thanks to Github user devoidfury for this<br><br>" +
"v0.34.3<br>" +
"-Minor balance changes to Corporation. Upgrades are generally cheaper and/or have more powerful effects. " +
"You will receive more funding while your are a private company. " +
"-Accessing the hacknetnodes array in Netscript now costs 4.0GB of RAM (only counts against RAM usage once)<br>"
"-Minor balance changes to Corporations: <br>" +
"---Upgrades are generally cheaper and/or have more powerful effects.<br>" +
"---You will receive more funding while your are a private company.<br>" +
"---Product demand decreases at a slower rate.<br>" +
"---Production multiplier for Industries (receives for owning real estate/hardware/robots/etc.) is slightly higher<br>" +
"-Accessing the hacknetnodes array in Netscript now costs 4.0GB of RAM (only counts against RAM usage once)<br>" +
"-Bug Fix: Corporation oustanding shares should now be numeric rather than a string<br>" +
"-Bug Fix: Corporation production now properly calculated for industries that dont produce materials.<br>" +
"-Bug Fix: Gangs should now properly reset when switching BitNodes<br>" +
"-Bug Fix: Corporation UI should now properly reset when you go public<br>"
}

@ -247,6 +247,9 @@ function prestigeSourceFile() {
//Gain int exp
Player.gainIntelligenceExp(5);
//Reset gang
Player.gang = null;
}
export {prestigeAugmentation, prestigeSourceFile};

@ -292,7 +292,13 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=fa
var yesBtn = yesNoBoxGetYesButton();
yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
yesBtn.addEventListener("click", function() {
if (!flume) {giveSourceFile(destroyedBitNode);}
if (!flume) {
giveSourceFile(destroyedBitNode);
} else {
//If player used flume, subtract 5 int exp. The prestigeSourceFile()
//function below grants 5 int exp, so this allows sets net gain to 0
Player.gainIntelligenceExp(-5);
}
redPillFlag = false;
var container = document.getElementById("red-pill-container");
removeChildrenFromElement(container);