From b85dc2a8e7cef62b6c3539dcceda0b9c8f4969cc Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Tue, 21 Nov 2017 19:33:01 -0500
Subject: [PATCH] Tweaks.

---
 devNotes/VersionChangeLog-Premod+LoliMod.txt |  5 ++++-
 src/js/utilJS.tw                             | 15 +++++++++++++++
 src/uncategorized/cellblockReport.tw         |  4 ++--
 src/uncategorized/pCoupAttempt.tw            |  8 ++++----
 src/uncategorized/seCustomSlaveDelivery.tw   | 10 +++++-----
 5 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/devNotes/VersionChangeLog-Premod+LoliMod.txt b/devNotes/VersionChangeLog-Premod+LoliMod.txt
index 34a547f5fe7..a51f9b3df8b 100644
--- a/devNotes/VersionChangeLog-Premod+LoliMod.txt
+++ b/devNotes/VersionChangeLog-Premod+LoliMod.txt
@@ -4652,4 +4652,7 @@ Pregmod 0.10.3.0
 	11/21/17
 	
 	149
-	-custom slave overhaul
\ No newline at end of file
+	-custom slave overhaul
+	
+	150
+	-tweaks
\ No newline at end of file
diff --git a/src/js/utilJS.tw b/src/js/utilJS.tw
index 8a9a52a3ca3..f1401412a25 100644
--- a/src/js/utilJS.tw
+++ b/src/js/utilJS.tw
@@ -37,6 +37,21 @@
  *                           paired with a high spread value results in the generator having to
  *                           do lots of work generating and re-generating random heights until
  *                           one "fits".
+ *
+ * Anon's explination:
+ *limitMult: [0, -30]
+ *
+ *This specifies a range going up from 0 to -30. It needs to go [-30, 0] instead. Same thing with [0, -5] two lines down. note: technically, this isn't true, because for some bizarre reason Height.random reverses the numbers for you if you get them wrong. But it's important to establish good habits, so.
+ *
+ *Skew, spread, limitMult: These are statistics things. BTW, a gaussian distribution is a normal distribution. Just a naming thing.
+ *
+ *Skew: See https://brownmath.com/stat/shape.htm#Skewness. Basically a measure of how asymmetrical the curve is. It doesn't change the mean, and can't move the main mass of the distribution far from the mean! The normal distribution can't do that. You can, however, use it to fatten one or the other tail.
+ *
+ *Spread: Changes the average distance from the mean, making the graph wider and shorter. Moves "mass" from the center to the tail. It's basically standard deviation, but named funny because FC codebase.
+ *
+ *limitMult: A clamp, expressed in z-score. (z=1 is one standard dev above mean, for ex.) If it excludes too much of the distribution the other parameters describe, you're going to spend lots of CPU making and throwing away heights. Don't worry about this unless you run into it.
+ *
+ *There's also limitHeight which you're not using. It's basically limitMult in different units.
  */
 window.Height = (function(){
 	'use strict';
diff --git a/src/uncategorized/cellblockReport.tw b/src/uncategorized/cellblockReport.tw
index 2d1fa4d4b6f..1f41e480a68 100644
--- a/src/uncategorized/cellblockReport.tw
+++ b/src/uncategorized/cellblockReport.tw
@@ -119,8 +119,8 @@
 			<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
 		<</if>>
 	<</for>>
-	<<if (_DL < 5)>>
-		<<set _seed = random(1,10)+((5-_DL)*(random(150,170)+(_idleBonus*10))), $cash += _seed>>
+	<<if (_DL < $cellblock)>>
+		<<set _seed = random(1,10)+(($cellblock-_DL)*(random(150,170)+(_idleBonus*10))), $cash += _seed>>
 		<br>&nbsp;&nbsp;&nbsp;&nbsp;Since she doesn't have enough prisoners to manage to keep her busy, she works on citizens' slaves, earning @@.yellowgreen;¤_seed.@@
 	<</if>>
 	<<if (_DL > 0)>><br><br><</if>>
diff --git a/src/uncategorized/pCoupAttempt.tw b/src/uncategorized/pCoupAttempt.tw
index 9ca8cce7ff2..12bf5fe1180 100644
--- a/src/uncategorized/pCoupAttempt.tw
+++ b/src/uncategorized/pCoupAttempt.tw
@@ -63,7 +63,7 @@ You are awakened in the middle of the night by a jolt that shakes the entire arc
 	<<else>>
 		<<set _pcaj = 0>>
 	<</if>>
-	<<for _pca = 0; _pca < _pcaj; _pca++>>
+	<<for _pca = 0; _pca <= _pcaj; _pca++>>
 		<<set $activeSlaveOneTimeMinAge = 16>>
 		<<set $activeSlaveOneTimeMaxAge = 32>>
 		<<include "Generate XY Slave">>
@@ -80,7 +80,7 @@ You are awakened in the middle of the night by a jolt that shakes the entire arc
 	<<else>>
 		<<set _pcaj = 5>>
 	<</if>>
-	<<for _pca = 0; _pca < _pcaj; _pca++>>
+	<<for _pca = 0; _pca <= _pcaj; _pca++>>
 		<<set $activeSlaveOneTimeMinAge = 16>>
 		<<set $activeSlaveOneTimeMaxAge = 32>>
 		<<include "Generate XX Slave">>
@@ -110,7 +110,7 @@ You are awakened in the middle of the night by a jolt that shakes the entire arc
 	<<else>>
 		<<set _pcaj = 0>>
 	<</if>>
-	<<for _pca = 0; _pca < _pcaj; _pca++>>
+	<<for _pca = 0; _pca <= _pcaj; _pca++>>
 		<<set $activeSlaveOneTimeMinAge = 16>>
 		<<set $activeSlaveOneTimeMaxAge = 32>>
 		<<include "Generate XY Slave">>
@@ -127,7 +127,7 @@ You are awakened in the middle of the night by a jolt that shakes the entire arc
 	<<else>>
 		<<set _pcaj = 3>>
 	<</if>>
-	<<for _pca = 0; _pca < _pcaj; _pca++>>
+	<<for _pca = 0; _pca <= _pcaj; _pca++>>
 		<<set $activeSlaveOneTimeMinAge = 16>>
 		<<set $activeSlaveOneTimeMaxAge = 32>>
 		<<include "Generate XX Slave">>
diff --git a/src/uncategorized/seCustomSlaveDelivery.tw b/src/uncategorized/seCustomSlaveDelivery.tw
index 7ccdc2a0b6d..7df38b915c1 100644
--- a/src/uncategorized/seCustomSlaveDelivery.tw
+++ b/src/uncategorized/seCustomSlaveDelivery.tw
@@ -65,15 +65,15 @@
 
 /* I have no clue what I'm doing here */
 <<if $customSlave.heightMod == "greatly below average">>
-	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: -5, spread: .2, limitMult: [0, -30]}))>>
+	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: -5, spread: .2, limitMult: [-5, -2]}))>>
 <<elseif $customSlave.heightMod == "below average">>
-	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: -1, limitMult: [0, -5]}))>>
+	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: -1, limitMult: [-2, 0]}))>>
 <<elseif $customSlave.heightMod == "normal">>
-	<<set $activeSlave.height = Math.round(Height.random($activeSlave))>>
+	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {limitMult: [-1, 1]}))>>
 <<elseif $customSlave.heightMod == "above average">>
-	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: 1, limitMult: [0, 5]}))>>
+	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: 1, limitMult: [0, 2]}))>>
 <<else>>
-	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: 5, spread: .2, limitMult: [0, 30]}))>>
+	<<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: 5, spread: .2, limitMult: [2, 5]}))>>
 <</if>>
 
 <<if $customSlave.analVirgin == 0>>
-- 
GitLab