code:
window.Beauty = (function() {
	"use strict";
	let V, arcology, beauty;

	/** @param {App.Entity.SlaveState} slave */
	function Beauty(slave) {
		V = State.variables;
		arcology = V.arcologies[0];
		modScore(slave);

		beauty = 120;
		calcInitBeauty(slave);
		if (slave.fuckdoll === 0) {
			beauty += 30;
			calcFaceBeauty(slave);
			calcTeethBeauty(slave);
			calcModBeauty(slave);
			calcCosmeticsBeauty(slave);
			calcFSNotFuckdollBeauty(slave);
			calcMiscNotFuckdollBeauty(slave);
		}
		if (slave.dick > 0) {
			calcDickBeauty(slave);
		}
		if (slave.balls > 0) {
			calcBallsBeauty(slave);
		}
		calcButtBeauty(slave);
		calcHipsBeauty(slave);
		calcBoobsBeauty(slave);
		calcWeightBeauty(slave);
		calcMusclesBeauty(slave);
		calcBodyHairBeauty(slave);
		calcImplantBeauty(slave);
		if (arcology.FSRepopulationFocus > 40) {
			calcRepopulationPregBeauty(slave);
		} else if (arcology.FSRepopulationFocusPregPolicy === 1) {
			calcTrendyPregBeauty(slave);
		} else if (arcology.FSRestart > 40) {
			calcRestartPregBeauty(slave);
		}
		if (arcology.FSRepopulationFocusMilfPolicy === 1) {
			calcTrendyMilfBeauty(slave);
		}
		if (arcology.FSGenderRadicalistLawFuta !== 0) {
			calcFutaLawBeauty(slave);
		}
		calcBodyProportionBeauty(slave);
		calcVoiceBeauty(slave);
		if (slave.amp !== 0) {
			calcLimbsBeauty(slave);
		}
		calcPubertyBeauty(slave);
		calcFSMiscBeauty(slave);

		calcPurityBeauty(slave);
		calcPhysiqueBeauty(slave);
		if (arcology.FSSlimnessEnthusiastLaw === 1) {
			calcSlimBeauty(slave);
		}
		if (arcology.FSGenderFundamentalistLawBeauty + arcology.FSGenderRadicalistLawBeauty > 0) {
			calcGenderLawBeauty(slave);
		}

		calcMultipliersBeauty(slave);
		beauty = Math.max(1, Math.trunc(0.5*beauty));

		return beauty;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcInitBeauty(slave) {
		beauty -= slave.waist/20;
		beauty -= slave.muscles/30;
		beauty += slave.lips/10;
		beauty += slave.clit;
		beauty += (slave.height-160)/10;
		beauty += 2*slave.hips;
		if (slave.anus > 3) {
			beauty -= 10 + (slave.anus*2); /*-20*/
		}
		if (slave.vagina > 3) {
			beauty -= 10 + (slave.vagina*2); /*-20*/
		}

	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFaceBeauty(slave) {
		beauty += slave.face/5;
		switch (slave.faceShape) {
			case "masculine":
				if (arcology.FSGenderRadicalist !== "unset") {
					beauty -= (2 - (arcology.FSGenderRadicalist/25))*(slave.face/30);
				} else if (arcology.FSGenderFundamentalist !== "unset") {
					beauty -= (2 + (arcology.FSGenderFundamentalist/25))*(slave.face/30);
				} else {
					beauty -= 2*(slave.face/30);
				}
				break;
			case "androgynous":
				if (arcology.FSGenderRadicalist !== "unset") {
					beauty += 2 - ((1 - (arcology.FSGenderRadicalist/25))*(slave.face/30));
				} else if (arcology.FSGenderFundamentalist !== "unset") {
					beauty += 2 - ((1 + (arcology.FSGenderFundamentalist/25))*(slave.face/30));
				} else {
					beauty += 2 - (slave.face/30);
				}
				break;
			case "exotic":
				beauty += 2*(slave.face/30);
				break;
			case "sensual":
				beauty += 2 + (slave.face/30);
				break;
			case "cute":
				beauty += 8/3;
				break;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcTeethBeauty(slave) {
		switch (slave.teeth) {
			case "crooked":
				beauty -= 3;
				break;
			case "gapped":
				if (slave.faceShape === "cute") {
					beauty += 1;
				} else {
					beauty -= 1;
				}
				break;
			case "braces":
			case "cosmetic braces":
				if (slave.visualAge > 14 && slave.visualAge < 18) {
					beauty += 1;
				}
				break;
			case "removable":
			case "pointy":
			case "baby":
			case "mixed":
				beauty -= 1;
				break;
		}
	}

	function calcModBeauty(/*slave*/) {
		if (arcology.FSTransformationFetishist > 20 || arcology.FSDegradationist > 20) {
			if (V.modScore > 15 || (V.piercingScore > 8 && V.tatScore > 5)) {
				beauty += 8 + (V.modScore*0.25);
			} else if (V.modScore > 7) {
				beauty += V.modScore - 7;
			}
		} else if (arcology.FSBodyPurist > 20 || arcology.FSPaternalist > 20) {
			if (V.modScore <= 7) {
				beauty += 10;
			} else {
				beauty += 15 - V.modScore;
			}
		} else {
			if (V.modScore <= 7) {
				beauty += V.modScore;
			} else if (V.modScore > 15 || (V.piercingScore > 8 && V.tatScore > 5)) {
				beauty += 11;
			} else {
				beauty += 7 + (0.5*(V.modScore - 7));
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcCosmeticsBeauty(slave) {
		if (slave.brand !== 0) {
			if (V.rep > 10000) {
				beauty += 1;
			} else if (V.rep < 5000) {
				beauty -= 1;
			}
		}
		if (slave.minorInjury !== 0) {
			beauty -= 2;
		}
		if (slave.cSec === 1) {
			beauty -= 2;
		}
		if (slave.nails > 0) {
			beauty += 1;
		}
		if (slave.makeup > 0) {
			beauty += 1;
		}
		switch (slave.markings) {
			case "beauty mark":
				if (slave.face > 40) {
					beauty += 6;
				} else if (slave.face < -10) {
					beauty -= 6;
				}
				break;
			case "birthmark":
				if (slave.prestige > 0 || slave.pornPrestige > 1) {
					beauty += 4;
				} else {
					beauty -= 4;
				}
				break;
			case "freckles":
			case "heavily freckled":
				if (slave.skin === "pale" || slave.skin === "fair") {
					beauty += 2;
					if (slave.hColor === "red") {
						beauty += 2;
					}
				}
				break;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFSNotFuckdollBeauty(slave) {
		if (arcology.FSSupremacist !== "unset") {
			if (slave.race === arcology.FSSupremacistRace) {
				beauty += (arcology.FSSupremacist/3) + (arcology.FSSupremacistLawME*10);
			}
		}
		if (arcology.FSSubjugationist !== "unset") {
			if (slave.race === arcology.FSSubjugationistRace) {
				beauty -= (arcology.FSSubjugationist/2) - (arcology.FSSubjugationistLawME*10);
			}
		}
		if (arcology.FSDegradationist !== "unset") {
			beauty -= (arcology.FSDegradationist/10)*((slave.intelligence + slave.intelligenceImplant)/20);
		}
		if (arcology.FSGenderFundamentalistLawBimbo === 1) {
			beauty -= (slave.intelligence + slave.intelligenceImplant)/2;
		}
		if (arcology.FSYouthPreferentialist !== "unset") {
			beauty += (30 - slave.visualAge)/(30 - V.minimumSlaveAge)*((arcology.FSYouthPreferentialist/2) + (arcology.FSYouthPreferentialistLaw*10)); /*max 60*/
		} else if (arcology.FSMaturityPreferentialist !== "unset") {
			if (V.retirementAge > 30) {
				beauty += (30 - slave.visualAge)/(30 - V.retirementAge)*((arcology.FSMaturityPreferentialist/2) + (arcology.FSMaturityPreferentialistLaw*10)); /*max 60, problems if retirementAge is 30 or under*/
			}
		}
		if (arcology.FSBodyPurist > 20) { /*bonus for virgin slaves*/
			if (slave.vagina === 0 && slave.vaginalCount === 0) {
				beauty += 30*(arcology.FSBodyPurist/100);
			}
			if (slave.anus === 0 && slave.analCount === 0) {
				beauty += 30*(arcology.FSBodyPurist/100);
			}
		}
		if (arcology.FSEdoRevivalist !== "unset") {
			if (slave.nationality === "Japanese" || slave.nationality === "Edo Revivalist") {
				beauty += arcology.FSEdoRevivalist/2;
			} else if (slave.race === "asian") {
				beauty += arcology.FSEdoRevivalist/5;
			} else {
				beauty -= arcology.FSEdoRevivalist/4;
			}
			if (V.language === "Japanese" && canTalk(slave)) {
				if (slave.accent > 1) {
					beauty -= arcology.FSEdoRevivalist/2;
				} else if (slave.accent > 0) {
					beauty -= arcology.FSEdoRevivalist/5;
				} else {
					beauty += arcology.FSEdoRevivalist/10;
				}
			}
		} else if (arcology.FSChineseRevivalist !== "unset") {
			if (slave.nationality === "Chinese" || slave.nationality === "Ancient Chinese Revivalist") {
				beauty += arcology.FSChineseRevivalist/2;
			} else if (slave.race === "asian") {
				beauty += arcology.FSChineseRevivalist/5;
			} else {
				beauty -= arcology.FSChineseRevivalist/4;
			}
			if (V.language === "Chinese" && canTalk(slave)) {
				if (slave.accent > 1) {
					beauty -= arcology.FSChineseRevivalist/2;
				} else if (slave.accent > 0) {
					beauty -= arcology.FSChineseRevivalist/5;
				} else {
					beauty += arcology.FSChineseRevivalist/10;
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcMiscNotFuckdollBeauty(slave) {
		beauty += Math.min(slave.health, 100)/5;
		beauty += slave.voice;
		beauty += (slave.intelligence + slave.intelligenceImplant)/10;
		beauty += slave.entertainSkill/10;
		beauty += slave.whoreSkill/10;
		beauty -= 3*slave.visualAge;
		if (setup.entertainmentCareers.includes(slave.career)) {
			beauty += 20;
		} else if (V.week - slave.weekAcquired >= 20 && slave.entertainSkill >= 100) {
			beauty += 10;
		}
		if (slave.race === "white" && slave.origRace === "white") {
			beauty += 4;
		} else if (slave.race === "white") {
			beauty += 2;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcDickBeauty(slave) {
		if (arcology.FSAssetExpansionist > 20 && arcology.FSGenderFundamentalist === "unset") {
			if (slave.dick >= 20) {
				beauty += 17 + (slave.dick*(arcology.FSAssetExpansionist/500)); /*23*/
			} else if (slave.dick >= 10) {
				beauty += 10 + (slave.dick*(arcology.FSAssetExpansionist/300)); /*16.3*/
			} else if (slave.dick > 6) {
				beauty += slave.dick*(1 + (arcology.FSAssetExpansionist/100)); /*10*/
			}
		} else if (arcology.FSGenderFundamentalist !== "unset") {
			if (slave.dick > 0) {
				beauty += 3 - slave.dick;
			}
		} else if (arcology.FSGenderRadicalist !== "unset") {
			if (slave.dick > 20) {
				beauty += 20 + (slave.dick*(arcology.FSGenderRadicalist/400)); /*27.5*/
			} else if (slave.dick >= 10) {
				beauty += 10 + (slave.dick*(arcology.FSGenderRadicalist/200)); /*20*/
			} else if (slave.dick > 0) {
				beauty += slave.dick*(1 + (arcology.FSGenderRadicalist/100)); /*10*/
			}
		} else {
			beauty -= 2*slave.dick;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcBallsBeauty(slave) {
		if (arcology.FSAssetExpansionist > 20 && arcology.FSGenderFundamentalist === "unset") {
			if (slave.balls > 100) {
				beauty += 41 + (slave.balls*(arcology.FSAssetExpansionist/500)); /*66*/
			} else if (slave.balls > 80) {
				beauty += 16 + (slave.balls*(arcology.FSAssetExpansionist/400)); /*41*/
			} else if (slave.balls > 60) {
				beauty += 6 + (slave.balls*(arcology.FSAssetExpansionist/800)); /*16*/
			} else if (slave.balls > 10) {
				beauty += slave.balls*((arcology.FSAssetExpansionist/1000)); /*6*/
			}
		} else if (arcology.FSGenderFundamentalist !== "unset") {
			if (slave.scrotum > 0) {
				beauty -= slave.balls*(1 + (arcology.FSGenderFundamentalist/200));
			}
		} else if (arcology.FSGenderRadicalist !== "unset") {
			if (slave.scrotum > 0) {
				if (slave.balls > 100) {
					beauty += 40 + (slave.balls*(arcology.FSGenderRadicalist/2000)); /*46.25*/
				} else if (slave.balls > 60) {
					beauty += 30 + (slave.balls*(arcology.FSGenderRadicalist/1000)); /*40*/
				} else if (slave.balls > 10) {
					beauty += 15 + (slave.balls*(arcology.FSGenderRadicalist/400)); /*30*/
				} else {
					beauty += slave.balls*(1 + (arcology.FSGenderRadicalist/200)); /*15*/
				}
			}
		} else {
			if (slave.scrotum > 0) {
				beauty -= slave.balls;
			}
		}
		if (arcology.FSRestart !== "unset") { /* Eugenics does not like slaves having working balls */
			if (slave.ballType === "human") {
				beauty -= slave.balls*(1 + (arcology.FSRestart/100));
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcButtBeauty(slave) {
		if (slave.butt <= 10) {
			beauty += 1.5*slave.butt; /*max 15*/
		} else {
			beauty += 15 + (slave.butt/4); /*max 20*/
		}
		if ((arcology.FSTransformationFetishist > 20 && arcology.FSSlimnessEnthusiast === "unset") || arcology.FSAssetExpansionist > 20) {
			if (slave.butt <= 2) {
				beauty += 2*(slave.butt - 1); /*2*/
			} else if (slave.butt <= 4) {
				beauty += 2 + 1.5*(slave.butt - 2); /*5*/
			} else if (slave.butt <= 10) {
				beauty += 5 + 1*(slave.butt - 4); /*11*/
			} else {
				beauty += 7 + 0.5*(slave.butt - 5); /*14.5*/
			} /* maybe buff butts? */
		} else if (arcology.FSSlimnessEnthusiast > 20) {
			if (slave.butt <= 3) {
				beauty += 12 + 3*(slave.butt - 1); /*18 buff if asses get buffed*/
			} else if (slave.butt <= 5) {
				beauty += 9;
			} else {
				beauty -= 10 + 3*slave.butt; /*-70*/
			}
		} else {
			if (slave.butt <= 2) {
				beauty += 2*(slave.butt-1); /*2*/
			} else if (slave.butt <= 4) {
				beauty += 2 + (1.5*(slave.butt - 2)); /*5*/
			} else if (slave.butt <= 8) {
				beauty += 2 + (1.5*(slave.butt - 2)); /*11*/
			} else {
				beauty += 9;
			}
		}
		if (arcology.FSTransformationFetishist > 20) { /* the cost of using AE's values */
			if (arcology.FSSlimnessEnthusiast !== "unset") {
				if (slave.butt >= 3) {
					if (slave.buttImplant/slave.butt < 0.25) {
						beauty -= 2*(slave.butt - 1) + 10;
					}
				}
			} else {
				if (slave.butt >= 6) {
					if (slave.buttImplant/slave.butt < 0.50) {
						beauty -= (1.5*slave.butt) + 6; /* will get nasty at huge sizes */
					}
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcHipsBeauty(slave) { /* butts in general may need buffs */
		switch (slave.hips) {
			case -2:
				if (slave.butt > 2) {
					if (arcology.FSTransformationFetishist === "unset" && arcology.FSHedonisticDecadence === "unset") {
						beauty += 2 - slave.butt;
					} else {
						beauty += 1;
					}
				} else {
					beauty += 1;
				}
				break;
			case -1:
				if (slave.butt > 4) {
					if (arcology.FSTransformationFetishist === "unset" && arcology.FSHedonisticDecadence === "unset") {
						beauty += 4 - slave.butt;
					} else {
						beauty += 1;
					}
				} else {
					beauty += 1;
				}
				break;
			case 0:
				if (slave.butt > 6) {
					if (arcology.FSTransformationFetishist === "unset" && arcology.FSHedonisticDecadence === "unset") {
						beauty += 6 - slave.butt;
					} else {
						beauty += 1;
					}
				} else if (slave.butt <= 1) {
					beauty += slave.butt - 2;
				} else {
					beauty += 1;
				}
				break;
			case 1:
				if (slave.butt > 8) {
					if (arcology.FSTransformationFetishist === "unset" && arcology.FSHedonisticDecadence === "unset") {
						beauty += 8 - slave.butt;
					} else {
						beauty += 1;
					}
				} else if (slave.butt <= 2) {
					beauty += slave.butt - 3;
				} else {
					beauty += 1;
				}
				break;
			case 2:
				if (slave.butt <= 3) {
					beauty += slave.butt - 4;
				} else {
					beauty += 1;
				}
				break;
			case 3:
				if (slave.butt <= 8) {
					beauty += slave.butt - 8;
				} else {
					beauty += 1;
				}
				break;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcBoobsBeauty(slave) {
		if ((arcology.FSTransformationFetishist > 20 && arcology.FSSlimnessEnthusiast === "unset") || arcology.FSAssetExpansionist > 20) {
			if (slave.boobs <= 500) {
				beauty += 0.02*(slave.boobs - 250); /*5*/
			} else if (slave.boobs <= 1500) {
				beauty += 5 + 0.015*(slave.boobs - 500); /*20*/
			} else if (slave.boobs <= 3000) {
				beauty += 20 + 0.01*(slave.boobs - 1500); /*42.5*/
			} else if (slave.boobs <= 25000) {
				beauty += 50 + 0.005*(slave.boobs - 3000); /*160 - this might need to be lowered. Maybe drop the 50? Otherwise break it down more.*/
			} else {
				beauty += 145 + 0.001*(slave.boobs - 10000); /* 185 */
			}
		} else if (arcology.FSSlimnessEnthusiast > 20) {
			if (slave.boobs <= 500) {
				beauty += 0.08*(slave.boobs); /*40 - buff me to be in line with higher end asset exp*/
			} else if (slave.boobs <= 1000) {
				beauty += 10;
			} else if (slave.boobs <= 3000) {
				beauty += 5;
			} else {
				beauty -= 5 + 0.005*(slave.boobs - 3000); /*-110*/
			}
		} else {
			if (slave.boobs <= 1200) {
				beauty += 0.02*(slave.boobs - 200); /*20*/
			} else if (slave.boobs <= 2400) {
				beauty += 20 + (0.01*(slave.boobs - 1200)); /*32*/
			} else if (slave.boobs <= 3600) {
				beauty += 32 + (0.005*(slave.boobs - 2400)); /*38*/
			} else if (slave.boobs <= 10000) {
				beauty += 38;
			} else if (slave.boobs <= 25000) {
				beauty += 30;
			} else {
				beauty += 20;
			}
		}
		if (arcology.FSTransformationFetishist > 20) { /* the cost of using AE's values */
			if (arcology.FSSlimnessEnthusiast !== "unset") {
				if (slave.boobs >= 400) {
					if (slave.boobs >= 10000) {
						if (slave.boobsImplant/slave.boobs < 0.75) {
							beauty -= (0.05*slave.boobs) + 10;
						}
					} else if (slave.boobs >= 2000) {
						if (slave.boobsImplant/slave.boobs < 0.50) {
							beauty -= (0.05*slave.boobs) + 10;
						}
					} else if (slave.boobs >= 1000) {
						if (slave.boobsImplant/slave.boobs < 0.25) {
							beauty -= (0.05*slave.boobs) + 10;
						}
					} else {
						if (slave.boobsImplant/slave.boobs < 0.10) {
							beauty -= (0.05*slave.boobs) + 10;
						}
					}
				}
			} else {
				if (slave.boobs >= 600) {
					if (slave.boobs >= 10000) {
						if (slave.boobsImplant/slave.boobs < 0.75) {
							beauty -= 30 + (0.005*slave.boobs); /* will get nasty at huge sizes */
						}
					} else if (slave.boobs >= 2000) {
						if (slave.boobsImplant/slave.boobs < 0.50) {
							beauty -= 30 + (0.005*slave.boobs); /* will get nasty at huge sizes */
						}
					} else if (slave.boobs >= 1000) {
						if (slave.boobsImplant/slave.boobs < 0.25) {
							beauty -= 30 + (0.005*slave.boobs); /* will get nasty at huge sizes */
						}
					} else {
						if (slave.boobsImplant/slave.boobs < 0.10) {
							beauty -= 30 + (0.005*slave.boobs); /* will get nasty at huge sizes */
						}
					}
				}
			}
		}
		if (slave.boobs > 250) {
			if (slave.boobShape === "perky") {
				beauty += 6;
			} else if (slave.boobShape === "torpedo-shaped") {
				beauty += 6;
			} else if (slave.boobShape === "downward-facing") {
				beauty -= 4;
			} else if (slave.boobShape === "saggy") {
				beauty -= 4;
			}
		}
		if (slave.nipples === "huge") {
			beauty += 4;
		} else if (slave.nipples === "inverted") {
			beauty += 2;
		} else if (slave.nipples === "puffy") {
			beauty += 2;
		} else if (slave.nipples === "tiny") {
			beauty -= 2;
		} else if (slave.nipples === "fuckable") {
			if (arcology.FSTransformationFetishist !== "unset") {
				beauty += arcology.FSTransformationFetishist/10;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcWeightBeauty(slave) {
		if (arcology.FSHedonisticDecadence > 20) {
			if (slave.weight < -95) {
				beauty += -70 + (slave.weight/10); /*-80*/
			} else if (slave.weight < -30) {
				beauty += -30 + (slave.weight/3); /*-61*/
			} else if (slave.weight < -10) {
				beauty += (slave.weight); /*-30*/
			} else if (slave.weight <= 10) {
				/* no effect */
			} else if (slave.weight <= 30) {
				beauty += (slave.weight/2); /*15*/
			} else if (slave.weight <= 95) {
				beauty += 15 + (slave.weight/7); /*28.5*/
			} else if (slave.weight <= 130) {
				beauty += 28 + (slave.weight/10); /*41*/
			} else if (slave.weight <= 160) {
				beauty += 42 + (slave.weight/20); /*50*/
			} else if (slave.weight <= 190) {
				beauty += 50 - (slave.weight/25); /*42.5*/
			} else {
				beauty += 40 - (slave.weight/20); /*30*/
			}
		} else {
			if (slave.weight > 130) {
				beauty -= Math.abs(slave.weight)/5;
			} else if (slave.hips === 3) {
				if (slave.weight < -10) {
					beauty -= Math.abs(slave.weight)/10;
				}
			} else if (slave.hips === 2) {
				if (slave.weight > 95) {
					beauty -= Math.abs(slave.weight)/15;
				} else if (slave.weight < -30) {
					beauty -= Math.abs(slave.weight)/10;
				}
			} else if (slave.hips === -2) {
				if (slave.weight < -95 || slave.weight > 30) {
					beauty -= Math.abs(slave.weight)/10;
				}
			} else {
				if (Math.abs(slave.weight) > 30) {
					beauty -= Math.abs(slave.weight)/10;
				}
			}
		}
		if (arcology.FSPhysicalIdealist !== "unset") {
			if (arcology.FSPhysicalIdealistStrongFat === 1) {
				if (slave.weight > 10 && slave.weight <= 130) {
					beauty += slave.weight*(arcology.FSPhysicalIdealist/200); /*65*/
				} else {
					beauty -= Math.abs(slave.weight)/2;
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcMusclesBeauty(slave) {
		if (arcology.FSPhysicalIdealist !== "unset") {
			if (arcology.FSPhysicalIdealistLaw === 1) {
				if (Math.abs(slave.weight) <= 30 && slave.health >= 20 && slave.muscles >= 20 && slave.muscles <= 50) {
					beauty += (slave.muscles + (Math.min(slave.health,300)/5))*(arcology.FSPhysicalIdealist/100);
				} else {
					beauty -= 30;
				}
			} else {
				if (slave.muscles > 30 || slave.muscles <= -5) {
					beauty += slave.muscles*(arcology.FSPhysicalIdealist/120); /*+-83*/
				}
			}
		} else if (arcology.FSHedonisticDecadence !== "unset") {
			if (slave.muscles < -10) {
				beauty += Math.abs(slave.muscles)*(arcology.FSHedonisticDecadence/160); /*62.5*/
			} else if (slave.muscles > 5) {
				if (arcology.FSHedonisticDecadenceStrongFat === 1) {
					beauty += slave.muscles*(arcology.FSHedonisticDecadence/200); /*50*/
				} else {
					beauty -= slave.muscles*(arcology.FSHedonisticDecadence/200); /*-50*/
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcBodyHairBeauty(slave) {
		if (slave.physicalAge < 11) {
			beauty += 4;
		} else if (slave.physicalAge >= 13) {
			switch (slave.underArmHStyle) {
				case "hairless":
				case "bald":
				case "waxed":
				case "shaved":
					beauty += 2;
					break;
				case "bushy":
					if (arcology.FSBodyPurist > 0) {
						beauty += 4;
					} else {
						beauty -= 2;
					}
					break;
			}
			switch (slave.pubicHStyle) {
				case "hairless":
				case "bald":
				case "waxed":
					beauty += 2;
					break;
				case "bushy":
					if (arcology.FSBodyPurist > 0) {
						beauty += 2;
					} else {
						beauty -= 4;
					}
					break;
				case "bushy in the front and neat in the rear":
					if (arcology.FSBodyPurist > 0) {
						beauty += 4;
					} else {
						beauty -= 2;
					}
					break;
				case "very bushy":
					if (arcology.FSBodyPurist > 0) {
						beauty += 2;
					} else {
						beauty -= 6;
					}
					break;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcImplantBeauty(slave) {
		if (arcology.FSTransformationFetishist !== "unset") {
			if (Math.abs(slave.shouldersImplant) > 1) {
				beauty += (arcology.FSTransformationFetishist/20) + Math.abs(slave.shouldersImplant);
			}
			if (Math.abs(slave.hipsImplant) > 1) {
				beauty += (arcology.FSTransformationFetishist/20) + Math.abs(slave.hipsImplant);
			}
			if (slave.race !== slave.origRace) {
				beauty += arcology.FSTransformationFetishist/20;
			}
			if (slave.faceImplant > 95 && slave.face > 40) {
				beauty += arcology.FSTransformationFetishist/4;
			}
		} else if (arcology.FSBodyPurist !== "unset") {
			if (slave.faceImplant > 5) {
				beauty -= (arcology.FSBodyPurist/100)*(slave.faceImplant/10);
			}
			if (slave.race === slave.origRace) {
				beauty -= arcology.FSBodyPurist/20;
			}
		} else {
			if (slave.faceImplant > 30) {
				beauty -= (slave.faceImplant - 30)/10;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcRepopulationPregBeauty(slave) {
		if (slave.preg > slave.pregData.normalBirth/1.33) { /*limited huge boost for full term */
			if (slave.broodmother > 0) {
				beauty += 0.4*(slave.broodmother*arcology.FSRepopulationFocus); /*40-80 limited due to constant presence. Also good breeders, but subpar mothers*/
			} else if (slave.bellyPreg >= 600000) {
				beauty += 1.5*arcology.FSRepopulationFocus; /*150*/
			} else if (slave.bellyPreg >= 300000) {
				beauty += arcology.FSRepopulationFocus; /*100*/
			} else if (slave.bellyPreg >= 120000) {
				beauty += 0.9*arcology.FSRepopulationFocus; /*90*/
			} else {
				beauty += 0.8*arcology.FSRepopulationFocus; /*80*/
			}
		} else if (slave.preg > slave.pregData.normalBirth/2) {
			if (slave.pregType >= 20) {
				beauty += 10*(arcology.FSRepopulationFocus/40); /*25*/
			} else if (slave.pregType >= 10) {
				beauty += 9*(arcology.FSRepopulationFocus/40); /*22.5*/
			} else {
				beauty += 8*(arcology.FSRepopulationFocus/40); /*20*/
			}
		} else if (slave.preg > slave.pregData.normalBirth/4) {
			if (slave.pregType >= 20) {
				beauty += arcology.FSRepopulationFocus/5; /*20*/
			} else if (slave.pregType >= 10) {
				beauty += arcology.FSRepopulationFocus/6.25; /*16*/
			} else {
				beauty += arcology.FSRepopulationFocus/10; /*10*/
			}
		} else if (slave.pregWeek < 0) {
			beauty += arcology.FSRepopulationFocus/10; /*10*/
		} else if (slave.preg > 0 && slave.collar === "preg biometrics") {
			beauty += arcology.FSRepopulationFocus/12; /*8.33*/
		} else {
			beauty -= arcology.FSRepopulationFocus/2.5; /*-40*/
		}
		if (slave.births > 50) {
			beauty += arcology.FSRepopulationFocus/1.5; /*66.6*/
		} else {
			beauty += slave.births*(arcology.FSRepopulationFocus/75);
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcTrendyPregBeauty(slave) {
		if (slave.preg > slave.pregData.normalBirth/1.33) { /*limited huge boost for full term */
			beauty += 20;
		} else if (slave.bellyPreg >= 1500) {
				beauty += 10;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcRestartPregBeauty(slave) {
		if (slave.breedingMark === 1 && V.propOutcome === 1) {
			if (slave.preg > slave.pregData.normalBirth/8 && slave.pregSource === -1) {
				beauty += arcology.FSRestart; /*100*/
			}
		} else {
			if (slave.preg > slave.pregData.normalBirth/1.33) {
				if (slave.bellyPreg >= 600000) {
					beauty -= 2.5*arcology.FSRestart; /*-250*/
				} else if (slave.bellyPreg >= 300000) {
					beauty -= 1.25*arcology.FSRestart; /*-125*/
				} else if (slave.bellyPreg >= 120000) {
					beauty -= arcology.FSRestart; /*-100*/
				} else {
					beauty -= 0.75*arcology.FSRestart; /*-75*/
				}
			} else if (slave.preg > slave.pregData.normalBirth/2) {
				if (slave.pregType >= 20) {
					beauty -= arcology.FSRestart/1.5; /*-66.6*/
				} else if (slave.pregType >= 10) {
					beauty -= arcology.FSRestart/2; /*-50*/
				} else {
					beauty -= arcology.FSRestart/3; /*-33.3*/
				}
			} else if (slave.preg > slave.pregData.normalBirth/4) {
				if (slave.pregType >= 20) {
					beauty -= 3*(arcology.FSRestart/8); /*-37.5*/
				} else if (slave.pregType >= 10) {
					beauty -= arcology.FSRestart/4; /*-25*/
				} else {
					beauty -= arcology.FSRestart/8; /*-12.5*/
				}
			} else if (slave.preg === -2) {
				beauty += arcology.FSRestart/7; /*14.2*/
			} else if (slave.preg < 1) {
				beauty += arcology.FSRestart/5; /*20*/
			}
			if (slave.births > 50) {
				beauty -= arcology.FSRestart; /*-100*/
			} else {
				beauty -= slave.births*(arcology.FSRestart/50);
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcTrendyMilfBeauty(slave) {
		if (slave.births > 50) {
			beauty += 6;
		} else {
			beauty += Math.ceil(slave.births/10);
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFutaLawBeauty(slave) {
		switch (arcology.FSGenderRadicalistLawFuta) {
			case 1:
				if (slave.dick > 0 && slave.vagina > -1) { /* herms */
					calcFutaLawTrueFutaBeauty(slave);
				}
				break;
			case 2:
				if (canAchieveErection(slave) && slave.balls > 0 && slave.scrotum > 0) { /* erection! */
					calcFutaLawBigDickBeauty(slave);
				}
				break;
			case 3:
				calcFutaLawBigBootyBeauty(slave);
				break;
			case 4:
				if (slave.dick > 0 && slave.vagina === -1 && slave.faceShape !== "masculine") {
					if (slave.boobs < 500 && slave.dick < 4 && slave.balls < 4) {
						calcFutaLawFemboyBeauty(slave);
					}
				}
				break;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFutaLawTrueFutaBeauty(slave) {
		if (slave.dick <= 10) {
			beauty += slave.dick;
		} else if (slave.dick > 20) {
			beauty += 2;
		} else {
			beauty += 4;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFutaLawBigDickBeauty(slave) {
		beauty += slave.dick;
		if (slave.balls > 120) {
			beauty += 14;
		} else if (slave.balls > 100) {
			beauty += 12;
		} else if (slave.balls > 80) {
			beauty += 10;
		} else if (slave.balls > 60) {
			beauty += 8;
		} else if (slave.balls > 40) {
			beauty += 6;
		} else if (slave.balls > 20) {
			beauty += 4;
		} else if (slave.balls > 10) {
			beauty += 2;
		} else {
			beauty += slave.balls;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFutaLawBigBootyBeauty(slave) {
		if (slave.hips >= 1) {
			beauty += 4*(slave.hips - 1); /*8*/
			if (arcology.FSSlimnessEnthusiast !== "unset") {
				beauty += 4*(slave.hips - 1); /*8*/ /* offsets the malus for big butts */
			}
		}
		if (slave.analSkill > 60 && slave.anus >= 2) {
			beauty += 2*(slave.anus-2); /*6*/
			if (arcology.FSSlimnessEnthusiast !== "unset") {
				beauty += 2*(slave.anus-2); /*6*/ /* offsets the malus for big butts */
			}
		}
		if (slave.butt >= 5) {
			beauty += (slave.butt - 5); /*15*/
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFutaLawFemboyBeauty(slave) {
		if (arcology.FSSlimnessEnthusiast === "unset") { /*balance with slimness*/
			beauty += 20;
			if (slave.boobs < 300) {
				beauty += 12;
			} else if (slave.boobs < 400) {
				beauty += 6;
			}
		}
		if (slave.dick === 1) {
			beauty += 12;
		} else if (slave.dick === 2) {
			beauty += 6;
		}
		if (slave.balls <= 2) {
			beauty += 8;
		}
		if (slave.faceShape === "cute" && slave.face > 0) { /*uggos need not apply, maybe a small boost for other faceShapes*/
			beauty += ((arcology.FSGenderRadicalist/25)*(slave.face/30)) - 2; /*gives a slightly better boost than androgynous does with gendrad boost, 15.3*/
		}
		if (slave.nipples === "tiny") {
			beauty += 5;
		} else if (slave.nipples === "cute") {
			beauty += 2;
		} else {
			beauty -= 5;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcBodyProportionBeauty(slave) {
		if (arcology.FSGenderFundamentalist !== "unset") {
			if (slave.shoulders > slave.hips) {
				if (slave.boobs <= 2000*(slave.shoulders - slave.hips)) {
					beauty -= (slave.shoulders - slave.hips)*(1 + (arcology.FSGenderFundamentalist/200));
				}
			}
		} else if (arcology.FSGenderRadicalist === "unset") {
			if (slave.shoulders > slave.hips) {
				if (slave.boobs <= 2000*(slave.shoulders - slave.hips)) {
					beauty -= slave.shoulders - slave.hips;
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcVoiceBeauty(slave) {
		if (canTalk(slave)) {
			if (slave.accent >= 3) {
				beauty -= 1;
			} else if (slave.accent === 1) {
				beauty += 1;
			}
		} else {
			beauty -= 2;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcLimbsBeauty(slave) {
		switch (slave.amp) {
			case 1:
				beauty -= 10;
				break;
			case -1:
			case -2:
			case -4:
				beauty -= 2;
				break;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcPubertyBeauty(slave) {
		if (slave.pubertyXX === 1) {
			beauty += 5;
		}
		if (slave.pubertyXY === 0 && slave.physicalAge > V.potencyAge && slave.balls > 0) {
			beauty += 10;
			if (arcology.FSGenderFundamentalist !== "unset") {
				beauty += 5;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFSMiscBeauty(slave) {
		if (arcology.FSTransformationFetishist > 20) {
			if (slave.lips > 70) {
				if (slave.lipsImplant/slave.lips < 0.5) {
					beauty -= ((slave.lips/10) + (arcology.FSTransformationFetishist/20));
				}
			}
			if (slave.hips === 3) {
				beauty += 10;
			}
		}
		if ((arcology.FSGenderRadicalist > 20 && arcology.FSGenderRadicalistLawFuta !== 3) || arcology.FSSlimnessEnthusiast > 20) {
			if (slave.hips < 0) {
				beauty += Math.abs(slave.hips);
			}
		}
		if (arcology.FSPhysicalIdealist !== "unset") {
			if (slave.height > Height.mean(slave)) {
				beauty += 10;
			}
		}
		if (arcology.FSHedonisticDecadenceLaw2 === 1) {
			if (slave.boobs >= 2000 && slave.butt >= 5 && slave.weight > 95) {
				beauty += 5 + (arcology.FSHedonisticDecadence/20); /*10*/
			} else {
				beauty -= 15 + (arcology.FSHedonisticDecadence/20); /*-20*/
			}
		}
		if (arcology.FSChattelReligionistCreed === 1) {
			if (V.nicaeaAssignment === slave.assignment) {
				beauty += 2*V.nicaeaPower;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcPurityBeauty(slave) {
		if (isPure(slave)) {
			V.pure = V.pure++ || 1;
			if (arcology.FSBodyPurist !== "unset") {
				beauty += arcology.FSBodyPurist/5;
			}
			if (arcology.FSTransformationFetishist === "unset") {
				beauty += 2;
			}
		} else if (arcology.FSTransformationFetishist !== "unset") {
			beauty += arcology.FSTransformationFetishist/40;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcPhysiqueBeauty(slave) {
		let physiquePass = 0;

		if (slave.boobs < 500 && slave.butt < 3) {
			if (slave.muscles <= 30 && arcology.FSPhysicalIdealist === "unset" && slave.weight <= 10 && arcology.FSHedonisticDecadence === "unset") {
				physiquePass = 1;
			} else if (arcology.FSPhysicalIdealist !== "unset") { /* no muscle malus for muscle loving societies */
				if (arcology.FSPhysicalIdealistStrongFat === 1 && slave.weight <= 30) { /* reduced weight malus for fat loving societies */
					physiquePass = 1;
				} else if (slave.weight <= 10) {
					physiquePass = 1;
				}
			} else if (arcology.FSHedonisticDecadence !== "unset" && slave.weight <= 30) { /* reduced weight malus for fat loving societies */
				if (arcology.FSHedonisticDecadenceStrongFat === 1) { /* no muscle malus for muscle loving societies */
					physiquePass = 1;
				} else if (slave.muscles <= 30) {
					physiquePass = 1;
				}
			}
		}
		if (physiquePass === 1) {
			beauty += 40;
			if (arcology.FSSlimnessEnthusiast > 20) {
				beauty += arcology.FSSlimnessEnthusiast/20;
				if (canTalk(slave) && slave.voice === 3) {
					beauty += arcology.FSSlimnessEnthusiast/40;
				}
			}
		} else if (slave.butt > 4 && slave.boobs > 800) {
			if (arcology.FSSlimnessEnthusiast === "unset") {
				beauty += 1;
			}
			if (arcology.FSAssetExpansionist > 20) {
				beauty += arcology.FSAssetExpansionist/20;
				if (canTalk(slave) && slave.voice === 3) {
					beauty += arcology.FSAssetExpansionist/40;
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcSlimBeauty(slave) {
		if (slimPass(slave) === 1) {
			beauty += 40 + (arcology.FSSlimnessEnthusiast/20); /*45*/
		} else {
			beauty -= arcology.FSSlimnessEnthusiast/20;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcGenderLawBeauty(slave) {
		V.genderLawPass = 1;

		if (arcology.FSPhysicalIdealist === "unset" && arcology.FSHedonisticDecadenceStrongFat === 0 && slave.muscles > 30) { /*muscle check*/
			V.genderLawPass = 0;
		}
		if (arcology.FSHedonisticDecadence !== "unset" || arcology.FSPhysicalIdealistStrongFat === 1) { /*weight check*/
			if (slave.weight > 130 || slave.weight <= -30) {
				V.genderLawPass = 0;
			}
		} else if (Math.abs(slave.weight) > 30) {
			V.genderLawPass = 0;
		}
		if (arcology.FSAssetExpansionist !== "unset") {
			if (slave.boobs < 500 || slave.boobs > 1600 || slave.butt < 3 || slave.butt > 6) {
				V.genderLawPass = 0;
			}
		} else if (slave.boobs < 500 || slave.boobs > 800 || slave.butt < 3 || slave.butt > 4) {
			V.genderLawPass = 0;
		}
		if (V.genderLawPass === 1) {
			beauty += 60;
		} else {
			beauty -= 10;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcMultipliersBeauty(slave) {
		calcBellyBeauty(slave);
		if (slave.breedingMark === 1) {
			if (V.propOutcome === 1) {
				beauty = 2*beauty;
			} else {
				beauty += 2;
			}
		}
		if (slave.fuckdoll === 0 && V.seeAge === 1) {
			calcAgeBeauty(slave);
		}
		if (slave.prestige + slave.pornPrestige > 0) {
			calcPrestigeBeauty(slave);
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcBellyBeauty(slave) {
		if (slave.bellySag > 0) {
			if (slave.belly < 100) {
				if (arcology.FSRepopulationFocus === "unset") {
					beauty -= 20;
				}
			}
		}
		if (slave.bellyPreg >= 500 && arcology.FSRepopulationFocus === "unset" && arcology.FSRestart === "unset") {
			if (arcology.FSRepopulationFocusPregPolicy === 1) {
				beauty = 0.9*beauty;
			} else if (arcology.FSGenderRadicalist !== "unset") {
				if (slave.mpreg === 1) {
					beauty = 0.9*beauty;
				} else {
					beauty = 0.7*beauty;
				}
			} else if (arcology.FSGenderFundamentalist === "unset") {
				beauty = 0.8*beauty;
			} else {
				beauty = 0.7*beauty;
			}
		}
		if (slave.bellyImplant >= 1500) {
			if (arcology.FSTransformationFetishist > 20) {
				beauty += Math.min(Math.trunc(slave.bellyImplant/1000), 50); /*50*/
			} else if (arcology.FSRepopulationFocus > 60) {
				if ((slave.ovaries === 0 && slave.mpreg === 0) || slave.preg < -1) {
					beauty += 20;
				}
			} else {
				if (slave.bellyImplant >= 750000) { /* multipliers */
					beauty = 0.2*beauty;
				} else if (slave.bellyImplant >= 450000) {
					beauty = 0.5*beauty;
				} else if (slave.bellyImplant >= 300000) {
					beauty = 0.7*beauty;
				} else if (slave.bellyImplant >= 100000) {
					beauty = 0.8*beauty;
				} else if (slave.bellyImplant >= 50000) {
					beauty = 0.85*beauty;
				} else {
					beauty = 0.9*beauty;
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcAgeBeauty(slave) {
		if (slave.physicalAge === V.minimumSlaveAge) {
			beauty += 1;
			if (slave.physicalAge === V.fertilityAge && canGetPregnant(slave) && (arcology.FSRepopulationFocus !== "unset" || arcology.FSGenderFundamentalist !== "unset") && arcology.FSRestart === "unset") {
				if (slave.birthWeek === 0) {
					beauty += 1.6*beauty;
				} else if (slave.birthWeek < 4) {
					beauty += 0.2*beauty;
				}
			} else {
				if (slave.birthWeek === 0) {
					beauty += 0.8*beauty;
				} else if (slave.birthWeek < 4) {
					beauty += 0.1*beauty;
				}
			}
		} else if (slave.physicalAge === V.fertilityAge && canGetPregnant(slave) && (arcology.FSRepopulationFocus !== "unset" || arcology.FSGenderFundamentalist !== "unset") && arcology.FSRestart === "unset") {
			beauty += 1;
			if (slave.birthWeek === 0) {
				beauty += 0.8*beauty;
			} else if (slave.birthWeek < 4) {
				beauty += 0.1*beauty;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcPrestigeBeauty(slave) { /* multipliers */
		if (slave.prestige >= 3) {
			beauty += 2*beauty;
		} else if (slave.prestige === 2) {
			beauty += 0.5*beauty;
		} else if (slave.prestige === 1) {
			beauty += 0.25*beauty;
		}
		if (slave.pornPrestige === 3) {
			beauty += beauty;
		} else if (slave.pornPrestige === 2) {
			beauty += 0.5*beauty;
		} else if (slave.pornPrestige === 1) {
			beauty += 0.1*beauty;
		}
	}

	return Beauty;
})();

// this is a port of the FResult widget
// it has been broken up into several functions, because it grew too long
// it has been wrapped in a closure so as not to pollute the global namespace
// and so that nested functions are only evaluated once

window.FResult = (function() {
	"use strict";
	// we can't initialize our global variables on load, because SugarCube.State isn't initialized
	// instead, declare them and initialize on run time
	let V, result, incest_bonus;
	/** @param {App.Entity.SlaveState} slave */
	function FResult(slave) {
		V = State.variables;
		incest_bonus = V.arcologies[0].FSEgyptianRevivalist > 20 || V.arcologies[0].FSEgyptianRevivalistIncestPolicy === 1;

		calcUseWeights(slave);
		if (!slave.fuckdoll)
			calcNotFuckdoll(slave);
		else
			result += slave.fuckdoll/10;

		result += Math.max(0, slave.aphrodisiacs) * 2;

		if (slave.inflationType === "aphrodisiac")
			result += slave.inflation*4;

		if (slave.lactation > 0)
			result += 1;

		if (slave.nipples === "fuckable")
			calcFuckableTits(slave);

		if (V.seeAge === 1)
			calcAge(slave);
		if (slave.fetish === "mindbroken")
			result = Math.trunc(result*0.4);
		else
			result = Math.trunc(result*0.7);

		if (slave.pregWeek < 0)
			result -= Math.trunc(result*slave.pregWeek/10); // reduced the most just after birth

		calcAmputation(slave);

		if (V.arcologies[0].FSHedonisticDecadence > 20)
			calcHedonismWeight(slave);
		if (result < 2) {
			if (supremeRaceP(slave) && V.arcologies[0].FSSupremacist > 20)
				result = 0;
			else
				result = 2;
		}
		return result;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcUseWeights(slave) {
		result = (3 - slave.anus)+(slave.muscles/30);
		if (slave.muscles < -95)
			result -= 5;
		else if (slave.muscles < -30)
			result -= 2;

		const uses = V.oralUseWeight + V.vaginalUseWeight + V.analUseWeight;
		if (uses <= 0) return;

		result += (6+slave.tonguePiercing) * (V.oralUseWeight/uses) * (slave.oralSkill/30);
		if (slave.sexualFlaw === "cum addict")
			result += (V.oralUseWeight/uses) * (slave.oralSkill/30);
		if (canDoVaginal(slave)) {
			result += 6 * (V.vaginalUseWeight/uses) * (slave.vaginalSkill/30);
			result += (3 - slave.vagina);
			result += slave.vaginaLube;
		}
		if (canDoAnal(slave)) {
			result += 6 * (V.analUseWeight/uses) * (slave.analSkill/30);
			if (slave.sexualFlaw === "anal addict")
				result += (V.analUseWeight/uses) * (slave.analSkill/30);
			if (slave.inflationType === "aphrodisiac")
				result += (V.analUseWeight/uses) * (slave.inflation * 3);
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFuckableTits(slave) {
		result += 2;
		if (slave.fetish === "boobs")
			result += Math.trunc(slave.fetishStrength/20);
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcWorksWithRelatives(slave) {
		V.slaves.forEach(islave => {
			if (isParentP(slave, islave) && sameAssignmentP(slave, islave)) {
				result += 1;
				if (incest_bonus) result += 1;
			}
			if (areSisters(slave, islave) > 0 && sameAssignmentP(slave, islave)) {
				result += 1;
				if (incest_bonus) result += 1;
			}
		});
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcWorksWithRelativesVanilla(slave) {
		const fre = getSlave(slave.relationTarget);
		if (fre !== undefined && sameAssignmentP(slave, fre)) {
			result += 2;
			if (incest_bonus) result += 2;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcWorksWithRelationship(slave) {
		const fre = V.slaves.findIndex(s => {
			return haveRelationshipP(slave, s) && sameAssignmentP(slave, s);
		});
		if (fre !== -1) result += 1;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcWorksWithRival(slave) {
		const en = getSlave(slave.rivalryTarget);
		if (en !== undefined && sameAssignmentP(slave, en)) result -= 1;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcHInjectionsDiet(slave) {
		if (slave.drugs === "male hormone injections" || slave.drugs === "female hormone injections")
			result -= 10;
		if (slave.diet === "XXY")
			result += 2;
		else if (slave.diet === "XY" || slave.diet === "XX")
			result += 1;
		else if (slave.diet === "cum production")
			result += 1;
		else if (slave.diet === "fertility")
			result += 1;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcPreg(slave) {
		if (V.arcologies[0].FSRepopulationFocus > 20) {
			if (slave.belly >= 1500) result += 2;
			else result -= 2;
		} else if (V.arcologies[0].FSRepopulationFocusPregPolicy === 1) {
			if (slave.bellyPreg >= 1500)
				result += 1;
		} else if (V.arcologies[0].FSRestart > 20) {
			if (slave.bellyPreg >= 500 && slave.breedingMark === 1 && V.propOutcome === 1)
				result += 1;
			else if (slave.bellyPreg >= 1500)
				result -= 10;
			else
				result += 0;
		}
		if (V.arcologies[0].FSRepopulationFocusMilfPolicy === 1 || V.arcologies[0].FSRepopulationFocus > 20) {
			result += 1;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcRace(slave) {
		if (V.arcologies[0].FSSupremacist !== "unset" && supremeRaceP(slave))
			result -= (V.arcologies[0].FSSupremacist/5) + (V.arcologies[0].FSSupremacistLawME*10);
		if (V.arcologies[0].FSSubjugationist !== "unset" && inferiorRaceP(slave))
			result += (V.arcologies[0].FSSubjugationist/10) + (V.arcologies[0].FSSubjugationistLawME);
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcSexAttributes(slave) {
		if (slave.clitPiercing > 2) result += 1;
		if (slave.tail === "sex") result += 1;
		if (slave.fetishKnown === 1 && slave.fetishStrength > 60 && slave.fetish !== "none")
			result += slave.fetishStrength/5;

		if (slave.attrKnown === 1) {
			result += Math.trunc(slave.attrXX/20);
			result += Math.trunc(slave.attrXY/20);
			if (slave.energy > 95) result += 3;
			else if (slave.energy > 80) result += 2;
			else if (slave.energy > 60) result += 1;
			else if (slave.energy <= 20) result -= 2;
			else if (slave.energy <= 40) result -= 1;
		}
		if (slave.sexualFlaw !== "none") result -= 2;
		if (slave.sexualQuirk !== "none") result += 2;
		if (slave.behavioralFlaw !== "none") result -= 2;
		if (slave.behavioralQuirk !== "none") result += 2;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcCareer(slave) {
		if (setup.whoreCareers.includes(slave.career))
			result += 1;
		else if (slave.oralCount + slave.analCount + slave.vaginalCount + slave.mammaryCount + slave.penetrativeCount > 1000)
			result += 1;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcSight(slave) {
		if (!canSee(slave)) result -= 3;
		else if (slave.eyes <= -1) {
			if (slave.eyewear !== "corrective glasses" && slave.eyewear !== "corrective contacts")
				result -= 1;
		} else if (slave.eyewear === "blurring glasses")
			result -= 1;
		else if (slave.eyewear === "blurring contacts")
			result -= 1;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcHearing(slave) {
		if (!canHear(slave)) result -= 2;
		else if (slave.hears <= -1) {
			if (slave.earwear !== "hearing aids")
				result -= 1;
		} else if (slave.earwear === "muffling ear plugs")
			result -= 1;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcEgyptianBonus(slave) {
		if (V.racialVarieties === undefined) V.racialVarieties = [];
		if (!V.racialVarieties.includes(slave.race))
			V.racialVarieties.push(slave.race);
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcYouthBonus(slave) {
		if (slave.visualAge < 30) {
			if (slave.actualAge > 30)
				result += 5; // experienced for her apparent age
			if (slave.physicalAge > 30)
				result -= slave.physicalAge/2; // too old :(
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcMatureBonus(slave) {
		if (slave.visualAge >= 30 && slave.actualAge >= 30 && slave.physicalAge < slave.visualAge)
			result += Math.min((slave.physicalAge - slave.visualAge) * 2, 20); // looks and acts mature, but has a body that just won't quit
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcNotFuckdoll(slave) {
		if (V.familyTesting === 1 && totalRelatives(slave) > 0)
			calcWorksWithRelatives(slave);
		else if(!V.familyTesting && slave.relation !==0)
			calcWorksWithRelativesVanilla(slave);
		if (slave.relationship > 0) calcWorksWithRelationship(slave);
		if (slave.rivalry !== 0) calcWorksWithRival(slave);
		calcHInjectionsDiet(slave);
		calcPreg(slave);
		calcRace(slave);
		calcSexAttributes(slave);
		calcCareer(slave);
		calcSight(slave);
		calcHearing(slave);
		if (V.arcologies[0].FSEgyptianRevivalist !== "unset")
			calcEgyptianBonus(slave);
		if (V.arcologies[0].FSYouthPreferentialist !== "unset")
			calcYouthBonus(slave);
		else if (V.arcologies[0].FSMaturityPreferentialist !== "unset")
			calcMatureBonus(slave);
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcAge(slave) {
		if ((V.arcologies[0].FSRepopulationFocus !== "unset" || V.arcologies[0].FSGenderFundamentalist !== "unset") && slave.physicalAge === V.minimumSlaveAge && slave.physicalAge === V.fertilityAge && canGetPregnant(slave)) {
			result += 1;
			if (slave.birthWeek === 0) result += result;
			else if (slave.birthWeek < 4) result += 0.2*result;
		} else if (slave.physicalAge === V.minimumSlaveAge) {
			result += 1;
			if (slave.birthWeek === 0 ) result += 0.5*result;
			else if (slave.birthWeek < 4) result += 0.1*result;
		} else if (slave.physicalAge === V.fertilityAge && canGetPregnant(slave) && (V.arcologies[0].FSRepopulationFocus !== "unset" || V.arcologies[0].FSGenderFundamentalist !== "unset")) {
			result += 1;
			if (slave.birthWeek === 0)
				result += 0.5*result;
			else if (slave.birthWeek < 4)
				result += 0.1*result;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcAmputation(slave) {
		switch(slave.amp) {
		case 0:
		case -2:
		case -5:
			break;
		case 1:
			result -= 2;
			break;
		default:
			result -= 1;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcHedonismWeight(slave) {
		if (slave.weight < 10)
			result -= 2;
		else if (slave.weight > 190)
			result -= 5; // too fat
	}
	return FResult;
})();

window.slaveCost = (function() {
	"use strict";
	let V, arcology, multiplier, cost;

	/** @param {App.Entity.SlaveState} slave */
	function slaveCost(slave, isStartingSlave) {
		V = State.variables;
		arcology = V.arcologies[0];
		multiplier = V.slaveCostFactor;
		cost = Beauty(slave)*FResult(slave);

		calcGenitalsCost(slave);
		calcDevotionTrustCost(slave);
		calcPreferencesCost(slave);
		calcPregCost(slave);
		if (slave.prestige + slave.pornPrestige > 0) {
			calcPrestigeCost(slave);
		}
		calcFSCost(slave);
		if (V.seeAge === 1) {
			calcAgeCost(slave);
		}
		calcCareersCost(slave);
		calcMiscCost(slave);
		calcIndentureCost(slave); /* multipliers */

		calcCost(slave);
		if (isStartingSlave) {
			calcStartingSlaveCost(slave);
		}
		return cost;
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcGenitalsCost(slave) {
		if (slave.vagina === 0) {
			multiplier += 0.1;
		}
		if (slave.vagina > -1 && arcology.FSRestartSMR === 1) {
			if (slave.dick > 0) {
				if (slave.ovaries === 0 && slave.balls === 0) {
					multiplier += 0.8;
				}
			}
		} else if (slave.vagina > -1) {
			if (slave.dick > 0) {
				if (V.ui !== "start" || V.PC.dick === 0 || V.PC.vagina === 0) {
					multiplier += 0.2;
					if (slave.ovaries > 0) {
						if (slave.balls > 0) {
							multiplier += 0.8;
						}
					}
				} else {
					multiplier += 0.1;
					if (slave.ovaries > 0) {
						if (slave.balls > 0) {
							multiplier += 0.2;
						}
					}
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcDevotionTrustCost(slave) {
		if (V.specialSlavesPriceOverride === 1) {
			if (slave.devotion > 50) {
				multiplier += slave.devotion/200;
			}
			if (slave.trust > 50) {
				multiplier += slave.trust/200;
			}
		} else {
			multiplier += slave.devotion/200;
			if (slave.devotion < -20) {
				if (slave.trust > 0) {
					multiplier -= slave.trust/200;
				}
			} else {
				if (slave.trust > 0) {
					multiplier += slave.trust/200;
				}
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcPreferencesCost(slave) {
		if (slave.behavioralFlaw !== "none") {
			multiplier -= 0.1;
		}
		if (slave.behavioralQuirk !== "none") {
			multiplier += 0.1;
		}
		if (slave.sexualFlaw === "breeder" && arcology.FSRepopulationFocus !== "unset") {
			multiplier += 0.3;
		} else if (slave.sexualFlaw !== "none") {
			multiplier -= 0.1;
		}
		if (slave.sexualQuirk !== "none") {
			multiplier += 0.1;
		}
		if (slave.fetishKnown === 1) {
			if (slave.fetish === "mindbroken") {
				multiplier -= 0.3;
			} else if (slave.fetish !== "none") {
				multiplier += slave.fetishStrength/1000;
			}
		} else {
			multiplier -= 0.1;
		}
		if (slave.attrKnown === 1) {
			if (slave.energy > 95) {
				multiplier += 0.2;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcPregCost(slave) {
		if (slave.mpreg === 1) {
			multiplier += 0.2;
		}
		if (arcology.FSRepopulationFocusSMR === 1) {
			if (slave.preg < -1) {
				multiplier -= 0.5;
			} else if (slave.bellyPreg >= 300000) {
				multiplier += 1;
			} else if (slave.bellyPreg >= 120000) {
				multiplier += 0.5;
			} else if (slave.preg > slave.pregData.normalBirth/4) {
				multiplier += 0.1;
			}
		} else if (arcology.FSRestartSMR === 1) {
			if (slave.preg < -1) {
				multiplier += 0.5;
			} else if (slave.bellyPreg >= 300000) {
				multiplier -= 2.5;
			} else if (slave.bellyPreg >= 30000) {
				multiplier -= 1.5;
			} else if (slave.preg > slave.pregData.normalBirth/4) {
				multiplier -= 1.0;
			}
		} else {
			if (slave.preg < -1) {
				multiplier -= 0.1;
			} else if (V.activeSlave.bellyPreg >= 300000) {
				multiplier -= 1.5;
			} else if (V.activeSlave.bellyPreg >= 120000) {
				multiplier -= 0.5;
			} else if (slave.bellyPreg >= 500 || slave.pregKnown === 1) {
				multiplier -= 0.1;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcPrestigeCost(slave) {
		if (slave.prestige > 0) {
			multiplier += 0.7*slave.prestige;
		}
		if (slave.pornPrestige === 3) {
			multiplier += 1.5;
		} else if (slave.pornPrestige === 2) {
			multiplier += 0.7;
		} else if (slave.pornPrestige === 1) {
			multiplier += 0.2;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcFSCost(slave) {
		if (arcology.FSSupremacistLawME !== 0) {
			if (slave.race !== arcology.FSSupremacistRace) {
				multiplier -= 0.1;
			}
		}
		if (arcology.FSSubjugationistLawME !== 0) {
			if (slave.race === arcology.FSSubjugationistRace) {
				multiplier -= 0.2;
			}
		}
		if (arcology.FSRepopulationFocusSMR !== 0) {
			if (slave.preg > 0) {
				multiplier += 0.1;
			}
		} else if (arcology.FSRestartSMR !== 0) {
			if (slave.dick > 0) {
				multiplier -= 0.1;
			}
			if (slave.balls > 0) {
				multiplier -= 0.2;
			}
			if (slave.vagina > 0) {
				multiplier -= 0.1;
			}
			if (slave.ovaries > 0) {
				multiplier -= 0.5;
			}
		}
		if (arcology.FSGenderFundamentalistSMR !== 0) {
			if (slave.dick > 0) {
				multiplier -= 0.1;
			}
			if (slave.balls > 0) {
				multiplier -= 0.1;
			}
		} else if (arcology.FSGenderRadicalist !== "unset") {
			if (slave.dick > 0) {
				multiplier += 0.1;
			}
			if (slave.balls > 0) {
				multiplier -= 0.1;
			}
		}
		if (arcology.FSHedonisticDecadenceSMR !== 0) {
			if (slave.weight > 60 && slave.muscles < 5) {
				multiplier += 0.1;
			}
		}
		if (arcology.FSArabianRevivalist > 50) {
			multiplier += 0.1;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcAgeCost(slave) {
		if (slave.physicalAge === V.minimumSlaveAge && slave.physicalAge === V.fertilityAge && canGetPregnant(slave) && (arcology.FSRepopulationFocus !== "unset" || arcology.FSGenderFundamentalist !== "unset")) {
			if (slave.birthWeek === 0) {
				multiplier -= 0.4;
			} else if (slave.birthWeek < 4) {
				multiplier -= 0.1;
			}
		} else if (slave.physicalAge === V.minimumSlaveAge) {
			if (slave.birthWeek === 0) {
				multiplier -= 0.2;
			} else if (slave.birthWeek < 4) {
				multiplier -= 0.05;
			}
		} else if (slave.physicalAge === V.fertilityAge && canGetPregnant(slave) && (arcology.FSRepopulationFocus !== "unset" || arcology.FSGenderFundamentalist !== "unset")) {
			if (slave.birthWeek === 0) {
				multiplier -= 0.2;
			} else if (slave.birthWeek < 4) {
				multiplier -= 0.05;
			}
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcCareersCost(slave) {
		if (slave.career !== 0) {
			if (slave.career === "a slave") {
				multiplier += 0.1;
			} else if (setup.bodyguardCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.wardenessCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.attendantCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.matronCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.schoolteacherCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.stewardessCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.milkmaidCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.farmerCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.madamCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.DJCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.HGCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.recruiterCareers.includes(slave.career)) {
				multiplier += 0.1;
			} else if (setup.entertainmentCareers.includes(slave.career)) {
				multiplier += 0.05;
			} else if (setup.whoreCareers.includes(slave.career)) {
				multiplier += 0.05;
			} else if (setup.gratefulCareers.includes(slave.career)) {
				multiplier += 0.05;
			} else if (setup.menialCareers.includes(slave.career)) {
				multiplier += 0.05;
			} else if (setup.servantCareers.includes(slave.career)) {
				multiplier += 0.05;
			}
		}
		if (V.week-slave.weekAcquired >= 20 && slave.entertainSkill >= 100) {
			if (!setup.entertainmentCareers.includes(slave.career)) {
				multiplier += 0.05;
			}
		}
		if (slave.oralCount + slave.analCount + slave.vaginalCount + slave.mammaryCount + slave.penetrativeCount > 1000) {
			if (!setup.whoreCareers.includes(slave.career)) {
				multiplier += 0.05;
			}
		}
		if (!setup.bodyguardCareers.includes(slave.career) && slave.skillBG >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.wardenessCareers.includes(slave.career) && slave.skillWA >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.attendantCareers.includes(slave.career) && slave.skillAT >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.matronCareers.includes(slave.career) && slave.skillMT >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.schoolteacherCareers.includes(slave.career) && slave.skillTE >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.stewardessCareers.includes(slave.career) && slave.skillST >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.milkmaidCareers.includes(slave.career) && slave.skillMM >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.farmerCareers.includes(slave.career) && slave.skillFA >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.madamCareers.includes(slave.career) && slave.skillMD >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.DJCareers.includes(slave.career) && slave.skillDJ >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.HGCareers.includes(slave.career) && slave.skillHG >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.recruiterCareers.includes(slave.career) && slave.skillRC >= V.masteredXP) {
			multiplier += 0.1;
		}
		if (!setup.servantCareers.includes(slave.career) && slave.skillS >= V.masteredXP) {
			multiplier += 0.05;
		}
		if (!setup.entertainmentCareers.includes(slave.career) && slave.skillE >= V.masteredXP) {
			multiplier += 0.05;
		}
		if (!setup.whoreCareers.includes(slave.career) && slave.skillW >= V.masteredXP) {
			multiplier += 0.05;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcMiscCost(slave) {
		let totalInt = Math.clamp(slave.intelligence + slave.intelligenceImplant,-130,130); /* make absolutely certain we do not use +-131 in the next line */
		multiplier += Math.floor((Math.asin(totalInt/131))*50)/50;
		if (slave.pubertyXY === 0 && slave.physicalAge >= V.potencyAge && slave.genes === "XY" && arcology.FSGenderRadicalist === "unset") {
			multiplier += 0.5;
		}
		if (slave.brand !== 0) {
			if (V.rep > 10000) {
				multiplier += 0.1;
			} else if (V.rep < 5000) {
				multiplier -= 0.1;
			}
		}
		if (slave.amp === 1) {
			multiplier -= 0.2;
		}
		if (slave.eyes === -2) {
			multiplier -= 0.2;
		}
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcIndentureCost(slave) {
		if (slave.indenture > -1) {
			multiplier -= 0.1*slave.indentureRestrictions;
			multiplier -= (260-slave.indenture)/260;
		} else if (V.seeAge === 1) {
			if (slave.actualAge >= (V.retirementAge-5) && V.PhysicalRetirementAgePolicy !== 1) {
				multiplier *= (V.retirementAge-slave.actualAge)/5;
			}
			if (slave.physicalAge >= (V.retirementAge-5) && V.PhysicalRetirementAgePolicy === 1) {
				multiplier *= (V.retirementAge-slave.actualAge)/5;
			}
		}
	}

	function calcCost(/*slave*/) {
		cost *= multiplier*50;
		cost = Number(cost) || 0;
		if (cost < V.minimumSlaveCost) {
			cost = V.minimumSlaveCost;
		} else if (cost <= 100000) {
			/* do nothing */
		} else if (cost <= 200000) {
			cost -= (cost-100000)*0.1;
		} else if (cost <= 300000) {
			cost -= 10000 + ((cost-200000)*0.2);
		} else if (cost <= 400000) {
			cost -= 30000 + ((cost-300000)*0.3);
		} else if (cost <= 500000) {
			cost -= 60000 + ((cost-400000)*0.4);
		} else {
			cost -= 100000 + ((cost-500000)*0.5);
		}
		if (cost < 1000) {
			cost = 1000;
		}
		cost = 500*Math.trunc(cost/500);
	}

	/** @param {App.Entity.SlaveState} slave */
	function calcStartingSlaveCost(slave) {
		let startingSlaveMultiplier = 0;

		if (slave.devotion > 20) {
			startingSlaveMultiplier += (0.000117*(slave.devotion-20)*(slave.devotion-20))+(0.003167*(slave.devotion-20));
		}
		if (slave.whoreSkill) {
			startingSlaveMultiplier += 0.00001*slave.whoreSkill*slave.whoreSkill;
		}
		if (slave.entertainSkill) {
			startingSlaveMultiplier += 0.00001*slave.entertainSkill*slave.entertainSkill;
		}
		if (slave.vaginalSkill) {
			startingSlaveMultiplier += 0.00001*slave.vaginalSkill*slave.vaginalSkill;
		}
		if (slave.analSkill) {
			startingSlaveMultiplier += 0.00001*slave.analSkill*slave.analSkill;
		}
		if (slave.oralSkill) {
			startingSlaveMultiplier += 0.00001*slave.oralSkill*slave.oralSkill;
		}
		if (slave.combatSkill) {
			startingSlaveMultiplier += 0.1;
		}
		if (slave.prestige) {
			startingSlaveMultiplier += slave.prestige;
		}
		if (startingSlaveMultiplier) {
			if (slave.actualAge > 25) {
				startingSlaveMultiplier -= startingSlaveMultiplier*(slave.actualAge-25)*0.05;
			}
		}
		startingSlaveMultiplier = Math.clamp(startingSlaveMultiplier, 0, 10);
		cost += cost*startingSlaveMultiplier;
		cost = 500*Math.trunc(cost/500);
		if (V.PC.career === "slaver") {
			cost = cost/2;
		}
	}

	return slaveCost;
})();

window.startingSlaveCost = /** @param {App.Entity.SlaveState} slave */ function startingSlaveCost(slave) {
	return slaveCost(slave, true);
};