diff --git a/.eslintrc.json b/.eslintrc.json index dbc6ba92fc33ee05c347dddc7c4bf193b33f3634..043a972497d5e9d3c3a801414bd23311886a777b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -50,7 +50,6 @@ ], "object-curly-spacing": "error", "no-var": "error", - "no-template-curly-in-string": "error", "spaced-comment": "warn", "no-undef": "off", "no-unused-vars": "error", diff --git a/src/js/economyJS.js b/src/js/economyJS.js index 970863e4f81ca2df95beb098beba9f53a34ea804..51eb187d5a8e45004a0d8547bb07439178be29ef 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -252,15 +252,13 @@ window.getMasterSuiteCosts = function() { window.getNurseryCosts = function() { const facilityCost = State.variables.facilityCost; const nursery = State.variables.nursery; - const costs = (nursery * facilityCost); - return costs; + return (nursery * facilityCost); }; window.getFarmyardCosts = function() { const facilityCost = State.variables.facilityCost; const farmyard = State.variables.farmyard; - const costs = (farmyard * facilityCost); - return costs; + return (farmyard * facilityCost); }; window.getSecurityExpansionCost = function() { @@ -321,15 +319,11 @@ window.getSecurityExpansionCost = function() { // general arcology costs window.getLifestyleCosts = function() { - let costs = 0; - const localEcon = State.variables.localEcon; - costs += (State.variables.girls * (250 + (50000 / localEcon))); - return costs; + return (State.variables.girls * (250 + (50000 / State.variables.localEcon))); }; window.getFSCosts = function() { - let costs = 0; - costs += State.variables.FSSpending; + let costs = State.variables.FSSpending; if (State.variables.arcologies[0].FSRepopulationFocusLaw === 1 && State.variables.PC.pregKnown === 1) { costs -= 500; } @@ -337,26 +331,16 @@ window.getFSCosts = function() { }; window.getCitizenOrphanageCosts = function() { - let costs = 0; - costs += State.variables.citizenOrphanageTotal * 100; - return costs; + return State.variables.citizenOrphanageTotal * 100; }; window.getPrivateOrphanageCosts = function() { - let costs = 0; - costs += State.variables.privateOrphanageTotal * 500; - if (State.variables.breederOrphanageTotal > 0) { - costs += 50; - } - return costs; + const costs = State.variables.privateOrphanageTotal * 500; + return costs + (State.variables.breederOrphanageTotal > 0) ? 50 : 0; }; window.getPeacekeeperCosts = function() { - let costs = 0; - if (State.variables.peacekeepers !== 0 && State.variables.peacekeepers.undermining !== 0) { - costs += State.variables.peacekeepers.undermining; - } - return costs; + return (State.variables.peacekeepers !== 0 && State.variables.peacekeepers.undermining !== 0) ? State.variables.peacekeepers.undermining : 0; }; window.getMercenariesCosts = function() { @@ -375,20 +359,12 @@ window.getMercenariesCosts = function() { }; window.getMenialRetirementCosts = function() { - let costs = 0; - if (State.variables.citizenRetirementMenials === 1) { - costs += State.variables.menials * 2; - } - return costs; + return (State.variables.citizenRetirementMenials === 1) ? State.variables.menials * 2 : 0; }; // policy and other expenses window.getRecruiterCosts = function() { - let costs = 0; - if (State.variables.Recruiter !== 0) { - costs += 250; - } - return costs; + return (State.variables.Recruiter !== 0) ? 250 : 0; }; window.getSchoolCosts = function() { @@ -446,7 +422,7 @@ window.getSchoolCosts = function() { window.getPolicyCosts = function() { let costs = 0; - let policyCost = State.variables.policyCost; + const policyCost = State.variables.policyCost; if (State.variables.alwaysSubsidizeGrowth === 1) { costs += policyCost; } @@ -477,24 +453,17 @@ window.getProstheticsCosts = function() { // player expenses window.getPCTrainingCosts = function() { + const PA = Object.values(PersonalAttention); + const currentPA = State.variables.personalAttention; let costs = 0; if (State.variables.PC.actualAge >= State.variables.IsInPrimePC && State.variables.PC.actualAge < State.variables.IsPastPrimePC) { - if (State.variables.personalAttention === PersonalAttention.TRADE) { - costs += 10000 * State.variables.AgeEffectOnTrainerPricingPC; - } else if (State.variables.personalAttention === PersonalAttention.WAR) { - costs += 10000 * State.variables.AgeEffectOnTrainerPricingPC; - } else if (State.variables.personalAttention === PersonalAttention.SLAVING) { - costs += 10000 * State.variables.AgeEffectOnTrainerPricingPC; - } else if (State.variables.personalAttention === PersonalAttention.ENGINEERING) { - costs += 10000 * State.variables.AgeEffectOnTrainerPricingPC; - } else if (State.variables.personalAttention === PersonalAttention.MEDICINE) { - costs += 10000 * State.variables.AgeEffectOnTrainerPricingPC; - } else if (State.variables.personalAttention === PersonalAttention.HACKING) { + if (PA.includes(currentPA) && currentPA !== PersonalAttention.MAID) { costs += 10000 * State.variables.AgeEffectOnTrainerPricingPC; } } return costs; }; + window.getPCCosts = function() { let costs = 0; if (State.variables.PC.preg === -1) { @@ -562,16 +531,12 @@ window.getWeatherCosts = function() { window.getSlaveMinorCosts = function(slave) { let costs = 0; - let rulesCost = State.variables.rulesCost; + const rulesCost = State.variables.rulesCost; if (slave.assignment === Job.SERVANT || slave.assignment === Job.SERVER) { if (slave.trust < -20) { costs -= rulesCost * 4; } else if (slave.devotion < -20) { - if (slave.trust >= 20) { - costs -= rulesCost / 2; - } else { - costs -= rulesCost * 2; - } + costs -= (slave.trust >= 20) ? rulesCost / 2 : rulesCost * 2; } else if (slave.devotion <= 20) { costs -= rulesCost * 3; } else if (slave.devotion <= 50) { @@ -641,11 +606,7 @@ window.getSlaveCost = function(s) { } break; case Job.BROTHEL: - if (s.livingRules === LivingRule.NORMAL) { - cost += rulesCost * 1.5; - } else { - cost += rulesCost; - } + cost += (s.livingRules === LivingRule.NORMAL) ? rulesCost * 1.5 : rulesCost; break; case Job.SCHOOL: case Job.CLUB: @@ -674,19 +635,11 @@ window.getSlaveCost = function(s) { if (s.livingRules === LivingRule.NORMAL) { cost += rulesCost * 1.5; } else { - if (State.variables.servantsQuartersDecoration === 'Degradationist') { - cost += rulesCost * 0.90; - } else { - cost += rulesCost; - } + cost += (State.variables.servantsQuartersDecoration === 'Degradationist') ? rulesCost * 0.90 : rulesCost; } break; case Job.JAIL: - if (s.livingRules === LivingRule.NORMAL) { - cost += rulesCost * 1.25; - } else { - cost += rulesCost * 0.90; - } + cost += (s.livingRules === LivingRule.NORMAL) ? rulesCost * 1.25 : rulesCost * 0.90; break; case Job.MADAM: case Job.DJ: @@ -805,11 +758,7 @@ window.getSlaveCost = function(s) { } if ((s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) { if (s.amp !== 0) { - if (s.amp === 1) { - cost += rulesCost; - } else { - cost += rulesCost / 2; - } + cost += (s.amp === 1) ? rulesCost : rulesCost / 2; } else if (!canWalk(s)) { cost += rulesCost; } @@ -957,7 +906,7 @@ window.menialSlaveCost = function(q) { window.NPCSexSupply = function(LC) { const V = State.variables; - let NPCSexSupply = {lowerClass: V.NPCSexSupply.lowerClass}; + const NPCSexSupply = {lowerClass: V.NPCSexSupply.lowerClass}; // Lower class calculations LC += V.sexSubsidiesLC / 10 - V.sexSupplyBarriersLC / 20; @@ -975,7 +924,7 @@ window.NPCSexSupply = function(LC) { // The function for calculating and storing a slave's sexual interaction with citizens/'the outside' window.slaveJobValues = function() { const V = State.variables; - let slaveJobValues = {arcade: 0, club: 0, clubSP: 0}, clubSpots = 0, toTheClubTotal = 0, DJRepBonus = 0; + const slaveJobValues = {arcade: 0, club: 0, clubSP: 0}; let clubSpots = 0; const toTheClubTotal = 0; let DJRepBonus = 0; V.slavesGettingHelp = 0; // This section is for specific slaves or non-unique slaves adding their values to the whole @@ -1065,7 +1014,7 @@ window.slaveJobValues = function() { // Glory hole slaves adding to 'arcade' V.JobIDArray["work a glory hole"].forEach(ID => { - let s = V.slaves[V.slaveIndices[ID]]; + const s = V.slaves[V.slaveIndices[ID]]; s.sexAmount = Math.trunc((jsRandom(160, 200) + (20 * (4 - s.anus)) + (10 * (4 - s.vagina)) + Math.trunc(s.health / 5)) * 0.8); slaveJobValues.arcade += s.sexAmount; }); @@ -1092,8 +1041,8 @@ window.slaveJobValues = function() { }); function SJVClub(s) { - let toTheClub = 0, - beautyMultiplier = 1; + let toTheClub = 0; + let beautyMultiplier = 1; s.minorInjury = 0; // The beauty multiplier