:: SA rivalries [nobr]

<<set _SL = $slaves.length>>

<<if $slaves[$i].rivalry == 0>>

<<if $slaves[$i].fuckdoll == 0>>
<<if $slaves[$i].fetish != "mindbroken">>
<<if $slaves[$i].assignment != "stay confined">>
<<if $slaves[$i].assignment != "be confined in the arcade">>
<<if $slaves[$i].devotion < random(20,100)>>
<<if $slaves[$i].trust > random(-100,-20)>>
	<<for _j = 0; _j < _SL; _j++>>
		<<if $slaves[_j].ID != $slaves[$i].ID>>
		<<if $slaves[_j].rivalry == 0>>
		<<if $slaves[_j].fetish != "mindbroken">>
		<<if $slaves[_j].ID != $slaves[$i].relationshipTarget>>
		<<if $slaves[_j].devotion < random(20,100)>>
		<<if $slaves[_j].trust > random(-100,-20)>>
			<<if $slaves[$i].behavioralFlaw != "none">>
				<<switch $slaves[$i].behavioralFlaw>>
				<<case "arrogant">>
					<<if $slaves[_j].intelligence > $slaves[$i].intelligence>>
						$slaves[$i].slaveName is an arrogant bitch, and <<SlaveFullName $slaves[_j]>> is authentically smarter than she is, which of course she cannot stand. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
				<<case "bitchy">>
					<<if $slaves[_j].behavioralFlaw == "odd">>
						$slaves[$i].slaveName is a bit of a bitch, and poor odd <<SlaveFullName $slaves[_j]>> is a convenient target for her bullying. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
				<<case "odd">>
					<<if $slaves[_j].behavioralFlaw == "bitchy">>
						$slaves[$i].slaveName is rather strange. <<SlaveFullName $slaves[_j]>>, who is kind of a bitch, frequently bullies her about it. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
				<<case "hates men">>
					<<if $slaves[_j].attrXX > 35>>
					<<if $slaves[_j].faceShape == "masculine" || $slaves[_j].faceShape == "androgynous" >>
					<<if $slaves[_j].muscles > 10>>
					<<if $slaves[_j].vagina > -1>>
						$slaves[$i].slaveName hates men, and poor butch <<SlaveFullName $slaves[_j]>> really gets to her, despite having a pussy and everything. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<<else>>
						$slaves[$i].slaveName hates men, and poor masculine <<SlaveFullName $slaves[_j]>> really gets to her. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
					<</if>>
					<</if>>
					<</if>>
				<<case "hates women">>
					<<if $slaves[_j].attrXY > 35>>
					<<if $slaves[_j].faceShape != "masculine">>
					<<if $slaves[_j].muscles <= 30>>
					<<if $slaves[_j].vagina > -1>>
						$slaves[$i].slaveName hates women, and something about the feminine <<SlaveFullName $slaves[_j]>> really gets to her. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<<else>>
						$slaves[$i].slaveName hates women, and something about the girly <<SlaveFullName $slaves[_j]>> really gets to her, despite poor $slaves[_j].slaveName not being perfectly female at all. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
					<</if>>
					<</if>>
					<</if>>
				<<case "gluttonous">>
					<<if $slaves[_j].behavioralFlaw == "anorexic">>
						$slaves[$i].slaveName, who loves food, can't stand <<SlaveFullName $slaves[_j]>>'s prissy anorexia. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
				<<case "anorexic">>
					<<if $slaves[_j].behavioralFlaw == "gluttonous">>
						$slaves[$i].slaveName, an anorexic, can't stand <<SlaveFullName $slaves[_j]>>'s disgusting gluttony. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
				<<case "devout">>
					<<if $slaves[_j].behavioralFlaw == "anorexic">>
						$slaves[$i].slaveName, who is devout and might be considered rather conservative if she were free, can't stand <<SlaveFullName $slaves[_j]>>'s revolting gender liberation. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
				<<case "liberated">>
					<<if $slaves[_j].behavioralFlaw == "devout">>
						$slaves[$i].slaveName, who is liberated and might be considered rather liberal if she were free, can't stand <<SlaveFullName $slaves[_j]>>'s bigoted religious faith. @@.lightsalmon;They start to dislike each other.@@
						<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
						<<break>>
					<</if>>
				<</switch>>
			<</if>>
			<<if $slaves[_j].assignment == $slaves[$i].assignment>>
			<<if random(0,1) == 1>>
				$slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> see too much of each other while they
				<<switch $slaves[_j].assignment>>
				<<case "be a servant" "work as a servant">>
					work as servants
				<<case "be a subordinate slave">>
					prepare to serve your other slaves
				<<case "work a glory hole">>
					work nearby glory holes
				<<case "be confined in the cellblock">>
					are confined in nearby cells
				<<case "please you">>
					wait for you to use them
				<<default>>
					$slaves[_j].assignment
				<</switch>>
				and @@.lightsalmon;start to dislike each other.@@
				<<set $slaves[_j].rivalry = 1, $slaves[$i].rivalry = 1, $slaves[_j].rivalryTarget = $slaves[$i].ID, $slaves[$i].rivalryTarget = $slaves[_j].ID>>
				<<break>>
			<</if>>
			<</if>>
		<</if>>
		<</if>>
		<</if>>
		<</if>>
		<</if>>
		<</if>>
	<</for>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<else>>

<<for _j = 0; _j < _SL; _j++>>
<<if $slaves[_j].ID == $slaves[$i].rivalryTarget>>
	<<if $slaves[$i].fuckdoll>>
		$slaves[$i].slaveName is a living sex toy, not a person, it @@.lightsalmon;can't really maintain any meaningful rivalry@@ with <<SlaveFullName $slaves[_j]>>.
		<<set $slaves[_j].rivalry = 0,$slaves[_j].rivalryTarget = 0, $slaves[$i].rivalry = 0, $slaves[$i].rivalryTarget = 0>>
		<<break>>
	<</if>>
	<<if $slaves[$i].fetish == "mindbroken">>
		Since $slaves[$i].slaveName is mindbroken, she @@.lightsalmon;can't really maintain any meaningful rivalry@@ with <<SlaveFullName $slaves[_j]>>.
		<<set $slaves[_j].rivalry = 0,$slaves[_j].rivalryTarget = 0, $slaves[$i].rivalry = 0, $slaves[$i].rivalryTarget = 0>>
		<<break>>
	<</if>>
	<<if $slaves[$i].need>>
	<<if $universalRulesConsent == 0>>
	<<if $slaves[$i].releaseRules != "restrictive" && $slaves[$i].releaseRules != "masturbation">>
	<<if $slaves[_j].releaseRules != "restrictive">>
	<<if $slaves[$i].fetishKnown>>
		<<if $slaves[$i].fetish == "sadist">>
			$slaves[$i].slaveName is horny and sadistic, so she rapes her rival <<SlaveFullName $slaves[_j]>> every chance she gets; this @@.hotpink;thrills@@ $slaves[$i].slaveName, but $slaves[_j].slaveName is @@.golden;frightened@@ that you let it happen.
			<<set $slaves[$i].need = 0, $slaves[$i].devotion += 3, $slaves[_j].trust -= 3, $slaves[$i].penetrativeCount += 5, $slaves[_j].oralCount += 5>>
			<<if $slaves[$i].rivalry < 3>> 
				Of course, this @@.lightsalmon;worstens their rivalry.@@
				<<set $slaves[_j].rivalry += 1, $slaves[$i].rivalry += 1>>
			<</if>>
		<<elseif $slaves[$i].fetish == "dom">>
			$slaves[$i].slaveName is horny and dominant, so she forces her rival <<SlaveFullName $slaves[_j]>> to submit to her whenever she can; this @@.hotpink;thoroughly satisfies@@ $slaves[$i].slaveName, but $slaves[_j].slaveName is @@.golden;angered@@ that you let it happen.
			<<set $slaves[$i].need = 0, $slaves[$i].devotion += 3, $slaves[_j].devotion -= 3, $slaves[$i].penetrativeCount += 5, $slaves[_j].oralCount += 5>>
			<<if $slaves[$i].rivalry < 3>> 
				Of course, this @@.lightsalmon;worstens their rivalry.@@
				<<set $slaves[_j].rivalry += 1, $slaves[$i].rivalry += 1>>
			<</if>>
		<</if>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
	<<set _roll = random(0,100)>>	
	<<if _roll > 50>>
		<<if $slaves[_j].fetish == $slaves[$i].fetish>>
		<<if $slaves[_j].fetishKnown>>
		<<if $slaves[$i].fetishKnown>>
			$slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> share sexual interests, and in the sexual atmosphere of the arcology, it's @@.lightgreen;difficult for them to keep up their dislike@@ of one another with the mutual attraction.
			<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<<break>>
		<</if>>
		<</if>>
		<</if>>
		<<if $slaves[_j].ID == $slaves[$i].relationshipTarget>>
		<<if $slaves[$i].relationship > 3>>
			<<set $slaves[_j].rivalry = 0, $slaves[_j].rivalryTarget = 0>>
			<<set $slaves[$i].rivalry = 0, $slaves[$i].rivalryTarget = 0>>
			<<break>>
		<</if>>
		<</if>>
	<<if _roll > 80>>
		<<if $slaves[_j].trust < -20>>
		<<if $slaves[$i].trust < -20>>
			Since both $slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> are terrified of you, they work together to @@.lightgreen;get over their feud,@@ since it brings punishment on both of them.
			<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<<break>>
		<</if>>
		<</if>>
		<<if $slaves[_j].devotion > 50>>
		<<if $slaves[$i].devotion > 50>>
			Since both $slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> are devoted to you, they work together to @@.lightgreen;get over their feud,@@ since it gets in the way of their duties.
			<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<<break>>
		<</if>>
		<</if>>
	<<if _roll > 90>>
		<<if $slaves[$i].energy > 95>>
			$slaves[$i].slaveName lusts after <<SlaveFullName $slaves[_j]>>, and does everything she can to @@.lightgreen;patch up their differences.@@
			<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<<break>>
		<</if>>
		<<if $slaves[$i].attrXX > 85>>
		<<if ($slaves[_j].vagina > -1) || ($slaves[_j].faceShape != "masculine")>>
			$slaves[$i].slaveName lusts after <<SlaveFullName $slaves[_j]>>, and does everything she can to @@.lightgreen;patch up their differences.@@
			<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<<break>>
		<</if>>
		<</if>>
		<<if $slaves[$i].attrXY > 85>>
		<<if ($slaves[_j].balls > 0) || ($slaves[_j].faceShape == "masculine")>>
			$slaves[$i].slaveName lusts after <<SlaveFullName $slaves[_j]>>, and does everything she can to @@.lightgreen;patch up their differences.@@
			<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<<break>>
		<</if>>
		<</if>>
		<<if $slaves[_j].assignment != $slaves[$i].assignment>>
		<<if $slaves[$i].subTarget != $slaves[_j].ID>>
		<<if $slaves[_j].subTarget != $slaves[$i].ID>>
			With time apart $slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> @@.lightgreen;dislike each other less.@@
			<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<<break>>
		<</if>>
		<</if>>
		<</if>>
	<</if>>
	<</if>>
	<</if>>
	<<if $familyTesting>>
		<<if $slaves[$i].mother == $slaves[_j].ID || $slaves[$i].father == $slaves[_j].ID || $slaves[_j].mother == $slaves[$i].ID || $slaves[_j].father == $slaves[$i].ID || areSisters($slaves[$i], $slaves[_j])>>
			<<if _roll > 70 && $slaves[$i].rivalry < 3>>
				$slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> @@.lightsalmon;pursue their family rivalry.@@
				<<set $slaves[_j].rivalry += 1, $slaves[$i].rivalry += 1>>
			<<elseif _roll > 40>>
				$slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> @@.lightgreen;patch up their family relationship.@@
				<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<</if>>
			<<break>>
		<</if>>
	<<else>>
		<<if $slaves[$i].relation>>
		<<if $slaves[$i].relationTarget == $slaves[$i].rivalryTarget>>
			<<if _roll > 70 && $slaves[$i].rivalry < 3>>
				$slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> @@.lightsalmon;pursue their family rivalry.@@
				<<set $slaves[_j].rivalry += 1, $slaves[$i].rivalry += 1>>
			<<elseif _roll > 40>>
				$slaves[$i].slaveName and <<SlaveFullName $slaves[_j]>> @@.lightgreen;patch up their family relationship.@@
				<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
			<</if>>
			<<break>>
		<</if>>
		<</if>>
	<</if>>
	<<if _roll > $slaves[$i].devotion-$slaves[$i].trust+10>>
		<<if  $slaves[$i].rivalry < 3>>
			$slaves[$i].slaveName @@.lightsalmon;bickers with <<SlaveFullName $slaves[_j]>>@@ whenever she can, worsening their rivalry.
			<<set $slaves[_j].rivalry += 1, $slaves[$i].rivalry += 1>>
			<<break>>
		<</if>>
	<<elseif _roll < $slaves[$i].devotion-$slaves[$i].trust-10>>
		$slaves[$i].slaveName does her best to be nice to <<SlaveFullName $slaves[_j]>>, and manages to @@.lightgreen;de-escalate their little feud.@@
		<<set $slaves[_j].rivalry -= 1, $slaves[$i].rivalry -= 1>>
		<<break>>
	<</if>>
	<<break>>
<</if>>
<</for>>

<</if>>

<<if $slaves[$i].rivalry>>
<<for _j = 0; _j < _SL; _j++>>
	<<if ($slaves[_j].ID == $slaves[$i].rivalryTarget) && ($slaves[$i].ID != $slaves[_j].rivalryTarget)>>
		<<set $slaves[_j].rivalry = 0, $slaves[_j].rivalryTarget = 0>>
		<<set $slaves[$i].rivalry = 0, $slaves[$i].rivalryTarget = 0>>
		<<break>>
	<</if>>
<</for>>
<</if>>