From 349314b32c16f6e427ada65a86b7fdcfdbcad45b Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Tue, 26 Mar 2019 22:54:01 -0400
Subject: [PATCH] Converted waistDescription to JS

---
 .../nursery/longChildDescription.tw           |   2 +-
 src/js/descriptionWidgets.js                  | 399 ++++++++++++++++++
 src/uncategorized/longSlaveDescription.tw     |   2 +-
 src/uncategorized/wardrobeUse.tw              |   2 +-
 4 files changed, 402 insertions(+), 3 deletions(-)

diff --git a/src/facilities/nursery/longChildDescription.tw b/src/facilities/nursery/longChildDescription.tw
index 5976eee141f..4f390875c77 100644
--- a/src/facilities/nursery/longChildDescription.tw
+++ b/src/facilities/nursery/longChildDescription.tw
@@ -968,7 +968,7 @@ and
 	$His hips are unrealistically wide; it is obvious they have been artificially widened.
 <</if>>
 
-<<waistDescription>>
+<<= App.Desc.Waist($activeChild)>>
 
 <<if $arcologies[0].FSGenderFundamentalistLawBeauty + $arcologies[0].FSGenderRadicalistLawBeauty > 0>>
 	<<if $arcologies[0].FSHedonisticDecadence == "unset" && $arcologies[0].FSPhysicalIdealistStrongFat == 0>>
diff --git a/src/js/descriptionWidgets.js b/src/js/descriptionWidgets.js
index 81824501ed0..669e91eb23a 100644
--- a/src/js/descriptionWidgets.js
+++ b/src/js/descriptionWidgets.js
@@ -684,4 +684,403 @@ App.Desc.Amputee = /**@param {App.Entity.SlaveState} slave */ function (slave) {
 		}
 	}
 	return r;
+}
+
+App.Desc.Waist = /**@param {App.Entity.SlaveState} slave */ function (slave) {
+	"use strict";
+	const V = State.variables;
+	let r = ``;
+	let belly;
+	var pronouns = getPronouns(slave);
+	var he = pronouns.pronoun;
+	var him = pronouns.object;
+	var his = pronouns.possessive;
+	var hers = pronouns.possessivePronoun;
+	var himself = pronouns.objectReflexive;
+	var boy = pronouns.noun;
+	var He = capFirstChar(he);
+	var His = capFirstChar(his);
+
+	if (slave.belly >= 1500) {
+		belly = bellyAdjective(slave);
+	}
+
+	r += `${He} has `;
+	if (slave.waist > 95) {
+		r += `a badly <span class=red>masculine waist</span> that ruins ${his} figure`;
+		if (slave.weight > 30) {
+			r += ` and greatly exaggerates how fat ${he} is.`;
+		} else if (slave.weight < -30) {
+			r += ` despite how thin ${he} is.`;
+		} else {
+			r += `. `;
+
+		}
+		if (slave.belly >= 1500) {
+			if (slave.belly >= 750000) {
+				r += `${His} ${belly} belly grotesquely bulges around ${his} thick waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is horribly distended by ${his} bursting womb in a last ditch effort to find more room for ${his} children, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 300000) {
+				r += `${His} ${belly} belly is hidden by ${his} thick waist.`;
+			} else if (slave.belly < 450000) {
+				r += `${His} ${belly} belly can be seen around ${his} thick waist.`;
+			} else if (slave.belly < 600000) {
+				r += `${His} ${belly} belly can clearly be seen around ${his} thick waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is swollen wider than usual by ${his} crowded womb in its search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 750000) {
+				r += `${His} ${belly} belly lewdly bulges around ${his} thick waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is greatly distended by ${his} overfilled womb in its desperate search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			}
+		}
+	} else if (slave.waist > 40) {
+		r += `a broad, <span class=red>ugly waist</span> that makes ${him} look mannish`
+		if (slave.weight > 30) {
+			r += ` and exaggerates how fat ${he} is.`
+		} else if (slave.weight < -30) {
+			r += ` despite how thin ${he} is.`
+		} else {
+			r += `.`;
+		}
+		if (slave.belly >= 1500) {
+			if (slave.belly >= 750000) {
+				r += `${His} ${belly} belly grotesquely bulges around ${his} chunky waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is horribly distended by ${his} bursting womb in a last ditch effort to find more room for ${his} children, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 150000) {
+				r += `${His} ${belly} belly is hidden by ${his} chunky waist.`;
+			} else if (slave.belly < 450000) {
+				r += `${His} ${belly} belly can be seen around ${his} chunky waist.`;
+			} else if (slave.belly < 600000) {
+				r += `${His} ${belly} belly can clearly be seen around ${his} chunky waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is swollen wider than usual by ${his} crowded womb in its search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 750000) {
+				r += `${His} ${belly} belly lewdly bulges around ${his} chunky waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is greatly distended by ${his} overfilled womb in its desperate search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			}
+		}
+	} else if (slave.waist > 10) {
+		r += `an <span class=red>unattractive waist</span> that conceals ${his} `
+		if (slave.visualAge > 25) {
+			r += `girlish`;
+		} else {
+			r += `womanly`;
+		}
+		r += ` figure`;
+		if (slave.weight > 30) {
+			r += ` and accentuates how fat ${he} is.`;
+		} else if (slave.weight < -30) {
+			r += ` despite how thin ${he} is.`;
+		} else {
+			r += `.`;
+		}
+		if (slave.belly >= 1500) {
+			if (slave.belly >= 750000) {
+				r += `${His} ${belly} belly grotesquely bulges around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is horribly distended by ${his} bursting womb in a last ditch effort to find more room for ${his} children, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 10000) {
+				r += `From behind, ${his} figure hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 200000) {
+				r += `From behind, ${his} figure barely hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 300000) {
+				r += `${His} ${belly} belly can be seen around ${his} waist.`;
+			} else if (slave.belly < 450000) {
+				r += `${His} ${belly} belly can clearly be seen around ${his} waist.`;
+			} else if (slave.belly < 600000) {
+				r += `${His} ${belly} belly can clearly be seen around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is swollen wider than usual by ${his} crowded womb in its search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 750000) {
+				r += `${His} ${belly} belly lewdly bulges around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is greatly distended by ${his} overfilled womb in its desperate search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			}
+		}
+	} else if (slave.waist > -10) {
+		r += `an average waist for a `
+		if (slave.visualAge > 25) {
+			r += `${boy}`;
+		} else {
+			r += `${woman}`;	// TODO: this is not correct - not sure where the setter for $woman is
+		}
+		if (slave.weight > 30) {
+			r += `, though it looks broader since ${he}'s fat.`
+		} else if (slave.weight < -30) {
+			r += `, though it looks narrower since ${he}'s thin.`
+		} else {
+			r += `.`;
+		}
+		if (slave.belly >= 1500) {
+			if (slave.belly >= 750000) {
+				r += `${His} ${belly} belly grotesquely bulges around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is horribly distended by ${his} bursting womb in a last ditch effort to find more room for ${his} children, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 10000) {
+				r += `From behind, ${his} figure hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 200000) {
+				r += `From behind, ${his} figure barely hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 300000) {
+				r += `${His} ${belly} belly can be seen around ${his} waist.`;
+			} else if (slave.belly < 450000) {
+				r += `${His} ${belly} belly can clearly be seen around ${his} waist.`;
+			} else if (slave.belly < 600000) {
+				r += `${His} ${belly} belly can clearly be seen around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is swollen wider than usual by ${his} crowded womb in its search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 750000) {
+				r += `${His} ${belly} belly lewdly bulges around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is greatly distended by ${his} overfilled womb in its desperate search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			}
+		}
+	} else if (slave.waist > -40) {
+		r += `a nice <span class=pink>feminine waist</span> that gives ${him} a `
+		if (slave.visualAge > 25) {
+			r += `girlish`;
+		} else {
+			r += `womanly`;
+		}
+		r += ` figure`;
+		if (slave.weight > 30) {
+			r += ` despite ${his} extra weight.`;
+		} else if (slave.weight < -30) {
+			r += ` and accentuates how thin ${he} is.`;
+		} else {
+			r += `.`;
+		}
+		if (slave.belly >= 1500) {
+			if (slave.belly >= 750000) {
+				r += `${His} ${belly} belly grotesquely bulges around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is horribly distended by ${his} bursting womb in a last ditch effort to find more room for ${his} children, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 10000) {
+				r += `From behind, ${his} figure hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 100000) {
+				r += `From behind, ${his} figure barely hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 300000) {
+				r += `${His} ${belly} belly can be seen around ${his} waist.`;
+			} else if (slave.belly < 450000) {
+				r += `${His} ${belly} belly can clearly be seen around ${his} waist.`;
+			} else if (slave.belly < 600000) {
+				r += `${His} ${belly} belly can clearly be seen around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is swollen wider than usual by ${his} crowded womb in its search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 750000) {
+				r += `${His} ${belly} belly lewdly bulges around ${his} waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is greatly distended by ${his} overfilled womb in its desperate search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			}
+		}
+	} else if (slave.waist > -95) {
+		r += `a hot <span class=pink>wasp waist</span> that gives ${him} an hourglass figure`;
+		if (slave.weight > 30) {
+			r += `despite $his extra weight.`;
+		} else if (slave.weight < -30) {
+			r += `further accentuated by how thin $he is.`;
+		} else {
+			r += `.`;
+		}
+		if (slave.belly >= 1500) {
+			if (slave.belly >= 750000) {
+				r += `${His} ${belly} belly grotesquely bulges around ${his} narrow waist and continues `;
+				if (slave.belly >= 1000000) {
+					r += `quite the distance`;
+				} else {
+					r += `over half a `;
+					if (V.showInches === 2) {
+						r += `yard`;
+					} else {
+						r += `meter`;
+					}
+					r += ` farther to either side.`;
+				}
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is horribly distended by ${his} bursting womb in a last ditch effort to find more room for ${his} children, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 5000) {
+				r += `From behind, ${his} narrow figure hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 80000) {
+				r += `From behind, ${his} narrow figure barely hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 100000) {
+				r += `${His} ${belly} belly can be seen around ${his} narrow waist.`;
+			} else if (slave.belly < 450000) {
+				r += `${His} ${belly} belly lewdly extends past ${his} narrow waist.`;
+			} else if (slave.belly < 600000) {
+				r += `${His} ${belly} belly lewdly distends far to either side of ${his} narrow waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is swollen wider than usual by ${his} crowded womb in its search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 750000) {
+				r += `${His} ${belly} belly lewdly bulges to either side of ${his} narrow waist and continues for nearly half a `
+				if (V.showInches === 2) {
+					r += `yard`;
+				} else {
+					r += `meter`;
+				}
+				r += `in both directions.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is greatly distended by ${his} overfilled womb in its desperate search for more room, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			}
+		}
+	} else {
+		r += `an <span class=pink>absurdly narrow waist</span> that gives ${him} a cartoonishly hourglass figure`
+		if (slave.weight > 30) {
+			r += `made even more ludicrous by ${his} extra weight.`;
+		} else if (slave.weight < -30) {
+			r += `made even more ludicrous by how thin ${he} is.`;
+		} else {
+			r += `.`;
+		}
+		if (slave.belly >= 1500) {
+			if (slave.belly >= 750000) {
+				r += `${His} ${belly} belly grotesquely bulges around ${his} narrow waist and continues `
+				if (slave.belly >= 1000000) {
+					r += `quite the distance`;
+				} else {
+					r += `over half a `;
+					if (V.showInches === 2) {
+						r += `yard`;
+					} else {
+						r += `meter`;
+					}
+					r += ` farther to either side.`;
+				}
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is horribly distended by ${his} bursting womb in a last ditch effort to find more room for ${his} children, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 2000) {
+				r += `From behind, ${his} narrow figure hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 5000) {
+				r += `From behind, ${his} narrow figure barely hides ${his} ${belly} belly.`;
+			} else if (slave.belly < 8000) {
+				r += `${His} ${belly} belly can be seen around ${his} narrow waist.`;
+			} else if (slave.belly < 15000) {
+				r += `${His} ${belly} belly lewdly extends past ${his} narrow waist.`;
+			} else if (slave.belly < 45000) {
+				r += `${His} ${belly} belly lewdly distends far to either side of ${his} narrow waist.`;
+			} else if (slave.belly < 600000) {
+				r += `${His} ${belly} belly lewdly distends far to either side of ${his} narrow waist.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is swollen wider than usual by ${his} crowded womb in its search for more room, leaving ${his} original waistline only visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			} else if (slave.belly < 750000) {
+				r += `${His} ${belly} belly lewdly bulges to either side of ${his} narrow waist and continues for nearly half a `
+				if (V.showInches === 2) {
+					r += `yard`;
+				} else {
+					r += `meter`;
+				}
+				r += ` in both directions.`;
+				if (slave.preg > 3) {
+					if (slave.belly > (slave.pregAdaptation * 1000)) {
+						r += `${His} waist is greatly distended by ${his} overfilled womb in its desperate search for more room, leaving ${his} original waistline barely visible from behind.`;
+					} else {
+						r += `However, ${his} body is so adapted to pregnancy that ${his} womb rests forward enough to preserve the shape of ${his} waistline.`;
+					}
+				}
+			}
+		}
+	}
+	return r;
 }
\ No newline at end of file
diff --git a/src/uncategorized/longSlaveDescription.tw b/src/uncategorized/longSlaveDescription.tw
index 9a0d07896ba..01a44ebb979 100644
--- a/src/uncategorized/longSlaveDescription.tw
+++ b/src/uncategorized/longSlaveDescription.tw
@@ -1771,7 +1771,7 @@ and
 	$His hips are unrealistically wide, it is obvious they have been artificially widened.
 <</if>>
 
-<<waistDescription>>
+<<= App.Desc.Waist($activeSlave)>>
 
 <<if $arcologies[0].FSGenderFundamentalistLawBeauty + $arcologies[0].FSGenderRadicalistLawBeauty > 0>>
 	<<if $arcologies[0].FSHedonisticDecadence == "unset" && $arcologies[0].FSPhysicalIdealistStrongFat == 0>>
diff --git a/src/uncategorized/wardrobeUse.tw b/src/uncategorized/wardrobeUse.tw
index 0537e3beee6..14fd11c4ad3 100644
--- a/src/uncategorized/wardrobeUse.tw
+++ b/src/uncategorized/wardrobeUse.tw
@@ -389,7 +389,7 @@ Collar: ''$activeSlave.collar.''
 
 Torso accessory: ''$activeSlave.bellyAccessory.''
 <br>
-//<<waistDescription>><<pregnancyDescription>><<clothingCorsetDescription>><<CorsetPiercingDescription>>//
+//<<= App.Desc.Waist($activeSlave)>><<pregnancyDescription>><<clothingCorsetDescription>><<CorsetPiercingDescription>>//
 <<options $activeSlave.bellyAccessory>>
 	<<option "none" "None">>
 	<<option "a corset" "Tight corset">>
-- 
GitLab