code:
:: Slave Assignments Report [nobr]

 <<print $arcologies[0].name + " Weekly Report - Week " + $week>>

<<set $nextLink to "Economics", $nextButton to "Continue">>

<<for _i to 0; _i < $slaves.length; _i++>>

/* PATCH, remove after 0.9.10 */
<<if $slaves[_i].fetish == "sub">>
	<<set $slaves[_i].fetish = "submissive">>
<</if>>

<<if ndef $slaves[_i].whoreSkill>>
	@@color:yellow;Reset bad whore skill for $slaves[_i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[_i].whoreSkill to 0>>
<</if>>
<<if ndef $slaves[_i].entertainSkill>>
	@@color:yellow;Reset bad entertain skill for $slaves[_i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[_i].entertainSkill to 0>>
<</if>>
<<if ndef $slaves[_i].vaginalSkill>>
	@@color:yellow;Reset bad vaginal skill for $slaves[_i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[_i].vaginalSkill to 0>>
<</if>>
<<if ndef $slaves[_i].analSkill>>
	@@color:yellow;Reset bad anal skill for $slaves[_i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[_i].analSkill to 0>>
<</if>>
<<if ndef $slaves[_i].oralSkill>>
	@@color:yellow;Reset bad skill for $slaves[_i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[_i].oralSkill to 0>>
<</if>>

<<if ($seeDicks > 0) && ($slaves[_i].dick > 0) && ($slaves[_i].balls > 0) && ($slaves[_i].hormones <= 0) && ($slaves[_i].dickAccessory != ("chastity")) && ($slaves[_i].releaseRules != "restrictive")>>
	<<set $averageDick += $slaves[_i].dick, $slavesWithWorkingDicks++>>
<</if>>

<<switch $slaves[_i].assignment>>
<<case "be your Head Girl">>
	<<set $HeadGirl to $slaves[_i]>>
	<<if $HeadGirl.fetish is "mindbroken">>
		''__@@color:pink;$HeadGirl.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your head girl any more.@@

		<<set $HeadGirl to 0>>
	<<elseif canTalk($HeadGirl) == false>>
		''__@@color:pink;$HeadGirl.slaveName@@__'' can't give slaves verbal orders @@color:yellow;and cannot serve as your head girl any more.@@

		<<set $HeadGirl to 0>>
	<<elseif canWalk($HeadGirl) != true>>
		''__@@color:pink;$HeadGirl.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your head girl any more.@@

		<<set $HeadGirl to 0>>
	<<elseif canSee($HeadGirl) != true>>
		''__@@color:pink;$HeadGirl.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your head girl any more.@@

		<<set $HeadGirl to 0>>
	<<elseif $HeadGirl.preg > 31 && $HeadGirl.pregType is 50>>
		''__@@color:pink;$HeadGirl.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your head girl any longer@@.
		<<set $HeadGirl to 0>>
	<<elseif $HeadGirl.devotion <= 20>>
		''__@@color:pink;$HeadGirl.slaveName@@__'' is no longer even accepting of you, @@color:yellow;and cannot serve as your head girl any more.@@

		<<set $HeadGirl to 0>>
	<</if>>
	<<if $HeadGirl != 0>>
		<<set $HGEnergy++>>
		<<if $HeadGirl.balls > 0>>
			<<set $HGBalls to 1>>
		<</if>>
		<<if $arcologies[0].FSChineseRevivalistLaw == 1>>
			<<set $HGEnergy++>>
		<</if>>
		<<if $personalAttention is "HG">>
			<<if $HeadGirl.trust > 95>>
				<<set $HGEnergy += 2>>
			<<else>>
				<<set $HGEnergy++>>
			<</if>>
		<</if>>
		<<if canAchieveErection($HeadGirl)>>
			<<set $HGCum = 2+Math.trunc(($HeadGirl.balls/5)+($HeadGirl.energy/95)+($HeadGirl.health/95)+($HeadGirl.devotion/95))>>
		<</if>>
	<<else>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "live with your Head Girl">>
	<<if random(-30,20) <= $slaves[_i].devotion>>
		<<set $HGSlaveSuccess++, $HGEnergy++>>
	<<else>>
		<<set $HGSlaveSuccess-->>
	<</if>>
<<case "recruit girls">>
	<<set $Recruiter to $slaves[_i]>>
	<<if $Recruiter.fetish is "mindbroken">>
		''__@@color:pink;$Recruiter.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your recruiter any more.@@

		<<set $Recruiter to 0>>
	<<elseif canTalk($Recruiter) == false>>
		''__@@color:pink;$Recruiter.slaveName@@__'' can't verbally entice marks @@color:yellow;and cannot serve as your recruiter any more.@@

		<<set $Recruiter to 0>>
	<<elseif $Recruiter.preg > 31 && $Recruiter.pregType is 50>>
		''__@@color:pink;$Recruiter.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your recruiter any longer@@.
		<<set $Recruiter to 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<<elseif canWalk($Recruiter) != true>>
		''__@@color:pink;$Recruiter.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your recruiter any more.@@

		<<set $Recruiter to 0>>
	<<elseif canSee($Recruiter) != true>>
		''__@@color:pink;$Recruiter.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your recruiter any more.@@

		<<set $Recruiter to 0>>
	<</if>>
	<<if $Recruiter == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be the Madam">>
	<<set $Madam to $slaves[_i]>>
	<<if canTalk($Madam) == false>>
		''__@@color:pink;$Madam.slaveName@@__'' can't give whores verbal orders @@color:yellow;and cannot serve as your Madam any more.@@

		<<set $Madam to 0>>
	<<elseif $Madam.preg > 31 && $Madam.pregType is 50>>
		''__@@color:pink;$Madam.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your Madam any longer@@.
		<<set $Madam to 0>>
	<<elseif $Madam.fetish is "mindbroken">>
		''__@@color:pink;$Madam.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your Madam any more.@@

		<<set $Madam to 0>>
	<<elseif canWalk($Madam) != true>>
		''__@@color:pink;$Madam.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your Madam any more.@@

		<<set $Madam to 0>>
	<<elseif canSee($Madam) != true>>
		''__@@color:pink;$Madam.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your Madam any more.@@

		<<set $Madam to 0>>
	<</if>>
	<<if $Madam == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be the DJ">>
	<<set $DJ to $slaves[_i]>>
	<<if canTalk($DJ) == false>>
		''__@@color:pink;$DJ.slaveName@@__'' can't speak @@color:yellow;and cannot serve as your DJ any more.@@

		<<set $DJ to 0>>
	<<elseif $DJ.preg > 31 && $DJ.pregType is 50>>
		''__@@color:pink;$DJ.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your DJ any longer@@.
		<<set $DJ to 0>>
	<<elseif $DJ.fetish is "mindbroken">>
		''__@@color:pink;$DJ.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your DJ any more.@@

		<<set $DJ to 0>>
	<<elseif canWalk($DJ) != true>>
		''__@@color:pink;$DJ.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your DJ any more.@@

		<<set $DJ to 0>>
	<</if>>
	<<if $DJ == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be the Milkmaid">>
	<<set $Milkmaid to $slaves[_i]>>
	<<if $Milkmaid.fetish is "mindbroken">>
		''__@@color:pink;$Milkmaid.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your Milkmaid any more.@@

		<<set $Milkmaid to 0>>
	<<elseif $Milkmaid.preg > 31 && $Milkmaid.pregType is 50>>
		''__@@color:pink;$Milkmaid.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your Milkmaid any longer@@.
		<<set $Milkmaid to 0>>
	<<elseif canWalk($Milkmaid) != true>>
		''__@@color:pink;$Milkmaid.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your Milkmaid any more.@@

		<<set $Milkmaid to 0>>
	<<elseif canSee($Milkmaid) != true>>
		''__@@color:pink;$Milkmaid.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your Milkmaid any more.@@

		<<set $Milkmaid to 0>>
	<</if>>
	<<if $Milkmaid == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be the Stewardess">>
	<<set $Stewardess to $slaves[_i]>>
	<<if canTalk($Stewardess) == false>>
		''__@@color:pink;$Stewardess.slaveName@@__'' can't give servants verbal orders @@color:yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess to 0>>
	<<elseif $Stewardess.preg > 31 && $Stewardess.pregType is 50>>
		''__@@color:pink;$Stewardess.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your Stewardess any longer@@.
		<<set $Stewardess to 0>>
	<<elseif $Stewardess.fetish is "mindbroken">>
		''__@@color:pink;$Stewardess.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess to 0>>
	<<elseif canWalk($Stewardess) != true>>
		''__@@color:pink;$Stewardess.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess to 0>>
	<<elseif canSee($Stewardess) != true>>
		''__@@color:pink;$Stewardess.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess to 0>>
	<</if>>
	<<if $Stewardess == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be the Schoolteacher">>
	<<set $Schoolteacher to $slaves[_i]>>
	<<if canTalk($Schoolteacher) == false>>
		''__@@color:pink;$Schoolteacher.slaveName@@__'' can't give verbal instruction @@color:yellow;and cannot serve as your Schoolteacher any more.@@

		<<set $Schoolteacher to 0>>
	<<elseif $Schoolteacher.preg > 31 && $Schoolteacher.pregType is 50>>
		''__@@color:pink;$Schoolteacher.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your Schoolteacher any longer@@.
		<<set $Schoolteacher to 0>>
	<<elseif $Schoolteacher.fetish is "mindbroken">>
		''__@@color:pink;$Schoolteacher.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your Schoolteacher any more.@@

		<<set $Schoolteacher to 0>>
	<<elseif canSee($Schoolteacher) != true>>
		''__@@color:pink;$Schoolteacher.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your Schoolteacher any more.@@

		<<set $Schoolteacher to 0>>
	<</if>>
	<<if $Schoolteacher == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be the Wardeness">>
	<<set $Wardeness to $slaves[_i]>>
	<<if canWalk($Wardeness) != true>>
		''__@@color:pink;$Wardeness.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your Wardeness any more.@@

		<<set $Wardeness to 0>>
	<<elseif $Wardeness.preg > 31 && $Wardeness.pregType is 50>>
		''__@@color:pink;$Wardeness.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your Wardeness any longer@@.
		<<set $Wardeness to 0>>
	<<elseif canSee($Wardeness) != true>>
		''__@@color:pink;$Wardeness.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your Wardeness any more.@@

		<<set $Wardeness to 0>>
	<</if>>
	<<if $Wardeness == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be the Attendant">>
	<<set $Attendant to $slaves[_i]>>
	<<if $Attendant.fetish is "mindbroken">>
		''__@@color:pink;$Attendant.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your Attendant any more.@@

		<<set $Attendant to 0>>
	<<elseif $Attendant.preg > 31 && $Attendant.pregType is 50>>
		''__@@color:pink;$Attendant.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your Attendant any longer@@.
		<<set $Attendant to 0>>
	<<elseif canWalk($Attendant) != true>>
		''__@@color:pink;$Attendant.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your Attendant any more.@@

		<<set $Attendant to 0>>
	<</if>>
	<<if $Attendant == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be the Nurse">>
	<<set $Nurse to $slaves[_i]>>
	<<if $Nurse.fetish is "mindbroken">>
		''__@@color:pink;$Nurse.slaveName@@__'' is mindbroken @@color:yellow;and cannot serve as your Nurse any more.@@

		<<set $Nurse to 0>>
	<<elseif $Nurse.preg > 31 && $Nurse.pregType is 50>>
		''__@@color:pink;$Nurse.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your Nurse any longer@@.
		<<set $Nurse to 0>>
	<<elseif canWalk($Nurse) != true>>
		''__@@color:pink;$Nurse.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your Nurse any more.@@

		<<set $Nurse to 0>>
	<<elseif canSee($Nurse) != true>>
		''__@@color:pink;$Nurse.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your Nurse any more.@@

		<<set $Nurse to 0>>
	<</if>>
	<<if $Nurse == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "guard you">>
	<<set $Bodyguard to $slaves[_i]>>
	<<if canWalk($Bodyguard) != true>>
		''__@@color:pink;$Bodyguard.slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot serve as your bodyguard any more.@@

		<<set $Bodyguard to 0>>
	<<elseif $Bodyguard.preg > 31 && $Bodyguard.pregType is 50>>
		''__@@color:pink;$Bodyguard.slaveName@@__'' spends so much time giving birth and laboring that @@color:yellow;she cannot effectively serve as your bodyguard any longer@@.
		<<set $Bodyguard to 0>>
	<<elseif canSee($Bodyguard) != true>>
		''__@@color:pink;$Bodyguard.slaveName@@__'' can no longer see @@color:yellow;and cannot serve as your Bodyguard any more.@@

		<<set $Bodyguard to 0>>
	<</if>>
	<<if $Bodyguard == 0>>
		<<set $slaves[_i].assignment to "rest", $slaves[_i].assignmentVisible to 1>>
	<</if>>
<<case "be your Concubine">>
	<<set $Concubine to $slaves[_i], $fuckSlaves++>>
<<case "serve in the master suite" "please you">>
	<<set $fuckSlaves++>>
<</switch>>

<<if $Lurcher>>
	<<if $slaves[_i].ID is $Lurcher.ID>>
		<<set $Lurcher to $slaves[_i]>>
		<<if canWalk($Lurcher) != true>>
			''__@@color:pink;$Lurcher.slaveName@@__'' is no longer able to run @@color:yellow;and cannot course as a lurcher.@@

			<<set $Lurcher to 0>>
		<<elseif $Lurcher.preg > 31 && $Lurcher.pregType >= 10>>
			''__@@color:pink;$Lurcher.slaveName@@__'' is too pregnant to run @@color:yellow;and cannot course as a lurcher.@@
			<<set $Lurcher to 0>>
		<</if>>
	<</if>>
<</if>>

<<if $fighterIDs.contains($slaves[_i])>>
	<<if canWalk($slaves[_i]) != true>>
		''__@@color:pink;$slaves[_i].slaveName@@__'' is no longer independently mobile @@color:yellow;and cannot fight any more.@@ She has been removed from $pitName roster
.
		<<for _k to 0; _k < $fighterIDs.length; _k++>>
		<<if $slaves[_i].ID == $fighterIDs[_k]>>
			<<set $dump to $fighterIDs.pluck([_k],[_k])>>
			<<set _k-->>
		<</if>>
		<</for>>
	<</if>>
<</if>>

<<if $slaves[_i].origin>>
<<set $toSearch to $slaves[_i].origin>>
<<if $toSearch.indexOf("Slave Shelter") != -1>>
	<<set $shelterGirlsIDs.push($slaves[_i].ID)>>
<</if>>
<</if>>

<<if $slaves[_i].bellyPain != 0>>
	<<set $slaves[_i].bellyPain = 0>>
<</if>>
/* preg speed control changes*/
<<if $slaves[_i].preg > 0>>
	<<if $slaves[_i].pregControl == "slow gestation">>
		<<set $slaves[_i].preg += 0.5>>
		<<set $slaves[_i].preg = (Math.ceil($slaves[_i].preg*10)/10)>> /* trick to avoid precission lost error showed like week: 29.499999999999998*/
	<<elseif $slaves[_i].pregControl == "speed up">>
		<<set $slaves[_i].preg += 2>>
	<<else>>
		<<set $slaves[_i].preg++>>
	<</if>>
<</if>>
/* end of preg speed control changes*/
<<if ($slaves[_i].scars == 3)>>
	<<set $slaves[_i].scarheal += 1>>
<</if>>

<</for>>
<<if $averageDick > 0>><<set $averageDick to $averageDick/$slavesWithWorkingDicks>><</if>>
<<set $freeSexualEnergy = $PC.sexualEnergy-$fuckSlaves>>
<<if $freeSexualEnergy > 0>>
<<if $freeSexualEnergy > $slavesVisible/2>>
	<<set $freeSexualEnergy = 3>>
<<elseif $freeSexualEnergy > $slavesVisible/4>>
	<<set $freeSexualEnergy = 2>>
<<else>>
	<<set $freeSexualEnergy = 1>>
<</if>>
<</if>>

/**
 * Accordion
 * @version 0.7RC
 * @author 000-250-006
 *
 * @param array _facListArr $args
 *     Multidimensional temporary array
 *     0: The passage name for the facility's report
 *     1: The facility name capitalized (@see todo)
 *     2: max number of slaves allowed in facility - > 0 implies open
 *     3: number of slaves assigned to facility
 *     4: ID of the slave assigned to run the facility ("Boss")
 *     5: Text title of the Boss
 *
 * @todo This is a proof of concept construct, if it works and cuts overhead, intended to create an object
 *      for deeper use in multiple locations, including streamlining reports/facilities code to one widget
 * @todo Figure out if this would be better as an object rather than an array for overhead
 *       StoryInit also?
 * @todo Figure out why we're not using ndef/-1 for a bunch of these story variables. Leaky conditionals
 * @todo Figure out why we're using variable space with capitalized facility names when we can parse it from true name
 */

<<set _facListArr to [
    ["Brothel Report", $brothelNameCaps, $brothel, $brothelSlaves, $Madam, "Madam"],
    ["Club Report", $clubNameCaps, $club, $clubSlaves, $DJ, "DJ"],
    ["Arcade Report", $arcadeNameCaps, $arcade, $arcadeSlaves, -1, -1],
    ["Dairy Report", $dairyNameCaps, $dairy, $dairySlaves, $Milkmaid, "Milkmaid"],
    ["Servants' Quarters Report", $servantsQuartersNameCaps, $servantsQuarters, $servantsQuartersSlaves, $Stewardess, "Stewardess"],
    ["Schoolroom Report", $schoolroomNameCaps, $schoolroom, $schoolroomSlaves, $Schoolteacher, "Schoolteacher"],
    ["Spa Report", $spaNameCaps, $spa, $spaSlaves, $Attendant, "Attendant"],
    ["Clinic Report", $clinicNameCaps, $clinic, $clinicSlaves, $Nurse, "Nurse"],
    ["Cellblock Report", $cellblockNameCaps, $cellblock, $cellblockSlaves, $Wardeness, "Wardeness"],
    ["Incubator Report", $incubatorNameCaps, $incubator, $incubatorSlaves, -1, -1],
    ["Master Suite Report", $masterSuiteNameCaps, $masterSuite, $masterSuiteSlaves, $Concubine, "Concubine"]
]>>

<<for _ii to 0; _ii lt _facListArr.length; _ii++>>
    <<set _facSubArr to _facListArr[_ii]>>
    <<if _facSubArr[2] > 0>>                                                                                /** Do we have one of these? */
        <<if $useAccordion > 0>><<set _accText to " accordion">><</if>>                                                 /** Quick settings check - static or pretty tops? */
        <<if (_facSubArr[3] eq 0) && (_facSubArr[4] eq 0)>>                                                   /** Do we have anyone inside? */
            <<= '
' + _facSubArr[1] + ' is currently unstaffed
'>>    /** Display the "Unstaffed" facility header bar */
        <<else>>
            <<= '<button id="passage-' + _res + '" class="' + _accText + '" data-after="' + _facSubArr[3] + ' slaves in ' + _facSubArr[1] + '">' + _facSubArr[1] + ' Report</button>'>>
        <</if>>
    <<include `_facSubArr[0]` "div">>                                                                             /** OK, we're done with the pretty stuff, go get the guts */
    <</if>>
    <<unset _facSubArr>>
<</for>>

/* IMPORTANT FOR REASONS!!! */
<<unset _ii>>
/** /Accordion */

<<if $slavesVisible > 0>>
__''Penthouse Report''__

<<for $i to 0; $i < $slaves.length; $i++>>
<<if $slaves[$i].assignmentVisible == 1>>
	<<if $slaves[$i].assignment is "be your Head Girl">>
		<<include "Full Report">>
		<<set _iTemp to $i>>
		<<for $i to 0; $i < $slaves.length; $i++>>
			<<if $slaves[$i].assignment is "live with your Head Girl">>
			<<set $HGRelease to 1>>

<<include "SA live with HG">>
			<<break>>
			<</if>>
		<</for>>
		<<set $i to _iTemp>>
	<<else>>
		<<include "Full Report">>
	<</if>>
	<<if ($rulesAssistantAuto == 1)>>
		<<if ($slaves[$i].useRulesAssistant == 1)>>
			<<set _rulesapplied to false>>
			<<for _r to 0; _r < $defaultRules.length; _r++>>
				<<if ($slaves[$i].assignmentVisible == 1) || ruleAppliedToSlaveFacility($defaultRules[_r], $slaves[$i])>>
					<<set _rulesapplied to true>>
					<<break>>
				<</if>>
			<</for>>
			<<if (_rulesapplied == true)>>
				<<set $activeSlave to $slaves[$i]>>
				<<include "Check Auto Rules Activate">>
				<<include "Default Rules">>
				<<set $slaves[$i] to $activeSlave>>
			<</if>>
		<</if>>
	<</if>>

<<else>>
	<<if ($rulesAssistantAuto == 1)>>
		<<if ($slaves[$i].useRulesAssistant == 1)>>
			<<set _rulesapplied to false>>
			<<for _r to 0; _r < $defaultRules.length; _r++>>
				<<if ($slaves[$i].assignmentVisible == 1) || ruleAppliedToSlaveFacility($defaultRules[_r], $slaves[$i])>>
					<<set _rulesapplied to true>>
					<<break>>
				<</if>>
			<</for>>
			<<if (_rulesapplied == true)>>
				<<set $activeSlave to $slaves[$i]>>
				<<include "Check Auto Rules Activate">>
				<<include "Default Rules">>
				<<set $slaves[$i] to $activeSlave>>
			<</if>>
		<</if>>
	<</if>>
<</if>>
<</for>>
<</if>>


code:
:: slave generation widgets [nobr widget]

<<widget "NationalityToRace">>

<<switch $args[0].nationality>>
<<case "American">>
	<<set $args[0].race to either("black", "middle eastern", "white", "white", "white", "latina", "latina", "asian", "amerindian", "mixed race")>>
<<case "Canadian">>
	<<set $args[0].race to either("white", "white", "white", "white", "amerindian")>>
<<case "Puerto Rican">>
	<<set $args[0].race to either("latina")>>
<<case "Cuban">>
	<<set $args[0].race to either("latina", "black")>>
<<case "Haitian">>
	<<set $args[0].race to either("black")>>
<<case "Jamaican">>
	<<set $args[0].race to either("black")>>
<<case "Mexican">>
	<<set $args[0].race to either("latina", "latina", "latina", "latina", "latina", "amerindian")>>
<<case "Dominican">>
	<<set $args[0].race to either("mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "white", "white", "black")>>
<<case "Peruvian">>
	<<set $args[0].race to either("latina", "amerindian")>>
<<case "Venezuelan">>
	<<set $args[0].race to either("latina")>>
<<case "Bolivian">>
	<<set $args[0].race to either("latina", "amerindian")>>
<<case "Guatemalan">>
	<<set $args[0].race to either("latina", "amerindian")>>
<<case "Brazilian">>
	<<set $args[0].race to either("black", "latina", "mixed race", "mixed race", "amerindian", "white", "white", "asian")>>
<<case "Argentinian">>
	<<set $args[0].race to either("white", "latina", "latina")>>
<<case "Chilean">>
	<<set $args[0].race to either("white", "latina", "latina", "latina")>>
<<case "Colombian">>
	<<set $args[0].race to either("latina")>>
<<case "Egyptian">>
	<<set $args[0].race to either("black", "middle eastern", "middle eastern", "middle eastern", "semitic")>>
<<case "Turkish">>
	<<set $args[0].race to either("middle eastern", "middle eastern", "middle eastern", "semitic")>>
<<case "Iranian">>
	<<set $args[0].race to either("indo-aryan", "indo-aryan", "indo-aryan", "semitic")>>
<<case "Armenian">>
	<<set $args[0].race to either("indo-aryan", "semitic")>>
<<case "Israeli">>
	<<set $args[0].race to either("white", "middle eastern", "semitic", "semitic")>>
<<case "Saudi">>
	<<set $args[0].race to either("black", "asian", "middle eastern", "middle eastern")>>
<<case "Moroccan">>
	<<set $args[0].race to either("middle eastern", "middle eastern", "black")>>
<<case "Nigerian">>
	<<set $args[0].race to either("black")>>
<<case "Kenyan">>
	<<set $args[0].race to either("black")>>
<<case "Zimbabwean">>
	<<set $args[0].race to either("black", "black", "black", "black", "white")>>
<<case "Ugandan">>
	<<set $args[0].race to either("black")>>
<<case "Tanzanian">>
	<<set $args[0].race to either("black", "black", "black", "semitic")>>
<<case "Ghanan">>
	<<set $args[0].race to either("black", "black", "black", "semitic")>>
<<case "Congolese">>
	<<set $args[0].race to either("black")>>
<<case "Ethiopian">>
	<<set $args[0].race to either("black", "black", "black", "middle eastern", "semitic")>>
<<case "South African">>
	<<set $args[0].race to either("black", "black", "black", "white")>>
<<case "Chinese">>
	<<set $args[0].race to either("asian")>>
<<case "Korean">>
	<<set $args[0].race to either("asian")>>
<<case "Japanese">>
	<<set $args[0].race to either("asian")>>
<<case "Thai">>
	<<set $args[0].race to either("asian", "asian", "malay")>>
<<case "Vietnamese">>
	<<set $args[0].race to either("asian")>>
<<case "Indonesian">>
	<<set $args[0].race to either("asian", "malay", "malay", "pacific islander")>>
<<case "Filipina">>
	<<set $args[0].race to either("asian", "malay", "malay", "pacific islander")>>
<<case "Burmese">>
	<<set $args[0].race to either("asian", "asian", "indo-aryan")>>
<<case "Nepalese">>
	<<set $args[0].race to either("asian", "asian", "indo-aryan")>>
<<case "Uzbek">>
	<<set $args[0].race to either("asian")>>
<<case "Afghan">>
	<<set $args[0].race to either("indo-aryan", "middle eastern")>>
<<case "Algerian">>
	<<set $args[0].race to either("middle eastern")>>
<<case "Libyan">>
	<<set $args[0].race to either("middle eastern")>>
<<case "Tunisian">>
	<<set $args[0].race to either("middle eastern")>>
<<case "Lebanese">>
	<<set $args[0].race to either("middle eastern", "semitic")>>
<<case "Jordanian">>
	<<set $args[0].race to either("middle eastern", "semitic")>>
<<case "Emirati">>
	<<set $args[0].race to either("middle eastern", "indo-aryan")>>
<<case "Omani">>
	<<set $args[0].race to either("middle eastern", "indo-aryan")>>
<<case "Malian">>
	<<set $args[0].race to either("black", "black", "black", "black", "black", "middle eastern")>>
<<case "Sudanese">>
	<<set $args[0].race to either("black", "black", "black", "middle eastern")>>
<<case "Yemeni">>
	<<set $args[0].race to either("black", "semitic", "middle eastern", "middle eastern", "middle eastern")>>
<<case "Iraqi">>
	<<set $args[0].race to either("semitic", "middle eastern", "middle eastern", "middle eastern", "middle eastern")>>
<<case "Indian">>
	<<set $args[0].race to either("indo-aryan")>>
<<case "Malaysian">>
	<<set $args[0].race to either("asian", "malay", "malay", "malay")>>
<<case "Kazakh">>
	<<set $args[0].race to either("asian", "asian", "asian", "semitic", "indo-aryan")>>
<<case "Pakistani">>
	<<set $args[0].race to either("indo-aryan", "indo-aryan", "indo-aryan", "semitic")>>
<<case "Bangladeshi">>
	<<set $args[0].race to either("indo-aryan")>>
<<case "Belarusian">>
	<<set $args[0].race to either("white")>>
<<case "Russian">>
	<<set $args[0].race to either("white")>>
<<case "Ukrainian">>
	<<set $args[0].race to either("white")>>
<<case "Irish">>
	<<set $args[0].race to either("white")>>
<<case "Icelandic">>
	<<set $args[0].race to either("white")>>
<<case "Finnish">>
	<<set $args[0].race to either("white")>>
<<case "Swiss">>
	<<set $args[0].race to either("white")>>
<<case "Danish">>
	<<set $args[0].race to either("white")>>
<<case "Norwegian">>
	<<set $args[0].race to either("white")>>
<<case "Austrian">>
	<<set $args[0].race to either("white")>>
<<case "Slovak">>
	<<set $args[0].race to either("white", "white", "white", "white", "indo-aryan")>>
<<case "Dutch">>
	<<set $args[0].race to either("white")>>
<<case "Belgian">>
	<<set $args[0].race to either("white")>>
<<case "Czech">>
	<<set $args[0].race to either("white")>>
<<case "Serbian">>
	<<set $args[0].race to either("white")>>
<<case "Portuguese">>
	<<set $args[0].race to either("white")>>
<<case "Hungarian">>
	<<set $args[0].race to either("white", "white", "white", "white", "indo-aryan")>>
<<case "Estonian">>
	<<set $args[0].race to either("white")>>
<<case "Polish">>
	<<set $args[0].race to either("white")>>
<<case "Lithuanian">>
	<<set $args[0].race to either("white")>>
<<case "Romanian">>
	<<set $args[0].race to either("semitic", "white", "white", "white", "white", "indo-aryan")>>
<<case "German">>
	<<set $args[0].race to either("black", "middle eastern", "white", "white", "white", "white", "white", "white")>>
<<case "Swedish">>
	<<set $args[0].race to either("middle eastern", "white", "white", "white", "white")>>
<<case "French">>
	<<set $args[0].race to either("black", "middle eastern", "white", "white", "white", "white", "white", "southern European")>>
<<case "Italian">>
	<<set $args[0].race to either("middle eastern", "southern European", "southern European", "white", "white")>>
<<case "Greek">>
	<<set $args[0].race to either("southern European")>>
<<case "Spanish">>
	<<set $args[0].race to either("semitic", "southern European", "southern European")>>
<<case "British">>
	<<set $args[0].race to either("indo-aryan", "white", "white", "white", "white", "white", "white", "white", "white", "white")>>
<<case "Scottish">>
	<<set $args[0].race to either("middle eastern", "indo-aryan", "white", "white", "white", "white", "white", "white", "white")>>
<<case "Australian">>
	<<set $args[0].race to either("white", "white", "black", "asian")>>
<<case "a New Zealander">>
	<<set $args[0].race to either("white", "white", "white", "white", "pacific islander")>>
<<default>>
	<<set $args[0].race to either("white")>>
<</switch>>

/% Begin mixed race rate adjustment. %/
/% Some countries are extremely ethnically homogeneous and unlikely to change soon. %/
<<if ($args[0].nationality is "Japanese")>>
	<<if random(1,100) > 98>>
		<<set $args[0].race to "mixed race">>
	<</if>>
<<elseif ($args[0].nationality is "Korean")>>
	<<if random(1,100) > 95>>
		<<set $args[0].race to "mixed race">>
	<</if>>
<<elseif ($args[0].nationality is "Polish") or ($args[0].nationality is "Romanian") or ($args[0].nationality is "Bulgarian") or ($args[0].nationality is "Lithuanian") or ($args[0].nationality is "Croatian")>>
	/% Croatia isn't an origin currently but the game might add it in the future. %/
	<<if random(1,100) > 98>>
		<<set $args[0].race to "mixed race">>
	<</if>>
<<elseif random(1,100) > 90>>
	/% Default rate. %/
	<<set $args[0].race to "mixed race">>
<</if>>
/% End mixed race rate adjustment. %/

<</widget>>

<<widget "NationalityToName">>

<<switch $args[0].nationality>>
<<case "American">>
	<<if $args[0].race is "black">>
		<<set $args[0].birthName to $africanAmericanSlaveNames.random()>>
	<<elseif $args[0].race is "latina">>
		<<set $args[0].birthName to $latinaSlaveNames.random()>>
	<<elseif $args[0].race is "asian">>
		<<set $args[0].birthName to $asianAmericanSlaveNames.random()>>
	<<elseif $args[0].race is "middle eastern">>
		<<set $args[0].birthName to $egyptianSlaveNames.random()>>
	<<else>>
		<<set $args[0].birthName to $whiteAmericanSlaveNames.random()>>
	<</if>>
<<case "Canadian">>
	<<set $args[0].birthName to $canadianSlaveNames.random()>>
<<case "Mexican">>
	<<set $args[0].birthName to $mexicanSlaveNames.random()>>
<<case "Dominican">>
	<<set $args[0].birthName to $dominicanSlaveNames.random()>>
<<case "Puerto Rican">>
	<<set $args[0].birthName to $puertoRicanSlaveNames.random()>>
<<case "Haitian">>
	<<set $args[0].birthName to $haitianSlaveNames.random()>>
<<case "Jamaican">>
	<<set $args[0].birthName to $jamaicanSlaveNames.random()>>
<<case "Cuban">>
	<<set $args[0].birthName to $cubanSlaveNames.random()>>
<<case "Guatemalan">>
	<<set $args[0].birthName to $guatemalanSlaveNames.random()>>
<<case "Chilean">>
	<<set $args[0].birthName to $chileanSlaveNames.random()>>
<<case "Peruvian">>
	<<set $args[0].birthName to $peruvianSlaveNames.random()>>
<<case "Bolivian">>
	<<set $args[0].birthName to $bolivianSlaveNames.random()>>
<<case "Venezuelan">>
	<<set $args[0].birthName to $venezuelanSlaveNames.random()>>
<<case "Belarusian">>
	<<set $args[0].birthName to $belarusianSlaveNames.random()>>
<<case "Russian">>
	<<set $args[0].birthName to $russianSlaveNames.random()>>
<<case "Ukrainian">>
	<<set $args[0].birthName to $ukrainianSlaveNames.random()>>
<<case "Italian">>
	<<set $args[0].birthName to $italianSlaveNames.random()>>
<<case "Spanish">>
	<<set $args[0].birthName to $spanishSlaveNames.random()>>
<<case "British">>
	<<set $args[0].birthName to $britishSlaveNames.random()>>
<<case "Scottish">>
	<<set $args[0].birthName to $scottishSlaveNames.random()>>
<<case "French">>
	<<set $args[0].birthName to $frenchSlaveNames.random()>>
<<case "German">>
	<<set $args[0].birthName to $germanSlaveNames.random()>>
<<case "Lithuanian">>
	<<set $args[0].birthName to $lithuanianSlaveNames.random()>>
<<case "Norwegian">>
	<<set $args[0].birthName to $norwegianSlaveNames.random()>>
<<case "Slovak">>
	<<set $args[0].birthName to $slovakSlaveNames.random()>>
<<case "Danish">>
	<<set $args[0].birthName to $danishSlaveNames.random()>>
<<case "Dutch">>
	<<set $args[0].birthName to $dutchSlaveNames.random()>>
<<case "Austrian">>
	<<set $args[0].birthName to $austrianSlaveNames.random()>>
<<case "Swiss">>
	<<set $args[0].birthName to $swissSlaveNames.random()>>
<<case "Serbian">>
	<<set $args[0].birthName to $serbianSlaveNames.random()>>
<<case "Belgian">>
	<<set $args[0].birthName to $belgianSlaveNames.random()>>
<<case "Czech">>
	<<set $args[0].birthName to $czechSlaveNames.random()>>
<<case "Portuguese">>
	<<set $args[0].birthName to $portugueseSlaveNames.random()>>
<<case "Swedish">>
	<<set $args[0].birthName to $swedishSlaveNames.random()>>
<<case "Romanian">>
	<<set $args[0].birthName to $romanianSlaveNames.random()>>
<<case "Hungarian">>
	<<set $args[0].birthName to $hungarianSlaveNames.random()>>
<<case "Estonian">>
	<<set $args[0].birthName to $estonianSlaveNames.random()>>
<<case "Irish">>
	<<set $args[0].birthName to $irishSlaveNames.random()>>
<<case "Icelandic">>
	<<set $args[0].birthName to $icelandicSlaveNames.random()>>
<<case "Finnish">>
	<<set $args[0].birthName to $finnishSlaveNames.random()>>
<<case "Greek">>
	<<set $args[0].birthName to $greekSlaveNames.random()>>
<<case "Polish">>
	<<set $args[0].birthName to $polishSlaveNames.random()>>
<<case "Brazilian">>
	<<set $args[0].birthName to $brazilianSlaveNames.random()>>
<<case "Egyptian">>
	<<set $args[0].birthName to $egyptianSlaveNames.random()>>
<<case "Colombian">>
	<<set $args[0].birthName to $colombianSlaveNames.random()>>
<<case "Argentinian">>
	<<set $args[0].birthName to $argentinianSlaveNames.random()>>
<<case "Turkish">>
	<<set $args[0].birthName to $turkishSlaveNames.random()>>
<<case "Iranian">>
	<<set $args[0].birthName to $iranianSlaveNames.random()>>
<<case "Armenian">>
	<<set $args[0].birthName to $armenianSlaveNames.random()>>
<<case "Israeli">>
	<<set $args[0].birthName to $israeliSlaveNames.random()>>
<<case "Saudi">>
	<<set $args[0].birthName to $saudiSlaveNames.random()>>
<<case "South African">>
	<<if $args[0].race is "black">>
		<<set $args[0].birthName to $blackSouthAfricanSlaveNames.random()>>
	<<else>>
		<<set $args[0].birthName to $whiteSouthAfricanSlaveNames.random()>>
	<</if>>
<<case "Nigerian">>
	<<set $args[0].birthName to $nigerianSlaveNames.random()>>
<<case "Congolese">>
	<<set $args[0].birthName to $congoleseSlaveNames.random()>>
<<case "Kenyan">>
	<<set $args[0].birthName to $kenyanSlaveNames.random()>>
<<case "Tanzanian">>
	<<set $args[0].birthName to $tanzanianSlaveNames.random()>>
<<case "Zimbabwean">>
	<<if $args[0].race == "white">>
		<<set $args[0].birthName to $britishSlaveNames.random()>>
	<<else>>
		<<set $args[0].birthName to $zimbabweanSlaveNames.random()>>
	<</if>>
<<case "Ghanan">>
	<<set $args[0].birthName to $ghananSlaveNames.random()>>
<<case "Ugandan">>
	<<set $args[0].birthName to $ugandanSlaveNames.random()>>
<<case "Ethiopian">>
	<<set $args[0].birthName to $ethiopianSlaveNames.random()>>
<<case "Moroccan">>
	<<set $args[0].birthName to $moroccanSlaveNames.random()>>
<<case "Chinese">>
	<<set $args[0].birthName to $chineseSlaveNames.random()>>
<<case "Korean">>
	<<set $args[0].birthName to $koreanSlaveNames.random()>>
<<case "Thai">>
	<<set $args[0].birthName to $thaiSlaveNames.random()>>
<<case "Vietnamese">>
	<<set $args[0].birthName to $vietnameseSlaveNames.random()>>
<<case "Japanese">>
	<<set $args[0].birthName to $japaneseSlaveNames.random()>>
<<case "Indonesian">>
	<<set $args[0].birthName to $indonesianSlaveNames.random()>>
<<case "Filipina">>
	<<set $args[0].birthName to $filipinaSlaveNames.random()>>
<<case "Bangladeshi">>
	<<set $args[0].birthName to $bangladeshiSlaveNames.random()>>
<<case "Malaysian">>
	<<set $args[0].birthName to $malaysianSlaveNames.random()>>
<<case "Uzbek">>
	<<set $args[0].birthName to $uzbekSlaveNames.random()>>
<<case "Afghan">>
	<<set $args[0].birthName to $afghanSlaveNames.random()>>
<<case "Nepalese">>
	<<set $args[0].birthName to $nepaleseSlaveNames.random()>>
<<case "Burmese">>
	<<set $args[0].birthName to $burmeseSlaveNames.random()>>
<<case "Iraqi">>
	<<set $args[0].birthName to $iraqiSlaveNames.random()>>
<<case "Yemeni">>
	<<set $args[0].birthName to $yemeniSlaveNames.random()>>
<<case "Sudanese">>
	<<set $args[0].birthName to $sudaneseSlaveNames.random()>>
<<case "Algerian">>
	<<set $args[0].birthName to $algerianSlaveNames.random()>>
<<case "Tunisian">>
	<<set $args[0].birthName to $tunisianSlaveNames.random()>>
<<case "Libyan">>
	<<set $args[0].birthName to $libyanSlaveNames.random()>>
<<case "Omani">>
	<<set $args[0].birthName to $omaniSlaveNames.random()>>
<<case "Malian">>
	<<set $args[0].birthName to $malianSlaveNames.random()>>
<<case "Jordanian">>
	<<set $args[0].birthName to $jordanianSlaveNames.random()>>
<<case "Lebanese">>
	<<set $args[0].birthName to $lebaneseSlaveNames.random()>>
<<case "Emirati">>
	<<set $args[0].birthName to $emiratiSlaveNames.random()>>
<<case "Kazakh">>
	<<set $args[0].birthName to $kazakhSlaveNames.random()>>
<<case "Pakistani">>
	<<set $args[0].birthName to $pakistaniSlaveNames.random()>>
<<case "Indian">>
	<<set $args[0].birthName to $indianSlaveNames.random()>>
<<case "Australian">>
	<<set $args[0].birthName to $australianSlaveNames.random()>>
<<case "a New Zealander">>
	<<set $args[0].birthName to $newZealanderSlaveNames.random()>>
<<default>>
	<<set $args[0].birthName to $whiteAmericanSlaveNames.random()>>
<</switch>>

<<set $args[0].slaveName to $args[0].birthName>>
<<if $useFSNames == 1>>
<<if $arcologies[0].FSChattelReligionist > 20>>
	<<set $args[0].slaveName to $chattelReligionistSlaveNames.random()>>
<<elseif $arcologies[0].FSRomanRevivalist > 20>>
	<<set $args[0].slaveName to $romanSlaveNames.random()>>
<<elseif $arcologies[0].FSEgyptianRevivalist > 20>>
	<<set $args[0].slaveName to $ancientEgyptianSlaveNames.random()>>
<<elseif $arcologies[0].FSEdoRevivalist > 20>>
	<<set $args[0].slaveName to $edoSlaveNames.random()>>
<<elseif $arcologies[0].FSDegradationist != "unset">>
	<<include "Degrading Name">>
<</if>>
<</if>>

<</widget>>

<<widget "NationalityToAccent">>

<<set $seed to either(0,1,1,2,2,2,3,3,3,3)>>

<<switch $args[0].nationality>>
<<case "American">>
	<<if $args[0].race is "black">>
	<<if $language is "English">>
		<<set $args[0].accent to 0>>
	<<else>>
		<<set $args[0].accent to either(0,1,1,2,2,2,3,3,3,3)>>
	<</if>>
	<<elseif $args[0].race is "latina">>
	<<if $language is "English">>
		<<set $args[0].accent to 0>>
	<<elseif $language is "Spanish">>
		<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
		<<set $args[0].accent to $seed>>
	<</if>>
	<<elseif $args[0].race is "asian">>
	<<if $language is "English">>
		<<set $args[0].accent to 0>>
	<<elseif $language is "Chinese">>
		<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
		<<set $args[0].accent to $seed>>
	<</if>>
	<<elseif $args[0].race is "middle eastern">>
	<<if $language is "English">>
		<<set $args[0].accent to 0>>
	<<elseif $language is "Arabic">>
		<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
		<<set $args[0].accent to $seed>>
	<</if>>
	<<else>>
	<<if $language is "English">>
		<<set $args[0].accent to 0>>
	<<else>>
		<<set $args[0].accent to $seed>>
	<</if>>
	<</if>>
<<case "Canadian">>
	<<if $language is "English">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Mexican">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Dominican">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Puerto Rican">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Haitian">>
	<<set $args[0].accent to $seed>>
<<case "Jamaican">>
	<<set $args[0].accent to $seed>>
<<case "Cuban">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Guatemalan">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Chilean">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Peruvian">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Bolivian">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Venezuelan">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Russian">>
	<<set $args[0].accent to $seed>>
<<case "Ukrainian">>
	<<set $args[0].accent to $seed>>
<<case "Italian">>
	<<set $args[0].accent to $seed>>
<<case "Spanish">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "British">>
	<<if $language is "English">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Scottish">>
	<<if $language is "English">>
	<<set $args[0].accent to 2>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "French">>
	<<set $args[0].accent to $seed>>
<<case "German">>
	<<set $args[0].accent to $seed>>
<<case "Lithuanian">>
	<<set $args[0].accent to $seed>>
<<case "Belarusian">>
	<<set $args[0].accent to $seed>>
<<case "Norwegian">>
	<<set $args[0].accent to $seed>>
<<case "Slovak">>
	<<set $args[0].accent to $seed>>
<<case "Danish">>
	<<set $args[0].accent to $seed>>
<<case "Dutch">>
	<<set $args[0].accent to $seed>>
<<case "Austrian">>
	<<set $args[0].accent to $seed>>
<<case "Swiss">>
	<<set $args[0].accent to $seed>>
<<case "Serbian">>
	<<set $args[0].accent to $seed>>
<<case "Belgian">>
	<<set $args[0].accent to $seed>>
<<case "Czech">>
	<<set $args[0].accent to $seed>>
<<case "Portuguese">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Swedish">>
	<<set $args[0].accent to $seed>>
<<case "Romanian">>
	<<set $args[0].accent to $seed>>
<<case "Hungarian">>
	<<set $args[0].accent to $seed>>
<<case "Estonian">>
	<<set $args[0].accent to $seed>>
<<case "Irish">>
	<<if $language is "English">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Icelandic">>
	<<set $args[0].accent to $seed>>
<<case "Finnish">>
	<<set $args[0].accent to $seed>>
<<case "Greek">>
	<<set $args[0].accent to $seed>>
<<case "Polish">>
	<<set $args[0].accent to $seed>>
<<case "Brazilian">>
	<<if $language is "Portuguese">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Egyptian">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Colombian">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Argentinian">>
	<<if $language is "Spanish">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Turkish">>
	<<set $args[0].accent to $seed>>
<<case "Iranian">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Armenian">>
	<<set $args[0].accent to $seed>>
<<case "Israeli">>
	<<set $args[0].accent to $seed>>
<<case "Saudi">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "South African">>
	<<if $language is "English">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Nigerian">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Congolese">>
	<<set $args[0].accent to $seed>>
<<case "Kenyan">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Tanzanian">>
	<<set $args[0].accent to $seed>>
<<case "Zimbabwean">>
	<<if $language is "English" && $args[0].race == "white">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Ghanan">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Ugandan">>
	<<set $args[0].accent to $seed>>
<<case "Ethiopian">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Moroccan">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Chinese">>
	<<if $language is "Chinese">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Korean">>
	<<if $language is "Chinese">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Thai">>
	<<if $language is "Chinese">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Vietnamese">>
	<<if $language is "Chinese">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Japanese">>
	<<set $args[0].accent to $seed>>
<<case "Indonesian">>
	<<set $args[0].accent to $seed>>
<<case "Filipina">>
	<<set $args[0].accent to $seed>>
<<case "Bangladeshi">>
	<<if $language is "Indian">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Malaysian">>
	<<set $args[0].accent to $seed>>
<<case "Uzbek">>
	<<set $args[0].accent to $seed>>
<<case "Afghan">>
	<<set $args[0].accent to $seed>>
<<case "Nepalese">>
	<<set $args[0].accent to $seed>>
<<case "Burmese">>
	<<set $args[0].accent to $seed>>
<<case "Iraqi">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Yemeni">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Sudanese">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Algerian">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Tunisian">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Libyan">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Omani">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Malian">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Jordanian">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Lebanese">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Emirati">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Kazakh">>
	<<set $args[0].accent to $seed>>
<<case "Pakistani">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to either(0,1,2,3)>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Indian">>
	<<if $language is "Indian">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Australian">>
	<<if $language is "English">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "a New Zealander">>
	<<if $language is "English">>
	<<set $args[0].accent to 1>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Roman Revivalist">>
	<<if $language is "Latin">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Ancient Egyptian Revivalist">>
	<<if $language is "Ancient Egyptian">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Edo Revivalist">>
	<<if $language is "Japanese">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Arabian Revivalist">>
	<<if $language is "Arabic">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<case "Ancient Chinese Revivalist">>
	<<if $language is "Chinese">>
	<<set $args[0].accent to 0>>
	<<else>>
	<<set $args[0].accent to $seed>>
	<</if>>
<<default>>
	<<set $args[0].accent to $seed>>
<</switch>>

<<if $args[0].nationality is $language>>
	<<set $args[0].accent to 0>>
<</if>>

<</widget>>