:: Generate XY Slave [nobr]

<<BaseSlave>>
/% Defaults that differ from the old template %/
<<set $activeSlave.genes = "XY", $activeSlave.hLength = 10, $activeSlave.prostate = 1, $activeSlave.canRecruit = 1>>

<<set $activeSlave.publicCount = 0>>
<<if $activeSlaveOneTimeMaxAge > 998>>
  <<if $pedo_mode == 1>>
    <<set $activeSlaveOneTimeMaxAge = 18>>
  <<else>>
    <<set $activeSlaveOneTimeMaxAge = 42>>
  <</if>>
<<elseif $pedo_mode == 1 && $one_time_age_overrides_pedo_mode == 0 && $activeSlaveOneTimeMaxAge > 18>>
    <<set $activeSlaveOneTimeMaxAge = 18>>
<</if>>
<<if $retirementAge < $activeSlaveOneTimeMaxAge>>
    <<set $activeSlaveOneTimeMaxAge = ($retirementAge-1)>>
<</if>>
<<if $activeSlaveOneTimeMinAge < $minimumSlaveAge>>
  <<set $activeSlaveOneTimeMinAge = $minimumSlaveAge>>
<<elseif $pedo_mode == 1 && $one_time_age_overrides_pedo_mode == 0>>
  <<set $activeSlaveOneTimeMinAge = $minimumSlaveAge>>
<</if>>
<<if $activeSlaveOneTimeMaxAge < $activeSlaveOneTimeMinAge>>
  <<set $activeSlaveOneTimeMaxAge = $activeSlaveOneTimeMinAge>>
<</if>>
<<if ($activeSlaveOneTimeMaxAge >= 30) && ($FSMaturityPreferentialist != "unset")>>
  <<set $activeSlaveOneTimeMaxAge = ($activeSlaveOneTimeMaxAge + 10)>>
<</if>>
<<set $activeSlave.actualAge = random($activeSlaveOneTimeMinAge,$activeSlaveOneTimeMaxAge)>>
<<set $activeSlaveOneTimeMinAge = random($activeSlaveOneTimeMinAge,$activeSlaveOneTimeMaxAge)>>
<<if ($FSYouthPreferentialist != "unset") && ($FSYouthPreferentialist >= random (1, 100))>>
  <<set $activeSlave.actualAge = Math.min($activeSlave.actualAge, $activeSlaveOneTimeMinAge)>>
<<elseif ($FSMaturityPreferentialist != "unset") && ($FSMaturityPreferentialist >= random (1, 100))>>
  <<set $activeSlave.actualAge = Math.max($activeSlave.actualAge, $activeSlaveOneTimeMaxAge)>>
<</if>>
<<if $activeSlave.actualAge >= $retirementAge>>
	<<set $activeSlave.actualAge = ($retirementAge-2)>>
<</if>>
<<set $activeSlaveOneTimeMinAge = 0>>
<<set $activeSlaveOneTimeMaxAge = 999>>
<<set $one_time_age_overrides_pedo_mode = 0>>
<<set $activeSlave.visualAge = $activeSlave.actualAge>>
<<set $activeSlave.physicalAge = $activeSlave.actualAge>>
<<set $activeSlave.age = $activeSlave.actualAge>> /*compatability*/
<<set $activeSlave.pubertyAgeXX = $fertilityAge>>
<<if $activeSlave.ovaries == 1>>
	<<if $activeSlave.physicalAge >= $activeSlave.pubertyAgeXX>>
		<<set $activeSlave.pubertyXX = 1>>
	<<else>>
		<<set $activeSlave.pubertyXX = 0>>
	<</if>>
<<else>>
	<<set $activeSlave.pubertyXX = 0>>
<</if>>
<<set $activeSlave.ID = $IDNumber++>>
<<set $activeSlave.weekAcquired = $week>>

<<set $seed = random(1,100)>>
<<if $seed > 98>>
	<<set $activeSlave.intelligence = 3>>
<<elseif $seed > 85>>
	<<set $activeSlave.intelligence = 2>>
<<elseif $seed > 65>>
	<<set $activeSlave.intelligence = 1>>
<<elseif $seed > 35>>
	<<set $activeSlave.intelligence = 0>>
<<elseif $seed > 15>>
	<<set $activeSlave.intelligence = -1>>
<<elseif $seed > 5>>
	<<set $activeSlave.intelligence = -2>>
<<else>>
	<<set $activeSlave.intelligence = -3>>
<</if>>

<<if random(1,100) < 50+(20*$activeSlave.intelligence)>>
	<<set $activeSlave.intelligenceImplant = 1>>
<</if>>
<<if $AgePenalty == 1>>
	<<if ($activeSlave.actualAge < 16)>>
		<<set $activeSlave.career = $veryYoungCareers.random()>>
	<<elseif ($activeSlave.actualAge <= 24)>>
		<<set $activeSlave.career = $youngCareers.random()>>
	<<elseif ($activeSlave.intelligenceImplant == 1)>>
		<<set $activeSlave.career = $educatedCareers.random()>>
	<<else>>
		<<set $activeSlave.career = $uneducatedCareers.random()>>
	<</if>>
<<else>>
	<<if ($activeSlave.actualAge < 16)>>
		<<set $activeSlave.career = $veryYoungCareers.random()>>
	<<elseif ($activeSlave.intelligenceImplant == 1)>>
		<<set $activeSlave.career = $educatedCareers.random()>>
	<<elseif ($activeSlave.actualAge <= 24)>>
		<<set $activeSlave.career = $youngCareers.random()>>
	<<else>>
		<<set $activeSlave.career = $uneducatedCareers.random()>>
	<</if>>
<</if>>

<<set $activeSlave.vaginalSkill = 0>>
<<set $activeSlave.analSkill = random(0,15)>>
<<set $activeSlave.oralSkill = random(0,15)>>
<<set $activeSlave.entertainSkill = random(0,15)>>
<<set $activeSlave.whoreSkill = random(0,15)>>

<<set $activeSlave.energy = random(15,90)>>
<<RandomizeAttraction>>
<<set $activeSlave.fetishStrength = random(0,90)>>
<<set $activeSlave.fetish = either("none", "none", "none", "none", "none", "none", "none", "none", "none", "none", "none", "none", "none", "submissive", "cumslut", "humiliation", "buttslut", "buttslut", "boobs", "dom", "sadist", "masochist")>>

<<set $activeSlave.behavioralFlaw = either("none", "none", "none", "arrogant", "bitchy", "odd", "hates men", "hates men", "hates men", "hates women", "anorexic", "gluttonous", "devout", "liberated")>>
<<if ($activeSlave.behavioralFlaw is "devout")>>
	<<set $activeSlave.sexualFlaw = either("none", "repressed",  "shamefast", "apathetic", "crude", "judgemental")>>
<<else>>
	<<set $activeSlave.sexualFlaw = either("none", "none", "none", "none", "hates oral", "hates anal", "hates anal", "repressed", "idealistic", "shamefast", "apathetic", "crude", "judgemental")>>
<</if>>
<<if ($activeSlave.behavioralFlaw == "none") && random(1,10) == 1>>
	<<set $activeSlave.behavioralQuirk = either("confident", "cutting", "funny", "adores women", "adores men", "fitness", "insecure", "sinful", "advocate")>>
<</if>>
<<if ($activeSlave.sexualFlaw == "none") && random(1,10) == 1>>
	<<set $activeSlave.sexualQuirk = either("gagfuck queen", "painal queen", "strugglefuck queen", "tease", "romantic", "perverted", "caring", "unflinching", "size queen")>>
<</if>>

<<set $activeSlave.health = random(-50,50)>>

<<set $activeSlave.devotion = random(-90,-60)>>
<<set $activeSlave.trust = random(-45,-25)>>

/% Begin height replacement section. %/
/% Vanilla settings yield an average height of 172.5 cm, which is not representative for the world as a whole. %/
<<if random(1,2) == 1>>
	<<set $activeSlave.height = random(160,180)>>
<<else>>
	<<set $activeSlave.height = random(150,200)>>
<</if>>

/% Set height-based effects before adjusting height for nationality. %/
<<if $activeSlave.physicalAge <= 13>>
	<<if $activeSlave.height > 170>>
	  <<set $activeSlave.hips = either(-2, -1, -1, 0, 1)>>
	  <<set $activeSlave.shoulders = either(-1, -1, 0, 0, 0, 1)>>
	<<else>>
	  <<set $activeSlave.hips = either(-2, -2, -1, -1, 0)>>
	  <<set $activeSlave.shoulders = either(-2, -1, -1, 0, 0, 1)>>
	<</if>>
<<else>>
	<<if $activeSlave.height >= 170>>
		<<set $activeSlave.hips = either(-2, -1, -1, 0, 1)>>
		<<set $activeSlave.shoulders = either(-1, 0, 1, 1, 2, 2)>>
	<<else>>
		<<set $activeSlave.hips = either(-2, -2, -1, -1, 0)>>
		<<set $activeSlave.shoulders = either(-1, 0, 0, 1, 1, 2)>>
	<</if>>
<</if>>

<<if ($activeSlave.physicalAge > random(0,100))>>
	<<set $activeSlave.eyes = -1>>
	<<if random(0,100) > 90>>
		<<set $activeSlave.eyes = -2>>
	<</if>>
<</if>>

/% Since we use nationality for height effects we need to initialize it now instead of later on like in vanilla Free Cities. %/

<<if $fixedNationality == 0>>
	<<set $activeSlave.nationality = $nationalities.random()>>
<<else>>
	<<set $activeSlave.nationality = $fixedNationality>>
<</if>>
<<NationalityToRace $activeSlave>>
/* Corporate slavegen with race selection */
<<if passage() == "Slave Markets" && $slaveMarket == "corporate" && ($captureUpgradeRace != "unselected") && ($captureUpgradeRace != "none")>> 
	<<if $captureUpgradeRace == "mixed race">>
		<<set $activeSlave.race = "mixed race">>
	<<else>>
		<<set _capUpgradeCheck = State.variables[$captureUpgradeRace.toLowerCase().replace(/[ -]/g, '')+'Nationalities']>>
		<<set _capUpgradeNationalities = []>>
		<<for _i = 0; _i < _capUpgradeCheck.length; _i++>>
			<<set _capNation = _capUpgradeCheck[_i]>>
			<<if $nationalities.includes(_capNation)>>
				<<set _capUpgradeNationalities.push(_capNation)>>
			<</if>>
		<</for>>
		<<if _capUpgradeNationalities.length > 0>>
			<<set $activeSlave.nationality = _capUpgradeNationalities.random(), $activeSlave.race = $captureUpgradeRace>>
		<<else>>
			<<set $activeSlave.nationality = _capUpgradeCheck.random(), $activeSlave.race = $captureUpgradeRace>>
		<</if>>
	<</if>>
<</if>>
/* end Corporate slavegen with race selection */
<<NationalityToName $activeSlave>>
<<NationalityToAccent $activeSlave>>

<<set $seed = 172.5>>
<<if $activeSlave.race == "white">>
	<<set $seed = 177.6>>/% White people use European average if no country-specific figure available. %/
<</if>>

<<switch $activeSlave.nationality>>
<<case "American">>
	<<if $activeSlave.race == "white">>
		<<set $seed = 178.2>>
	<<elseif $activeSlave.race == "black">>
		<<set $seed = 177.4>>
	<<elseif ($activeSlave.race == "latina") or ($activeSlave.race == "asian")>>
		/% Averages are 172.4 and 172.3 which are close enough to default. %/
	<<else>>
		<<set $seed = 176.4>>
	<</if>>
<<case "Afghan">>
<<case "Argentinian">>
	<<set $seed = 174.46>>
<<case "Armenian">>
<<case "Australian">>
	<<set $seed = 175.6>>
<<case "Austrian">>
	<<set $seed = 179>>
<<case "Belarusian">>
	<<set $seed = 176.9>>
<<case "Belgian">>
	<<set $seed = 178.7>>
<<case "Bolivian">>
	<<set $seed = 160.0>>
<<case "Brazilian">>
	<<set $seed = 170.7>>
<<case "British">>
	<<set $seed = 175.3>>
<<case "Canadian">>
	<<set $seed = 175.1>>
<<case "Chilean">>
	<<set $seed = 169.6>>
<<case "Chinese">>
	<<set $seed = 167.1>>
<<case "Colombian">>
  <<set $seed = 170.6>>
<<case "Congolese">>
	<<set $seed = 158.9>>
<<case "Cuban">>
	<<set $seed = 168>>
<<case "Czech">>
	<<set $seed = 180.31>>
<<case "Danish">>
	<<set $seed = 180.4>>
<<case "Dominican">>
	<<set $seed = 168.4>>
<<case "Dutch">>
	<<set $seed = 181>>
<<case "Emirati">>
<<case "Egyptian">>
	<<set $seed = 170.3>>
<<case "Estonian">>
	<<set $seed = 179.1>>
<<case "Ethiopian">>
<<case "Finnish">>
	<<set $seed = 178.9>>
<<case "French">>
	<<set $seed = 175.6>>
<<case "German">>
	<<set $seed = 175.4>>
<<case "Ghanan">>
	<<set $seed = 169.5>>
<<case "Greek">>
	<<set $seed = 177>>
<<case "Guatemalan">>
<<case "Haitian">>
<<case "Hungarian">>
	<<set $seed = 176>>
<<case "Icelandic">>
<<case "Indian">>
	<<set $seed = 164.7>>
<<case "Indonesian">>
<<case "Iranian">>
	<<set $seed = 170.3>>
<<case "Iraqi">>
	<<set $seed = 165.4>>
<<case "Irish">>
  <<set $seed = 177>>
<<case "Israeli">>
	<<set $seed = 177>>
<<case "Italian">>
	<<set $seed = 176.5>>
<<case "Jamaican">>
	<<set $seed = 171.8>>
<<case "Japanese">>
	<<set $seed = 172>>
<<case "Jordanian">>
<<case "Kazakh">>
<<case "Kenyan">>
<<case "Korean">>
	<<if either(1,2,3) == 3>>
		<<set $seed = 165.6>>
	<<else>>
		<<set $seed = 170.7>>
	<</if>>
<<case "Lebanese">>
<<case "Libyan">>
<<case "Lithuanian">>
	<<set $seed = 177.2>>
<<case "Malaysian">>
	<<set $seed = 166.3>>
<<case "Malian">>
	<<set $seed = 171.3>>
<<case "Mexican">>
	<<set $seed = 167>>
<<case "Moroccan">>
<<case "Nepalese">>
<<case "Nigerian">>
	<<set $seed = 163.8>>
<<case "Norwegian">>
	<<set $seed = 179.63>>
<<case "Omani">>
<<case "Pakistani">>
	/% Default to India's figures. %/
	<<set $seed = 164.7>>
<<case "Peruvian">>
	<<set $seed = 164>>
<<case "Polish">>
	<<set $seed = 178.7>>
<<case "Portuguese">>
	<<set $seed = 173.9>>
<<case "Puerto Rican">>
	/% Average for U.S. Hispanics == 172.4. No adjustment necessary. %/
<<case "Romanian">>
	<<set $seed = 172>>
<<case "Russian">>
	<<set $seed = 177.2>>
<<case "Saudi">>
	<<set $seed = 168.9>>
<<case "Scottish">>
	<<set $seed = 177.6>>
<<case "Serbian">>
	<<set $seed = 182>>
<<case "Slovak">>
	<<set $seed = 179.4>>
<<case "Spanish">>
	<<set $seed = 173.1>>
<<case "Sudanese">>
<<case "Swedish">>
	<<set $seed = 181.5>>
<<case "Swiss">>
	<<set $seed = 178.2>>
<<case "Tanzanian">>
<<case "Thai">>
<<case "Tunisian">>
<<case "Turkish">>
	<<set $seed = 173.6>>
<<case "Ugandan">>
<<case "Ukrainian">>
<<case "Uzbek">>
<<case "Venezuelan">>
<<case "Vietnamese">>
	<<set $seed = 165.7>>
<<case "Yemeni">>
<<case "a New Zealander">>
	<<set $seed = 177>>
<<case "Zimbabwean">>
<<default>>
<</switch>>

/% Include adjustment factor for age. %/
<<if $activeSlave.physicalAge <= 15>>
  <<set $seed = interpolate(2,86,15,$seed * 170/178.0,$activeSlave.physicalAge)>>
<<elseif $activeSlave.physicalAge < 20>>
  <<set $seed = interpolate(15,$seed * 170.0/178.0,20,$seed,$activeSlave.physicalAge)>>
<</if>>

/% Adjust height and convert from decimal number to integer. %/
<<set $activeSlave.height = Math.round($activeSlave.height * $seed / 172.5)>>
/% End height replacement section. %/

<<set $activeSlave.weight = random(-100, 100)>>
<<if ($activeSlave.weight < -30)>>
	<<set $activeSlave.waist = random(-45,45)>>
<<elseif ($activeSlave.weight <= 30)>>
	<<set $activeSlave.waist = random(-15,65)>>
<<elseif $activeSlave.physicalAge < 13>>
	<<set $activeSlave.waist = random(-15,25)>>
<<else>>
	<<set $activeSlave.waist = random(5,100)>>
<</if>>

<<if ($activeSlave.intelligenceImplant == 1) && ($activeSlave.accent >= 3) && (3+$activeSlave.intelligence) > random(0,6)>>
	<<set $activeSlave.accent -= 1>>
<</if>>

<<set $seed = 4+$activeSlave.intelligence+$activeSlave.intelligenceImplant>>
<<if "American" == $activeSlave.nationality>>
	<<set $seed += 2>>
<<elseif ["Canadian", "Israeli", "Japanese", "Korean", "Irish", "Icelandic", "Finnish", "Swiss", "Danish", "Norwegian", "Austrian", "Slovak", "Dutch", "Belgian", "Czech", "Portuguese", "Hungarian", "Portuguese", "Estonian", "Polish", "Lithuanian", "Romanian", "German", "Swedish", "French", "Italian", "Spanish", "British", "Australian", "a New Zealander"].includes($activeSlave.nationality)>>
<<else>>
	<<set $seed -= 2>>
<</if>>
<<if random(1,$seed) == 1>>
	<<set $activeSlave.teeth = "crooked">>
<</if>>

<<switch $activeSlave.race>>
<<case "black">>
	<<set $activeSlave.butt = either(1, 1, 2, 3)>>
	<<set $activeSlave.boobs = either(100, 200, 200, 300, 300, 400, 500)>>
	<<set $activeSlave.lips = random(5,30)>>
	<<set $activeSlave.skin = either("black", "brown", "light brown")>>
	<<set $activeSlave.hColor = either("black", "black", "black", "brown")>>
	<<set $activeSlave.hStyle = either("neat", "crinkled")>>
<<case "white">>
	<<set $activeSlave.butt = either(1, 1, 2, 3)>>
	<<set $activeSlave.boobs = either(100, 200, 200, 300, 300, 400, 500)>>
	<<set $activeSlave.lips = random(5,25)>>
	<<if $activeSlave.nationality is "German">>
		<<set $activeSlave.skin = either("pale", "tanned", "fair")>>
		<<set $activeSlave.eyeColor = either("blue", "blue", "blue", "brown", "green")>>
		<<set $activeSlave.hColor = either("black", "blonde", "blonde", "blonde", "red", "brown")>>
	<<elseif $activeSlave.nationality is "Icelandic">>
		<<set $activeSlave.skin = either("pale", "pale", "tanned", "fair")>>
		<<set $activeSlave.eyeColor = either("blue", "blue", "blue", "brown", "green")>>
		<<set $activeSlave.hColor = either("black", "blonde", "blonde", "blonde", "red", "brown")>>
	<<elseif $activeSlave.nationality is "Irish">>
		<<set $activeSlave.skin = either("pale", "pale", "tanned", "fair")>>
		<<set $activeSlave.eyeColor = either("blue", "brown", "green", "green", "green")>>
		<<set $activeSlave.hColor = either("black", "blonde", "red", "red", "red", "brown")>>
	<<elseif $activeSlave.nationality == "Scottish">>
		<<set $activeSlave.skin = either("pale", "fair", "tanned", "fair")>>
		<<set $activeSlave.eyeColor = either("blue", "brown", "brown", "green", "green", "green")>>
		<<set $activeSlave.hColor = either("black", "black", "blonde", "red", "red", "red", "brown")>>
	<<else>>
		<<set $activeSlave.skin = either("pale", "tanned", "fair")>>
		<<set $activeSlave.eyeColor = either("blue", "brown", "green")>>
		<<set $activeSlave.hColor = either("black", "blonde", "red", "brown")>>
	<</if>>
	<<set $activeSlave.hStyle = "neat">>
<<case "latina">>
	<<set $activeSlave.butt = either(1, 1, 2, 3)>>
	<<set $activeSlave.boobs = either(100, 200, 200, 300, 300, 400, 500)>>
	<<set $activeSlave.lips = random(5,25)>>
	<<set $activeSlave.skin = either("olive", "brown", "light brown", "tanned", "fair")>>
	<<set $activeSlave.hColor = either("black", "black", "brown", "brown")>>
	<<set $activeSlave.hStyle = "neat">>
<<case "indo-aryan" "malay" "pacific islander" "amerindian">>
	<<set $activeSlave.butt = either(1, 1, 2, 3)>>
	<<set $activeSlave.boobs = either(100, 200, 200, 300, 300, 400, 500)>>
	<<set $activeSlave.lips = random(5,25)>>
	<<set $activeSlave.skin = either("dark", "light")>>
	<<set $activeSlave.hColor = either("black")>>
	<<set $activeSlave.hStyle = "neat">>
<<case "asian">>
	<<set $activeSlave.butt = either(1, 1, 2, 3)>>
	<<set $activeSlave.boobs = either(100, 200, 200, 300, 300, 400, 500)>>
	<<set $activeSlave.lips = random(5,25)>>
	<<set $activeSlave.skin = either("pale", "dark", "light")>>
	<<set $activeSlave.hColor = either("black")>>
	<<set $activeSlave.hStyle = "neat">>
<<case "middle eastern" "semitic" "southern European">>
	<<set $activeSlave.butt = either(1, 1, 2, 3)>>
	<<set $activeSlave.boobs = either(100, 200, 200, 300, 300, 400, 500)>>
	<<set $activeSlave.lips = random(5,25)>>
	<<set $activeSlave.skin = either("pale", "dark", "tanned", "light")>>
	<<set $activeSlave.hColor = either("black")>>
	<<set $activeSlave.hStyle = "neat">>
<<default>>
	<<set $activeSlave.butt = either(1, 1, 2, 3)>>
	<<set $activeSlave.boobs = either(100, 200, 200, 300, 300, 400, 500)>>
	<<set $activeSlave.lips = random(5,25)>>
	<<set $activeSlave.skin = either("pale", "dark", "light")>>
	<<set $activeSlave.hColor = either("black", "black", "black", "black", "brown", "brown", "blonde", "red")>>
	<<set $activeSlave.hStyle = "neat">>
<</switch>>
<<if $activeSlave.physicalAge > 55>>
	<<if random(1,100) > 40>>
		<<set $activeSlave.hStyle = "bald", $activeSlave.bald = 1>>
	<</if>>
<</if>>
<<if ($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")>>
	<<if random(1,4) == 1>>
	<<set $activeSlave.markings = either("freckles", "freckles", "freckles", "heavily freckled", "beauty mark", "beauty mark", "birthmark", "birthmark")>>
	<</if>>
<<elseif random(1,8) == 1>>
	<<set $activeSlave.markings = either("beauty mark", "birthmark")>>
<</if>>

<<set $activeSlave.origEye = $activeSlave.eyeColor>>
<<set $activeSlave.origHColor = $activeSlave.hColor>>
<<set $activeSlave.pubicHColor = $activeSlave.hColor>>
<<set $activeSlave.pubicHStyle = either("hairless", "bald", "bald", "waxed", "waxed", "waxed", "waxed", "waxed", "waxed", "in a strip", "in a strip", "in a strip", "neat", "neat", "neat", "neat", "neat", "neat", "bushy in the front and neat in the rear", "bushy in the front and neat in the rear", "bushy in the front and neat in the rear", "bushy", "bushy", "bushy", "bushy", "bushy", "bushy")>>
<<set $activeSlave.underArmHColor = $activeSlave.hColor>>
<<set $activeSlave.underArmHStyle = either("hairless", "bald", "bald", "waxed", "waxed", "waxed", "waxed", "shaved", "shaved", "shaved", "shaved", "shaved", "neat", "neat", "neat", "neat", "neat", "neat", "neat", "bushy", "bushy", "bushy", "bushy", "bushy")>>
<<if ($activeSlave.pubicHStyle == "hairless" || $activeSlave.underArmHStyle == "hairless") && random(1,100) > 40>>
	<<set $activeSlave.pubicHStyle = "hairless", $activeSlave.underArmHStyle = "hairless">>
<</if>>
<<set $seed = []>>
<<if $activeSlave.boobs > 250 && $activeSlave.boobs < 800>>
	<<set $seed.push("perky")>>
	<<set $seed.push("downward-facing")>>
<</if>>
<<if $activeSlave.boobs > 400 && $activeSlave.boobs < 1200>>
	<<set $seed.push("torpedo-shaped")>>
	<<set $seed.push("wide-set")>>
<</if>>
<<if $activeSlave.boobs > 800 && $activeSlave.physicalAge > random(10,50)>>
	<<set $seed.push("saggy")>>
<</if>>
<<if $seed.length == 1>>
	<<if random(1,2) != 1>>
	<<set $activeSlave.boobShape = $seed.random()>>
	<</if>>
<<elseif $seed.length > 1>>
	<<if random(1,3) != 1>>
	<<set $activeSlave.boobShape = $seed.random()>>
	<</if>>
<</if>>

<<set $activeSlave.earPiercing = either(0,0,0,1)>>
<<set $activeSlave.nosePiercing = either(0,0,0,0,1)>>
<<set $activeSlave.eyebrowPiercing = either(0,0,0,0,0,1)>>
<<set $activeSlave.dickPiercing = either(0,0,0,0,0,1)>>
<<set $activeSlave.lipsPiercing = either(0,0,0,0,0,1)>>
<<set $activeSlave.navelPiercing = either(0,0,0,0,1)>>
<<set $activeSlave.nipplesPiercing = either(0,0,0,0,1)>>

<<set $activeSlave.face = random(-70,20)>>
<<if random(0,2) == 1>><<set $activeSlave.face = random(-40,-10)>><</if>>
<<if $activeSlave.physicalAge > 40>>
	<<set $activeSlave.face -= random(0,20)>>
<<elseif $activeSlave.physicalAge > 35>>
	<<set $activeSlave.face -= random(0,10)>>
<<elseif $activeSlave.physicalAge <= 20>>
	<<set $activeSlave.face += random(0,20)>>
<<elseif $activeSlave.physicalAge <= 25>>
	<<set $activeSlave.face += random(0,10)>>
<</if>>
<<if $activeSlave.physicalAge >= 17>>
	<<set $activeSlave.faceShape = either("masculine", "masculine", "masculine", "androgynous")>>
<<elseif $activeSlave.physicalAge >= 15>>
	<<set $activeSlave.faceShape = either("masculine", "masculine", "masculine", "masculine", "masculine", "masculine", "masculine", "masculine", "androgynous", "sensual", "exotic", "normal")>>
<<elseif $activeSlave.physicalAge >= 13>>
	<<set $activeSlave.faceShape = either("masculine", "masculine", "masculine", "androgynous", "cute", "sensual", "exotic", "normal")>>
<<elseif $activeSlave.physicalAge >= 11>>
	<<set $activeSlave.faceShape = either("masculine", "androgynous", "cute", "sensual", "exotic", "normal", "normal")>>
<<else>>
	<<set $activeSlave.faceShape = either("androgynous", "androgynous", "cute", "cute", "sensual", "exotic", "normal", "normal")>>
<</if>>
<<switch $activeSlave.faceShape>>
<<case "sensual" "cute">>
	<<set $activeSlave.face += random(0,20)>>
<<case "exotic" "androgynous">>
	<<set $activeSlave.face += random(-10,10)>>
<<case "masculine">>
	<<set $activeSlave.face += random(-10,0)>>
<</switch>>

<<if $activeSlave.boobs < 250>>
	<<set $activeSlave.nipples = either("tiny", "tiny", "tiny", "tiny", "cute", "cute", "puffy", "partially inverted")>>
<<elseif $activeSlave.boobs < 500>>
	<<set $activeSlave.nipples = either("tiny", "cute", "cute", "cute", "puffy", "partially inverted")>>
<<elseif $activeSlave.boobs < 1000>>
	<<set $activeSlave.nipples = either("tiny", "cute", "cute", "cute", "puffy", "puffy", "partially inverted", "inverted")>>
<<else>>
	<<set $activeSlave.nipples = either("cute", "puffy", "partially inverted", "inverted", "huge")>>
<</if>>

<<set $activeSlave.vagina = -1>>
<<set $activeSlave.clit = 0>>
<<set $activeSlave.preg = 0>>

<<set $activeSlave.dick = either(1, 2, 2, 2, 3, 3, 3, 4, 4, 5)>>
<<if $seeExtreme == 1>>
	<<set $activeSlave.balls = either(0, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5)>>
<<else>>
	<<set $activeSlave.balls = either(1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5)>>
<</if>>
<<set $activeSlave.scrotum = $activeSlave.balls>>

<<set $activeSlave.pubertyAgeXY = $potencyAge>>
<<if $activeSlave.balls > 0>>
	<<if $activeSlave.physicalAge >= $activeSlave.pubertyAgeXY>>
		<<set $activeSlave.pubertyXY = 1>>
	<<else>>
		<<set $activeSlave.pubertyXY = 0>>
	<</if>>
<<else>>
	<<set $activeSlave.pubertyXY = 0>>
<</if>>

/% Begin circumcision rate replacement section. %/
/% The default rate of 50% is wildly unrepresentative, and there is extreme regional variation. %/
/%
 What we want is the prevalence among newborns, since this game
 happens about 20 years in the future, but we'll use this lacking
 something better.
 https://pophealthmetrics.biomedcentral.com/articles/10.1186/s12963-016-0073-5
 Right now we mostly just break it down by country.
 It would be better to break it down by both country
 and race if statistics are available.
%/
<<if ($seeCircumcision == 0)>>
	<<set $activeSlave.foreskin = $activeSlave.dick + random(0,1)>>
<<else>>
	/% Temporarily use activeSlave.foreskin to store the chance of circumcision. %/
	<<switch $activeSlave.nationality>>
	<<case "Iranian" "Moroccan" "Afghan" "Tunisian">>
		<<set $activeSlave.foreskin = 100>>
	<<case "Turkish" "Nigerian" "Iraqi" "Yemeni" "Jordanian">>
		<<set $activeSlave.foreskin = 99>>
	<<case "Algerian">>
		<<set $activeSlave.foreskin = 98>>
	<<case "Saudi" "Uzbek" "Libyan">>
		<<set $activeSlave.foreskin = 97>>
	<<case "Congolese" "Pakistani">>
		/% Population-weighted average of Democratic Republic of Congo and Republic of Congo %/
		<<set $activeSlave.foreskin = 96>>
	<<case "Egyptian">>
		<<set $activeSlave.foreskin = 95>>
	<<case "Indonesian" "Bangladeshi">>
		<<set $activeSlave.foreskin = 93>>
	<<case "Israeli" "Ghanan" "Ethiopian" "Filipina">>
		<<set $activeSlave.foreskin = 92>>
	<<case "Kenyan">>
		<<set $activeSlave.foreskin = 91>>
	<<case "Omani">>
		<<set $activeSlave.foreskin = 88>>
	<<case "Malian">>
		<<set $activeSlave.foreskin = 86>>
	<<case "American")>>
		<<set $activeSlave.foreskin = 77>>
	<<case "Emirati">>
		<<set $activeSlave.foreskin = 76>>
	<<case "Tanzanian">>
		<<set $activeSlave.foreskin = 72>>
	<<case "Malaysian">>
		<<set $activeSlave.foreskin = 61>>
	<<case "Lebanese">>
		<<set $activeSlave.foreskin = 60>>
	<<case "Kazakh">>
		<<set $activeSlave.foreskin = 56>>
	<<case "Korean">>
		/% Population-weighted average of South Korea and North Korea. %/
		<<set $activeSlave.foreskin = 52>>
	<<case "South African">>
		<<set $activeSlave.foreskin = 45>>
	<<case "Dominican">>
		<<set $activeSlave.foreskin = 43>>
	<<case "Mexican">>
		<<set $activeSlave.foreskin = 38>>
	<<case "Sudanese">>
		/% Population-weighted average of Sudan and South Sudan. %/
		<<set $activeSlave.foreskin = 36>>
	<<case "a New Zealander">>
		<<set $activeSlave.foreskin = 33>>
	<<case "Scottish">>
		<<set $activeSlave.foreskin = 28>>
	<<case "Ugandan" "Australian">>
		<<set $activeSlave.foreskin = 27>>
	<<case "Belgian" "Thai">>
		<<set $activeSlave.foreskin = 23>>
	<<case "British">>
		<<set $activeSlave.foreskin = 21>>
	<<case "Puerto Rican">>
		<<set $activeSlave.foreskin = 20>>
	<<case "Jamaican" "French" "Chinese" "Indian">>
		<<set $activeSlave.foreskin = 14>>
	<<case "Russian">>
		<<set $activeSlave.foreskin = 12>>
	<<case "German">>
		<<set $activeSlave.foreskin = 11>>
	<<case "Belarusian">>
		<<set $activeSlave.foreskin = 10>>
	<<case "Zimbabwean" "Japanese">>
		<<set $activeSlave.foreskin = 9>>
	<<case "Haitian" "Spanish">>
		<<set $activeSlave.foreskin = 7>>
	<<case "Dutch" "Austrian" "Swiss">>
		<<set $activeSlave.foreskin = 6>>
	<<case "Danish" "Swedish" "Greek">>
		<<set $activeSlave.foreskin = 5>>
	<<case "Peruvian" "Serbian" "Nepalese" "Burmese">>
		<<set $activeSlave.foreskin = 4>>
	<<case "Italian" "Norwegian" "Argentinian">>
		<<set $activeSlave.foreskin = 3>>
	<<case "Ukrainian">>
		<<set $activeSlave.foreskin = 2>>
	<<case "Portuguese" "Hungarian" "Irish" "Finnish" "Brazilian">>
			<<set $activeSlave.foreskin = 1>>
	<<case "Cuban" "Guatemalan" "Chilean" "Bolivian" "Venezuelan" "Lithuanian" "Slovak" "Czech" "Romanian" "Estonian" "Icelandic" "Polish" "Colombian" "Armenian" "Vietnamese">>
		<<set $activeSlave.foreskin = 0>>
	<<default>>
		/% Some overlooked country, or possibly stateless. Use global average. %/
		<<set $activeSlave.foreskin = 38>>
	<</switch>>
	/% Second pass for minorities in other countries. %/
	<<if ($activeSlave.race == "middle eastern") && ($activeSlave.foreskin < 76)>>
		<<set $activeSlave.foreskin = 76>>
	<</if>>
	<<if ($activeSlave.race == "semitic") && ($activeSlave.foreskin < 90)>>
		<<set $activeSlave.foreskin = 90>>
	<</if>>
	/% Chance activeSlave.foreskin back to the normal meaning. %/
	<<if (random(0,99) < $activeSlave.foreskin)>>
		<<set $activeSlave.foreskin = 0>>
	<<else>>
		<<set $activeSlave.foreskin = $activeSlave.dick + random(0,1)>>
	<</if>>
<</if>>
/% End circumcision rate replacement section. %/
<<if $activeSlave.balls == 0>>
	<<if random(0,1) == 1 && $activeSlave.faceShape == "masculine">>
		<<set $activeSlave.faceShape = either("androgynous", "cute")>>
	<</if>>
<<else>>
	<<set $activeSlave.scrotum = $activeSlave.balls += either(0, 0, 1)>>
<</if>>

<<if $activeSlave.balls > 2>>
	<<set $activeSlave.voice = 1>>
<<elseif $activeSlave.balls > 0>>
	<<set $activeSlave.voice = either(1, 1, 2)>>
<<else>>
	<<set $activeSlave.voice = either(1, 2, 2)>>
<</if>>

<<if $activeSlave.attrXY > 0>>
	<<set $activeSlave.anus = either(0, 1, 2)>>
<<else>>
	<<set $activeSlave.anus = either(0, 0, 0, 1, 1, 2)>>
<</if>>
<<set $activeSlave.analArea = $activeSlave.anus + either(0, 0, 0, 1)>>

<<if $activeSlave.anus == 0>>
	<<set $activeSlave.analSkill = 0>>
<<elseif random(1,4) == 1>>
	<<set $activeSlave.anusTat = "bleached">>
<</if>>

/%pedoshit%/
<<if $activeSlave.physicalAge <= 13>>
	<<set $activeSlave.dick = either(1, 1, 1, 1, 2, 2, 2, 3)>>	
	<<set $activeSlave.balls = either(0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3)>>
	<<set $activeSlave.scrotum = $activeSlave.balls>>
	<<set $activeSlave.anus = either(0, 0, 0, 0, 0, 1)>>
<<elseif $activeSlave.physicalAge <= 15>>
	<<set $activeSlave.dick = either(1, 1, 1, 2, 2, 2, 3)>>
	<<set $activeSlave.balls = either(0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4)>>
	<<set $activeSlave.scrotum = $activeSlave.balls>>
	<<set $activeSlave.anus = either(0, 0, 0, 0, 1, 1, 1)>>
<<elseif $activeSlave.physicalAge <= 17>>
	<<set $activeSlave.dick = either(1, 1, 2, 2, 3, 3)>>
	<<set $activeSlave.balls = either(0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5)>>
	<<set $activeSlave.scrotum = $activeSlave.balls>>
	<<set $activeSlave.anus = either(0, 0, 0, 1, 1, 1)>>
<</if>>

<<if ($activeSlave.physicalAge <= 13)>>
	<<set $activeSlave.butt = either(1, 1, 1, 2, 2, 3, 3, 4)>>
<</if>>

<<if ($activeSlave.physicalAge <= 11)>>
	<<set $activeSlave.voice = either(2, 2, 2, 3, 3, 3, 3, 3, 3)>>
<<elseif ($activeSlave.physicalAge <= 13)>>
	<<set $activeSlave.voice = either(1, 1, 2, 2, 2, 2, 2, 3, 3)>>
<<elseif ($activeSlave.physicalAge <= 16)>>
	<<set $activeSlave.voice = either(1, 1, 1, 2, 2, 2, 2, 2, 3)>>
<</if>>

<<if passage() == "Slave Markets" && $slaveMarket == "corporate">>
	<<if ($captureUpgradeRace != "unselected") && ($captureUpgradeRace != "none")>>
	<<if $activeSlave.race != $captureUpgradeRace>>
        <<set $slaveMarket = "corporate">>
        <<goto "Slave Markets">>
	<</if>>
	<</if>>
<</if>>
