Fixed Corporation bug with businessFactor for Products

This commit is contained in:
danielyxie 2018-01-27 12:29:21 -06:00
parent 19c8972fb4
commit f60fe597fb
2 changed files with 6 additions and 2 deletions

4
dist/bundle.js vendored

@ -40414,6 +40414,7 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
var maxSell = (mat.qlt + .001) * mat.dmd * (100 - mat.cmp)/100 * markup * businessFactor * var maxSell = (mat.qlt + .001) * mat.dmd * (100 - mat.cmp)/100 * markup * businessFactor *
Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) *
(this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)); (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));
var sellAmt; var sellAmt;
if (mat.sllman[1] !== -1) { if (mat.sllman[1] !== -1) {
//Sell amount is manually limited //Sell amount is manually limited
@ -40427,7 +40428,7 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
console.log("ERROR: sellAmt is negative"); console.log("ERROR: sellAmt is negative");
continue; continue;
} }
if (sellAmt && sCost) { if (sellAmt && sCost >= 0) {
mat.qty -= sellAmt; mat.qty -= sellAmt;
revenue += (sellAmt * sCost); revenue += (sellAmt * sCost);
mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles); mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles);
@ -40620,6 +40621,7 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
markup = markupLimit / (product.sCost - product.pCost); markup = markupLimit / (product.sCost - product.pCost);
} }
} }
var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
var maxSell = Math.pow(product.rat, 0.95) * product.dmd * (1-(product.cmp/100)) * var maxSell = Math.pow(product.rat, 0.95) * product.dmd * (1-(product.cmp/100)) *
markup * businessFactor * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * markup * businessFactor * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) *
(this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)); (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));

@ -1127,6 +1127,7 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
var maxSell = (mat.qlt + .001) * mat.dmd * (100 - mat.cmp)/100 * markup * businessFactor * var maxSell = (mat.qlt + .001) * mat.dmd * (100 - mat.cmp)/100 * markup * businessFactor *
Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) *
(this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)); (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));
var sellAmt; var sellAmt;
if (mat.sllman[1] !== -1) { if (mat.sllman[1] !== -1) {
//Sell amount is manually limited //Sell amount is manually limited
@ -1140,7 +1141,7 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
console.log("ERROR: sellAmt is negative"); console.log("ERROR: sellAmt is negative");
continue; continue;
} }
if (sellAmt && sCost) { if (sellAmt && sCost >= 0) {
mat.qty -= sellAmt; mat.qty -= sellAmt;
revenue += (sellAmt * sCost); revenue += (sellAmt * sCost);
mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles); mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles);
@ -1333,6 +1334,7 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
markup = markupLimit / (product.sCost - product.pCost); markup = markupLimit / (product.sCost - product.pCost);
} }
} }
var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
var maxSell = Math.pow(product.rat, 0.95) * product.dmd * (1-(product.cmp/100)) * var maxSell = Math.pow(product.rat, 0.95) * product.dmd * (1-(product.cmp/100)) *
markup * businessFactor * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * markup * businessFactor * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) *
(this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)); (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));