From 3b587c25708c65a8807de21821a3c6b1319a9951 Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@mailbox.org>
Date: Tue, 21 Feb 2023 23:27:06 +0100
Subject: [PATCH] Make cloning and ova transplanting easier to navigate

---
 src/npc/surgery/cloningWorkaround.js       | 21 ++++++++++++---------
 src/npc/surgery/ovaTransplantWorkaround.js | 17 ++++++++++++-----
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/src/npc/surgery/cloningWorkaround.js b/src/npc/surgery/cloningWorkaround.js
index 04780cf1848..2231b3cbe93 100644
--- a/src/npc/surgery/cloningWorkaround.js
+++ b/src/npc/surgery/cloningWorkaround.js
@@ -35,11 +35,12 @@ App.UI.cloningWorkaround = function() {
 		}
 	));
 	for (const slave of V.slaves) {
+		const div = App.UI.DOM.appendNewElement("div", node, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave)));
 		if (donatrix !== "undecided" && donatrix.ID === slave.ID) {
-			App.UI.DOM.appendNewElement("div", node, SlaveFullName(slave), "note");
+			div.classList.add("note");
 		} else {
-			App.UI.DOM.appendNewElement("div", node, App.UI.DOM.link(
-				SlaveFullName(slave),
+			div.append(" ", App.UI.DOM.link(
+				"Select",
 				() => {
 					V.donatrix = slave;
 					App.UI.reload();
@@ -52,18 +53,20 @@ App.UI.cloningWorkaround = function() {
 
 	for (const slave of V.slaves) {
 		if (canBeReceptrix(slave)) {
-			const name = SlaveFullName(slave);
+			const div = App.UI.DOM.appendNewElement("div", node, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave)));
 			if (receptrix !== "undecided" && receptrix.ID === slave.ID) {
-				App.UI.DOM.appendNewElement("div", node, name, "note");
+				div.classList.add("note");
 			} else {
-				App.UI.DOM.appendNewElement("div", node, App.UI.DOM.link(
-					name,
+				div.append(" ", App.UI.DOM.link(
+					"Select",
 					() => {
 						V.receptrix = slave;
 						App.UI.reload();
-					}, [], "",
-					(slave.pregType >= 4) ? `Using a slave carrying multiples is inadvisable` : ``
+					}
 				));
+				if (slave.pregType >= 4) {
+					App.UI.DOM.appendNewElement("span", div, `Using a slave carrying multiples is inadvisable`, ["note"]);
+				}
 			}
 			eligibility = 1;
 		}
diff --git a/src/npc/surgery/ovaTransplantWorkaround.js b/src/npc/surgery/ovaTransplantWorkaround.js
index 26d1d7f063f..3bca0240b07 100644
--- a/src/npc/surgery/ovaTransplantWorkaround.js
+++ b/src/npc/surgery/ovaTransplantWorkaround.js
@@ -8,16 +8,23 @@ App.UI.ovaTransplantWorkaround = function() {
 	App.UI.DOM.appendNewElement("h2", node, "Select a slave to serve as the host");
 
 	for (const slave of V.slaves) {
-		if ((V.donatrix.ID !== slave.ID && slave.ovaries > 0 || slave.mpreg > 0) && isSlaveAvailable(slave) && slave.preg >= 0 && slave.preg < slave.pregData.normalBirth / 10 && slave.pregWeek >= 0 && slave.pubertyXX === 1 && slave.pregType < 12 && slave.bellyImplant === -1 && slave.broodmother === 0 && slave.inflation <= 2 && slave.physicalAge < 70) {
-			App.UI.DOM.appendNewElement("div", node, App.UI.DOM.link(
-				SlaveFullName(slave),
+		if ((V.donatrix.ID !== slave.ID && slave.ovaries > 0 || slave.mpreg > 0) &&
+			isSlaveAvailable(slave) && slave.preg >= 0 && slave.preg < slave.pregData.normalBirth / 10 &&
+			slave.pregWeek >= 0 && slave.pubertyXX === 1 && slave.pregType < 12 && slave.bellyImplant === -1 &&
+			slave.broodmother === 0 && slave.inflation <= 2 && slave.physicalAge < 70
+		) {
+			const div = App.UI.DOM.appendNewElement("div", node, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave)));
+			div.append(" ", App.UI.DOM.passageLink(
+				"Select", "Surrogacy",
 				() => {
 					V.receptrix = slave;
 					cashX(forceNeg(V.surgeryCost * 2), "slaveSurgery");
 					V.surgeryType = "transplant";
-				}, [], "Surrogacy",
-				(slave.pregType >= 4) ? `Using a slave carrying multiples is inadvisable` : ``
+				}
 			));
+			if (slave.pregType >= 4) {
+				App.UI.DOM.appendNewElement("span", div, `Using a slave carrying multiples is inadvisable`, ["note"]);
+			}
 			eligibility = 1;
 		}
 	}
-- 
GitLab