From 297e2bbeeed62880bb152d174656d49e7e74415c Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Thu, 26 Nov 2020 11:36:19 -0500
Subject: [PATCH] 4.0.0 functions + some documentation updating

---
 devNotes/Useful JS Function Documentation.txt | 13 +++++++++
 slave variables documentation - Pregmod.txt   | 14 ++++++++++
 src/js/statsChecker/statsChecker.js           | 27 +++++++++++++++++++
 src/js/storyJS.js                             | 27 +++++++++++++++++++
 src/player/js/playerJS.js                     | 17 ++++++++++++
 5 files changed, 98 insertions(+)

diff --git a/devNotes/Useful JS Function Documentation.txt b/devNotes/Useful JS Function Documentation.txt
index e114b88f489..38ab1c21a08 100644
--- a/devNotes/Useful JS Function Documentation.txt	
+++ b/devNotes/Useful JS Function Documentation.txt	
@@ -110,6 +110,12 @@ canHold(slave) - Returns if the slave can use both arms.
 
 canWalk(slave) - Returns if the slave can walk unassisted.
 
+canStand(slave) - Returns if the slave can stand unassisted.
+
+canMove(slave) - Returns if the slave is capable of moving themselves.
+
+isHindered(actor) - Returns if the actor's movement is impeded for any reason.
+
 canTalk(slave) - Returns if the slave can talk.
 
 canDoAnal(slave) - Returns if the slave can currently have anal sex.
@@ -138,9 +144,16 @@ isVegetable(slave) - Returns if the slave is mindbroken.
 
 overpowerCheck(slave, PC) - Returns an integer that represents the chance of a slave overpowering the player.
 
+canLift(actor1, actor2) - Returns if actor2 is capable of picking up and carrying actor1.
+
 heelLength(slave) - Returns the length of a slave's heels should she be wearing any
 
 
+Player Functions:
+
+onBedRest(actor) - Returns if the actor is on mandatory bedrest or just incapable of leaving their bed. (Mostly for player use.)
+
+
 Display Functions:
 
 properTitle() - Returns the player's proper title. (customTitle, Sir, Ma'am)
diff --git a/slave variables documentation - Pregmod.txt b/slave variables documentation - Pregmod.txt
index 8c3a9c6a7e6..1d740d27a4f 100644
--- a/slave variables documentation - Pregmod.txt	
+++ b/slave variables documentation - Pregmod.txt	
@@ -570,6 +570,8 @@ what porn she is known for
 "underage"
 "weight gain"
 "big dick"
+"muscle"
+"taboo"
 "generic"
 "deepthroat"
 "unwilling"
@@ -610,6 +612,8 @@ what aspect of her the upgraded studio is focusing on for porn
 "loli"
 "gainer"
 "stud"
+"muscle"
+"incest"
 "porn"
 "gagfuck queen"
 "strugglefuck queen"
@@ -656,6 +660,16 @@ porn.fame.stud:
 well hung porn fame
 accepts int
 
+porn.fame.muscle:
+
+muscle porn fame
+accepts int
+
+porn.fame.incest:
+
+incest porn fame
+accepts int
+
 porn.fame.loli:
 
 underage porn fame
diff --git a/src/js/statsChecker/statsChecker.js b/src/js/statsChecker/statsChecker.js
index 5982f0690fd..3723d1a3f37 100644
--- a/src/js/statsChecker/statsChecker.js
+++ b/src/js/statsChecker/statsChecker.js
@@ -905,6 +905,33 @@ globalThis.canMove = function(slave) {
 	return true;
 };
 
+/** Assuming the actor can walk, is their movement hindered by anything? Intended for the player, but could be applied to slaves.
+ * @param {App.Entity.SlaveState} slave
+ * @returns {boolean}
+ */
+globalThis.isHindered = function(slave) {
+	if (!slave) {
+		return null;
+	} else if (!canWalk(slave) && canMove(slave)) {
+		return true;
+	} else if (slave.weight >= 130 || (slave.weight >= 95 + ((slave.physicalAge - 9) * 5))) {
+		return true;
+	} else if (slave.belly >= 60000 || slave.belly >= 60000 / (1 + Math.Pow(Math.E, -0.4 * (slave.physicalAge - 14))) || slave.belly >= Math.max(10000, ((12500 / 19) * slave.height) - (1172500 / 19))) {
+		return true;
+	} else if (slave.boobs > 5000) {
+		return true;
+	} else if (slave.balls >= 14) {
+		return true;
+	} else if (slave.hips > 2) {
+		return true;
+	} else if (slave.butt > 6) {
+		return true;
+	} else if (slave.muscles < -30) {
+		return true;
+	}
+	return false;
+};
+
 /**
  * @param {App.Entity.SlaveState} slave
  * @param {boolean} checkLanguage Does a bad accent count as being unable to speak?
diff --git a/src/js/storyJS.js b/src/js/storyJS.js
index b2a89cadc66..25cab312c4d 100644
--- a/src/js/storyJS.js
+++ b/src/js/storyJS.js
@@ -453,6 +453,33 @@ globalThis.overpowerCheck = function(slave, PC) {
 	return strength;
 };
 
+/**
+ * returns if arg2 can pick up and carry arg1
+ * @param {App.Entity.SlaveState} liftee
+ * @param {App.Entity.SlaveState} lifter
+ * @returns {boolean}
+ */
+globalThis.canLift = function(liftee, lifter) {
+	let sumWeight;
+
+	sumWeight = liftee.height - lifter.height;
+	sumWeight += liftee.weight / 2;
+	sumWeight += liftee.boobs / 500;
+	sumWeight += liftee.belly / 1000;
+	sumWeight += liftee.butt / 2;
+	if (liftee.hips > 0) {
+		sumWeight += Math.pow(liftee.hips, 2);
+	}
+	if (liftee.dick >= 20) {
+		sumWeight += Math.trunc(liftee.dick / 10);
+	}
+	if (liftee.balls >= 10) {
+		sumWeight += Math.pow(Math.trunc(liftee.balls / 10), 3);
+	}
+
+	return 20 + lifter.strength >= sumWeight && hasBothArms(lifter);
+};
+
 /**
  * returns array of IDs of all characters who impregnated slave
  * @param {FC.HumanState} slave
diff --git a/src/player/js/playerJS.js b/src/player/js/playerJS.js
index 278777f6163..a9a5df36f88 100644
--- a/src/player/js/playerJS.js
+++ b/src/player/js/playerJS.js
@@ -637,3 +637,20 @@ globalThis.IncreasePCSkills = function(input, increase = 1) {
 	}
 	return t;
 };
+
+/** Returns if the player is on mandatory bedrest.
+ * @returns {boolean}
+ */
+globalThis.onBedRest = function(actor) {
+	// consider player health and injury in the future!
+	if (!actor) {
+		return null;
+	} else if (!canMove(actor)) {
+		return true;
+	} else if (actor.preg > actor.pregData.normalBirth / 1.33 && actor.womb.find((ft) => ft.genetics.geneticQuirks.polyhydramnios === 2 && ft.age >= 20)) {
+		return true;
+	} else if (actor.bellyPreg >= actor.pregAdaptation * 2200) {
+		return true;
+	}
+	return false;
+};
-- 
GitLab