From 5308b84a204a10391f92f6201150aaa92144d012 Mon Sep 17 00:00:00 2001
From: Vas <whiterocket@outlook.com>
Date: Thu, 19 Jul 2018 14:21:59 +0300
Subject: [PATCH] port faceincrease

---
 src/js/assayJS.tw          | 19 +++++++++++++++++++
 src/utility/miscWidgets.tw | 29 +----------------------------
 2 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/src/js/assayJS.tw b/src/js/assayJS.tw
index 0a1a30e2d2f..050d5c78ed9 100644
--- a/src/js/assayJS.tw
+++ b/src/js/assayJS.tw
@@ -1419,3 +1419,22 @@ window.MenialPopCap = function MenialPopCap () {
 	V.PopCap = popCap;
 	return r;
 };
+
+window.faceIncrease = function faceIncrease(slave, amount) {
+	const pronouns = getPronouns(slave);
+	const His = capFirstChar(his);
+	if (slave.face <= -95)
+		r += `<span class="green">${His} face is no longer horrifying,</span> and is now merely ugly.`;
+	else if (slave.face <= -40 && slave.face + amount > -40)
+		r += `<span class="green">${His} face is no longer ugly,</span> and is now merely unattractive.`;
+	else if (slave.face <= -10 && slave.face + amount > -10)
+		r += `<span class="green">${His} face is no longer unattractive,</span> and is now somewhat tolerable.`;
+	else if (slave.face <= 10 && slave.face + amount > 10)
+		r += `<span class="green">${His} face is now decently attractive,</span> rather than merely tolerable.`;
+	else if (slave.face <= 40 && slave.face + amount > 40)
+		r += `<span class="green">${His} face is now quite beautiful,</span> rather than merely pretty.`;
+	else if (slave.face <= 95 && slave.face + amount > 95)
+		r += `<span class="green">${His} face is now perfect.</span> It's difficult to imagine how it could be any more beautiful.`;
+	slave.face = Math.clamp(slave.face + amount,-100,100);
+	if (slave.face > 95) slave.face = 100;
+}
diff --git a/src/utility/miscWidgets.tw b/src/utility/miscWidgets.tw
index 40793215da3..49345e163f5 100644
--- a/src/utility/miscWidgets.tw
+++ b/src/utility/miscWidgets.tw
@@ -1211,34 +1211,7 @@
  $args[1]: Amount of increase.
 %/
 <<widget "FaceIncrease">>
-
-<<run SlavePronouns($args[0])>>
-<<if $args[0].face <= -95>>
-	@@.green;$possessiveCap face is no longer horrifying,@@ and is now merely ugly.
-<<elseif $args[0].face <= -40>>
-	<<if $args[0].face+$args[1] > -40>>
-		@@.green;$possessiveCap face is no longer ugly,@@ and is now merely unattractive.
-	<</if>>
-<<elseif $args[0].face <= -10>>
-	<<if $args[0].face+$args[1] > -10>>
-		@@.green;$possessiveCap face is no longer unattractive,@@ and is now somewhat tolerable.
-	<</if>>
-<<elseif $args[0].face <= 10>>
-	<<if $args[0].face+$args[1] > 10>>
-		@@.green;$possessiveCap face is now decently attractive,@@ rather than merely tolerable.
-	<</if>>
-<<elseif $args[0].face <= 40>>
-	<<if $args[0].face+$args[1] > 40>>
-		@@.green;$possessiveCap face is now quite beautiful,@@ rather than merely pretty.
-	<</if>>
-<<elseif $args[0].face <= 95>>
-	<<if $args[0].face+$args[1] > 95>>
-		@@.green;$possessiveCap face is now perfect.@@ It's difficult to imagine how it could be any more beautiful.
-	<</if>>
-<</if>>
-<<set $args[0].face = Math.clamp($args[0].face+$args[1],-100,100)>>
-<<if $args[0].face > 95>><<set $args[0].face = 100>><</if>>
-
+	<<= faceIncrease($args[0], $args[1]) >>
 <</widget>>
 
 /%
-- 
GitLab