From 58cd94111c6215fc91ba6c2e50db6c1c3ada3172 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Fri, 6 Nov 2020 12:52:04 -0500
Subject: [PATCH] more cleanup

---
 src/endWeek/reports/dairyReport.js | 169 +++++++++++++++--------------
 1 file changed, 85 insertions(+), 84 deletions(-)

diff --git a/src/endWeek/reports/dairyReport.js b/src/endWeek/reports/dairyReport.js
index d21ba36749e..2d43f8c1399 100644
--- a/src/endWeek/reports/dairyReport.js
+++ b/src/endWeek/reports/dairyReport.js
@@ -29,7 +29,7 @@ App.EndWeek.dairyReport = function() {
 	let Tadd;
 	let milkResults;
 	let growth;
-	let cashXvalue;
+	let cashValue;
 	let outputMilk;
 	let outputCum;
 
@@ -603,62 +603,65 @@ App.EndWeek.dairyReport = function() {
 				improveCondition(slave, 25);
 			} else {
 				if (V.dairySlimMaintain === 0 && slave.lactation > 0) {
-					if (V.dairyFeedersSetting > 1 && V.dairyStimulatorsSetting > 0) {
-						if (slave.boobs < 50000) {
-							if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
-								if (slave.boobs < 2000) {
-									growth = 75 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
-								} else if (slave.boobs < 5000 * gigantomastiaMod) {
-									growth = 50 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+					const growthCalc = Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting;
+					if (V.dairyStimulatorsSetting > 0) {
+						if (V.dairyFeedersSetting > 1) {
+							if (slave.boobs < 50000) {
+								if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
+									if (slave.boobs < 2000) {
+										growth = 75 * growthCalc + (50 / 4);
+									} else if (slave.boobs < 5000 * gigantomastiaMod) {
+										growth = 50 * growthCalc + (50 / 4);
+									} else {
+										growth = 25 * growthCalc + (50 / 4);
+									}
 								} else {
-									growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+									growth = 25 * growthCalc + ((50 - slave.physicalAge) / 4);
 								}
+								if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
+									boobtacular++;
+								}
+								if (slave.geneMods.NCS === 1) {
+									growth = Math.trunc(growth / 2);
+								}
+								slave.boobs += growth;
 							} else {
-								growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50 - slave.physicalAge) / 4);
-							}
-							if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
-								boobtacular++;
-							}
-							if (slave.geneMods.NCS === 1) {
-								growth = Math.trunc(growth / 2);
+								/* slave.boobs = 50000;*/
 							}
-							slave.boobs += growth;
 						} else {
-							/* slave.boobs = 50000;*/
-						}
-					} else if (V.dairyFeedersSetting > 0 && V.dairyStimulatorsSetting > 0) {
-						if (slave.boobs < 25000) {
-							if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
-								if (slave.boobs < 2000) {
-									growth = 75 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
-								} else if (slave.boobs < 5000 * gigantomastiaMod) {
-									growth = 50 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+							if (slave.boobs < 25000) {
+								if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
+									if (slave.boobs < 2000) {
+										growth = 75 * growthCalc + (50 / 4);
+									} else if (slave.boobs < 5000 * gigantomastiaMod) {
+										growth = 50 * growthCalc + (50 / 4);
+									} else {
+										growth = 25 * growthCalc + (50 / 4);
+									}
 								} else {
-									growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+									growth = 25 * growthCalc + ((50 - slave.physicalAge) / 4);
 								}
-							} else {
-								growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50 - slave.physicalAge) / 4);
-							}
-							if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
-								boobtacular++;
-							}
-							if (slave.geneMods.NCS === 1) {
-								growth = Math.trunc(growth / 2);
+								if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
+									boobtacular++;
+								}
+								if (slave.geneMods.NCS === 1) {
+									growth = Math.trunc(growth / 2);
+								}
+								slave.boobs += growth;
 							}
-							slave.boobs += growth;
 						}
 					} else if (V.dairyFeedersSetting > 1) {
 						if (slave.boobs < 10000) {
 							if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 								if (slave.boobs < 2000) {
-									growth = 75 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+									growth = 75 * growthCalc + (50 / 4);
 								} else if (slave.boobs < 5000 * gigantomastiaMod) {
-									growth = 50 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+									growth = 50 * growthCalc + (50 / 4);
 								} else {
-									growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+									growth = 25 * growthCalc + (50 / 4);
 								}
 							} else {
-								growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50 - slave.physicalAge) / 4);
+								growth = 25 * growthCalc + ((50 - slave.physicalAge) / 4);
 							}
 							if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
 								boobtacular++;
@@ -672,14 +675,14 @@ App.EndWeek.dairyReport = function() {
 						if (slave.boobs < 5000) {
 							if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 								if (slave.boobs < 2000) {
-									growth = 75 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+									growth = 75 * growthCalc + (50 / 4);
 								} else if (slave.boobs < 5000 * gigantomastiaMod) {
-									growth = 50 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+									growth = 50 * growthCalc + (50 / 4);
 								} else {
-									growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+									growth = 25 * growthCalc + (50 / 4);
 								}
 							} else {
-								growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50 - slave.physicalAge) / 4);
+								growth = 25 * growthCalc + ((50 - slave.physicalAge) / 4);
 							}
 							if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
 								boobtacular++;
@@ -692,7 +695,7 @@ App.EndWeek.dairyReport = function() {
 					}
 				}
 				if (slave.balls > 0) {
-					const ballFormula = (10 * slave.balls) - (10 * V.dairyRestraintsSetting) - (V.injectionUpgrade * 10);
+					const ballFormula = 10 * (slave.balls - (V.dairyRestraintsSetting + V.injectionUpgrade));
 					if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 						if (slave.geneMods.NCS === 0 && slave.balls < 125) {
 							slave.balls++;
@@ -707,14 +710,10 @@ App.EndWeek.dairyReport = function() {
 							btSlave = slave;
 						}
 					} else if (slave.balls < 10) {
-						if (slave.geneMods.NCS === 0 &&
-							random(1, 100) > (40 + ballFormula)
-						) {
+						if (slave.geneMods.NCS === 0 && random(1, 100) > (40 + ballFormula)) {
 							slave.balls++;
 						} else if (
-							slave.geneMods.NCS === 1 && slave.balls < 125 &&
-							random(1, 50) > (40 + ballFormula)
-						) {
+							slave.geneMods.NCS === 1 && slave.balls < 125 && random(1, 50) > (40 + ballFormula)) {
 							slave.balls++;
 						}
 						if (slave.balls >= 10) {
@@ -748,18 +747,19 @@ App.EndWeek.dairyReport = function() {
 			if (slave.health.condition < 60) {
 				improveCondition(slave, 20);
 			} else if (V.dairySlimMaintain === 0 && slave.lactation > 0) {
+				const boobsCalc = Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting;
 				if (V.dairyFeedersSetting > 1) {
 					if (slave.boobs < 50000) {
 						if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 							if (slave.boobs < 2000) {
-								growth = 75 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 75 * boobsCalc + (50 / 4);
 							} else if (slave.boobs < 5000 * gigantomastiaMod) {
-								growth = 50 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 50 * boobsCalc + (50 / 4);
 							} else {
-								growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 25 * boobsCalc + (50 / 4);
 							}
 						} else {
-							growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50 - slave.physicalAge) / 4);
+							growth = 25 * boobsCalc + ((50 - slave.physicalAge) / 4);
 						}
 						if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
 							boobtacular++;
@@ -773,14 +773,14 @@ App.EndWeek.dairyReport = function() {
 					if (slave.boobs < 25000) {
 						if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 							if (slave.boobs < 2000) {
-								growth = 75 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 75 * boobsCalc + (50 / 4);
 							} else if (slave.boobs < 5000 * gigantomastiaMod) {
-								growth = 50 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 50 * boobsCalc + (50 / 4);
 							} else {
-								growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 25 * boobsCalc + (50 / 4);
 							}
 						} else {
-							growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50 - slave.physicalAge) / 4);
+							growth = 25 * boobsCalc + ((50 - slave.physicalAge) / 4);
 						}
 						if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
 							boobtacular++;
@@ -794,14 +794,14 @@ App.EndWeek.dairyReport = function() {
 					if (slave.boobs < 10000) {
 						if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 							if (slave.boobs < 2000) {
-								growth = 75 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 75 * boobsCalc + (50 / 4);
 							} else if (slave.boobs < 5000 * gigantomastiaMod) {
-								growth = 50 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 50 * boobsCalc + (50 / 4);
 							} else {
-								growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50) / 4);
+								growth = 25 * boobsCalc + (50 / 4);
 							}
 						} else {
-							growth = 25 * Math.trunc(V.injectionUpgrade * 2) + V.dairyFeedersSetting + V.dairyRestraintsSetting + ((50 - slave.physicalAge) / 4);
+							growth = 25 * boobsCalc + ((50 - slave.physicalAge) / 4);
 						}
 						if (slave.boobs <= 20000 && slave.boobs + growth > 20000) {
 							boobtacular++;
@@ -1037,12 +1037,13 @@ App.EndWeek.dairyReport = function() {
 					}
 				} else if (slave.pregKnown === 1) {
 					if (V.dairyPregSetting > 2) {
-						cashX(100, "slaveAssignmentDairy", slave);
+						cashValue = 100;
 					} else if (V.dairyPregSetting > 1) {
-						cashX(50, "slaveAssignmentDairy", slave);
+						cashValue = 50;
 					} else {
-						cashX(25, "slaveAssignmentDairy", slave);
+						cashValue = 25;
 					}
+					cashX(cashValue, "slaveAssignmentDairy", slave);
 					if (V.dairyPregSetting > 1 && slave.vagina < 4) {
 						slave.vagina++;
 						if (slave.vagina === 4) {
@@ -1074,35 +1075,35 @@ App.EndWeek.dairyReport = function() {
 		seed = (BF.XY.cum * V.bioreactorsXY) + (BF.herm.cum * V.bioreactorsHerm);
 		cumWeek += seed;
 		if (V.arcologies[0].FSPastoralistLaw === 1) {
-			cashXvalue = seed * random(40, 50);
+			cashValue = seed * random(40, 50);
 		} else if (V.arcologies[0].FSPastoralist !== "unset") {
-			cashXvalue = seed * (random(25, 35) + Math.trunc(V.arcologies[0].FSPastoralist / 10));
+			cashValue = seed * (random(25, 35) + Math.trunc(V.arcologies[0].FSPastoralist / 10));
 		} else {
-			cashXvalue = seed * random(25, 35);
+			cashValue = seed * random(25, 35);
 		}
-		cashX(cashXvalue, "menialBioreactors");
+		cashX(cashValue, "menialBioreactors");
 
 		seed = (BF.XX.femCum * V.bioreactorsXX) + (BF.herm.femCum * V.bioreactorsHerm);
 		femCumWeek += seed;
 		if (V.arcologies[0].FSPastoralistLaw === 1) {
-			cashXvalue = seed * random(40, 50);
+			cashValue = seed * random(40, 50);
 		} else if (V.arcologies[0].FSPastoralist !== "unset") {
-			cashXvalue = seed * (random(25, 35) + Math.trunc(V.arcologies[0].FSPastoralist / 10));
+			cashValue = seed * (random(25, 35) + Math.trunc(V.arcologies[0].FSPastoralist / 10));
 		} else {
-			cashXvalue = seed * random(25, 35);
+			cashValue = seed * random(25, 35);
 		}
-		cashX(cashXvalue, "menialBioreactors");
+		cashX(cashValue, "menialBioreactors");
 
 		seed = (BF.XX.milk * V.bioreactorsXX) + (BF.barren.milk * V.bioreactorsBarren) + (BF.XY.milk * V.bioreactorsXY) + (BF.herm.milk * V.bioreactorsHerm);
 		milkWeek += seed;
 		if (V.arcologies[0].FSPastoralist !== "unset" && V.arcologies[0].FSPastoralistLaw === 1) {
-			cashXvalue = seed * (13 + Math.trunc(V.arcologies[0].FSPastoralist / 30));
+			cashValue = seed * (13 + Math.trunc(V.arcologies[0].FSPastoralist / 30));
 		} else if (V.arcologies[0].FSPastoralist !== "unset") {
-			cashXvalue = seed * (8 + Math.trunc(V.arcologies[0].FSPastoralist / 30));
+			cashValue = seed * (8 + Math.trunc(V.arcologies[0].FSPastoralist / 30));
 		} else {
-			cashXvalue = seed * 9;
+			cashValue = seed * 9;
 		}
-		cashX(cashXvalue, "menialBioreactors");
+		cashX(cashValue, "menialBioreactors");
 		r.push(`${Tadd} permanently converted biological`);
 		if (Tadd > 1) {
 			r.push(`"machines" produce`);
@@ -1114,12 +1115,12 @@ App.EndWeek.dairyReport = function() {
 	}
 
 	if (inflatedSlaves.milk > 0) {
-		cashXvalue = -Math.trunc((600 * (inflatedSlaves.milk) + 8) + random(50, 200));
-		cashX(cashXvalue, "slaveAssignmentDairy");
+		cashValue = -Math.trunc((600 * (inflatedSlaves.milk) + 8) + random(50, 200));
+		cashX(cashValue, "slaveAssignmentDairy");
 	}
 	if (inflatedSlaves.cum > 0) {
-		cashXvalue = -Math.trunc((300 * (inflatedSlaves.cum + 8)) + random(25, 100));
-		cashX(cashXvalue, "slaveAssignmentDairy");
+		cashValue = -Math.trunc((300 * (inflatedSlaves.cum + 8)) + random(25, 100));
+		cashX(cashValue, "slaveAssignmentDairy");
 	}
 
 	profits = V.cash - oldCash;
@@ -1387,9 +1388,9 @@ App.EndWeek.dairyReport = function() {
 				r.push(commaNum(100 * Math.trunc(BF[gender].femCum * ageInWeeks) / 100));
 				r.push(`liters of vaginal secretions,`);
 				if (V.dairyPregSetting === 3) {
-					r.push(13 * (V.retirementAge - bioreactor.physicalAge)).toString();
+					r.push((13 * (V.retirementAge - bioreactor.physicalAge)).toString());
 				} else {
-					r.push(5 * (V.retirementAge - bioreactor.physicalAge)).toString();
+					r.push((5 * (V.retirementAge - bioreactor.physicalAge)).toString());
 				}
 				r.push(`slaves,`);
 			}
-- 
GitLab