:: SA rivalries [nobr]

<<if $slaves[$i].fuckdoll == 0>>
<<set _SL = $slaves.length>>
<<if $slaves[$i].rivalry == 0>>

<<if $slaves[$i].fetish != "mindbroken">>
	<<if $slaves[$i].behavioralFlaw is "none">>
		<<set _seed to random(1,100)>>
	<<else>>
		<<set _seed to random(1,110)>>
	<</if>>
	<<if _seed > 90>>
	<<for _j to 0; _j < _SL; _j++>>
		<<if $slaves[_j].assignment == $slaves[$i].assignment>>
		<<if $slaves[_j].ID != $slaves[$i].ID>>
		<<if $slaves[_j].assignment != "stay confined">>
		<<if $slaves[_j].assignment != "be confined in the arcade">>
		<<if ($slaves[_j].rivalry == 0)>>
		<<if ($slaves[$i].relationshipTarget != $slaves[_j].ID)>>
		<<if random(-100,100) > ($slaves[_j].devotion+$slaves[$i].devotion)>>
			$slaves[$i].slaveName and $slaves[_j].slaveName see too much of each other and @@color:lightsalmon;start to dislike each other.@@
			<<set $slaves[_j].rivalry to 1, $slaves[_j].rivalryTarget to $slaves[$i].ID>>
			<<set $slaves[$i].rivalry to 1, $slaves[$i].rivalryTarget to $slaves[_j].ID>>
		<</if>>
		<</if>>
		<</if>>
		<</if>>
		<</if>>
		<</if>>
		<</if>>
	<</for>>
	<</if>>
<</if>>

<<else>>
<<set _SlaveJ = null>>
<<for _j = 0; _j < _SL; _j++>>
<<if $slaves[_j].ID is $slaves[$i].rivalryTarget>>
	<<set _SlaveJ = $slaves[_j]>>
	<<break>>
<</if>>
<</for>>

<<if _SlaveJ != null>>

<<if $slaves[$i].fetish is "mindbroken">>
	Since she is mindbroken, she @@color:lightsalmon;can't really maintain@@ any meaningful rivalry with _SlaveJ.slaveName.
	<<set _SlaveJ.rivalry to 0,_SlaveJ.rivalryTarget to 0>>
	<<set $slaves[$i].rivalry to 0, $slaves[$i].rivalryTarget to 0>>
<<else>>

<<if (random(1,100) > 70)>>
	<<if (_SlaveJ.assignment != $slaves[$i].assignment) && ($slaves[$i].subTarget != _SlaveJ.ID) && (_SlaveJ.subTarget != $slaves[$i].ID)>>
		With time apart $slaves[$i].slaveName and _SlaveJ.slaveName @@color:lightgreen;dislike each other less.@@
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
	<<elseif (_SlaveJ.fetish is $slaves[$i].fetish) && (_SlaveJ.fetishKnown == 1) && ($slaves[$i].fetishKnown == 1)>>
		$slaves[$i].slaveName and _SlaveJ.slaveName share sexual interests, and in the sexual atmosphere of the arcology, it's @@color:lightgreen;difficult for them to keep up their dislike@@ of one another with the mutual attraction.
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
	<<elseif (_SlaveJ.devotion > 50) && ($slaves[$i].devotion > 50)>>
		Since both $slaves[$i].slaveName and _SlaveJ.slaveName are devoted to you, they work together to @@color:lightgreen;get over their feud,@@ since it gets in the way of their duties.
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
	<<elseif (_SlaveJ.trust < -20) && ($slaves[$i].devotion < -20)>>
		Since both $slaves[$i].slaveName and _SlaveJ.slaveName are terrified of you, they work together to @@color:lightgreen;get over their feud,@@ since it brings punishment on both of them.
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
	<<elseif (_SlaveJ.ID is $slaves[$i].relationshipTarget) && ($slaves[$i].relationship > 3)>>
		<<set _SlaveJ.rivalry to 0, _SlaveJ.rivalryTarget to 0>>
		<<set $slaves[$i].rivalry to 0, $slaves[$i].rivalryTarget to 0>>
	<<elseif (random(1,100) > 70)>>
		$slaves[$i].slaveName and _SlaveJ.slaveName's @@color:lightgreen;feud dissipates a little.@@
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
	<</if>>
<<elseif $familyTesting == 1 && totalRelatives($slaves[$i]) > 0 && (random(1,100) > 80)>>
		$slaves[$i].slaveName and_SlaveJ.slaveName @@color:lightsalmon;pursue their family rivalry.@@
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
<<elseif ($slaves[$i].relation != 0) && ($slaves[$i].relationTarget is $slaves[$i].rivalryTarget) && (random(1,100) > 80)>>
	$slaves[$i].slaveName and _SlaveJ.slaveName @@color:lightsalmon;pursue their family rivalry.@@
	<<set _SlaveJ.rivalry += 1, $slaves[$i].rivalry += 1>>
<<elseif $familyTesting == 1 && totalRelatives($slaves[$i]) > 0 && (random(1,100) > 80)>>
		$slaves[$i].slaveName and _SlaveJ.slaveName @@color:lightgreen;patch up their family relationship.@@
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
<<elseif ($slaves[$i].relation != 0) && ($slaves[$i].relationTarget is $slaves[$i].rivalryTarget) && (random(1,100) > 80)>>
	$slaves[$i].slaveName and _SlaveJ.slaveName @@color:lightgreen;patch up their family relationship.@@
	<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
<<elseif ($slaves[$i].energy > 95) && (random(1,100) > 60)>>
	$slaves[$i].slaveName lusts after _SlaveJ.slaveName, and does everything she can to @@color:lightgreen;patch up their differences.@@
	<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
<<elseif ($slaves[$i].attrXX > 85) && (random(1,100) > 70)>>
	<<if (_SlaveJ.vagina > -1) || (_SlaveJ.faceShape != "masculine")>>
		$slaves[$i].slaveName lusts after _SlaveJ.slaveName, and does everything she can to @@color:lightgreen;patch up their differences.@@
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
	<</if>>
<<elseif ($slaves[$i].attrXY > 85) && (random(1,100) > 70)>>
	<<if (_SlaveJ.balls > 0) || (_SlaveJ.faceShape is "masculine")>>
		$slaves[$i].slaveName lusts after _SlaveJ.slaveName, and does everything she can to @@color:lightgreen;patch up their differences.@@
		<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
	<</if>>
<<elseif (random(1,100) > 90)>>
	$slaves[$i].slaveName and _SlaveJ.slaveName @@color:lightsalmon;bicker@@ and indulge their rivalry whenever they can.
	<<set _SlaveJ.rivalry += 1, $slaves[$i].rivalry += 1>>
<<elseif (random(1,100) > 90)>>
	$slaves[$i].slaveName and _SlaveJ.slaveName manage to @@color:lightgreen;de-escalate their little feud.@@
	<<set _SlaveJ.rivalry -= 1, $slaves[$i].rivalry -= 1>>
<</if>>
<</if>>
<<set $slaves[_j] = _SlaveJ>>
<</if>>
<</if>>

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

<</if>> /* CLOSES FUCKDOLL CHECK */

src/uncategorized/saRivalries.tw