Hotfix corp mku getting set to zero and causing infinity

This commit is contained in:
Olivier Gagnon 2021-08-26 15:22:06 -04:00
parent e2d74f9432
commit ceb4e304fd
3 changed files with 7 additions and 1 deletions

File diff suppressed because one or more lines are too long

@ -1126,6 +1126,7 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
}
}
var maxSell = 0.5
* Math.pow(product.rat, 0.65)
* marketFactor

@ -187,6 +187,11 @@ export class Product {
this.calculateRating(industry);
const advMult = 1 + (Math.pow(this.advCost, 0.1) / 100);
this.mku = 100 / (advMult * Math.pow((this.qlt + 0.001), 0.65) * (busRatio + mgmtRatio));
// I actually don't understand well enough to know if this is right.
// I'm adding this to prevent a crash.
if(this.mku === 0) this.mku = 1;
this.dmd = industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));
this.cmp = getRandomInt(0, 70);