diff --git a/src/Corporation/corporate-divisionProcessing.js b/src/Corporation/corporate-divisionProcessing.js index b66bdded6136e825a7d9a623626067594c9bca47..d1425fdd164faaf29d54cddc8f8099bd0a78bb08 100644 --- a/src/Corporation/corporate-divisionProcessing.js +++ b/src/Corporation/corporate-divisionProcessing.js @@ -56,9 +56,8 @@ App.Corporate.Init_DivisionProcessing = function(shared) { return divLedger.slaves.apply(slaves); } get initialSlaveValue() { - const values = this.relatedDivisions.from - .map(fromDiv => fromDiv.initialSlaveValue); - if(values.length == 0) { throw "No route to acquisition found."; } + const values = this.relatedDivisions.from.map(fromDiv => fromDiv.initialSlaveValue); + if(values.length === 0) { throw "No route to acquisition found."; } return Math.min(...values) + this._const.addedValue; } // virtual override diff --git a/src/Corporation/corporate.js b/src/Corporation/corporate.js index 0f0d0dbbc0c8029a32f73a271dc1ff1d4de6cdd0..7fd01f6e73b8a352189b7e049b014a0aaf59a02b 100644 --- a/src/Corporation/corporate.js +++ b/src/Corporation/corporate.js @@ -62,29 +62,29 @@ App.Corporate.Init = function() { this.suffix = suffix; this.clear(); } - get operations( ) { return this.getStored('OpCost' ); } - set operations(value) { return this.setStored('OpCost', value); } + get operations( ) { return this.getStored('OpCost'); } + set operations(value) { this.setStored('OpCost', value); } - get localRevenue( ) { return this.getStored('Rev' ); } - set localRevenue(value) { return this.setStored('Rev', value); } + get localRevenue( ) { return this.getStored('Rev'); } + set localRevenue(value) { this.setStored('Rev', value); } - get development( ) { return this.getStored('AssetsDev' ); } - set development(value) { return this.setStored('AssetsDev', value); } + get development( ) { return this.getStored('AssetsDev'); } + set development(value) { this.setStored('AssetsDev', value); } - get slaves( ) { return this.getStored('AssetsSlave' ); } - set slaves(value) { return this.setStored('AssetsSlave', value); } + get slaves( ) { return this.getStored('AssetsSlave'); } + set slaves(value) { this.setStored('AssetsSlave', value); } - get overhead( ) { return this.getStored('Overhead' ); } - set overhead(value) { return this.setStored('Overhead', value); } + get overhead( ) { return this.getStored('Overhead'); } + set overhead(value) { this.setStored('Overhead', value); } - get economicBoost( ) { return this.getStored('EconBonus' ); } - set economicBoost(value) { return this.setStored('EconBonus', value); } + get economicBoost( ) { return this.getStored('EconBonus'); } + set economicBoost(value) { this.setStored('EconBonus', value); } - get economy( ) { return this.getStored('Econ' ); } - set economy(value) { return this.setStored('Econ', value); } + get economy( ) { return this.getStored('Econ'); } + set economy(value) { this.setStored('Econ', value); } - get foreignRevenue( ) { return this.getStored('NeighborBonus' ); } - set foreignRevenue(value) { return this.setStored('NeighborBonus', value); } + get foreignRevenue( ) { return this.getStored('NeighborBonus'); } + set foreignRevenue(value) { this.setStored('NeighborBonus', value); } copy(ledger) { this.operations = ledger.operations; @@ -422,7 +422,7 @@ App.Corporate.Init = function() { }, FoundingSetupAutoBuy: function(division) { let foundedFrom = division.relatedDivisions.from.filter(div=>div.founded); - if(foundedFrom.length == 0) { + if(foundedFrom.length === 0) { division.setAutoBuyFromMarket(true); } else { for(let otherDiv of foundedFrom) { @@ -434,7 +434,7 @@ App.Corporate.Init = function() { }, FoundingSetupAutoSell: function(division) { let foundedTo = division.relatedDivisions.to.filter(div=>div.founded); - if(foundedTo.length == 0) { + if(foundedTo.length === 0) { division.setAutoSendToMarket(true); } else { for(let otherDiv of foundedTo) { @@ -451,7 +451,6 @@ App.Corporate.Init = function() { App.Corporate.Init_DivisionWorking(shared); App.Corporate.InitConstants(); - if (!V.corp) { V.corp = {}; } let divisions = App.Corporate.divisions = mapIdList(App.Corporate.divisionList); App.Corporate.maintenance.divisionCategories = mapIdList(App.Corporate.maintenance.divisionCategoriesList); @@ -484,11 +483,11 @@ App.Corporate.Init = function() { for(const property in propertyToStoryInt) { const key = propertyToStoryInt[property]; Object.defineProperty(App.Corporate, property, { - get: function( ) { return this.getStored(key); }, - set: function(value) { - if(!Number.isFinite(value)) { throw "Unreal number " + key; } - this.setStored(key, Math.trunc(value)); - } + get: function( ) { return this.getStored(key); }, + set: function(value) { + if(!Number.isFinite(value)) { throw "Unreal number " + key; } + this.setStored(key, Math.trunc(value)); + } }); } @@ -503,7 +502,7 @@ App.Corporate.Init = function() { const key = propertyToStoryBool[property]; Object.defineProperty(App.Corporate, property, { get: function( ) { return this.getStored(key) === 1; }, - set: function(value) { this.setStored(key, value == true ? 1 : 0); } + set: function(value) { this.setStored(key, value ? 1 : 0); } }); } @@ -647,7 +646,7 @@ App.Corporate.Init = function() { if(!Number.isFinite(cost)) { throw "The cost provided was not a real number"; } cost = Math.trunc(cost); if(!(type in this.ledger.current)) { throw `Ledger doesn't record '${type}' category.`; } - if(cost == 0) { return; } + if(cost === 0) { return; } this.ledger.current[type] += cost; this.cash -= cost; @@ -679,7 +678,7 @@ App.Corporate.Init = function() { App.Corporate.ownsIntermediaryDivision = function(fromDivision, toDivision) { for(let intermediateDiv of toDivision.relatedDivisions .from - .filter(iDep => iDep.id != fromDivision.id + .filter(iDep => iDep.id !== fromDivision.id && fromDivision.relatedDivisions.to.includes(iDep))) { if(intermediateDiv.founded) { return true; } } diff --git a/src/npc/generate/generateGenetics.js b/src/npc/generate/generateGenetics.js index 85b3c6419e7f0ab5e77c1c3906ee411089f584ac..80853ba899583c8218aa95ed3c686ecd2427e30b 100644 --- a/src/npc/generate/generateGenetics.js +++ b/src/npc/generate/generateGenetics.js @@ -28,6 +28,7 @@ globalThis.generateGenetics = (function() { motherName: "none", father: 0, fatherName: "none", + inbreedingCoeff: 0, nationality: "Stateless", race: "white", intelligence: 0,