diff --git a/src/Corporation/corporate-constants.js b/src/Corporation/corporate-constants.js index 35ada304801db41e9e32cf8170ec424e46d4f726..3cacb89f4cc564242aa0f55a072369eb02a1c680 100644 --- a/src/Corporation/corporate-constants.js +++ b/src/Corporation/corporate-constants.js @@ -99,22 +99,22 @@ App.Corporate.InitConstants = function() { */ App.Corporate.divisionList = [ new App.Corporate.Division.Acquiring( { - 'id':'Extra', - 'name':'Extralegal Enslavement', - 'focusDescription':'capturing and enslaving prisoners', + 'id': 'Extra', + 'name': 'Extralegal Enslavement', + 'focusDescription': 'capturing and enslaving prisoners', 'sizeCost': 20, - 'slaveValue':10, + 'slaveValue': 10, 'acquiring': { - 'center':1, + 'center': 1, 'range': 0.8, }, - 'maintenance':{ + 'maintenance': { 'linear': 7.5, 'quadratic': 5, - 'category':'acquisition', + 'category': 'acquisition', }, - 'founding':{ - 'corporateCash':100, + 'founding': { + 'corporateCash': 100, }, 'mercenaryHelp': { 'level': 2, @@ -124,13 +124,13 @@ App.Corporate.InitConstants = function() { "Break", "Arcade" ], - 'merger':[ + 'merger': [ { 'name': 'mercenary company', 'cost': 50, 'text': { - 'trouble':'a troubled mercenary company. After a spate of failed operations, the rank and file deposed their management and are now looking to merge with a better-run organization. The old leadership did not engage in enslavement activities, but the mercenaries have decided to turn their talents towards slaving for profit in conflict zones.', - 'acquire':' and ease their transition to conflict zone slaving.' + 'trouble': 'a troubled mercenary company. After a spate of failed operations, the rank and file deposed their management and are now looking to merge with a better-run organization. The old leadership did not engage in enslavement activities, but the mercenaries have decided to turn their talents towards slaving for profit in conflict zones.', + 'acquire': ' and ease their transition to conflict zone slaving.' }, 'result': { 'development': 5 @@ -143,34 +143,34 @@ App.Corporate.InitConstants = function() { 'name': 'Legal Enslavement', 'focusDescription': 'legal enslavement', 'sizeCost': 25, - 'slaveValue':15, + 'slaveValue': 15, 'acquiring': { - 'center':1, + 'center': 1, 'range': 0.5, }, - 'maintenance':{ + 'maintenance': { 'linear': 12, 'quadratic': 6, - 'category':'acquisition', + 'category': 'acquisition', }, - 'founding':{ - 'corporateCash':125, + 'founding': { + 'corporateCash': 125, }, 'nextDivision': [ "Train", "Menial", "Surgery" ], - 'merger':[ + 'merger': [ { - 'name':'telemarketing firm', + 'name': 'telemarketing firm', 'cost': 50, 'text': { - 'trouble':'an old world telemarketing firm. In an attempt to survive in the changing economy, it turned its focus towards convincing desperate, ignorant, or stupid people from the old world to accept voluntary enslavement, through a variety of entrapment procedures. It failed to make the transition successfully, but you could certainly continue its operations under your aegis.', - 'acquire':' and clean out the deadwood, getting the business in Free Cities shape.' + 'trouble': 'an old world telemarketing firm. In an attempt to survive in the changing economy, it turned its focus towards convincing desperate, ignorant, or stupid people from the old world to accept voluntary enslavement, through a variety of entrapment procedures. It failed to make the transition successfully, but you could certainly continue its operations under your aegis.', + 'acquire': ' and clean out the deadwood, getting the business in Free Cities shape.' }, 'result': { - 'development':5 + 'development': 5 } } ] @@ -182,25 +182,25 @@ App.Corporate.InitConstants = function() { 'sizeCost': 10, 'addedValue': 5, 'processing': { - 'center':0.3, - 'range':0.3, + 'center': 0.3, + 'range': 0.3, }, - 'maintenance':{ + 'maintenance': { 'linear': 0.45, 'quadratic': 0.6, - 'category':'processing', + 'category': 'processing', }, - 'founding':{ - 'corporateCash':25, + 'founding': { + 'corporateCash': 25, }, - 'slaveProcessType':{ - 'present':'break', - 'past':'broke' + 'slaveProcessType': { + 'present': 'break', + 'past': 'broke' }, - 'slaveProcessDescription':{ - 'present':'attempting to break', - 'future':'break', - 'past':'broken', + 'slaveProcessDescription': { + 'present': 'attempting to break', + 'future': 'break', + 'past': 'broken', 'market': { single: 'slave that needs breaking', plural: 'slaves that need breaking' @@ -211,17 +211,17 @@ App.Corporate.InitConstants = function() { "Menial", "Surgery" ], - 'merger':[ + 'merger': [ { 'name': 'slave breaking facility', 'cost': 50, 'text': { - 'trouble':'a small slave breaking firm. Despite a great need for obedient slaves the owner of this little establishment was unable to turn a profit. The facility has everything a respecting slave breaking could ever need, it seems the owner simply lacked the right character to apply effective breaking techniques. Your corporation knows perfectly well what it takes to achieve obedience and the assets can be put to great use.', - 'acquire':' and staff it with qualified personnel to make use of the new assets.' + 'trouble': 'a small slave breaking firm. Despite a great need for obedient slaves the owner of this little establishment was unable to turn a profit. The facility has everything a respecting slave breaking could ever need, it seems the owner simply lacked the right character to apply effective breaking techniques. Your corporation knows perfectly well what it takes to achieve obedience and the assets can be put to great use.', + 'acquire': ' and staff it with qualified personnel to make use of the new assets.' }, 'result': { - 'development':5, - 'slaves':5 + 'development': 5, + 'slaves': 5 } } ] @@ -231,27 +231,27 @@ App.Corporate.InitConstants = function() { 'name': 'Slave Modifications', 'focusDescription': 'physical slave modifications', 'sizeCost': 20, - 'addedValue':8, + 'addedValue': 8, 'processing': { - 'center':0.5, - 'range':0.2, + 'center': 0.5, + 'range': 0.2, }, - 'maintenance':{ + 'maintenance': { 'linear': 2.4, 'quadratic': 1, - 'category':'processing', + 'category': 'processing', }, - 'founding':{ - 'corporateCash':55, + 'founding': { + 'corporateCash': 55, }, - 'slaveProcessType':{ - 'present':'modify', - 'past':'finished working on' + 'slaveProcessType': { + 'present': 'modify', + 'past': 'finished working on' }, - 'slaveProcessDescription':{ - 'present':'working on', - 'future':'work on', - 'past':'improved', + 'slaveProcessDescription': { + 'present': 'working on', + 'future': 'work on', + 'past': 'improved', 'market': { single: 'slave that could use some work done to their body', plural: 'slaves that could use some work done to their bodies' @@ -261,17 +261,17 @@ App.Corporate.InitConstants = function() { "Train", "Dairy" ], - 'merger':[ + 'merger': [ { 'name': 'medical clinic', 'cost': 50, 'text': { - 'trouble':"a small medical clinic. Medical malpractice continues to be a major source of trouble for surgeons in the old world. A plastic surgeon has just suffered defeat in a major legal case over implant ruptures. He's looking to make the transition to a more enlightened area, along with his inventory and staff.", - 'acquire':" and the surgeon decides to retire on the proceeds of the sale, wishing your corporation well. It was a smart decision; he can retire to the Free Cities on that sum of money, and remote surgery is killing surgeons' wages." + 'trouble': "a small medical clinic. Medical malpractice continues to be a major source of trouble for surgeons in the old world. A plastic surgeon has just suffered defeat in a major legal case over implant ruptures. He's looking to make the transition to a more enlightened area, along with his inventory and staff.", + 'acquire': " and the surgeon decides to retire on the proceeds of the sale, wishing your corporation well. It was a smart decision; he can retire to the Free Cities on that sum of money, and remote surgery is killing surgeons' wages." }, 'result': { 'development': 3, - 'slaves':3 + 'slaves': 3 } } ] @@ -283,25 +283,25 @@ App.Corporate.InitConstants = function() { 'sizeCost': 25, 'addedValue': 11, 'processing': { - 'center':0.2, - 'range':0.3, + 'center': 0.2, + 'range': 0.3, }, - 'maintenance':{ + 'maintenance': { 'linear': 0.7, 'quadratic': 1, - 'category':'processing', + 'category': 'processing', }, - 'founding':{ - 'corporateCash':50, + 'founding': { + 'corporateCash': 50, }, - 'slaveProcessType':{ - 'present':'train', - 'past':'trained' + 'slaveProcessType': { + 'present': 'train', + 'past': 'trained' }, - 'slaveProcessDescription':{ - 'present':'training', - 'future':'train', - 'past':'trained', + 'slaveProcessDescription': { + 'present': 'training', + 'future': 'train', + 'past': 'trained', 'market': { single: 'slave that needs slave training', plural: 'slaves that need slave training' @@ -310,17 +310,17 @@ App.Corporate.InitConstants = function() { 'nextDivision': [ "Whore" ], - 'merger':[ + 'merger': [ { 'name': 'slave training firm', 'cost': 50, 'text': { - 'trouble':"a small slave training firm. Slave training is a notoriously difficult business, since the maturation times on the merchandise can be extremely long, and the improvement in price can be marginal if the training does not prove highly successful. There's nothing inherently wrong with the business, they've simply hit a cash flow bottleneck and need to merge with a cash-rich organization like yours.", - 'acquire':". The previous owners are happy they'll be able to continue operations under the aegis of a better-run, richer corporation." + 'trouble': "a small slave training firm. Slave training is a notoriously difficult business, since the maturation times on the merchandise can be extremely long, and the improvement in price can be marginal if the training does not prove highly successful. There's nothing inherently wrong with the business, they've simply hit a cash flow bottleneck and need to merge with a cash-rich organization like yours.", + 'acquire': ". The previous owners are happy they'll be able to continue operations under the aegis of a better-run, richer corporation." }, 'result': { 'development': 3, - 'slaves':3 + 'slaves': 3 } } ] @@ -331,39 +331,39 @@ App.Corporate.InitConstants = function() { 'focusDescription': 'operating sex arcades', 'sizeCost': 5, 'attrition': { - 'center':0.05, - 'range':0.2, + 'center': 0.05, + 'range': 0.2, }, - 'maintenance':{ + 'maintenance': { 'linear': 0.2, 'quadratic': 0.125, - 'category':'working', + 'category': 'working', }, - 'revenue':{ - 'center':1000, - 'range':0.1 + 'revenue': { + 'center': 1000, + 'range': 0.1 }, - 'founding':{ - 'corporateCash':15, - 'startingSize':20, + 'founding': { + 'corporateCash': 15, + 'startingSize': 20, }, - 'slaveWorkDescription':{ - 'present':'exploiting', - 'future':'exploit', - 'past':'wore out', + 'slaveWorkDescription': { + 'present': 'exploiting', + 'future': 'exploit', + 'past': 'wore out', 'market': 'fresh slave' }, - 'merger':[ + 'merger': [ { 'name': 'café', 'cost': 50, 'text': { - 'trouble':"a quaint maid café. The prime location together with a popular concept should make for a bustling business and yet the owner is looking to get out of the business hoping to salvage some of his savings. Sadly there was a lack of capital to employ attractive servant slave maids. While someone might very well be more than willing to come in and invest in some better slaves, the place is so cheap you could easily replace the furniture and use the current assets to create a new arcade location for your corporation instead.", - 'acquire':". The old owner wishes his slaves luck under the new management, not knowing your plans for the place. A new sex arcade under your corporate umbrella will open shortly." + 'trouble': "a quaint maid café. The prime location together with a popular concept should make for a bustling business and yet the owner is looking to get out of the business hoping to salvage some of his savings. Sadly there was a lack of capital to employ attractive servant slave maids. While someone might very well be more than willing to come in and invest in some better slaves, the place is so cheap you could easily replace the furniture and use the current assets to create a new arcade location for your corporation instead.", + 'acquire': ". The old owner wishes his slaves luck under the new management, not knowing your plans for the place. A new sex arcade under your corporate umbrella will open shortly." }, 'result': { - 'development':5, - 'slaves':5 + 'development': 5, + 'slaves': 5 } } ] @@ -374,39 +374,39 @@ App.Corporate.InitConstants = function() { 'focusDescription': 'offering menial services', 'sizeCost': 6.5, 'attrition': { - 'center':0.05, - 'range':0.2, + 'center': 0.05, + 'range': 0.2, }, - 'maintenance':{ + 'maintenance': { 'linear': 0.2, 'quadratic': 0.1, - 'category':'working', + 'category': 'working', }, - 'revenue':{ - 'center':1250, - 'range':0.2 + 'revenue': { + 'center': 1250, + 'range': 0.2 }, - 'founding':{ - 'corporateCash':20, - 'startingSize':20, + 'founding': { + 'corporateCash': 20, + 'startingSize': 20, }, - 'slaveWorkDescription':{ - 'present':'exploiting', - 'future':'exploit', - 'past':'wore out', - 'market':'menial slave' + 'slaveWorkDescription': { + 'present': 'exploiting', + 'future': 'exploit', + 'past': 'wore out', + 'market': 'menial slave' }, - 'merger':[ + 'merger': [ { 'name': 'slaveholding firm', 'cost': 50, 'text': { - 'trouble':"a minor slaveholding company. A major deal with a troubled government just fell through, and they had depended on it going through to an unwise degree. They need to merge with a larger slaving concern immediately, but there's nothing at all wrong with their significant inventory of slaves.", - 'acquire':", cash out its hapless staff, and absorb its stock into your corporation." + 'trouble': "a minor slaveholding company. A major deal with a troubled government just fell through, and they had depended on it going through to an unwise degree. They need to merge with a larger slaving concern immediately, but there's nothing at all wrong with their significant inventory of slaves.", + 'acquire': ", cash out its hapless staff, and absorb its stock into your corporation." }, 'result': { - 'development':5, - 'slaves':5 + 'development': 5, + 'slaves': 5 } } ] @@ -417,38 +417,38 @@ App.Corporate.InitConstants = function() { 'focusDescription': 'milking slaves', 'sizeCost': 15, 'attrition': { - 'center':0.05, - 'range':0.2, + 'center': 0.05, + 'range': 0.2, }, - 'maintenance':{ + 'maintenance': { 'linear': 0.85, 'quadratic': 0.4, - 'category':'working', + 'category': 'working', }, - 'revenue':{ - 'center':3000, - 'range':0.2 + 'revenue': { + 'center': 3000, + 'range': 0.2 }, - 'founding':{ - 'corporateCash':25, + 'founding': { + 'corporateCash': 25, }, - 'slaveWorkDescription':{ - 'present':'milking', - 'future':'milk', - 'past':'ran dry', + 'slaveWorkDescription': { + 'present': 'milking', + 'future': 'milk', + 'past': 'ran dry', 'market': 'cow' }, - 'merger':[ + 'merger': [ { 'name': 'farm', 'cost': 50, 'text': { - 'trouble':"a dairy farm. Why a conventional dairy farm popped up as target confused you for a moment, but it quickly became clear the entire family was so deep in debt it would be a no brainer to buy the farm and start milking the farmer's large-uddered daughters as a great addition to your corporate dairy.", - 'acquire':" and your new slaves for the corporation. The family is not happy with your plans, but their approval is not required, you care only for their fluids." + 'trouble': "a dairy farm. Why a conventional dairy farm popped up as target confused you for a moment, but it quickly became clear the entire family was so deep in debt it would be a no brainer to buy the farm and start milking the farmer's large-uddered daughters as a great addition to your corporate dairy.", + 'acquire': " and your new slaves for the corporation. The family is not happy with your plans, but their approval is not required, you care only for their fluids." }, 'result': { - 'development':3, - 'slaves':3 + 'development': 3, + 'slaves': 3 } } ] @@ -459,38 +459,38 @@ App.Corporate.InitConstants = function() { 'focusDescription': 'whoring out slaves', 'sizeCost': 20, 'attrition': { - 'center':0.05, - 'range':0.2, + 'center': 0.05, + 'range': 0.2, }, - 'maintenance':{ + 'maintenance': { 'linear': 0.7, 'quadratic': 0.25, - 'category':'working', + 'category': 'working', }, - 'revenue':{ - 'center':3000, - 'range':0.1 + 'revenue': { + 'center': 3000, + 'range': 0.1 }, - 'founding':{ - 'corporateCash':50, + 'founding': { + 'corporateCash': 50, }, - 'slaveWorkDescription':{ - 'present':'whoring out', - 'future':'whore out', - 'past':'lost their appeal', + 'slaveWorkDescription': { + 'present': 'whoring out', + 'future': 'whore out', + 'past': 'lost their appeal', 'market': 'trained whore' }, - 'merger':[ + 'merger': [ { 'name': 'brothel', 'cost': 50, 'text': { - 'trouble':"a little brothel. With slave whores becoming the dominant force in sexual services the current madam lost her passion for the business. She's getting up there in age and has run a tight ship for many years so she deemed it the right time to bow out. All you need to do to add a new brothel location for your corporation is sign at the dotted line before anyone else has a chance to bite.", - 'acquire':" before anyone else can make an offer. The madam is surprised by your speed, but happily signs over the brothel." + 'trouble': "a little brothel. With slave whores becoming the dominant force in sexual services the current madam lost her passion for the business. She's getting up there in age and has run a tight ship for many years so she deemed it the right time to bow out. All you need to do to add a new brothel location for your corporation is sign at the dotted line before anyone else has a chance to bite.", + 'acquire': " before anyone else can make an offer. The madam is surprised by your speed, but happily signs over the brothel." }, 'result': { - 'development':3, - 'slaves':3 + 'development': 3, + 'slaves': 3 } } ] @@ -512,21 +512,21 @@ App.Corporate.InitConstants = function() { App.Corporate.maintenance = { divisionCategoriesList: [ { - id:'acquisition', + id: 'acquisition', freeDivisions: 0, divisionCost: 25000, freeDevelopment: 100, developmentCost: 2 }, { - id:'processing', + id: 'processing', freeDivisions: 0, divisionCost: 25000, freeDevelopment: 200, developmentCost: 1 }, { - id:'working', + id: 'working', freeDivisions: 1, divisionCost: 15000, freeDevelopment: 800, diff --git a/src/Corporation/corporate-divisionAcquiring.js b/src/Corporation/corporate-divisionAcquiring.js index 3b38d926bf039933479e2d358448e6b0c22dc706..a26fe0354a541077c05cf057b43079d3a7e2c48b 100644 --- a/src/Corporation/corporate-divisionAcquiring.js +++ b/src/Corporation/corporate-divisionAcquiring.js @@ -5,7 +5,7 @@ App.Corporate.Init_DivisionAcquiring = function(shared) { this._const.slaveValue = slaveValue; this._const.acquiring = new averageRange(acquiring); this._const.nextDivisions = nextDivision; - if(mercenaryHelp != null) { + if (mercenaryHelp != null) { this._const.mercenaryHelp = { level: mercenaryHelp.level, cost: mercenaryHelp.cost @@ -13,17 +13,17 @@ App.Corporate.Init_DivisionAcquiring = function(shared) { } } // abstract virtual definitions - get fromMarket() { return false; } - get toMarket() { return true; } - get heldSlaves() { return this.getStored("Slaves"); } - set heldSlaves(value) { this.setStored("Slaves", Math.trunc(value)); } - get activeSlaves() { return 0; } - set activeSlaves(value) { throw "Cannot set active slaves for acquiring divisions"; } - get processRate() { return this._const.acquiring.center; } + get fromMarket() { return false; } + get toMarket() { return true; } + get heldSlaves() { return this.getStored("Slaves"); } + set heldSlaves(value) { this.setStored("Slaves", Math.trunc(value)); } + get activeSlaves() { return 0; } + set activeSlaves(value) { throw "Cannot set active slaves for acquiring divisions"; } + get processRate() { return this._const.acquiring.center; } get purchasedSlaveValue() { return null; } - get initialSlaveValue() { return this.soldSlaveValue; } - get soldSlaveValue() { return this._const.slaveValue; } - get nounFinishedSlave() { return "slave"; } + get initialSlaveValue() { return this.soldSlaveValue; } + get soldSlaveValue() { return this._const.slaveValue; } + get nounFinishedSlave() { return "slave"; } get nounSlaveFromMarket() { return "slave"; } messageSlaveCount() { return `It averages <span class="green">${numberWithPluralNonZero(this.developmentCount, "new slave")}</span> each week.`; @@ -33,12 +33,12 @@ App.Corporate.Init_DivisionAcquiring = function(shared) { } message_endWeek_Slaves(divLedger) { let newSlaves = divLedger.slaves.value; - if(newSlaves > 0) { + if (newSlaves > 0) { return `<span class="green">acquired ${numberWithPlural(newSlaves, "slave")}` - + (this.hadMercenaryHelp ? "</span> with the help of your mercenaries." : ".</span>"); ++ (this.hadMercenaryHelp ? "</span> with the help of your mercenaries." : ".</span>"); } else { return `<span class="red">failed to acquire any slaves` - + (this.hadMercenaryHelp ? "</span> even with the help of your mercenaries." : ".</span>"); ++ (this.hadMercenaryHelp ? "</span> even with the help of your mercenaries." : ".</span>"); } } endWeek_Slaves(divLedger) { @@ -47,7 +47,7 @@ App.Corporate.Init_DivisionAcquiring = function(shared) { return divLedger.slaves.apply(slaves); } // virtual overrides - get nextDivisions() { return this._const.nextDivisions; } + get nextDivisions() { return this._const.nextDivisions; } dissolve() { App.Corporate.sellSlaves(this, this.heldSlaves); super.dissolve(); @@ -66,7 +66,7 @@ App.Corporate.Init_DivisionAcquiring = function(shared) { // If it makes sense to have mercenaries help with other types of divisions, this code and the mercenaryHelp property will need to be moved into the super class. let baseCost = super.maintenanceCost; - if(this.hadMercenaryHelp) { + if (this.hadMercenaryHelp) { const mercHelpCost = Math.trunc((V.mercenaries - this._const.mercenaryHelp.level) * this._const.mercenaryHelp.cost * 1000); baseCost += mercHelpCost; } diff --git a/src/Corporation/corporate-divisionBase.js b/src/Corporation/corporate-divisionBase.js index 007c142b6dcdff7e78ede6fd75bfb2e7b78e3a9c..0fb03eb656f22c7ed222b8e560657d99414a8713 100644 --- a/src/Corporation/corporate-divisionBase.js +++ b/src/Corporation/corporate-divisionBase.js @@ -12,11 +12,11 @@ App.Corporate.Init_DivisionBase = function(shared) { linear: maintenance.linear, category: maintenance.category }; - if(founding != null) { + if (founding != null) { this._const.founding = new shared.FoundingType(this, founding); } - if(merger != null && _.isObject(merger) || (Array.isArray(merger) && merger.length > 0)) { - if(!Array.isArray(merger)) { + if (merger != null && _.isObject(merger) || (Array.isArray(merger) && merger.length > 0)) { + if (!Array.isArray(merger)) { merger = [merger]; } this._const.merger = merger; @@ -24,38 +24,37 @@ App.Corporate.Init_DivisionBase = function(shared) { this.relatedDivisions = new shared.RelatedDivisionType(); } // initialized data - get id() { return this._const.id; } - get sizeCost() { return this._const.cost; } - get name() { return this._const.name; } - get focusDescription() { return this._const.focusDescription; } - get founding() { return this._const.founding; } - get nextDivisions() { return null; } - get hasMergers() { return this._const.merger != null; } - get mergerChoices() { return this._const.merger; } + get id() { return this._const.id; } + get sizeCost() { return this._const.cost; } + get name() { return this._const.name; } + get focusDescription() { return this._const.focusDescription; } + get founding() { return this._const.founding; } + get nextDivisions() { return null; } + get hasMergers() { return this._const.merger != null; } + get mergerChoices() { return this._const.merger; } get maintenanceCategory() { return this._const.maintenance.category; } // stored variables - get founded() { return this.getStored('') == 1; } - get foundedDate() { return this.getStored('Founded'); } - get developmentCount() { return this.getStored("Dev"); } + get founded() { return this.getStored('') == 1; } + get foundedDate() { return this.getStored('Founded'); } + get developmentCount() { return this.getStored("Dev"); } set developmentCount(value) { - if(value < 0) { throw "Cannot set development count to less than 0"; } + if (value < 0) { throw "Cannot set development count to less than 0"; } // dissolve is the only function that sets founded to false. - if(value === 0 && this.founded) { throw "Cannot set development count to 0; use dissolve instead."; } + if (value === 0 && this.founded) { throw "Cannot set development count to 0; use dissolve instead."; } this.setStored("Dev", value); } // calculated - get availableRoom() { return Math.max(0, this.developmentCount - this.activeSlaves); } + get availableRoom() { return Math.max(0, this.developmentCount - this.activeSlaves); } get maintenanceCost() { - return Math.trunc( this._const.maintenance.linear * 1000 * this.developmentCount - + this._const.maintenance.quadratic * Math.pow(this.activeSlaves, 2)); + return Math.trunc( this._const.maintenance.linear * 1000 * this.developmentCount + this._const.maintenance.quadratic * Math.pow(this.activeSlaves, 2)); } get foundingCostDivision() { return this._const.founding.size * this.sizeCost; } - get foundingCost() { return this.foundingCostDivision; } - get canFoundCorporation() { return this._const.founding != null; } + get foundingCost() { return this.foundingCostDivision; } + get canFoundCorporation() { return this._const.founding != null; } get foundingCash() { - if(!this.canFoundCorporation) { throw `${this.name} is not set up found a corporation`; } + if (!this.canFoundCorporation) { throw `${this.name} is not set up found a corporation`; } return 1000 * this._const.founding.startingPrice; } get value() { @@ -63,54 +62,54 @@ App.Corporate.Init_DivisionBase = function(shared) { let slaveProcValue = 0; let slaveHeldValue = 0; - if(this.activeSlaves > 0) { slaveProcValue = this.activeSlaves * this.purchasedSlaveValue * 1000; } - if(this.heldSlaves > 0) { slaveHeldValue = this.heldSlaves * this.soldSlaveValue * 1000; } + if (this.activeSlaves > 0) { slaveProcValue = this.activeSlaves * this.purchasedSlaveValue * 1000; } + if (this.heldSlaves > 0) { slaveHeldValue = this.heldSlaves * this.soldSlaveValue * 1000; } return developmentValue + slaveProcValue + slaveHeldValue; } // abstract virtual - get fromMarket() { throw "Must be defined"; } - get toMarket() { throw "Must be defined"; } + get fromMarket() { throw "Must be defined"; } + get toMarket() { throw "Must be defined"; } /** @returns {number} */ // eslint-disable-line - get heldSlaves() { throw "Must be defined"; } - set heldSlaves(value) { throw "Must be defined"; } + get heldSlaves() { throw "Must be defined"; } + set heldSlaves(value) { throw "Must be defined"; } /** @returns {number} */ // eslint-disable-line - get activeSlaves() { throw "Must be defined"; } - set activeSlaves(value) { throw "Must be defined"; } + get activeSlaves() { throw "Must be defined"; } + set activeSlaves(value) { throw "Must be defined"; } /** @returns {number} */ // eslint-disable-line - get processRate() { throw "Must be defined"; } - get initialSlaveValue() { throw "Must be defined"; } + get processRate() { throw "Must be defined"; } + get initialSlaveValue() { throw "Must be defined"; } /** @returns {number} */ // eslint-disable-line - get soldSlaveValue() { throw "Must be defined"; } - get slaveAction() { throw "Must be defined"; } - get nounFinishedSlave() { throw "Must be defined"; } - get nounSlaveFromMarket() { throw "Must be defined"; } - messageSlaveCount() { throw "Must be defined"; } - messageSlaveOutput() { throw "Must be defined"; } - message_endWeek_Slaves(divLedger) { throw "Must be defined"; } - endWeek_Slaves(ledger, divLedger) { throw "Must be defined"; } + get soldSlaveValue() { throw "Must be defined"; } + get slaveAction() { throw "Must be defined"; } + get nounFinishedSlave() { throw "Must be defined"; } + get nounSlaveFromMarket() { throw "Must be defined"; } + messageSlaveCount() { throw "Must be defined"; } + messageSlaveOutput() { throw "Must be defined"; } + message_endWeek_Slaves(divLedger) { throw "Must be defined"; } + endWeek_Slaves(ledger, divLedger) { throw "Must be defined"; } // The value of a slave ignoring enhancements from founded divisions // The actual value of a slave after all improvements get purchasedSlaveValue() { - let cheapest = {'value':Number.MAX_VALUE, 'div': null}; + let cheapest = {'value': Number.MAX_VALUE, 'div': null}; let expensive = {'value': 0, 'div': null}; - for(let fromDiv of this.relatedDivisions.from) { + for (let fromDiv of this.relatedDivisions.from) { let initialValue = fromDiv.initialSlaveValue; - if(initialValue < cheapest.value) { + if (initialValue < cheapest.value) { cheapest.value = initialValue; cheapest.div = fromDiv; } - if(fromDiv.founded) { + if (fromDiv.founded) { let soldValue = fromDiv.soldSlaveValue; - if(soldValue > expensive.value) { + if (soldValue > expensive.value) { expensive.value = soldValue; expensive.div = fromDiv; } } } - if(expensive.div != null && expensive.value != cheapest.value) { + if (expensive.div != null && expensive.value != cheapest.value) { // The added value of an owned intermediary takes time to work its way through this division to the next let expensiveDiv = expensive.div; let valueDiff = expensive.value - cheapest.value; @@ -119,21 +118,20 @@ App.Corporate.Init_DivisionBase = function(shared) { let multiplier = Math.min(weeksSinceFounding / weeksToProcess, 1); let finalAddedValue = valueDiff * multiplier; return cheapest.value + finalAddedValue; - } else if(cheapest.div != null) { + } else if (cheapest.div != null) { return cheapest.value; } throw "No route to acquisition found."; } get maintenanceSlaves() { return this.activeSlaves * this.processRate; } getDisplayMaintenanceCost() { - const cost = this.maintenanceCost; + const cost = this.maintenanceCost; const processedCount = this.maintenanceSlaves; return {cost, perUnit: cost / processedCount}; } getAutoSendToDivision(division) { - return !App.Corporate.ownsIntermediaryDivision(this, division) - && this.getStored(`To${division.id}`) == 1; + return (!App.Corporate.ownsIntermediaryDivision(this, division) && this.getStored(`To${division.id}`) == 1); } setAutoSendToDivision(division, value) { this.setStored(`To${division.id}`, value ? 1 : 0); @@ -155,32 +153,32 @@ App.Corporate.Init_DivisionBase = function(shared) { } endWeek_Transfer(divLedger) { let divisions = []; - for(let otherDiv of this.relatedDivisions.to.filter(div=> div.founded && this.getAutoSendToDivision(div))) { + for (let otherDiv of this.relatedDivisions.to.filter(div=> div.founded && this.getAutoSendToDivision(div))) { const otherLedger = divLedger.weekLedger.getDivision(otherDiv); const room = otherDiv.availableRoom - otherLedger.transfer.in; - if(room === 0) { continue; } + if (room === 0) { continue; } divisions.push({division: otherDiv, room}); } const fillDivisions = evenFillArray(divisions, this.heldSlaves, pair=>pair.room); - for(const filled of fillDivisions) { + for (const filled of fillDivisions) { const division = filled.item.division; const value = filled.value; divLedger.transfer.addDivision(division, value); } } endWeek_Market(divLedger) { - if(this.getAutoSendToMarket()) { + if (this.getAutoSendToMarket()) { divLedger.market.sell = this.heldSlaves - divLedger.transfer.total; } - if(this.getAutoBuyFromMarket()) { + if (this.getAutoBuyFromMarket()) { divLedger.market.buy = this.availableRoom - divLedger.transfer.in; } shared.SellUnhousedSlaves(this, divLedger, this.processRate); } create() { - if(this.founded) { throw `${this.name} has already been founded.`; } + if (this.founded) { throw `${this.name} has already been founded.`; } App.Corporate.expandedDivision(); App.Corporate.chargeAsset(this.foundingCostDivision * 1000, "development"); @@ -196,7 +194,7 @@ App.Corporate.Init_DivisionBase = function(shared) { } // private helpers - getStored(key ) { return V.corp[this._const.corpId + key]; } + getStored(key ) { return V.corp[this._const.corpId + key]; } setStored(key, value) { V.corp[this._const.corpId + key] = value; } }; }; diff --git a/src/Corporation/corporate-divisionProcessing.js b/src/Corporation/corporate-divisionProcessing.js index d1425fdd164faaf29d54cddc8f8099bd0a78bb08..21cb3c17c701fd0f8e6d9ad9612eb3e87b9f87dd 100644 --- a/src/Corporation/corporate-divisionProcessing.js +++ b/src/Corporation/corporate-divisionProcessing.js @@ -11,12 +11,12 @@ App.Corporate.Init_DivisionProcessing = function(shared) { // abstract virtual definitions get fromMarket() { return true; } - get toMarket() { return true; } - get heldSlaves() { return this.getStored("Slaves2" ); } - set heldSlaves(value) { this.setStored("Slaves2", Math.trunc(value)); } - get activeSlaves() { return this.getStored("Slaves" ); } + get toMarket() { return true; } + get heldSlaves() { return this.getStored("Slaves2" ); } + set heldSlaves(value) { this.setStored("Slaves2", Math.trunc(value)); } + get activeSlaves() { return this.getStored("Slaves" ); } set activeSlaves(value) { this.setStored("Slaves", Math.trunc(value)); } - get processRate() { return this._const.processing.center; } + get processRate() { return this._const.processing.center; } get soldSlaveValue() { // TODO: find a way to cache this. return this.purchasedSlaveValue + this._const.addedValue; @@ -24,7 +24,7 @@ App.Corporate.Init_DivisionProcessing = function(shared) { get slaveAction() { return this._const.slaveProcessDescription; } - get nounFinishedSlave() { return `${this._const.slaveProcessDescription.past} slave`; } + get nounFinishedSlave() { return `${this._const.slaveProcessDescription.past} slave`; } get nounSlaveFromMarket() { return this._const.slaveProcessDescription.market; } messageSlaveCount() { return shared.MessageProcessedSlaves(this, `can ${this._const.slaveProcessType.present}`, 'green'); @@ -36,13 +36,13 @@ App.Corporate.Init_DivisionProcessing = function(shared) { let newSlaves = divLedger.slaves.value; // The division let retval = this._const.slaveProcessType.past; // exploited - if(newSlaves <= 0) { + if (newSlaves <= 0) { retval += " <span class='red'>none of its slaves.</span>"; } else { retval += ` <span class="green">${numberWithPlural(newSlaves, 'slave')}.</span>`; } retval += " The division "; - if(this.activeSlaves) { + if (this.activeSlaves) { retval += `is still ${this._const.slaveProcessDescription.present} ${numberWithPlural(this.activeSlaves, "slave")}.`; } else { retval += `doesn't have any slaves to ${this._const.slaveProcessDescription.future}.`; @@ -57,7 +57,7 @@ App.Corporate.Init_DivisionProcessing = function(shared) { } get initialSlaveValue() { const values = this.relatedDivisions.from.map(fromDiv => fromDiv.initialSlaveValue); - if(values.length === 0) { throw "No route to acquisition found."; } + if (values.length === 0) { throw "No route to acquisition found."; } return Math.min(...values) + this._const.addedValue; } // virtual override @@ -75,7 +75,7 @@ App.Corporate.Init_DivisionProcessing = function(shared) { } get foundingCostSlaves() { return this._const.founding.size * this.purchasedSlaveValue; } - get foundingCost() { return this.foundingCostDivision + this.foundingCostSlaves; } + get foundingCost() { return this.foundingCostDivision + this.foundingCostSlaves; } create() { super.create(); App.Corporate.chargeAsset(this.foundingCostSlaves * 1000, "slaves"); diff --git a/src/Corporation/corporate-divisionWorking.js b/src/Corporation/corporate-divisionWorking.js index 8f4a6dbf1b13f769abca14e09e28f7c913b111f9..6eaca63b52c5c4be15ddb86f66d26250f726e684 100644 --- a/src/Corporation/corporate-divisionWorking.js +++ b/src/Corporation/corporate-divisionWorking.js @@ -15,12 +15,12 @@ App.Corporate.Init_DivisionWorking = function(shared) { get activeSlaves() { return this.getStored("Slaves"); } set activeSlaves(value) { this.setStored("Slaves", Math.trunc(value)); } get processRate() { return this._const.attrition.center; } - get initialSlaveValue() { return null; } + get initialSlaveValue() { return null; } get soldSlaveValue() { return null; } get slaveAction() { return this._const.slaveWorkDescription; } - get nounFinishedSlave() { throw "Cannot get finished slave in working division, since they don't produce finished slaves."; } + get nounFinishedSlave() { throw "Cannot get finished slave in working division, since they don't produce finished slaves."; } get nounSlaveFromMarket() { return this._const.slaveWorkDescription.market; } messageSlaveCount() { return shared.MessageProcessedSlaves(this, `has to replace`, 'red'); @@ -37,12 +37,12 @@ App.Corporate.Init_DivisionWorking = function(shared) { message_endWeek_Slaves(divLedger) { let lostSlaves = divLedger.slaves.value; let retval = '';// The division - if(this.activeSlaves <= 0) { + if (this.activeSlaves <= 0) { retval += `has <span class="red">no slaves</span> to ${this._const.slaveWorkDescription.future}.`; } else { retval += `is ${this._const.slaveWorkDescription.present} <span class="green">${numberWithPlural(this.activeSlaves, 'slave')}.</span> `; } - if(lostSlaves > 0) { + if (lostSlaves > 0) { retval += `During operations <span class="red">${numberWithPlural(lostSlaves, 'slave')}</span> ${this._const.slaveWorkDescription.past}.`; } return retval; @@ -82,7 +82,7 @@ App.Corporate.Init_DivisionWorking = function(shared) { } get foundingCostSlaves() { return this._const.founding.size * this.purchasedSlaveValue; } - get foundingCost() { return this.foundingCostDivision + this.foundingCostSlaves; } + get foundingCost() { return this.foundingCostDivision + this.foundingCostSlaves; } create() { super.create(); App.Corporate.chargeAsset(this.foundingCostSlaves * 1000, "slaves"); diff --git a/src/Corporation/corporate.js b/src/Corporation/corporate.js index 204edfd1f1c9d4375ac465250d008aa7edfe6344..d39773d7f8b0ec0685a7ca1b4b513eb5777b31f4 100644 --- a/src/Corporation/corporate.js +++ b/src/Corporation/corporate.js @@ -24,23 +24,23 @@ globalThis.evenFillArray = function(array, amount, lookupAmount) { let newArray = []; changed = false; perItem = Math.trunc(amount / array.length); - for(let item of array) { + for (let item of array) { let itemValue = lookupAmount(item); - if(itemValue >= perItem) { + if (itemValue >= perItem) { newArray.push(item); continue; } amount -= itemValue; - retval.push({item, value:itemValue}); + retval.push({item, value: itemValue}); changed = true; } array = newArray; } while (changed); let remainder = amount % array.length; - for(let item of array) { + for (let item of array) { let extra = 0; - if(remainder > 0) { + if (remainder > 0) { remainder--; extra = 1; } @@ -51,59 +51,59 @@ globalThis.evenFillArray = function(array, amount, lookupAmount) { globalThis.typeHiddenMembers = class { constructor() { this._const = {}; - this._var = {}; + this._var = {}; this._cache = {}; } }; App.Corporate.Init = function() { const Ledger = class { - constructor(corp, suffix="") { + constructor(corp, suffix = "") { this.corp = corp; this.suffix = suffix; } - get operations( ) { return this.getStored('OpCost'); } - set operations(value) { 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) { 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) { 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) { 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) { 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) { 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) { this.setStored('Econ', value); } + get economy() { return this.getStored('Econ'); } + set economy(value) { this.setStored('Econ', value); } - get foreignRevenue( ) { return this.getStored('NeighborBonus'); } + get foreignRevenue() { return this.getStored('NeighborBonus'); } set foreignRevenue(value) { this.setStored('NeighborBonus', value); } copy(ledger) { - this.operations = ledger.operations; - this.localRevenue = ledger.localRevenue; + this.operations = ledger.operations; + this.localRevenue = ledger.localRevenue; this.foreignRevenue = ledger.foreignRevenue; - this.development = ledger.development; - this.slaves = ledger.slaves; - this.overhead = ledger.overhead; - this.economicBoost = ledger.economicBoost; - this.economy = ledger.economy; + this.development = ledger.development; + this.slaves = ledger.slaves; + this.overhead = ledger.overhead; + this.economicBoost = ledger.economicBoost; + this.economy = ledger.economy; } clear() { - this.operations = 0; - this.localRevenue = 0; + this.operations = 0; + this.localRevenue = 0; this.foreignRevenue = 0; - this.development = 0; - this.slaves = 0; - this.overhead = 0; - this.economicBoost = 0; - this.economy = 0; + this.development = 0; + this.slaves = 0; + this.overhead = 0; + this.economicBoost = 0; + this.economy = 0; } release() { this.deleteStored('OpCost'); @@ -117,7 +117,7 @@ App.Corporate.Init = function() { } get profit() { return this.revenue + this.economicBoost - - this.development - this.slaves - this.overhead - this.operations; +- this.development - this.slaves - this.overhead - this.operations; } get revenue() { return this.localRevenue + this.foreignRevenue; @@ -136,7 +136,7 @@ App.Corporate.Init = function() { setStored(key, value) { return this.corp.setStored(key + this.suffix, value); } - deleteStored(key){ + deleteStored(key) { this.corp.deleteStored(key + this.suffix); } }; @@ -170,8 +170,8 @@ App.Corporate.Init = function() { return this._var.in; } set in(value) { - if(value == this._var.in) { return; } - if(this._const.divLedger.market.canBuy) { + if (value == this._var.in) { return; } + if (this._const.divLedger.market.canBuy) { this._const.divLedger.market.buy -= value - this._var.in; } this._var.in = value; @@ -210,11 +210,11 @@ App.Corporate.Init = function() { this._cache.sellValue = null; } get sellValue() { - if(this._cache.sellValue == null) { this._cache.sellValue = App.Corporate.slaveMarketSellValue(this.division, this.sell); } + if (this._cache.sellValue == null) { this._cache.sellValue = App.Corporate.slaveMarketSellValue(this.division, this.sell); } return this._cache.sellValue; } get buyValue() { - if(this._cache.buyValue == null) { this._cache.buyValue = App.Corporate.slaveMarketPurchaseValue(this.division, this.buy); } + if (this._cache.buyValue == null) { this._cache.buyValue = App.Corporate.slaveMarketPurchaseValue(this.division, this.buy); } return this._cache.buyValue; } get canBuy() { @@ -234,10 +234,10 @@ App.Corporate.Init = function() { this._const.division = division; this._const.ledger = weekLedger; - this._var.slaves = new WeekProcessingEfficiencyLine(); - this._var.revenue = new WeekProcessingEfficiencyLine(); + this._var.slaves = new WeekProcessingEfficiencyLine(); + this._var.revenue = new WeekProcessingEfficiencyLine(); this._var.transfer = new WeekProcessingTransfer(this); - this._var.market = new WeekProcessingMarket(this); + this._var.market = new WeekProcessingMarket(this); } get slaves() { return this._var.slaves; @@ -263,7 +263,7 @@ App.Corporate.Init = function() { super(); this._const.category = App.Corporate.maintenance.divisionCategories[categoryId]; - if(this._const.category == null) { throw "Invalid category id: " + categoryId; } + if (this._const.category == null) { throw "Invalid category id: " + categoryId; } this._var.divisions = []; } addDivision(division) { @@ -272,9 +272,9 @@ App.Corporate.Init = function() { get cost() { const category = this._const.category; const ownedDivisionCount = this._var.divisions.length - category.freeDivisions; - const developmentCount = this._var.divisions.reduce((r, div) => r + div.developmentCount, 0) - category.freeDevelopment; + const developmentCount = this._var.divisions.reduce((r, div) => r + div.developmentCount, 0) - category.freeDevelopment; - const divisionCost = Math.trunc(Math.pow(Math.max(ownedDivisionCount, 0), 2) * category.divisionCost ); + const divisionCost = Math.trunc(Math.pow(Math.max(ownedDivisionCount, 0), 2) * category.divisionCost ); const developmentCost = Math.trunc(Math.pow(Math.max(developmentCount, 0), 2) * category.developmentCost); return divisionCost + developmentCost; @@ -294,7 +294,7 @@ App.Corporate.Init = function() { } getDivision(division) { - if(!(division.id in this._var.divisions)) { + if (!(division.id in this._var.divisions)) { this._var.divisions[division.id] = new WeekProcessingDivision(division, this); } return this._var.divisions[division.id]; @@ -305,7 +305,7 @@ App.Corporate.Init = function() { registerMaintenanceForDivision(division) { let categoryId = division.maintenanceCategory; - if(!(categoryId in this._var.maintenanceCategories)) { + if (!(categoryId in this._var.maintenanceCategories)) { this._var.maintenanceCategories[categoryId] = new WeekProcessingOverheadCategory(categoryId); } let category = this._var.maintenanceCategories[categoryId]; @@ -319,12 +319,12 @@ App.Corporate.Init = function() { return this._var.operatingCost; } set operatingCost(value) { - if(!Number.isFinite(value)) { throw "Operating cost wasn't finite "; } + if (!Number.isFinite(value)) { throw "Operating cost wasn't finite "; } this._var.operatingCost = Math.trunc(value); } get overhead() { const divCount = App.Corporate.numDivisions; - if(divCount <= 1) { return 0; } + if (divCount <= 1) { return 0; } const divisionOverhead = Object.values(this.maintenanceCategories).reduce((r, categoryLedger) => r + categoryLedger.cost, 0); const corpMaintInfo = App.Corporate.maintenance.corporate; @@ -351,14 +351,14 @@ App.Corporate.Init = function() { RelatedDivisionType: class { constructor() { this._var = { - to: [], + to: [], from: [], - all: [] + all: [] }; } - get to() { return this._var.to; } + get to() { return this._var.to; } get from() { return this._var.from; } - get all() { return this._var.all; } + get all() { return this._var.all; } addTo(value) { this._var.to.push(value); this._var.all.push(value); @@ -385,8 +385,8 @@ App.Corporate.Init = function() { } }, SellOverflowSlaves: function(division) { - const slavesToSell = division.activeSlaves - division.developmentCount; - if(slavesToSell > 0) { + const slavesToSell = division.activeSlaves - division.developmentCount; + if (slavesToSell > 0) { const slaveProcCost = Math.trunc(App.Corporate.slaveMarketPurchaseValue(division, -slavesToSell)); App.Corporate.chargeAsset(slaveProcCost, "slaves"); division.activeSlaves -= slavesToSell; @@ -394,11 +394,11 @@ App.Corporate.Init = function() { } }, SellUnhousedSlaves: function(division, divLedger, rate) { - if(divLedger.market.sell != 0) { return; } + if (divLedger.market.sell != 0) { return; } let housing = Math.trunc(2 * rate * division.developmentCount); let unhoused = division.heldSlaves - housing; - if(unhoused <= 0) { return; } + if (unhoused <= 0) { return; } divLedger.market.sell = unhoused; }, @@ -414,18 +414,18 @@ App.Corporate.Init = function() { EndWeekProcessing_Slaves: function(processingCount, rate) { const perDevPair = rate.roll(); let slaveIncrease = perDevPair.value * processingCount; - if(slaveIncrease < 1) { + if (slaveIncrease < 1) { slaveIncrease = (slaveIncrease > Math.random() ? 1 : 0); } return {efficiency: perDevPair.roll, value: Math.trunc(slaveIncrease)}; }, 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) { - if(otherDiv.getAutoSendToMarket()) { + for (let otherDiv of foundedFrom) { + if (otherDiv.getAutoSendToMarket()) { otherDiv.setAutoSendToDivision(division, true); } } @@ -433,11 +433,11 @@ 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) { - if(otherDiv.getAutoBuyFromMarket()) { + for (let otherDiv of foundedTo) { + if (otherDiv.getAutoBuyFromMarket()) { division.setAutoSendToDivision(otherDiv, true); } } @@ -453,21 +453,21 @@ App.Corporate.Init = function() { let divisions = App.Corporate.divisions = mapIdList(App.Corporate.divisionList); App.Corporate.maintenance.divisionCategories = mapIdList(App.Corporate.maintenance.divisionCategoriesList); - for(const divInfo of App.Corporate.divisionList.filter(div=>div.nextDivisions != null)) { + for (const divInfo of App.Corporate.divisionList.filter(div=>div.nextDivisions != null)) { const div = divisions[divInfo.id]; - for(const nextDepId of divInfo.nextDivisions) { + for (const nextDepId of divInfo.nextDivisions) { let nextDiv = divisions[nextDepId]; div.relatedDivisions.addTo(nextDiv); nextDiv.relatedDivisions.addFrom(div); } } let asDivision = function(division) { - if(_.isObject(division)) { return division; } + if (_.isObject(division)) { return division; } return App.Corporate.divisions[division]; }; - App.Corporate.getStored = function(key ) { return V.corp[key]; }; - App.Corporate.setStored = function(key, value) { V.corp[key] = value; }; - App.Corporate.deleteStored = function(key ) { delete V.corp[key]; }; + App.Corporate.getStored = function(key ) { return V.corp[key]; }; + App.Corporate.setStored = function(key, value) { V.corp[key] = value; }; + App.Corporate.deleteStored = function(key ) { delete V.corp[key]; }; // Integer properties starting with corp const propertyToStoryInt = { @@ -479,12 +479,12 @@ App.Corporate.Init = function() { specializationTokens: "SpecToken", specializationTimer: "SpecTimer", }; - for(const property in propertyToStoryInt) { + for (const property in propertyToStoryInt) { const key = propertyToStoryInt[property]; Object.defineProperty(App.Corporate, property, { - get: function( ) { return this.getStored(key); }, + get: function() { return this.getStored(key); }, set: function(value) { - if(!Number.isFinite(value)) { throw "Unreal number " + key; } + if (!Number.isFinite(value)) { throw "Unreal number " + key; } this.setStored(key, Math.trunc(value)); } }); @@ -497,10 +497,10 @@ App.Corporate.Init = function() { payoutCash: "CashDividend", canExpand: 'ExpandToken', }; - for(const property in propertyToStoryBool) { + for (const property in propertyToStoryBool) { const key = propertyToStoryBool[property]; Object.defineProperty(App.Corporate, property, { - get: function( ) { return this.getStored(key) === 1; }, + get: function() { return this.getStored(key) === 1; }, set: function(value) { this.setStored(key, value ? 1 : 0); } }); } @@ -508,20 +508,20 @@ App.Corporate.Init = function() { // Abnormal properties Object.defineProperty(App.Corporate, "value", { get: function() { - if(!this.founded) { return 0; } + if (!this.founded) { return 0; } let corpAssets = App.Corporate.divisionList - .filter(div=>div.founded) - .reduce((v, div)=>v + div.value, 0); + .filter(div=>div.founded) + .reduce((v, div)=>v + div.value, 0); return corpAssets + this.dividend + this.cash; } }); Object.defineProperty(App.Corporate, "dividendRatio", { - get: function( ) { return V.dividendRatio; }, - set: function(value) { V.dividendRatio = value; } + get: function() { return V.dividendRatio; }, + set: function(value) { V.dividendRatio = value; } }); Object.defineProperty(App.Corporate, "dividendTimer", { - get: function( ) { return V.dividendTimer; }, - set: function(value) { V.dividendTimer = value; } + get: function() { return V.dividendTimer; }, + set: function(value) { V.dividendTimer = value; } }); Object.defineProperty(App.Corporate, "payoutAfterCash", { get: function() { @@ -530,16 +530,16 @@ App.Corporate.Init = function() { }); const SharesType = class { - get personal() { return V.personalShares; } - set personal(value) { V.personalShares = value; } - get public() { return V.publicShares; } - set public(value) { V.publicShares = value; } - get total() { return this.personal + this.public; } + get personal() { return V.personalShares; } + set personal(value) { V.personalShares = value; } + get public() { return V.publicShares; } + set public(value) { V.publicShares = value; } + get total() { return this.personal + this.public; } }; App.Corporate.shares = new SharesType(); App.Corporate.ledger = { current: new Ledger(App.Corporate), - old: new Ledger(App.Corporate, "Old"), + old: new Ledger(App.Corporate, "Old"), swap: function() { this.old.copy(this.current); this.current.clear(); @@ -560,7 +560,7 @@ App.Corporate.Init = function() { }; App.Corporate.create = function(division, personalShares, publicShares) { this.shares.personal = personalShares; - this.shares.public = publicShares; + this.shares.public = publicShares; V.dividendTimer = 13; this.founded = true; this.foundedDate = V.week; @@ -582,7 +582,7 @@ App.Corporate.Init = function() { App.Corporate.ledger.swap(); }; App.Corporate.dissolve = function() { - for(let division of this.divisionList.filter(x=>x.founded)) { + for (let division of this.divisionList.filter(x=>x.founded)) { division.dissolve(); } this.founded = false; @@ -629,7 +629,7 @@ App.Corporate.Init = function() { ]; toDeleteCorp.forEach(id => delete V.corp[id]); - if(this.hasMarket) { + if (this.hasMarket) { App.Arcology.cellUpgrade(V.building, App.Arcology.Cell.Market, "Corporate Market", "Markets"); this.hasMarket = false; } @@ -642,27 +642,27 @@ App.Corporate.Init = function() { this.numDivisions -= 1; }; App.Corporate.chargeAsset = function(cost, type) { - if(!Number.isFinite(cost)) { throw "The cost provided was not a real number"; } + 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 (!(type in this.ledger.current)) { throw `Ledger doesn't record '${type}' category.`; } + if (cost === 0) { return; } this.ledger.current[type] += cost; this.cash -= cost; }; App.Corporate.earnRevenue = function(cost, locality) { - if(!Number.isFinite(cost)) { throw "The cost provided was not real"; } + if (!Number.isFinite(cost)) { throw "The cost provided was not real"; } cost = Math.trunc(cost); let current = this.ledger.current; let key = `${locality}Revenue`; - if(!(key in current)) { throw `Unknown locality '${locality}'`; } + if (!(key in current)) { throw `Unknown locality '${locality}'`; } current[key] += cost; this.cash += cost; }; App.Corporate.chargeDividend = function(cost, weekLedger) { - if(!Number.isFinite(cost)) { throw "The cost provided was not real"; } + if (!Number.isFinite(cost)) { throw "The cost provided was not real"; } cost = Math.trunc(cost); - if(weekLedger == null) { + if (weekLedger == null) { throw "No weekLedger provided"; } this.dividend += cost; @@ -675,11 +675,11 @@ App.Corporate.Init = function() { }; /* Need to prevent skipping intermediaries if they exist, ie break->surgery->train, you can skip surgery only if you don't have it.*/ App.Corporate.ownsIntermediaryDivision = function(fromDivision, toDivision) { - for(let intermediateDiv of toDivision.relatedDivisions - .from - .filter(iDep => iDep.id !== fromDivision.id - && fromDivision.relatedDivisions.to.includes(iDep))) { - if(intermediateDiv.founded) { return true; } + for (let intermediateDiv of toDivision.relatedDivisions + .from + .filter(iDep => iDep.id !== fromDivision.id + && fromDivision.relatedDivisions.to.includes(iDep))) { + if (intermediateDiv.founded) { return true; } } return false; }; @@ -696,24 +696,24 @@ App.Corporate.Init = function() { return Math.trunc(totalValue); }; App.Corporate.buySlaves = function(division, count) { - if(count <= 0) { return 0; } + if (count <= 0) { return 0; } division = asDivision(division); let purchasePrice = this.slaveMarketPurchaseValue(division, count); - if(this.cash < purchasePrice) { + if (this.cash < purchasePrice) { throw "Attempted purchase without enough money"; } this.chargeAsset(purchasePrice, "slaves"); division.activeSlaves += count; - V.menialSupplyFactor -= count; + V.menialSupplyFactor -= count; return purchasePrice; }; App.Corporate.sellSlaves = function(division, count) { - if(count <= 0) { return 0; } + if (count <= 0) { return 0; } division = asDivision(division); - if(division.heldSlaves < count) { throw "Attempted to sell more slaves than held."; } + if (division.heldSlaves < count) { throw "Attempted to sell more slaves than held."; } let sellPrice = this.slaveMarketSellValue(division, count); this.earnRevenue(sellPrice, "local"); @@ -726,7 +726,7 @@ App.Corporate.Init = function() { toDivision = asDivision(toDivision); // TODO: validate the from and to departments are directly connected. - if(fromDivision.heldSlaves < count) { throw `Tried to move ${count} slaves out of ${fromDivision.name}, but it only had ${fromDivision.heldSlaves}`; } + if (fromDivision.heldSlaves < count) { throw `Tried to move ${count} slaves out of ${fromDivision.name}, but it only had ${fromDivision.heldSlaves}`; } fromDivision.heldSlaves -= count; toDivision.activeSlaves += count; @@ -745,7 +745,7 @@ App.Corporate.Init = function() { const devCount = division.developmentCount; count = count || devCount; - if(count > devCount) { throw `Attempted to sell more of a division ${division.id} than exists (${count} of ${devCount})`; } + if (count > devCount) { throw `Attempted to sell more of a division ${division.id} than exists (${count} of ${devCount})`; } const developmentCost = Math.trunc(count * division.sizeCost * 800); this.chargeAsset(-developmentCost, "development"); division.developmentCount -= count; @@ -766,19 +766,19 @@ App.Corporate.Init = function() { }; App.Corporate.calculateDividend = function(weekLedger) { let profit = this.ledger.current.profit; - if(this.dividendRatio > 0 && profit > 0) { + if (this.dividendRatio > 0 && profit > 0) { this.chargeDividend(profit * this.dividendRatio, weekLedger); } // Payout leftover cash should be the last thing the corporation does // in a week so that its cash will be at the payout amount. - if(this.payoutCash) { + if (this.payoutCash) { let payoutAfter = this.payoutAfterCash; - if(this.cash > payoutAfter) { + if (this.cash > payoutAfter) { this.chargeDividend(this.cash - payoutAfter, weekLedger); } } - if(this.dividendTimer <= 1) { + if (this.dividendTimer <= 1) { weekLedger.payout = Math.trunc(this.dividend * this.shares.personal / this.shares.total); cashX(weekLedger.payout, "stocks"); this.dividendTimer = 14;// 13 for each quarter, but +1 because we're subtracting one below. @@ -790,7 +790,7 @@ App.Corporate.Init = function() { App.Corporate.endWeek = function() { let ledger = new WeekProcessingLedger(); // Prepare requests - for(let div of this.divisionList.filter(div=>div.founded)) { + for (let div of this.divisionList.filter(div=>div.founded)) { let divLedger = ledger.getDivision(div); ledger.operatingCost += div.maintenanceCost; @@ -799,7 +799,7 @@ App.Corporate.Init = function() { div.endweek_Revenue(divLedger); div.endWeek_Slaves(divLedger); } - for(let divLedger of Object.values(ledger.divisionLedgers)) { + for (let divLedger of Object.values(ledger.divisionLedgers)) { let div = divLedger.division; div.endWeek_Transfer(divLedger); div.endWeek_Market(divLedger); @@ -807,21 +807,21 @@ App.Corporate.Init = function() { this.chargeAsset(ledger.operatingCost, "operations"); this.chargeAsset(ledger.overhead, "overhead"); // Execute sales requests, transfers, and earned revenue - for(let divLedger of Object.values(ledger.divisionLedgers)) { + for (let divLedger of Object.values(ledger.divisionLedgers)) { let div = divLedger.division; this.earnRevenue(divLedger.revenue.value, "local"); - if(div.activeSlaves > 0) { + if (div.activeSlaves > 0) { shared.SellOverflowSlaves(div); } - for(let otherDivPair of divLedger.transfer.divisions) { + for (let otherDivPair of divLedger.transfer.divisions) { let otherDiv = otherDivPair.division; let count = otherDivPair.fill; - if(count == 0) { continue; } + if (count == 0) { continue; } this.transferSlaves(div, otherDiv, count); } - if(divLedger.market.sell > 0) { + if (divLedger.market.sell > 0) { divLedger.market.finalSale = this.sellSlaves(div, divLedger.market.sell); } } @@ -832,20 +832,20 @@ App.Corporate.Init = function() { // todo: Cheapest first // Even purchase requests: let purchaseValues = evenFillArray(Object.values(ledger.divisionLedgers) - .filter(divLedger=>divLedger.market.buy > 0) - , this.cash - , divLedger=>divLedger.market.buyValue); - for(let divLedgerPair of purchaseValues) { + .filter(divLedger=>divLedger.market.buy > 0) + , this.cash + , divLedger=>divLedger.market.buyValue); + for (let divLedgerPair of purchaseValues) { let divLedger = divLedgerPair.item; let purchaseCost = divLedgerPair.value; let div = divLedger.division; - if(divLedger.market.buyValue > purchaseCost) { + if (divLedger.market.buyValue > purchaseCost) { // Estimate how many slaves we can afford within the purchase cost let perSlaveEstimate = Math.trunc(divLedger.market.buyValue / divLedger.market.buy); let numSlavesEstimate = Math.trunc(purchaseCost / perSlaveEstimate); - if(numSlavesEstimate < 1) { + if (numSlavesEstimate < 1) { divLedger.market.originalBuy = divLedger.market.buy; divLedger.market.buyShortMoney = divLedger.market.buyValue; divLedger.market.buyShortSlaves = divLedger.market.buy; @@ -861,20 +861,20 @@ App.Corporate.Init = function() { } this.creditEconomy(); - if(this.numDivisions < this.divisionList.length && !this.canExpand) { + if (this.numDivisions < this.divisionList.length && !this.canExpand) { let expansionValue = Math.trunc(Math.pow(this.numDivisions, 1.5) + (5 * this.numDivisions + 2) / 4); - if(this.value > expansionValue * 1000000) { + if (this.value > expansionValue * 1000000) { ledger.canExpandNow = true; this.canExpand = true; } } let specializationExpansion = 1.6 * Math.pow(1.25, this.specializations) - 1.2; - if(this.value > specializationExpansion * 1000000){ + if (this.value > specializationExpansion * 1000000) { this.specializationTokens++; this.specializations++; ledger.canSpecializeNow = true; } - if(this.specializationTimer > 0) { + if (this.specializationTimer > 0) { this.specializationTimer--; } this.calculateDividend(ledger); @@ -883,17 +883,17 @@ App.Corporate.Init = function() { }; App.Corporate.cheatCash = function(userCash) { userCash = Math.trunc(Number(userCash)); - if(Number.isFinite(userCash)) { + if (Number.isFinite(userCash)) { this.cash = userCash; V.cheater = 1; } }; - App.Corporate.Backcompat = function(){ + App.Corporate.Backcompat = function() { // current foreignRevenue used to be used for old foreignRevenue let c = this.ledger.current; App.Corporate.ledger.old.foreignRevenue = c.foreignRevenue; - if(c.operations === undefined) { + if (c.operations === undefined) { c.operations = 0; c.overhead = 0; c.economicBoost = 0; @@ -910,7 +910,7 @@ globalThis.corpSharePrice = function(q = 0, personalShares = null, publicShares return 0; } personalShares = personalShares || V.personalShares; - publicShares = publicShares || V.publicShares; + publicShares = publicShares || V.publicShares; return Math.trunc(1000 * (App.Corporate.value / (personalShares + publicShares + q))); }; diff --git a/src/events/scheduled/assholeKnight.tw b/src/events/scheduled/assholeKnight.tw index baa8c9c93044724b213244ad4f540e3ce351f8bb..68ff0acdd8d75f954dee57890757bd5e8e1f78fc 100644 --- a/src/events/scheduled/assholeKnight.tw +++ b/src/events/scheduled/assholeKnight.tw @@ -2,7 +2,7 @@ <<set $nextButton = "Continue", $nextLink = "Scheduled Event">> -The group of citizens you hand-picked as your Knights have quickly proven themselves a reliable staple of the Arcology. Being visibly a league above the common citizen with their heavy Imperial Plate decorated with glimmering pendants and marks of their individual, flowery coats of arms, their mere prescence is enough to make most common criminals cower and keep merchants selling their wares at fair prices. The tenets of neo-Imperial hierarchy and their own social prestige have already gone to their heads, and many Knights are now recognized immediately by the common citizens as heroic, uncowed citizen-soldiers. +The group of citizens you hand-picked as your Knights have quickly proven themselves a reliable staple of the Arcology. Being visibly a league above the common citizen with their heavy Imperial Plate decorated with glimmering pendants and marks of their individual, flowery coats of arms, their mere presence is enough to make most common criminals cower and keep merchants selling their wares at fair prices. The tenets of neo-Imperial hierarchy and their own social prestige have already gone to their heads, and many Knights are now recognized immediately by the common citizens as heroic, uncowed citizen-soldiers. <br><br> Despite the noble reputations of many of your Knights, their image as defenders of the downtrodden and honest protectors of the Arcology is not universal. Although you Knighted every last one of them yourself, it seems you might have made a misjudgement on the character of one of your new servants; a stream of minor offenses from one Knight in particular has been building up in your inbox for quite some time, and reviewing the whole dossier now paints a portrait of abuses and misconduct. <br><br> @@ -19,7 +19,7 @@ This singular Knight has apparently been using their position to extort and bull <</link>> <br> <<link "Have him publicly flogged, then enslaved">> <<replace "#result">> - You have the insolent Knight's gear and weapons confiscated, then publicly flog him in the plaza and annouce that he's to be enslaved for crimes against the people of $arcologies[0].name. Although the watching peasants are clearly @@.green;relieved@@ that the cruel bully is off the streets, some of them, those who did not feel the fist of the howling man on their own neck, @@.red;recoil@@ somewhat at the sudden brutality against a class that most of them idolize and romanticize. + You have the insolent Knight's gear and weapons confiscated, then publicly flog him in the plaza and announce that he's to be enslaved for crimes against the people of $arcologies[0].name. Although the watching peasants are clearly @@.green;relieved@@ that the cruel bully is off the streets, some of them, those who did not feel the fist of the howling man on their own neck, @@.red;recoil@@ somewhat at the sudden brutality against a class that most of them idolize and romanticize. <<run repX(1000, "event")>> <<set $activeSlaveOneTimeMinAge = 22>> <<set $activeSlaveOneTimeMaxAge = 34>> diff --git a/src/events/scheduled/newBaron.tw b/src/events/scheduled/newBaron.tw index 03b98b6e9b739008d1c8bf16a55496b998d9e94d..41c0bd9b0e7f126a07605c8d1383f1a616482d83 100644 --- a/src/events/scheduled/newBaron.tw +++ b/src/events/scheduled/newBaron.tw @@ -6,14 +6,14 @@ $arcologies[0].name is prospering. New citizens flood to your gates, filling out <br><br> The appointment of a new Baron is not something to be taken lightly; it is undoubtedly the most desired title in your arcology, and a veritable horde of citizens and millionaires hound your inbox and parties with hints and implications, subtly attempting to display their qualifications, because the Barons posses something even the wealthiest trillionaire in the Free Cities does not - security. The golden band of office of an Imperial Baron brings with it a penthouse, a sense of nobility, and a guaranteed sector of people to rule; so long as the Arcology continues to exist, the Barons will rule in your name, free from worries about petty market fluctuations and slave prices. Short of your personal intervention or the total collapse of the Arcology, nothing can unseat a Baron once they're appointed. <br><br> -The hunger for such security among your upper class leaves you in an intersting position. You have dozens of citizens that you could give the title to, with various skills and proficiencies from your diverse acology, and anyone who's handed a noble title will be certain to show their gratitude. The only real question on your mind - and on the minds of the waiting elites - is who you plan to promote. +The hunger for such security among your upper class leaves you in an interesting position. You have dozens of citizens that you could give the title to, with various skills and proficiencies from your diverse arcology, and anyone who's handed a noble title will be certain to show their gratitude. The only real question on your mind - and on the minds of the waiting elites - is who you plan to promote. <br><br> <span id="result"> <br> <<link "Appoint a wealthy executive">> <<replace "#result">> - You select one of your loyal executives, an ultra-wealthy trader within the arcology who made a fortune in the sale of human bodies, for the new Barony. The man, a portly and unintimidating man that hides a razor-sharp mind behind his fat and an exepensive suit, smiles full of teeth as you annouce your decision to a waiting crowd of elites. After you go through the formalities and hand him the golden band that'll represent his symbol of office, he shakes your hand vigorously, still smiling devilishly. The next day, the newly-appointed Baron sends you a platter of expensive gifts and foreign candies, complimented with a @@.green;massive direct deposit to your bank account.@@ You can't help but feel that such a crafty fox might use his new power to @@.red;corner the market@@ in his barony, though. + You select one of your loyal executives, an ultra-wealthy trader within the arcology who made a fortune in the sale of human bodies, for the new Barony. The man, a portly and unintimidating man that hides a razor-sharp mind behind his fat and an expensive suit, smiles full of teeth as you announce your decision to a waiting crowd of elites. After you go through the formalities and hand him the golden band that'll represent his symbol of office, he shakes your hand vigorously, still smiling devilishly. The next day, the newly-appointed Baron sends you a platter of expensive gifts and foreign candies, complimented with a @@.green;massive direct deposit to your bank account.@@ You can't help but feel that such a crafty fox might use his new power to @@.red;corner the market@@ in his barony, though. <<run cashX(5000, "Baron gift")>> <<run $arcologies[0].prosperity -= 1>> <</replace>> diff --git a/src/events/scheduled/pitFightNonlethal.js b/src/events/scheduled/pitFightNonlethal.js index a420a8b8dee5a740dad8465246534f9854dc19a9..8c073d413b65636d61f33e4e05db149cd1e494ef 100644 --- a/src/events/scheduled/pitFightNonlethal.js +++ b/src/events/scheduled/pitFightNonlethal.js @@ -7,7 +7,6 @@ App.Facilities.Pit.fight.nonlethal = function(fighters) { const loser = getSlave(getLoser()); - frag.append(intro(), fighterDeadliness(getSlave(fighters[0])), fighterDeadliness(getSlave(fighters[1])), fight(), postFight()); return frag; @@ -1014,7 +1013,7 @@ App.Facilities.Pit.fight.nonlethal = function(fighters) { r.push(`${He} noticed something while ${he} was raping ${loser.slaveName}; watching the way ${he2} writhed in pain was strangely satisfying, as ${he} was making ${him2} suffer. ${winner.slaveName} cums powerfully at the mere thought; ${he} has become `, App.UI.DOM.makeElement("span", `sexually addicted to inflicting pain and anguish.`, "noteworthy")); winner.sexualFlaw = "malicious"; - } else if (winner.fetish === "masochist" && winner.fetishStrength > 90 && winner.sexualFlaw !== "self-hating" && winner.devotion < 20) { + } else if (winner.fetish === "masochist" && winner.fetishStrength > 90 && winner.sexualFlaw !== "self hating" && winner.devotion < 20) { r.push(`${He} feels horrible after forcing ${himself} on ${loser.slaveName}; ${he} is the one that should suffer, not ${him2}. ${winner.slaveName} has `, App.UI.DOM.makeElement("span", `descended into true self hatred.`, "noteworthy")); winner.sexualFlaw = "self hating"; @@ -1025,7 +1024,7 @@ App.Facilities.Pit.fight.nonlethal = function(fighters) { } else if (winner.behavioralFlaw === "none" && random(1, 100) < 5 && winner.devotion < 20) { r.push(`${He} begins to act `, App.UI.DOM.makeElement("span", `oddly`, ["flaw", "gain"]), ` after the fight; having to beat down and rape another slave may have affected ${him} mentally.`); - winner.sexualFlaw = "odd"; + winner.behavioralFlaw = "odd"; } App.Events.addNode(winnerEffectsDiv, r); @@ -1085,10 +1084,10 @@ App.Facilities.Pit.fight.nonlethal = function(fighters) { } } - if (loser.fetish === "masochist" && loser.fetishStrength > 90 && loser.behavioralFlaw !== "self hating") { + if (loser.fetish === "masochist" && loser.fetishStrength > 90 && loser.sexualFlaw !== "self hating") { r.push(`${He2} feels strangely content after being abused and violated; ${he2} is the one that should suffer, after all. ${loser.slaveName} has `, App.UI.DOM.makeElement("span", `descended into true self hatred.`, ["flaw", "gain"])); - loser.behavioralFlaw = "self hating"; + loser.sexualFlaw = "self hating"; } else if (loser.behavioralFlaw === "none" && random(1, 100) < 5 && loser.devotion < 20) { r.push(`${He2} begins to act `, App.UI.DOM.makeElement("span", `oddly`, ["flaw", "gain"]), ` after the fight; losing and getting raped may have affected ${him2} mentally.`); diff --git a/src/markets/specificMarkets/customSlaveMarket.js b/src/markets/specificMarkets/customSlaveMarket.js index d90915fd8222617b77dfc4496be571afb49035ab..2372c8c26cba79780044f6f65ffc14ad58a3907b 100644 --- a/src/markets/specificMarkets/customSlaveMarket.js +++ b/src/markets/specificMarkets/customSlaveMarket.js @@ -899,7 +899,7 @@ App.Markets["Custom Slave"] = function() { ["leg.right", "Right leg"], ]); - for (const [value, text] of limbs) { + for (const [value, text] of limbs) { const div = document.createElement("div"); // Desc setup diff --git a/src/markets/specificMarkets/huskSlave.js b/src/markets/specificMarkets/huskSlave.js index 39244fd5cc14646b7b528347fb92d5dbca2aa33b..ff4e664200fd8f5b5183a1b0f80d370b0e48c192 100644 --- a/src/markets/specificMarkets/huskSlave.js +++ b/src/markets/specificMarkets/huskSlave.js @@ -134,7 +134,7 @@ App.Markets["Husk Slave"] = function() { p.append(`Futanari.`); } const choices = { - Important: 0, + "Important": 0, "Not Important": 1, }; p.append(links(choices, "virgin")); diff --git a/src/markets/specificMarkets/schoolFutanari.js b/src/markets/specificMarkets/schoolFutanari.js index dbcfc77bb7851e9367a31cb1eaceb137cd74f107..8e9ddba2aacb15447bbc37d00e9b735a591ac203 100644 --- a/src/markets/specificMarkets/schoolFutanari.js +++ b/src/markets/specificMarkets/schoolFutanari.js @@ -162,12 +162,12 @@ App.Markets.TFS = function() { } let costMod = 0.8; if (V.TFS.schoolSale !== 0) { - costMod = costMod * 0.5; + costMod *= 0.5; } else if (V.TFS.schoolUpgrade !== 0) { - costMod = costMod * 0.8; + costMod *= 0.8; } el.append( - App.Markets.purchaseFramework("TFS", {costMod:costMod}) + App.Markets.purchaseFramework("TFS", {costMod: costMod}) ); return el; diff --git a/src/markets/specificMarkets/schools.js b/src/markets/specificMarkets/schools.js index ea21559657c975c65a93611fb159e8c8ce6f288d..e68521ac77ac7311b634bcd520bc313a31506300 100644 --- a/src/markets/specificMarkets/schools.js +++ b/src/markets/specificMarkets/schools.js @@ -25,7 +25,7 @@ App.Markets.GRI = function() { costMod = 0.8; } el.append( - App.Markets.purchaseFramework("GRI", {costMod:costMod}) + App.Markets.purchaseFramework("GRI", {costMod: costMod}) ); return el; @@ -55,7 +55,7 @@ App.Markets.LDE = function() { costMod = 0.8; } el.append( - App.Markets.purchaseFramework("LDE", {costMod:costMod}) + App.Markets.purchaseFramework("LDE", {costMod: costMod}) ); return el; @@ -86,7 +86,7 @@ App.Markets.NUL = function() { costMod = 0.8; } el.append( - App.Markets.purchaseFramework("NUL", {costMod:costMod}) + App.Markets.purchaseFramework("NUL", {costMod: costMod}) ); return el; @@ -123,7 +123,7 @@ App.Markets.SCP = function() { costMod = 0.8; } el.append( - App.Markets.purchaseFramework("SCP", {costMod:costMod}) + App.Markets.purchaseFramework("SCP", {costMod: costMod}) ); return el; @@ -157,7 +157,7 @@ App.Markets.TCR = function() { costMod = 0.8; } el.append( - App.Markets.purchaseFramework("TCR", {costMod:costMod, sTitleSingular: "cow", sTitlePlural: "cattle"}) + App.Markets.purchaseFramework("TCR", {costMod: costMod, sTitleSingular: "cow", sTitlePlural: "cattle"}) ); return el; @@ -193,7 +193,7 @@ App.Markets.TGA = function() { costMod = 0.8; } el.append( - App.Markets.purchaseFramework("TGA", {costMod:costMod}) + App.Markets.purchaseFramework("TGA", {costMod: costMod}) ); return el; @@ -221,7 +221,7 @@ App.Markets.HA = function() { costMod = 1.2; } el.append( - App.Markets.purchaseFramework("HA", {costMod:costMod}) + App.Markets.purchaseFramework("HA", {costMod: costMod}) ); return el; @@ -257,7 +257,7 @@ App.Markets.TSS = function() { costMod = 0.8; } el.append( - App.Markets.purchaseFramework("TSS", {costMod:costMod}) + App.Markets.purchaseFramework("TSS", {costMod: costMod}) ); return el; @@ -275,7 +275,7 @@ App.Markets.TUO = function() { costMod = 1.2; } el.append( - App.Markets.purchaseFramework("TUO", {costMod:costMod}) + App.Markets.purchaseFramework("TUO", {costMod: costMod}) ); return el; diff --git a/src/markets/specificMarkets/slaveMarkets.js b/src/markets/specificMarkets/slaveMarkets.js index 2240f470c0c451638144e6adf5ef4125a7d01704..43ac7235a419d0952288f13a4f9c623b62b13a0d 100644 --- a/src/markets/specificMarkets/slaveMarkets.js +++ b/src/markets/specificMarkets/slaveMarkets.js @@ -208,7 +208,7 @@ App.Markets.neighbor = function() { costMod = (1 - (_opinion * 0.05)); } - el.append(App.Markets.purchaseFramework("neighbor", {costMod:costMod})); + el.append(App.Markets.purchaseFramework("neighbor", {costMod: costMod})); return el; }; diff --git a/src/pregmod/eliteBreedingExam.js b/src/pregmod/eliteBreedingExam.js index cd91cfc011409ee4e8d917180c6c45d4bae262b3..7258819cddb8fbdaf791656e73c045f4472c15cd 100644 --- a/src/pregmod/eliteBreedingExam.js +++ b/src/pregmod/eliteBreedingExam.js @@ -1,17 +1,17 @@ -globalThis.eliteBreedingExam = function(slave = null) { +globalThis.eliteBreedingExam = function(slave = null) { const eliteAngered = V.failedElite > 100; const SlaveProfessionalismEstablished = V.arcologies[0].FSSlaveProfessionalism > 20; - const preferYounger= V.arcologies[0].FSYouthPreferentialist > 20; + const preferYounger = V.arcologies[0].FSYouthPreferentialist > 20; const partyAnimal = V.arcologies[0].FSHedonisticDecadence > 20; const cost = 5000; let r = [], test, passing = 0, fixable; - + const result = function() { if (slave) { if (test === true) { return `<span class="lime">PASSED</span>`; } else if (fixable) { - return `<span class="yellow">Within fixable range.</span>` + return `<span class="yellow">Within fixable range.</span>`; } else { passing--; return `<span class="red">FAILED</span>`; @@ -33,12 +33,12 @@ globalThis.eliteBreedingExam = function(slave = null) { test = slave.intelligence + slave.intelligenceImplant >= (eliteAngered ? 95 : 50); } r.push(`Must be ${eliteAngered ? 'highly intelligent' : 'very smart'}. ${result()}`); - + if (slave) { test = Beauty(slave) >= (eliteAngered ? 120 : 100); } r.push(`Must be ${eliteAngered ? 'unbelievably' : ''} beautiful. ${result()}`); - + if (slave) { test = slave.face >= (eliteAngered ? 95 : 40); } @@ -46,9 +46,9 @@ globalThis.eliteBreedingExam = function(slave = null) { if (slave) { test = slave.chem <= 20; - } + } r.push(`Their health must not be overly impacted by drug use. ${result()}`); - + if (slave) { test = slave.addict === 0; } @@ -63,7 +63,7 @@ globalThis.eliteBreedingExam = function(slave = null) { test = slave.physicalAge < targetAge; } } - r.push(`Must be ${preferYounger? 'younger' : 'older'} than ${targetAge}. ${result()}`); + r.push(`Must be ${preferYounger ? 'younger' : 'older'} than ${targetAge}. ${result()}`); } if (V.arcologies[0].FSIntellectualDependency > 20) { @@ -216,7 +216,7 @@ globalThis.eliteBreedingExam = function(slave = null) { r.push(`Must be big, soft and fat. ${result()}`); } } - + if (slave) { if (passing === 2) { r.push(`The aforementioned slave has been deemed <span class="yellow">currently unsuitable</span> for breeding, but may be resubmitted after corrections are applied. We understand the subjective nature of "fit" and do not wish to preclude the use a viable breeder over such a trivial fix. A contraceptive routine has been applied to protect against "accidents" in the interim.`); @@ -228,10 +228,10 @@ globalThis.eliteBreedingExam = function(slave = null) { r.push(`The aforementioned slave has been deemed <span class="green">worthy</span> of being used for breeding and has been marked as such. Please note the increased restrictions on breeding slaves.`); r.push(`They are not permitted for public use or anything that may harm their growing child. The child within them is considered a member of the Elite class and as such, any harm that comes to them will result in severe penalties to the breeder's owner. Development of the child will be closely monitored; should the fetus be identified as not of the owner's blood (or any other member of the Elite class), said owner shall face severe fines.`); slave.breedingMark = 1; slave.pregControl = "none"; - removeJob(slave, slave.assignment); + removeJob(slave, slave.assignment); } cashX(-cost, "capEx"); } - + return r.map(t => `<div>${t}</div>`).join(""); };