:: RA widgets [widget nobr]

/%
 Call as <<RAChangeActivation>>
%/
<<widget "RAChangeActivation">>

<<replace #activation>>
__($currentRule.activation):__
<br>
<<if $currentRule.activation == "custom" >>
	<<textarea "$currentRule.customActivationText" $currentRule.customActivationText>>
	<<link "Save activation">>
	<<RAChangeSave>>
	<<RAChangeApply>>
	<</link>>
<<elseif ($currentRule.activation != "none") && ($currentRule.activation != "always")>>
<span id="lower">
<<if ($currentRule.thresholdLower == "none")>>
(no lower limit)
<<else>>
<<if $currentRule.eqLower>>
When ''$currentRule.activation'' is
<<textbox "$currentRule.thresholdLower" $currentRule.thresholdLower>> ''or more''
<<else>>
When ''$currentRule.activation'' is ''more than''
<<textbox "$currentRule.thresholdLower" $currentRule.thresholdLower>>
<</if>>
<</if>>
</span>
      <<link ">">>
<<set $currentRule.eqLower = false>>
<<replace "#lower">>
When ''$currentRule.activation'' is ''more than''
<<textbox "$currentRule.thresholdLower" $currentRule.thresholdLower>>
<</replace>>
<</link>>
 |
<<link ">=">>
<<set $currentRule.eqLower = true>>
<<replace "#lower">>
When ''$currentRule.activation'' is
<<textbox "$currentRule.thresholdLower" $currentRule.thresholdLower>> ''or more''
<</replace>>
<</link>>
 |
<<link "No lower limit">>
<<set $currentRule.thresholdLower = "none">>
<<replace "#lower">>
(no lower limit)
<</replace>>
<</link>>
<br>and<br>
<span id="upper">
<<if ($currentRule.thresholdUpper == "none")>>
(no upper limit)
<<else>>
<<if $currentRule.eqUpper>>
When ''$currentRule.activation'' is
<<textbox "$currentRule.thresholdUpper" $currentRule.thresholdUpper>> ''or less''
<<else>>
When ''$currentRule.activation'' is ''less than''
<<textbox "$currentRule.thresholdUpper" $currentRule.thresholdUpper>>
<</if>>
<</if>>
</span>
      <<link "<">>
<<set $currentRule.eqUpper = false>>
<<replace "#upper">>
When ''$currentRule.activation'' is ''less than''
<<textbox "$currentRule.thresholdUpper" $currentRule.thresholdUpper>>
<</replace>>
<</link>>
 |
<<link "<=">>
<<set $currentRule.eqUpper = true>>
<<replace "#upper">>
When ''$currentRule.activation'' is
<<textbox "$currentRule.thresholdUpper" $currentRule.thresholdUpper>> ''or less''
<</replace>>
<</link>>
|
<<link "No upper limit">>
<<set $currentRule.thresholdUpper = "none">>
<<replace "#upper">>
(no upper limit)
<</replace>>
<</link>>
<<if ($currentRule.thresholdLower == "none") && ( $currentRule.thresholdUpper == "none")>>
	<<set $currentRule.activation = "always">>
<<elseif ($currentRule.thresholdLower != "none") && ( $currentRule.thresholdUpper != "none")>>
	<<if (def $currentRule.thresholdLower && $currentRule.thresholdLower > $currentRule.thresholdUpper)>>
	<<set $currentRule.thresholdLower = $currentRule.thresholdUpper>>
	<</if>>
	<<if (def $currentRule.thresholdUpper && $currentRule.thresholdUpper < $currentRule.thresholdLower)>>
	<<set $currentRule.thresholdUpper = $currentRule.thresholdLower>>
	<</if>>
<</if>>
<</if>>
<<switch $currentRule.activation>>
<<case "none">>
''None.''
<<case "always">>
''Always.''
<<case "devotion">>
<br>@@color:darkviolet;Very hateful@@: under -95, @@color:darkviolet;Hateful@@: -95 to under -50, @@color:mediumorchid;Resistant@@: -50 to under -20,
<br>@@color:yellow;Ambivalent@@: -20 to 20, @@color:hotpink;Accepting@@: over 20 to 50, @@color:deeppink;Devoted@@: over 50 to 95, @@color:magenta;Worshipful@@: over 95
<<case "trust">>
<br>@@color:goldenrod;Extremely terrified@@: under -95, @@color:goldenrod;Terrified@@: -95 to under -50, @@color:gold;Frightened@@: -50 to under -20,
<br>@@color:yellow;Fearful@@: -20 to 20, @@color:mediumaquamarine;Careful@@: over 40 to 50, @@color:mediumseagreen;Trusting@@: 50 to 95, @@color:seagreen;Total trust@@: over 95
<<case "health">>
<br>@@color:red;Death@@: under -100, @@color:red;Near death@@: -100 to less than -90, @@color:red;Extremely unhealthy@@: -90 to less than -50, @@color:red;Unhealthy@@: -50 to less than -20 @@color:green;Healthy@@: -20 to 20, @@color:green;Very healthy@@: 20 to 50, @@color:green;Extremely healthy@@: over 50 to 90, @@color:green;Unnaturally healthy@@: over 90
<<case "sex drive">>
<br>@@color:red;Frigid@@: 20 or under, @@color:red;Poor@@: 21 to 40, @@color:yellow;Average@@: 41 to 60, @@color:green;Powerful@@: 61 to 80, @@color:green;Sex addict@@: 81 to 99, @@color:green;Nympho@@: 100
<<case "weight">>
<br>@@color:red;Emaciated@@: under -95, @@color:red;Skinny@@: -95 to less than -30, Thin: -30 to less than -10 Average weight: -10 to 10, Plush: over 10 to 30, @@color:red;Fat@@: over 30 to 95, @@color:red;Overweight@@: over 95
<<case "lactation">>
<br>// 0 - none, 1 - natural, 2 - lactation implant. //
<<case "pregnancy week">>
<br>// >1 - pregnancy week(s), 0 - not pregnant, -1 - on contraceptives, -2 - barren. //
<<case "pregnancy foetuses">>
<br>// Fetus count, rule can be applied only after week 10 of pregnancy. //
<<case "belly implant volume">>
<br>// Volume of belly implant in ccs. 0 - none. //
<<case "custom">>
<br>// Enter custom condition. //
<</switch>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeApplyAssignment>>
%/
<<widget "RAChangeApplyAssignment">>
<<replace #applyassignment>>
Apply to assignments:
<br>
<<if ndef $currentRule.assignment>>
	<<set $currentRule.assignment = []>>
<</if>>
<<set _rest = false>>
<<set _fucktoy = false>>
<<set _servant = false>>
<<set _confined = false>>
<<set _whore = false>>
<<set _public = false>>
<<set _milked = false>>
<<set _subordinate = false>>
<<set _gloryhole = false>>

<<for _a = $currentRule.assignment.length; _a >= 0; _a-->>
<<if $currentRule.assignment[_a] == "rest">>
	<<set _rest = true>>
<</if>>
<<if $currentRule.assignment[_a] == "please you">>
	<<set _fucktoy = true>>
<</if>>
<<if $currentRule.assignment[_a] == "be a servant">>
	<<set _servant = true>>
<</if>>
<<if $currentRule.assignment[_a] == "whore">>
	<<set _whore = true>>
<</if>>
<<if $currentRule.assignment[_a] == "work a glory hole">>
	<<set _gloryhole = true>>
<</if>>
<<if $currentRule.assignment[_a] == "get milked">>
	<<set _milked = true>>
<</if>>
<<if $currentRule.assignment[_a] == "serve the public">>
	<<set _public = true>>
<</if>>
<<if $currentRule.assignment[_a] == "be a subordinate slave">>
	<<set _subordinate = true>>
<</if>>
<<if $currentRule.assignment[_a] == "stay confined">>
	<<set _confined = true>>
<</if>>
<</for>>

<<if _rest || _fucktoy || _servant || _confined || _whore || _public || _milked || _subordinate || _gloryhole>>
	<<link "None">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>> |
<<else>>
	''None'' |
<</if>>

<<if !_rest>>
	<<link "Rest">>
		<<set $currentRule.assignment.push("rest")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Rest''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "rest")>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_fucktoy>>
	<<link "Fucktoy">>
		<<set $currentRule.assignment.push("please you")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Fucktoy''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "please you")>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_subordinate>>
	<<link "Subordinate Slave">>
		<<set $currentRule.assignment.push("be a subordinate slave")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Subordinate Slave''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "be a subordinate slave")>>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|

<<if !_servant>>
	<<link "House Servant">>
		<<set $currentRule.assignment.push("be a servant")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''House Servant''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "be a servant")>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_confined>>
	<<link "Confined">>
		<<set $currentRule.assignment.push("stay confined")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Confined''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "stay confined")>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_whore>>
	<<link "Whore">>
		<<set $currentRule.assignment.push("whore")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Whore''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "whore")>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_public>>
	<<link "Public Servant">>
		<<set $currentRule.assignment.push("serve the public")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Public Servant''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "serve the public")>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_milked>>
	<<link "Milking">>
		<<set $currentRule.assignment.push("get milked")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Milking''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "get milked")>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_gloryhole>>
	<<link "Gloryhole">>
		<<set $currentRule.assignment.push("work a glory hole")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Gloryhole''
	<<link Stop>>
		<<set removeFromArray($currentRule.assignment, "work a glory hole")>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeExcludeAssignment>>
%/
<<widget "RAChangeExcludeAssignment">>
<<replace #excludeassignment>>
Exclude assignments:
<br>
<<if ndef $currentRule.excludeAssignment>>
	<<set $currentRule.excludeAssignment = []>>
<</if>>
<<set _rest = false>>
<<set _fucktoy = false>>
<<set _servant = false>>
<<set _confined = false>>
<<set _whore = false>>
<<set _public = false>>
<<set _milked = false>>
<<set _subordinate = false>>
<<set _gloryhole = false>>
<<for _a = $currentRule.excludeAssignment.length; _a >= 0; _a-->>
<<if $currentRule.excludeAssignment[_a] == "rest">>
	<<set _rest = true>>
<</if>>
<<if $currentRule.excludeAssignment[_a] == "please you">>
	<<set _fucktoy = true>>
<</if>>
<<if $currentRule.excludeAssignment[_a] == "be a servant">>
	<<set _servant = true>>
<</if>>
<<if $currentRule.excludeAssignment[_a] == "whore">>
	<<set _whore = true>>
<</if>>
<<if $currentRule.excludeAssignment[_a] == "work a glory hole">>
	<<set _gloryhole = true>>
<</if>>
<<if $currentRule.excludeAssignment[_a] == "get milked">>
	<<set _milked = true>>
<</if>>
<<if $currentRule.excludeAssignment[_a] == "serve the public">>
	<<set _public = true>>
<</if>>
<<if $currentRule.excludeAssignment[_a] == "be a subordinate slave">>
	<<set _subordinate = true>>
<</if>>
<<if $currentRule.excludeAssignment[_a] == "stay confined">>
	<<set _confined = true>>
<</if>>
<</for>>
<<if _rest || _fucktoy || _servant || _confined || _whore || _public || _milked || _subordinate || _gloryhole>>
	<<link "None">>
		<<set $currentRule.excludeAssignment = []>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>> |
<<else>>
	''None'' |
<</if>>
<<if !_rest>>
	<<link "Rest">>
		<<set $currentRule.excludeAssignment.push("rest")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Rest''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "rest")>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_fucktoy>>
	<<link "Fucktoy">>
		<<set $currentRule.excludeAssignment.push("please you")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Fucktoy''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "please you")>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_subordinate>>
	<<link "Subordinate Slave">>
		<<set $currentRule.excludeAssignment.push("be a subordinate slave")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Subordinate Slave''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "be a subordinate slave")>>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_servant>>
	<<link "House Servant">>
		<<set $currentRule.excludeAssignment.push("be a servant")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''House Servant''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "be a servant")>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_confined>>
	<<link "Confined">>
		<<set $currentRule.excludeAssignment.push("stay confined")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Confined''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "stay confined")>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_whore>>
	<<link "Whore">>
		<<set $currentRule.excludeAssignment.push("whore")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Whore''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "whore")>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_public>>
	<<link "Public Servant">>
		<<set $currentRule.excludeAssignment.push("serve the public")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Public Servant''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "serve the public")>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_milked>>
	<<link "Milking">>
		<<set $currentRule.excludeAssignment.push("get milked")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Milking''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "get milked")>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
|
<<if !_gloryhole>>
	<<link "Gloryhole">>
		<<set $currentRule.excludeAssignment.push("work a glory hole")>>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Gloryhole''
	<<link Stop>>
		<<set removeFromArray($currentRule.excludeAssignment, "work a glory hole")>>
		<<RAChangeExcludeAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeApplyFacility>>
%/
<<widget "RAChangeApplyFacility">>

<<replace #applyfacility>>
<<if ($HGSuite > 0) || ($brothel > 0) || ($club > 0) || ($arcade > 0) || ($dairy > 0) || ($servantsQuarters > 0) || ($masterSuite > 0) || ($schoolroom > 0) || ($spa > 0) || ($clinic > 0) || ($cellblock > 0)>>
<br><br>
Apply to facilities:
<br>
<<if (_facility.length > 0)>>
	<<link "None">>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''None''
<</if>>
<<if ($HGSuite > 0)>>
|
<<if !ruleFacility(_facility,"hgsuite")>>
	<<link $HGSuiteNameCaps>>
		<<set _facility.push("hgsuite")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$HGSuiteNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "hgsuite")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($brothel > 0)>>
|
<<if !ruleFacility(_facility,"brothel")>>
	<<link $brothelNameCaps>>
		<<set _facility.push("brothel")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$brothelNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "brothel")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($club > 0)>>
|
<<if !ruleFacility(_facility,"club")>>
	<<link $clubNameCaps>>
		<<set _facility.push("club")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$clubNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "club")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($arcade > 0)>>
|
<<if !ruleFacility(_facility,"arcade")>>
	<<link $arcadeNameCaps>>
		<<set _facility.push("arcade")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$arcadeNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "arcade")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($dairy > 0)>>
|
<<if !ruleFacility(_facility,"dairy")>>
	<<link $dairyNameCaps>>
		<<set _facility.push("dairy")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$dairyNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "dairy")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($servantsQuarters > 0)>>
|
<<if !ruleFacility(_facility,"servantsquarters")>>
	<<link $servantsQuartersNameCaps>>
		<<set _facility.push("servantsquarters")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$servantsQuartersNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "servantsquarters")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($masterSuite > 0)>>
|
<<if !ruleFacility(_facility,"mastersuite")>>
	<<link $masterSuiteNameCaps>>
		<<set _facility.push("mastersuite")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$masterSuiteNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "mastersuite")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($schoolroom > 0)>>
|
<<if !ruleFacility(_facility,"schoolroom")>>
	<<link $schoolroomNameCaps>>
		<<set _facility.push("schoolroom")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$schoolroomNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "schoolroom")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($spa > 0)>>
|
<<if !ruleFacility(_facility,"spa")>>
	<<link $spaNameCaps>>
		<<set _facility.push("spa")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$spaNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "spa")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($clinic > 0)>>
|
<<if !ruleFacility(_facility,"clinic")>>
	<<link $clinicNameCaps>>
		<<set _facility.push("clinic")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
''$clinicNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "clinic")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($cellblock > 0)>>
|
<<if !ruleFacility(_facility,"cellblock")>>
	<<link $cellblockNameCaps>>
		<<set _facility.push("cellblock")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$cellblockNameCaps''
	<<link Stop>>
		<<set removeFromArray(_facility, "cellblock")>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<</if>>
<<if (def _facility) && (_facility.length > 0)>>
<br>
  Exclude special slaves:
<<if $currentRule.excludeSpecialSlaves>>
	''True'' |
	<<link False>>
		<<set $currentRule.excludeSpecialSlaves = false>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''False'' |
	<<link True>>
		<<set $currentRule.excludeSpecialSlaves = true>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeExcludeFacility>>
%/
<<widget "RAChangeExcludeFacility">>
<<replace #excludefacility>>
<<if ($HGSuite > 0) || ($brothel > 0) || ($club > 0) || ($arcade > 0) || ($dairy > 0) || ($servantsQuarters > 0) || ($masterSuite > 0) || ($schoolroom > 0) || ($spa > 0) || ($clinic > 0) || ($cellblock > 0)>>
<br>
Exclude facilities:
<br>
<<if (_excludeFacility.length > 0)>>
	<<link "None">>
		<<set _excludeFacility = []>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''None''
<</if>>
<<if ($HGSuite > 0)>>
|
<<if !ruleFacility(_excludeFacility,"hgsuite")>>
	<<link $HGSuiteNameCaps>>
		<<set _excludeFacility.push("hgsuite")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$HGSuiteNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "hgsuite")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($brothel > 0)>>
|
<<if !ruleFacility(_excludeFacility,"brothel")>>
	<<link $brothelNameCaps>>
		<<set _excludeFacility.push("brothel")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$brothelNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "brothel")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($club > 0)>>
|
<<if !ruleFacility(_excludeFacility,"club")>>
	<<link $clubNameCaps>>
		<<set _excludeFacility.push("club")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$clubNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "club")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($arcade > 0)>>
|
<<if !ruleFacility(_excludeFacility,"arcade")>>
	<<link $arcadeNameCaps>>
		<<set _excludeFacility.push("arcade")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$arcadeNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "arcade")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($dairy > 0)>>
|
<<if !ruleFacility(_excludeFacility,"dairy")>>
	<<link $dairyNameCaps>>
		<<set _excludeFacility.push("dairy")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$dairyNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "dairy")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($servantsQuarters > 0)>>
|
<<if !ruleFacility(_excludeFacility,"servantsquarters")>>
	<<link $servantsQuartersNameCaps>>
		<<set _excludeFacility.push("servantsquarters")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$servantsQuartersNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "servantsquarters")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($masterSuite > 0)>>
|
<<if !ruleFacility(_excludeFacility,"mastersuite")>>
	<<link $masterSuiteNameCaps>>
		<<set _excludeFacility.push("mastersuite")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$masterSuiteNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "mastersuite")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($schoolroom > 0)>>
|
<<if !ruleFacility(_excludeFacility,"schoolroom")>>
	<<link $schoolroomNameCaps>>
		<<set _excludeFacility.push("schoolroom")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$schoolroomNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "schoolroom")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($spa > 0)>>
|
<<if !ruleFacility(_excludeFacility,"spa")>>
	<<link $spaNameCaps>>
		<<set _excludeFacility.push("spa")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$spaNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "spa")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($clinic > 0)>>
|
<<if !ruleFacility(_excludeFacility,"clinic")>>
	<<link $clinicNameCaps>>
		<<set _excludeFacility.push("clinic")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
''$clinicNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "clinic")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<<if ($cellblock > 0)>>
|
<<if !ruleFacility(_excludeFacility,"cellblock")>>
	<<link $cellblockNameCaps>>
		<<set _excludeFacility.push("cellblock")>>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeExcludeFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$cellblockNameCaps''
	<<link Stop>>
		<<set removeFromArray(_excludeFacility, "cellblock")>>
		<<RAChangeExcludeFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeSetAssignment>>
%/
<<widget "RAChangeSetAssignment">>

<<replace #setassignment>>
<<if ($currentRule.setAssignment != "none")>>
''Automatically set assignment:''
<br>
	<<link "None">>
		<<set $currentRule.setAssignment = "none">>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
Automatically set assignment:
<br>
	''None''
<</if>>
|
<<if ($currentRule.setAssignment != "rest")>>
	<<link "Rest">>
		<<set $currentRule.setAssignment = "rest">>
		<<set $currentRule.assignFacility = "none">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSetAssignment>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Rest''
<</if>>
|
<<if ($currentRule.setAssignment != "please you")>>
	<<link "Fucktoy">>
		<<set $currentRule.setAssignment = "please you">>
		<<set $currentRule.assignFacility = "none">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSetAssignment>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Fucktoy''
<</if>>
|
<<if ($currentRule.setAssignment != "be a servant")>>
	<<link "House Servant">>
		<<set $currentRule.setAssignment = "be a servant">>
		<<set $currentRule.assignFacility = "none">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSetAssignment>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''House Servant''
<</if>>
|
<<if ($currentRule.setAssignment != "stay confined")>>
	<<link "Confined">>
		<<set $currentRule.setAssignment = "stay confined">>
		<<set $currentRule.assignFacility = "none">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSetAssignment>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Confined''
<</if>>
|
<<if ($currentRule.setAssignment != "whore")>>
	<<link "Whore">>
		<<set $currentRule.setAssignment = "whore">>
		<<set $currentRule.assignFacility = "none">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSetAssignment>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Whore''
<</if>>
|
<<if ($currentRule.setAssignment != "serve the public")>>
	<<link "Public Servant">>
		<<set $currentRule.setAssignment = "serve the public">>
		<<set $currentRule.assignFacility = "none">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSetAssignment>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Public Servant''
<</if>>
|
<<if ($currentRule.setAssignment != "get milked")>>
	<<link "Milking">>
		<<set $currentRule.setAssignment = "get milked">>
		<<set $currentRule.assignFacility = "none">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSetAssignment>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Milking''
<</if>>
|
<<if ($currentRule.setAssignment != "work a glory hole")>>
	<<link "Gloryhole">>
		<<set $currentRule.setAssignment = "work a glory hole">>
		<<set $currentRule.assignFacility = "none">>
		<<set $currentRule.assignment = []>>
		<<RAChangeApplyAssignment>>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''Gloryhole''
<</if>>
<<if ($currentRule.setAssignment != "none")>>
<br>
  Exclude special slaves:
<<if $currentRule.excludeSpecialSlaves>>
	''True'' |
	<<link False>>
		<<set $currentRule.excludeSpecialSlaves = false>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''False'' |
	<<link True>>
		<<set $currentRule.excludeSpecialSlaves = true>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeAssignFacility>>
%/
<<widget "RAChangeAssignFacility">>

<<replace #assignfacility>>
<<if ($HGSuite > 0) || ($brothel > 0) || ($club > 0) || ($arcade > 0) || ($dairy > 0) || ($servantsQuarters > 0) || ($masterSuite > 0) || ($schoolroom > 0) || ($spa > 0) || ($clinic > 0) || ($cellblock > 0)>>
<br><br>
<<if ($currentRule.assignFacility != "none")>>
''Automatically assign slaves to facility:''
<br>
	<<link "None">>
		<<set $currentRule.assignFacility = "none">>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
Automatically assign slaves to facility:
<br>
	''None''
<</if>>
<<if ($HGSuite > 0)>>
|
<<if ($currentRule.assignFacility != "hgsuite")>>
	<<link $HGSuiteNameCaps>>
		<<set $currentRule.assignFacility = "hgsuite">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeApplyFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$HGSuiteNameCaps''
<</if>>
<</if>>
<<if ($brothel > 0)>>
|
<<if ($currentRule.assignFacility != "brothel")>>
	<<link $brothelNameCaps>>
		<<set $currentRule.assignFacility = "brothel">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$brothelNameCaps''
<</if>>
<</if>>
<<if ($club > 0)>>
|
<<if ($currentRule.assignFacility != "club")>>
	<<link $clubNameCaps>>
		<<set $currentRule.assignFacility = "club">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$clubNameCaps''
<</if>>
<</if>>
<<if ($arcade > 0)>>
|
<<if ($currentRule.assignFacility != "arcade")>>
	<<link $arcadeNameCaps>>
		<<set $currentRule.assignFacility = "arcade">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$arcadeNameCaps''
<</if>>
<</if>>
<<if ($dairy > 0)>>
|
<<if ($currentRule.assignFacility != "dairy")>>
	<<link $dairyNameCaps>>
		<<set $currentRule.assignFacility = "dairy">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$dairyNameCaps''
<</if>>
<</if>>
<<if ($servantsQuarters > 0)>>
|
<<if ($currentRule.assignFacility != "servantsquarters")>>
	<<link $servantsQuartersNameCaps>>
		<<set $currentRule.assignFacility = "servantsquarters">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$servantsQuartersNameCaps''
<</if>>
<</if>>
<<if ($masterSuite > 0)>>
|
<<if ($currentRule.assignFacility != "mastersuite")>>
	<<link $masterSuiteNameCaps>>
		<<set $currentRule.assignFacility = "mastersuite">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$masterSuiteNameCaps''
<</if>>
<</if>>
<<if ($schoolroom > 0)>>
|
<<if ($currentRule.assignFacility != "schoolroom")>>
	<<link $schoolroomNameCaps>>
		<<set $currentRule.assignFacility = "schoolroom">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$schoolroomNameCaps''
<</if>>
<</if>>
<<if ($spa > 0)>>
|
<<if ($currentRule.assignFacility != "spa")>>
	<<link $spaNameCaps>>
		<<set $currentRule.assignFacility = "spa">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$spaNameCaps''
<</if>>
<</if>>
<<if ($clinic > 0)>>
|
<<if ($currentRule.assignFacility != "clinic")>>
	<<link $clinicNameCaps>>
		<<set $currentRule.assignFacility = "clinic">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$clinicNameCaps''
<</if>>
<</if>>
<<if ($cellblock > 0)>>
|
<<if ($currentRule.assignFacility != "cellblock")>>
	<<link $cellblockNameCaps>>
		<<set $currentRule.assignFacility = "cellblock">>
		<<set $currentRule.setAssignment = "none">>
		<<set $currentRule.facility = []>>
		<<set _facility = []>>
		<<RAChangeApplyFacility>>
		<<RAChangeAssignFacility>>
		<<RAChangeSetAssignment>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''$cellblockNameCaps''
<</if>>
<</if>>
<<if ($currentRule.assignFacility != "none")>>
<br>
  Exclude special slaves:
<<if $currentRule.excludeSpecialSlaves>>
	''True'' |
	<<link False>>
		<<set $currentRule.excludeSpecialSlaves = false>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''False'' |
	<<link True>>
		<<set $currentRule.excludeSpecialSlaves = true>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<br>
  Automatically remove from facility:
<<if $currentRule.facilityRemove>>
	''True'' |
	<<link False>>
		<<set $currentRule.facilityRemove = false>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
	''False'' |
	<<link True>>
		<<set $currentRule.facilityRemove = true>>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<</if>>
<br>
  Assignment on removal:
$currentRule.removalAssignment |
<<if ($currentRule.removalAssignment != "rest")>>
	<<link Rest>>
		<<set $currentRule.removalAssignment = "rest">>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>> |
<<else>>
''Rest'' |
<</if>>
<<if ($currentRule.removalAssignment != "please you")>>
	<<link "Please you">>
		<<set $currentRule.removalAssignment = "please you">>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>> |
<<else>>
''Please you'' |
<</if>>
<<if ($currentRule.removalAssignment != "whore")>>
	<<link Whore>>
		<<set $currentRule.removalAssignment = "whore">>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>> |
<<else>>
''Whore'' |
<</if>>
<<if ($currentRule.removalAssignment != "serve the public")>>
	<<link "Public servant">>
		<<set $currentRule.removalAssignment = "serve the public">>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>> |
<<else>>
''Public servant'' |
<</if>>
<<if ($currentRule.removalAssignment != "get milked")>>
	<<link "Get milked">>
		<<set $currentRule.removalAssignment = "get milked">>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>> |
<<else>>
''Get milked'' |
<</if>>
<<if ($currentRule.removalAssignment != "stay confined")>>
	<<link "Stay confined">>
		<<set $currentRule.removalAssignment = "stay confined">>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>> |
<<else>>
''Stay confined'' |
<</if>>
<<if ($currentRule.removalAssignment != "work a glory hole")>>
	<<link "Glory hole">>
		<<set $currentRule.removalAssignment = "work a glory hole">>
		<<RAChangeAssignFacility>>
		<<RAChangeSave>>
		<<RAChangeApply>>
	<</link>>
<<else>>
''Glory hole''
<</if>>
<</if>>
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeClothes>>
%/
<<widget "RAChangeClothes">>
<<replace #clothes>>
<<if $currentRule.choosesOwnClothes == 1>>
	''slave's choice.''
	<<set $currentRule.clothes = "choosing her own clothes">>
<<else>>
	''$currentRule.clothes.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeCollar>>
%/
<<widget "RAChangeCollar">>
<<replace #collar>>
Collar: ''$currentRule.collar.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangeShoes>>
%/
<<widget "RAChangeShoes">>
<<replace #shoes>>
Shoes: ''$currentRule.shoes.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangeBelly>>
%/
<<widget "RAChangeBelly">>
<<replace #baccessory>>
Corsetage: ''$currentRule.bellyAccessory.
<</replace>>
<</widget>>

/%
 Call as <<RAChangeVAccessory>>
 $arg[0] - 0: virgin, 1: anal virgin, else non-virgin.
%/
<<widget "RAChangeVAccessory">>
<<if $args[0] == 0>>
	<<replace #vaccessory>>
		Vaginal accessories for virgins: ''$currentRule.virginAccessory.''
	<</replace>>
<<elseif $args[0] == 1>>
	<<replace #avaccessory>>
		Vaginal accessories for anal virgins: ''$currentRule.aVirginAccessory.''
	<</replace>>
<<else>>
	<<replace #voaccessory>>
		Vaginal accessories for other slaves: ''$currentRule.vaginalAccessory.''
	<</replace>>
<</if>>
<</widget>>

/%
 Call as <<RAChangeDAccessory>>
 $arg[0] - 0: anal virgin, else non-virgin.
%/
<<widget "RAChangeDAccessory">>
<<if $args[0] == 0>>
	<<replace #avdaccessory>>
		Dick accessories for anal virgins: ''$currentRule.aVirginDickAccessory.''
	<</replace>>
<<else>>
	<<replace #daccessory>>
		Dick accessories for other slaves: ''$currentRule.dickAccessory.''
	<</replace>>
<</if>>
<</widget>>

/%
 Call as <<RAChangeBAccessory>>
 $arg[0] - 0: anal virgin, else non-virgin.
%/
<<widget "RAChangeBAccessory">>
<<if $args[0] == 0>>
	<<replace #avbuaccessory>>
		Buttplugs for anal virgins: ''$currentRule.aVirginButtplug.''
	<</replace>>
<<else>>
	<<replace #buaccessory>>
		Buttplugs for other slaves: ''$currentRule.buttplug.''
	<</replace>>
<</if>>
<</widget>>

/%
 Call as <<RAChangeCuratives>>
%/
<<widget "RAChangeCuratives">>
<<replace #curatives>>
<<if $currentRule.curatives == "no default setting">>
	''no default setting.''
<<elseif $currentRule.curatives > 0>>
	<<if $currentRule.curatives > 1>>
		''curatives.''
	<<else>>
		''preventatives.''
	<</if>>
<<else>>
	''none.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeGrowth>>
%/
<<widget "RAChangeGrowth">>
<<replace #growth>>
Growth hormones for healthy slaves:

<<if $currentRule.growth == "girlish">>
	''up to a girlish figure.''
<<elseif $currentRule.growth == "stacked">>
	''up to a stacked figure.''
<<elseif $currentRule.growth == "functional">>
	''as large as will allow a normal life.''
<<elseif $currentRule.growth == "unlimited">>
	''no limits.''
<<else>>
	''no default setting.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeAphrodisiacs>>
%/
<<widget "RAChangeAphrodisiacs">>
<<replace #aphrodisiacs>>
Aphrodisiacs:

<<if $currentRule.aphrodisiacs == "no default setting">>
	''no default setting.''
<<elseif $currentRule.aphrodisiacs > 0>>
	<<if $currentRule.aphrodisiacs > 1>>
		''extreme.''
	<<else>>
		''standard.''
	<</if>>
<<else>>
	''none.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangePreg>>
%/
<<widget "RAChangePreg">>
<<replace #preg>>
Contraceptives for fertile slaves: // Will override hormones and drugs if applicable.//

<<if $currentRule.preg == 0>>
	''fertile.''
<<elseif $currentRule.preg == 1>>
	''very fertile.''
<<elseif $currentRule.preg == 2>>
	''extremely fertile.''
<<elseif $currentRule.preg == 3>>
	''hyper fertile.''
<<elseif $currentRule.preg == 4>>
	''just knock my shit up.''
<<elseif $currentRule.preg == -1>>
	''contraceptives.''
<<else>>
	''no default setting.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeXXHormones>>
%/
<<widget "RAChangeXXHormones">>
<<replace #xxhormones>>
Hormones for female slaves:

<<if $currentRule.XX == 0>>
	''no hormones.''
<<elseif $currentRule.XX == 1>>
	''female.''
<<elseif $currentRule.XX == 2>>
	''intensive female.''
<<elseif $currentRule.XX == -1>>
	''male.''
<<elseif $currentRule.XX == -2>>
	''intensive male.''
<<else>>
	''no default setting.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeXYHormones>>
%/
<<widget "RAChangeXYHormones">>
<<replace #xyhormones>>
Hormones for shemales:

<<if $currentRule.XY == 0>>
	''no hormones.''
<<elseif $currentRule.XY == 1>>
	''female.''
<<elseif $currentRule.XY == 2>>
	''intensive female.''
<<elseif $currentRule.XY == -1>>
	''male.''
<<elseif $currentRule.XY == -2>>
	''intensive male.''
<<else>>
	''no default setting.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeGeldHormones>>
%/
<<widget "RAChangeGeldHormones">>
<<replace #geldhormones>>
Hormones for geldings:

<<if $currentRule.gelding == 0>>
	''no hormones.''
<<elseif $currentRule.gelding == 1>>
	''female.''
<<elseif $currentRule.gelding == 2>>
	''intensive female.''
<<elseif $currentRule.gelding == -1>>
	''male.''
<<elseif $currentRule.gelding == -2>>
	''intensive male.''
<<else>>
	''no default setting.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeDiet>>
%/
<<widget "RAChangeDiet">>
<<replace #diet>>
Slave diets:

<<if $currentRule.diet == 30>>
	''designed to keep slaves plush.''
<<elseif $currentRule.diet == 0>>
	''designed for average weight.''
<<elseif $currentRule.diet == -30>>
	''designed to keep slaves thin.''
<<elseif $currentRule.diet == "attractive">>
	''fat slaves will slim down to plush; skinny slaves will fill out to thin.''
<<elseif $currentRule.diet == "XY">>
	''designed to promote male development.''
<<elseif $currentRule.diet == "XX">>
	''designed to promote female development.''
<<elseif $currentRule.diet == "XXY">>
	''designed to promote hermaphrodite development.''
<<else>>
	''no default setting.''
<</if>>
<</replace>>
<<replace #dietsupport>>
<<if $currentRule.diet !== "no default setting">>
<br>&nbsp;&nbsp;&nbsp;&nbsp;Diet support for growth drugs:
<<if $currentRule.dietGrowthSupport == 1>>
	''on.''
<<else>>
	''off.''
<</if>>

<<link "On">>
	<<set $currentRule.dietGrowthSupport = 1>>
	<<RAChangeDiet>>
<</link>>
|
<<link "Off">>
	<<set $currentRule.dietGrowthSupport = 0>>
	<<RAChangeDiet>>
<</link>>
<</if>>
<</replace>>
<<replace #dietBase>>
Diet Base:

<<if $currentRule.dietCum == 2>>
	''Cum-Based.''
<<elseif (($currentRule.dietCum == 1) && ($currentRule.dietMilk == 0))>>
	''Cum Added.''
<<elseif (($currentRule.dietCum == 0) && ($currentRule.dietMilk == 1))>>
	''Milk Added.''
<<elseif (($currentRule.dietCum == 1) && ($currentRule.dietMilk == 1))>>
	''Cum & Milk Added.''
<<elseif ($currentRule.dietMilk == 2)>>
	''Milk Based.''
<<elseif (($currentRule.dietCum == 0) && ($currentRule.dietMilk == 0))>>
	''Normal Diet.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeMuscles>>
%/
<<widget "RAChangeMuscles">>
<<replace #muscles>>
Muscles:

<<if $currentRule.muscles > 95>>
	''massive.''
<<elseif $currentRule.muscles > 30>>
	''ripped.''
<<elseif $currentRule.muscles > 5>>
	''toned.''
<<elseif $currentRule.muscles == 0>>
	''none.''
<<else>>
	''no default setting.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeBraces>>
%/
<<widget "RAChangeBraces">>
<<replace #braces>>
Braces:

<<if $currentRule.teeth == "straighten">>
	''straighten'' teeth, then remove.
<<elseif $currentRule.teeth == "universal">>
	''universally'' applied.
<<elseif $currentRule.teeth == "none">>
	''none.''
<<else>>
	''no default setting.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeAssistantImplants>>
%/
<<widget "RAChangeAssistantImplants">>
<<replace #assistantimplants>>
Assistant-applied implants:

<<if $currentRule.autoSurgery == 1>>
	''ACTIVE, STAND CLEAR.''
	<<link "Off">>
		<<set $currentRule.autoSurgery = 0>>
		<<RAChangeAssistantImplants>>
	<</link>>
<<else>>
	''off.''
	<<link "Activate">>
		<<set $currentRule.autoSurgery = 1>>
		<<RAChangeAssistantImplants>>
	<</link>>
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeAssignment>>
%/
<<widget "RAChangeAssignment">>
<<replace #chooseassignment>>
Assignments:

<<if $currentRule.choosesOwnAssignment == 0>>
  ''selected by the player.''

<<link "Slave's choice">>
	<<set $currentRule.choosesOwnAssignment = 1>>
	<<RAChangeAssignment>>
<</link>>
<<else>>
  ''selected by the slave.''
<<link "Player control">>
	<<set $currentRule.choosesOwnAssignment = 0>>
	<<RAChangeAssignment>>
<</link>>
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeLiving>>
%/
<<widget "RAChangeLiving">>
<<replace #living>>
Living standard: ''$currentRule.livingRules.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangePunish>>
%/
<<widget "RAChangePunish">>
<<replace #punish>>
Typical punishment: ''$currentRule.standardPunishment.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangeReward>>
%/
<<widget "RAChangeReward">>
<<replace #reward>>
Typical reward: ''$currentRule.standardReward.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangeMast>>
%/
<<widget "RAChangeMast">>
<<replace #mast>>
Masturbation rules: ''$currentRule.releaseRules.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangeSPF>>
%/
<<widget "RAChangeSPF">>
<<replace #spf>>
	''$currentRule.clitSetting.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangeSPXY>>
%/
<<widget "RAChangeSPXY">>
<<replace #spxy>>
	<<RAInitSPXY>>
<</replace>>
<</widget>>

<<widget "RAInitSPXY">>
	<<if $currentRule.clitSettingXY == "no default setting">>
		''no default setting.''
	<<elseif $currentRule.clitSettingXY > 95>>
		''passionate.''
	<<elseif $currentRule.clitSettingXY > 70>>
		''attracted.''
	<<elseif $currentRule.clitSettingXY > 30>>
		''indifferent.''
	<<else>>
		''none.''
	<</if>>
<</widget>>

/%
 Call as <<RAChangeSPXX>>
%/
<<widget "RAChangeSPXX">>
<<replace #spxx>>
	<<RAInitSPXX>>
<</replace>>
<</widget>>

<<widget "RAInitSPXX">>
	<<if $currentRule.clitSettingXX == "no default setting">>
		''no default setting.''
	<<elseif $currentRule.clitSettingXX > 95>>
		''passionate.''
	<<elseif $currentRule.clitSettingXX > 70>>
		''attracted.''
	<<elseif $currentRule.clitSettingXX > 30>>
		''indifferent.''
	<<else>>
		''none.''
	<</if>>
<</widget>>

/%
 Call as <<RAChangeSPE>>
%/
<<widget "RAChangeSPE">>
<<replace #spe>>
	<<RAInitSPE>>
<</replace>>
<</widget>>

<<widget "RAInitSPE">>
	<<if $currentRule.clitSettingEnergy == "no default setting">>
		''no default setting.''
	<<elseif $currentRule.clitSettingEnergy > 95>>
		''nympho.''
	<<elseif $currentRule.clitSettingEnergy > 80>>
		''sex addict.''
	<<elseif $currentRule.clitSettingEnergy > 60>>
		''powerful.''
	<<elseif $currentRule.clitSettingEnergy > 40>>
		''healthy.''
	<<elseif $currentRule.clitSettingEnergy > 20>>
		''weak.''
	<<else>>
		''frigid.''
	<</if>>
<</widget>>


/%
 Call as <<RAChangeSpeech>>
%/
<<widget "RAChangeSpeech">>
<<replace #speech>>
Speech rules: ''$currentRule.speechRules.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangeRelationship>>
%/
<<widget "RAChangeRelationship">>
<<replace #relation>>
Relationship rules: ''$currentRule.relationshipRules.''
<</replace>>
<</widget>>

/%
 Call as <<RAChangeFameSpending>>
%/
<<widget "RAChangeFameSpending">>
<<replace #pornfame>>
<<if $currentRule.pornFameSpending == -1>>
  Release of feeds showing excellent slaves' sex lives: ''off.''
<<link "Enable">>
	<<set $currentRule.pornFameSpending = 0>>
	<<RAChangeFameSpending>>
<</link>>
<<else>>
  Weekly porn publicity subsidy for excellent slaves: ''¤$currentRule.pornFameSpending.''
<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeSave>>
%/
<<widget "RAChangeSave">>
<<replace #saveresult>>
<<link _text>>
	<<replace "#saveresult">>
	//Rule saved.//
	<<for _t = 0; _t < $defaultRules.length; _t++>>
		<<if $currentRule.ID == $defaultRules[_t].ID>>
			<<if $currentRule.thresholdLower != "none">>
				<<set $currentRule.thresholdLower = Number($currentRule.thresholdLower)>>
			<</if>>
			<<if $currentRule.thresholdUpper != "none">>
				<<set $currentRule.thresholdUpper = Number($currentRule.thresholdUpper)>>
			<</if>>
			<<set $currentRule.facility = _facility>>
			<<set $currentRule.excludeFacility = _excludeFacility>>
			<<set $defaultRules[_t] = $currentRule>>
			<<break>>
		<</if>>
	<</for>>
	<</replace>>
<</link>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeApply>>
<<RAChangeApply>>
%/
<<widget "RAChangeApply">>
<<replace #apply>>
<span id="applyresult">
<<link "Apply rules">>
	<<replace "#applyresult">>
	//Rules applied.//
	<</replace>>
	<<replace "#applied">>
	<<for _t = 0; _t < $defaultRules.length; _t++>>
		<<if $currentRule.ID == $defaultRules[_t].ID>>
			<<set $currentRule.facility = _facility>>
			<<set $currentRule.excludeFacility = _excludeFacility>>
			<<if $currentRule.thresholdLower != "none">>
				<<set $currentRule.thresholdLower = Number($currentRule.thresholdLower)>>
			<</if>>
			<<if $currentRule.thresholdUpper != "none">>
				<<set $currentRule.thresholdUpper = Number($currentRule.thresholdUpper)>>
			<</if>>
			<<set $defaultRules[_t] = $currentRule>>
		<</if>>
	<</for>>
	<<for $i = 0; $i < $slaves.length; $i++>>
		  <<if $slaves[$i].useRulesAssistant == 1>>
		  <<set $activeSlave = $slaves[$i]>>
		  <<CheckAutoRulesActivate $activeSlave>>
		  <<DefaultRules $activeSlave>>
		  /*<<set $slaves[$i] = $activeSlave>>*/
		  <</if>>
	<</for>>

	<<for _t = 0; _t < $defaultRules.length; _t++>>
		<<set _r = $r-1>>
		<<if $defaultRules[_t].ID == $defaultRules[_r].ID>>
			<<set $currentRule = $defaultRules[_t]>>
			<<set _facility = $currentRule.facility>>
			<<set _excludeFacility = $currentRule.excludeFacility>>
			<<break>>
		<</if>>
	<</for>>
	<</replace>>
<</link>>
</span>
<</replace>>
<</widget>>

/%
 Call as <<RAChangeEyewear>>
%/
<<widget "RAChangeEyewear">>
<<replace #eyewear>>
Eyewear: ''$currentRule.eyewear.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeEyecolor>>
%/
<<widget "RAChangeEyecolor">>
<<replace #eyecolor>>
Eye coloring: ''$currentRule.eyeColor.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeMakeup>>
%/
<<widget "RAChangeMakeup">>
<<replace #makeup>>
''
<<if $currentRule.makeup == 0>>
	makeup-free.
<<elseif $currentRule.makeup == 1>>
	minimal makeup.
<<elseif $currentRule.makeup == 2>>
	luxurious, expensive makeup.
<<elseif $currentRule.makeup == 3>>
	color-coordinated.
<<elseif $currentRule.makeup == 4>>
	garish.
<<else>>
	no default setting.
<</if>>
''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeNails>>
%/
<<widget "RAChangeNails">>
<<replace #nails>>
''
<<if $currentRule.nails == 0>>
	clipped.
<<elseif $currentRule.nails == 1>>
	long and elegant.
<<elseif $currentRule.nails == 2>>
	color-coordinated.
<<elseif $currentRule.nails == 3>>
	sharp and claw-like.
<<elseif $currentRule.nails == 4>>
	bright and glittery.
<<elseif $currentRule.nails == 5>>
	garish.
<<else>>
	no default setting.
<</if>>
''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeHColor>>
%/
<<widget "RAChangeHColor">>
<<replace #hcolor>>
Hair color: ''$currentRule.hColor.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeHStyle>>
%/
<<widget "RAChangeHStyle">>
<<replace #hstyle>>
Hair style: ''$currentRule.hStyle.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeHLength>>
%/
<<widget "RAChangeHLength">>
<<replace #hlength>>
Hair length: ''$currentRule.hLength.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangePHColor>>
%/
<<widget "RAChangePHColor">>
<<replace #phcolor>>
Pubic hair color, when present: ''$currentRule.pubicHColor.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangePHStyle>>
%/
<<widget "RAChangePHStyle">>
<<replace #phstyle>>
Pubic hair style: ''$currentRule.pubicHStyle.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeAHColor>>
%/
<<widget "RAChangeAHColor">>
<<replace #ahcolor>>
Underarm hair color, when present: ''$currentRule.underArmHColor.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeAHStyle>>
%/
<<widget "RAChangeAHStyle">>
<<replace #ahstyle>>
Underarm hair style: ''$currentRule.underArmHStyle.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeEarPiercings>>
%/
<<widget "RAChangeEarPiercings">>
<<replace #earpiercing>>
<<if $currentRule.earPiercing == "no default setting">>No default setting.<<elseif $currentRule.earPiercing == 0>>None.<<elseif $currentRule.earPiercing == 1>>Light.
<<elseif $currentRule.earPiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeNosePiercings>>
%/
<<widget "RAChangeNosePiercings">>
<<replace #nosepiercing>>
<<if $currentRule.nosePiercing == "no default setting">>No default setting.<<elseif $currentRule.nosePiercing == 0>>None.<<elseif $currentRule.nosePiercing == 1>>Light.
<<elseif $currentRule.nosePiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeEybrowPiercings>>
%/
<<widget "RAChangeEyebrowPiercings">>
<<replace #eyebrowpiercing>>
<<if $currentRule.eyebrowPiercing == "no default setting">>No default setting.<<elseif $currentRule.eyebrowPiercing == 0>>None.<<elseif $currentRule.eyebrowPiercing == 1>>Light.
<<elseif $currentRule.eyebrowPiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeNavelPiercings>>
%/
<<widget "RAChangeNavelPiercings">>
<<replace #navelpiercing>>
<<if $currentRule.navelPiercing == "no default setting">>No default setting.<<elseif $currentRule.navelPiercing == 0>>None.<<elseif $currentRule.navelPiercing == 1>>Light.
<<elseif $currentRule.navelPiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeNipplePiercings>>
%/
<<widget "RAChangeNipplePiercings">>
<<replace #nipplepiercing>>
<<if $currentRule.nipplesPiercing == "no default setting">>No default setting.<<elseif $currentRule.nipplesPiercing == 0>>None.<<elseif $currentRule.nipplesPiercing == 1>>Light.
<<elseif $currentRule.nipplesPiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeAreolaPiercings>>
%/
<<widget "RAChangeAreolaPiercings">>
<<replace #areolapiercing>>
<<if $currentRule.areolaePiercing == "no default setting">>No default setting.<<elseif $currentRule.areolaePiercing == 0>>None.<<elseif $currentRule.areolaePiercing == 1>>Studded.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeLipPiercings>>
%/
<<widget "RAChangeLipPiercings">>
<<replace #lippiercing>>
<<if $currentRule.lipsPiercing == "no default setting">>No default setting.<<elseif $currentRule.lipsPiercing == 0>>None.<<elseif $currentRule.lipsPiercing == 1>>Light.
<<elseif $currentRule.lipsPiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeTonguePiercings>>
%/
<<widget "RAChangeTonguePiercings">>
<<replace #tonguepiercing>>
<<if $currentRule.tonguePiercing == "no default setting">>No default setting.<<elseif $currentRule.tonguePiercing == 0>>None.<<elseif $currentRule.tonguePiercing == 1>>Light.
<<elseif $currentRule.tonguePiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeClitPiercings>>
%/
<<widget "RAChangeClitPiercings">>
<<replace #clitpiercing>>
<<if $currentRule.clitPiercing == "no default setting">>No default setting.<<elseif $currentRule.clitPiercing == 0>>None.<<elseif $currentRule.clitPiercing == 1>>Light.
<<elseif $currentRule.clitPiercing == 2>>Heavy.
<<elseif $currentRule.clitPiercing == 3>>Smart.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeVaginaPiercings>>
%/
<<widget "RAChangeVaginaPiercings">>
<<replace #vaginapiercing>>
<<if $currentRule.vaginaPiercing == "no default setting">>No default setting.<<elseif $currentRule.vaginaPiercing == 0>>None.<<elseif $currentRule.vaginaPiercing == 1>>Light.
<<elseif $currentRule.vaginaPiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeDickPiercings>>
%/
<<widget "RAChangeDickPiercings">>
<<replace #dickpiercing>>
<<if $currentRule.dickPiercing == "no default setting">>No default setting.<<elseif $currentRule.dickPiercing == 0>>None.<<elseif $currentRule.dickPiercing == 1>>Light.
<<elseif $currentRule.dickPiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeAnusPiercings>>
%/
<<widget "RAChangeAnusPiercings">>
<<replace #anuspiercing>>
<<if $currentRule.anusPiercing == "no default setting">>No default setting.<<elseif $currentRule.anusPiercing == 0>>None.<<elseif $currentRule.anusPiercing == 1>>Light.
<<elseif $currentRule.anusPiercing == 2>>Heavy.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeCorsetPiercings>>
%/
<<widget "RAChangeCorsetPiercings">>
<<replace #corsetpiercing>>
<<if $currentRule.corsetPiercing == "no default setting">>No default setting.<<elseif $currentRule.corsetPiercing == 0>>None.<<elseif $currentRule.corsetPiercing == 1>>Applied.<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeBranding>>
%/
<<widget "RAChangeBranding">>
<<replace #branding>>
<<if $currentRule.autoBrand == 1>>
  ''on.''
  <<link "Deactivate">>
<<set $currentRule.autoBrand = 0>>
<<RAChangeBranding>>
<</link>>
<<else>>
  ''off.''
  <<link "Activate">>
<<set $currentRule.autoBrand = 1>>
<<RAChangeBranding>>
<</link>>
<</if>>
<</replace>>
<</widget>>
/%
 Call as <<RAChangeBrandTarget>>
%/
<<widget "RAChangeBrandTarget">>
<<replace #brandtarget>>
Your preferred location for brands is the ''$brandTarget.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeBrandDesign>>
%/
<<widget "RAChangeBrandDesign">>
<<replace #branddesign>>
Your brand design is ''$brandDesign.''
<</replace>>
<</widget>>
/%
 Call as <<RAChangeChestTattoos>>
%/
<<widget "RAChangeChestTattoos">>
<<replace #chesttattoo>>
<<if $currentRule.boobsTat == 0>>none<<else>>$currentRule.boobsTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeButtTattoos>>
%/
<<widget "RAChangeButtTattoos">>
<<replace #butttattoo>>
<<if $currentRule.buttTat == 0>>none<<else>>$currentRule.buttTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeFaceTattoos>>
%/
<<widget "RAChangeFaceTattoos">>
<<replace #facetattoo>>
<<if $currentRule.lipsTat == 0>>none<<else>>$currentRule.lipsTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeShoulderTattoos>>
%/
<<widget "RAChangeShoulderTattoos">>
<<replace #shouldertattoo>>
<<if $currentRule.shouldersTat == 0>>none<<else>>$currentRule.shouldersTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeArmTattoos>>
%/
<<widget "RAChangeArmTattoos">>
<<replace #armtattoo>>
<<if $currentRule.armsTat == 0>>none<<else>>$currentRule.armsTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeLegTattoos>>
%/
<<widget "RAChangeLegTattoos">>
<<replace #legtattoo>>
<<if $currentRule.legsTat == 0>>none<<else>>$currentRule.legsTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeBackTattoos>>
%/
<<widget "RAChangeBackTattoos">>
<<replace #backtattoo>>
<<if $currentRule.backTat == 0>>none<<else>>$currentRule.backTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeStampTattoos>>
%/
<<widget "RAChangeStampTattoos">>
<<replace #stamptattoo>>
<<if $currentRule.stampTat == 0>>none<<else>>$currentRule.stampTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeVaginaTattoos>>
%/
<<widget "RAChangeVaginaTattoos">>
<<replace #vaginatattoo>>
<<if $currentRule.vaginaTat == 0>>none<<else>>$currentRule.vaginaTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeDickTattoos>>
%/
<<widget "RAChangeDickTattoos">>
<<replace #dicktattoo>>
<<if $currentRule.dickTat == 0>>none<<else>>$currentRule.dickTat<</if>>.
<</replace>>
<</widget>>
/%
 Call as <<RAChangeAnusTattoos>>
%/
<<widget "RAChangeAnusTattoos">>
<<replace #anustattoo>>
<<if $currentRule.anusTat == 0>>none<<else>>$currentRule.anusTat<</if>>.
<</replace>>
<</widget>>

/%
 Call as <<RASurgeryChangeLacation>>
%/
<<widget "RASurgeryChangeLacation">>
<<replace #lactation>>
	<<if ($currentRule.surgery.lactation == "no default setting")>>
		''no default setting.''
	<<elseif ($currentRule.surgery.lactation == 1)>>
		''implanted.''
	<<else>>
		''implants will be removed.''
	<</if>>

	<br>

	<<if ($currentRule.surgery.lactation !== "no default setting")>>
		<<link "No default setting">>
			<<set $currentRule.surgery.lactation = "no default setting">>
			<<RASurgeryChangeLacation>>
		<</link>> |
	<<else>>
		No default setting |
	<</if>>
	<<if ($currentRule.surgery.lactation !== 0)>>
		<<link "Removed">>
			<<set $currentRule.surgery.lactation = 0>>
			<<RASurgeryChangeLacation>>
		<</link>> |
	<<else>>
		Removed |
	<</if>>
	<<if ($currentRule.surgery.lactation !== 1)>>
		<<link "Implanted">>
			<<set $currentRule.surgery.lactation = 1>>
			<<RASurgeryChangeLacation>>
		<</link>>
	<<else>>
		Implanted
	<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RASurgeryChangeCosmetic>>
%/
<<widget "RASurgeryChangeCosmetic">>
<<replace #cosmetic>>
	<<if ($currentRule.surgery.cosmetic == 2)>>
		''invasive.''
	<<elseif ($currentRule.surgery.cosmetic == 1)>>
		''subtle.''
	<<else>>
		''none.''
	<</if>>

	<br>

	<<if ($currentRule.surgery.cosmetic !== 0)>>
		<<link "None">>
			<<set $currentRule.surgery.cosmetic = 0>>
			<<RASurgeryChangeCosmetic>>
		<</link>> |
	<<else>>
		None |
	<</if>>
	<<if ($currentRule.surgery.cosmetic !== 1)>>
		<<link "Subtle">>
			<<set $currentRule.surgery.cosmetic = 1>>
			<<RASurgeryChangeCosmetic>>
		<</link>> |
	<<else>>
		Subtle |
	<</if>>
	<<if ($currentRule.surgery.cosmetic !== 2)>>
		<<link "Invasive">>
			<<set $currentRule.surgery.cosmetic = 2>>
			<<RASurgeryChangeCosmetic>>
		<</link>>
	<<else>>
		Invasive
	<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RASurgeryChangeLips>>
%/
<<widget "RASurgeryChangeLips">>
<<replace #lips>>
	<<if ($currentRule.surgery.lips == "no default setting")>>
		''no default setting.''
	<<elseif ($currentRule.surgery.lips == 95)>>
		implanted until a ''facepussy.''
	<<elseif ($currentRule.surgery.lips == 70)>>
		implanted until ''huge.''
	<<elseif ($currentRule.surgery.lips == 40)>>
		implanted until ''big.''
	<<elseif ($currentRule.surgery.lips == 20)>>
		implanted until ''plush.''
	<<else>>
		''implants will be removed.''
	<</if>>

	<br>

	<<if ($currentRule.surgery.lips !== "no default setting")>>
		<<link "No default setting">>
		<<set $currentRule.surgery.lips = "no default setting">>
		<<RASurgeryChangeLips>>
		<</link>> |
	<<else>>
		No default setting |
	<</if>>
	<<if ($currentRule.surgery.lips != 0)>>
		<<link "Removed">>
		<<set $currentRule.surgery.lips = 0>>
		<<RASurgeryChangeLips>>
		<</link>> |
	<<else>>
		Removed |
	<</if>>
	<<if ($currentRule.surgery.lips != 20)>>
		<<link "Plush">>
		<<set $currentRule.surgery.lips = 20>>
		<<RASurgeryChangeLips>>
		<</link>> |
	<<else>>
		Plush |
	<</if>>
	<<if ($currentRule.surgery.lips != 40)>>
		<<link "Big">>
		<<set $currentRule.surgery.lips = 40>>
		<<RASurgeryChangeLips>>
		<</link>> |
	<<else>>
		Big |
	<</if>>
	<<if ($currentRule.surgery.lips != 70)>>
		<<link "Huge">>
		<<set $currentRule.surgery.lips = 70>>
		<<RASurgeryChangeLips>>
		<</link>>
	<<else>>
		Huge
	<</if>>
	<<if ($seeExtreme != 0)>>
	<<if ($currentRule.surgery.lips != 95)>>
		| <<link "Facepussy">>
		<<set $currentRule.surgery.lips = 95>>
		<<RASurgeryChangeLips>>
		<</link>>
	<<else>>
		| Facepussy
	<</if>>
	<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RASurgeryChangeButt>>
%/
<<widget "RASurgeryChangeButt">>
<<replace #butt>>
	<<if ($currentRule.surgery.butt == "no default setting")>>
		''no default setting.''
	<<elseif ($currentRule.surgery.butt == 9)>>
		implanted until ''maximized.''
	<<elseif ($currentRule.surgery.butt == 6)>>
		implanted until ''huge.''
	<<elseif ($currentRule.surgery.butt == 4)>>
		implanted until ''stacked.''
	<<elseif ($currentRule.surgery.butt == 2)>>
		implanted until ''slim.''
	<<else>>
		''implants will be removed.''
	<</if>>

	<br>

	<<if ($currentRule.surgery.butt !== "no default setting")>>
		<<link "No default setting">>
		<<set $currentRule.surgery.butt = "no default setting">>
		<<RASurgeryChangeButt>>
		<</link>> |
	<<else>>
		No default setting |
	<</if>>
	<<if ($currentRule.surgery.butt != 0)>>
		<<link "Removed">>
		<<set $currentRule.surgery.butt = 0>>
		<<RASurgeryChangeButt>>
		<</link>> |
	<<else>>
		Removed |
	<</if>>
	<<if ($currentRule.surgery.butt != 2)>>
		<<link "Slim">>
		<<set $currentRule.surgery.butt = 2>>
		<<RASurgeryChangeButt>>
		<</link>> |
	<<else>>
		Slim |
	<</if>>
	<<if ($currentRule.surgery.butt != 4)>>
		<<link "Stacked">>
		<<set $currentRule.surgery.butt = 4>>
		<<RASurgeryChangeButt>>
		<</link>> |
	<<else>>
		Stacked |
	<</if>>
	<<if ($currentRule.surgery.butt != 6)>>
		<<link "Huge">>
		<<set $currentRule.surgery.butt = 6>>
		<<RASurgeryChangeButt>>
		<</link>> |
	<<else>>
		Huge |
	<</if>>
	<<if ($currentRule.surgery.butt != 9)>>
		<<link "Maximize">>
		<<set $currentRule.surgery.butt = 9>>
		<<RASurgeryChangeButt>>
		<</link>>
	<<else>>
		Maximize
	<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RASurgeryChangeBoobs>>
%/
<<widget "RASurgeryChangeBoobs">>
<<replace #boobs>>
	<<if ($currentRule.surgery.boobs == "no default setting")>>
		''no default setting.''
	<<elseif ($currentRule.surgery.boobs == 24000)>>
		implanted until ''maximized.''
	<<elseif ($currentRule.surgery.boobs == 9000)>>
		implanted to maximally ''functional,'' where more would immobilize the slave.
	<<elseif ($currentRule.surgery.boobs == 2000)>>
		implanted until ''huge.''
	<<elseif ($currentRule.surgery.boobs == 1000)>>
		implanted until ''stacked.''
	<<elseif ($currentRule.surgery.boobs == 400)>>
		implanted until ''slim.''
	<<else>>
		''implants will be removed.''
	<</if>>

	<br>

	<<if ($currentRule.surgery.boobs != "no default setting")>>
		<<link "No default setting">>
		<<set $currentRule.surgery.boobs = "no default setting">>
		<<RASurgeryChangeBoobs>>
		<</link>> |
	<<else>>
		No default setting |
	<</if>>
	<<if ($currentRule.surgery.boobs != 0)>>
		<<link "Removed">>
		<<set $currentRule.surgery.boobs = 0>>
		<<RASurgeryChangeBoobs>>
		<</link>> |
	<<else>>
		Removed |
	<</if>>
	<<if ($currentRule.surgery.boobs != 400)>>
		<<link "Slim">>
		<<set $currentRule.surgery.boobs = 400>>
		<<RASurgeryChangeBoobs>>
		<</link>> |
	<<else>>
		Slim |
	<</if>>
	<<if ($currentRule.surgery.boobs != 1000)>>
		<<link "Stacked">>
		<<set $currentRule.surgery.boobs = 1000>>
		<<RASurgeryChangeBoobs>>
		<</link>> |
	<<else>>
		Stacked |
	<</if>>
	<<if ($currentRule.surgery.boobs != 2000)>>
		<<link "Huge">>
		<<set $currentRule.surgery.boobs = 2000>>
		<<RASurgeryChangeBoobs>>
		<</link>> |
	<<else>>
		Huge |
	<</if>>
	<<if ($currentRule.surgery.boobs != 9000)>>
		<<link "Functional">>
		<<set $currentRule.surgery.boobs = 9000>>
		<<RASurgeryChangeBoobs>>
		<</link>> |
	<<else>>
		Functional |
	<</if>>
	<<if ($currentRule.surgery.boobs != 24000)>>
		<<link "Maximize">>
		<<set $currentRule.surgery.boobs = 24000>>
		<<RASurgeryChangeBoobs>>
		<</link>>
	<<else>>
		Maximize
	<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RASurgeryChangeHoles>>
%/
<<widget "RASurgeryChangeHoles">>
<<replace #holes>>
	<<if ($currentRule.surgery.holes == 2)>>
		''virginity restoration'' will be applied where possible.
	<<elseif ($currentRule.surgery.holes == 1)>>
		''hole tightening'' will be applied.
	<<else>>
		''none.''
	<</if>>

	<br>
	<<if ($currentRule.surgery.holes != 0)>>
		<<link "Off">>
		<<set $currentRule.surgery.holes = 0>>
		<<RASurgeryChangeHoles>>
		<</link>> |
	<<else>>
		Off |
	<</if>>
	<<if ($currentRule.surgery.holes != 1)>>
		<<link "Tightening">>
		<<set $currentRule.surgery.holes = 1>>
		<<RASurgeryChangeHoles>>
		<</link>> |
	<<else>>
		Tightening |
	<</if>>
	<<if ($currentRule.surgery.holes != 2)>>
		<<link "Virginity">>
		<<set $currentRule.surgery.holes = 2>>
		<<RASurgeryChangeHoles>>
		<</link>>
	<<else>>
		Virginity
	<</if>>
<</replace>>
<</widget>>

/%
 Call as <<RARemoveRule>>
%/
<<widget "RARemoveRule">>
	<<for _s = 0; _s < $activeSlave.currentRules.length; _s++>>
		<<if _currentRule.ID == $activeSlave.currentRules[_s]>>
			<<set $dump = $activeSlave.currentRules.pluck([_s],[_s])>>
		<</if>>
	<</for>>
	<br>Rule _rule (_currentRule.name) is no longer applying to $activeSlave.slaveName.
	<<include "Rules Facility Remove">>
<</widget>>

/%
	Call as <<DefaultRules SlaveObject>>
%/
<<widget "DefaultRules">>
<<for _r = 0; _r < $defaultRules.length; _r++>>
<<set _currentRule = $defaultRules[_r]>>
<<if (!ruleApplied($args[0], _currentRule.ID)) || ((def _currentRule.facility) && (_currentRule.facility.length > 1) && !ruleAppliedToSlaveFacility(_currentRule, $args[0]))>><<continue>><</if>>

<<if $args[0].fuckdoll == 0>>

<<if (_currentRule.choosesOwnAssignment == 1)>>
<<if ($args[0].choosesOwnAssignment == 0)>>
<<if ($args[0].assignmentVisible == 1)>>
<<if ($args[0].assignment != "recruit girls")>>
<<if ($args[0].assignment != "be your Head Girl")>>
<<if ($args[0].assignment != "guard you")>>
	<br>$args[0].slaveName is now allowed to select her own assignments.
	<<set $args[0].choosesOwnAssignment = 1>>
	<<set $args[0].assignment = "choose her own job">>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if (_currentRule.clothes !== "no default setting")>>
<<if (_currentRule.choosesOwnClothes == 1)>>
 <<if ($args[0].choosesOwnClothes == 0)>>
	<br>$args[0].slaveName is now allowed to choose her own clothes.
	<<set $args[0].choosesOwnClothes = 1>>
	<<set $args[0].clothes = "choosing her own clothes">>
  <</if>>
<<elseif ($args[0].clothes !== _currentRule.clothes)>>
	<<set $args[0].clothes = _currentRule.clothes>>
	<br>$args[0].slaveName is now wearing $args[0].clothes.
	<<set $args[0].choosesOwnClothes = 0>>
<</if>>
<</if>>

<<if (_currentRule.collar !== "no default setting")>>
<<if ($args[0].collar !== _currentRule.collar)>>
	<<set $args[0].collar = _currentRule.collar>>
	<<if ($args[0].collar == "none")>>
		<br>$args[0].slaveName has been given no collar.
	<<else>>
		<br>$args[0].slaveName has been given a $args[0].collar collar.
	<</if>>
<</if>>
<</if>>

<<set _tmp = lastEyeWearRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.eyewear !== "no default setting")>>
	<<if _currentRule.eyewear == "correct with glasses">>
	<<if $args[0].eyes <= -1>>
		<<if $args[0].eyewear != "corrective glasses">>
		<<set $args[0].eyewear = "corrective glasses">>
		<<set $cash -= $modCost>>
		<br>$args[0].slaveName has been given corrective glasses.
		<</if>>
	<<else>>
		<<if $args[0].eyewear != "none">>
		<<set $args[0].eyewear = "none">>
		<br>$args[0].slaveName's eyewear has been removed.
		<</if>>
	<</if>>
	<<elseif _currentRule.eyewear == "correct with contacts">>
	<<if $args[0].eyes <= -1>>
		<<if $args[0].eyewear != "corrective contacts">>
		<<set $args[0].eyewear = "corrective contacts">>
		<<set $cash -= $modCost>>
		<br>$args[0].slaveName has been given corrective contacts.
	  <</if>>
	<<else>>
		<<if $args[0].eyewear != "none">>
		<<set $args[0].eyewear = "none">>
		<br>$args[0].slaveName's eyewear has been removed.
	  <</if>>
	<</if>>
	<<elseif _currentRule.eyewear == "blur with glasses">>
	<<if $args[0].eyes > -1>>
		<<if $args[0].eyewear != "blurring glasses">>
		<<set $args[0].eyewear = "blurring glasses">>
		<<set $cash -= $modCost>>
		<br>$args[0].slaveName has been given blurring glasses.
	  <</if>>
	<<else>>
		<<if $args[0].eyewear != "none">>
		<<set $args[0].eyewear = "none">>
		<br>$args[0].slaveName's eyewear has been removed.
		<</if>>
	<</if>>
	<<elseif _currentRule.eyewear == "blur with contacts">>
	<<if $args[0].eyes > -1>>
	  <<if $args[0].eyewear != "blurring contacts">>
		<<set $args[0].eyewear = "blurring contacts">>
		<<set $cash -= $modCost>>
		<br>$args[0].slaveName has been given blurring contacts.
	  <</if>>
	<<else>>
	  <<if $args[0].eyewear != "none">>
		<<set $args[0].eyewear = "none">>
		<br>Since $args[0].slaveName's eyewear has been removed.
	  <</if>>
	<</if>>
	<<elseif _currentRule.eyewear == "universal glasses">>
	<<if $args[0].eyes <= -1>>
	  <<if $args[0].eyewear != "corrective glasses">>
		<<set $args[0].eyewear = "corrective glasses">>
		<<set $cash -= $modCost>>
		<br>$args[0].slaveName has been given corrective glasses.
	  <</if>>
	<<else>>
	  <<if $args[0].eyewear != "glasses">>
		<<set $args[0].eyewear = "glasses">>
		<<set $cash -= $modCost>>
		<br>$args[0].slaveName has been given decorative glasses.
	  <</if>>
	<</if>>
  <<else>>
	  <<if $args[0].eyewear != "none">>
		<<set $args[0].eyewear = "none">>
		<br>$args[0].slaveName's eyewear has been removed.
	  <</if>>
  <</if>>
<</if>>
<</if>>

<<if $args[0].vagina == 0>>
<<if _currentRule.virginAccessory !== "no default setting">>
<<if $args[0].vaginalAccessory !== _currentRule.virginAccessory>>
	<<set $args[0].vaginalAccessory = _currentRule.virginAccessory>>
	<<if $args[0].vaginalAccessory == "huge dildo">>
		<br>$args[0].slaveName has been given a
		<<if $args[0].vagina >= 3>>
			massive dildo to permanently gape her cunt,
		<<else>>
			large dildo for her pussy, since it must be stretched before it can accommodate a huge one,
			<<set $args[0].vaginalAccessory = "large dildo">>
		<</if>>
	<<elseif $args[0].vaginalAccessory == "none">>
		<br>$args[0].slaveName's item for her pussy has been changed to be nothing.
	<<else>>
		<br>$args[0].slaveName has been given a $args[0].vaginalAccessory for her pussy,
	<</if>>
<</if>>
<</if>>
<<elseif ($args[0].vagina > 0) && ($args[0].anus == 0)>>
<<if _currentRule.aVirginAccessory !== "no default setting">>
<<if $args[0].vaginalAccessory !== _currentRule.aVirginAccessory>>
	<<set $args[0].vaginalAccessory = _currentRule.aVirginAccessory>>
	<<if $args[0].vaginalAccessory == "huge dildo">>
		<br>$args[0].slaveName has been given a
		<<if $args[0].vagina >= 3>>
			massive dildo to permanently gape her cunt.
		<<else>>
			large dildo for her pussy, since it must be stretched before it can accommodate a huge one.
			<<set $args[0].vaginalAccessory = "large dildo">>
		<</if>>
	<<elseif $args[0].vaginalAccessory == "none">>
		<br>$args[0].slaveName's item for her pussy has been changed to be nothing.
	<<else>>
		<br>$args[0].slaveName has been given a $args[0].vaginalAccessory for her pussy,
	<</if>>
<</if>>
<</if>>
<<elseif $args[0].vagina > 0>>
<<if _currentRule.vaginalAccessory !== "no default setting">>
<<if $args[0].vaginalAccessory !== _currentRule.vaginalAccessory>>
	<<set $args[0].vaginalAccessory = _currentRule.vaginalAccessory>>
	<<if $args[0].vaginalAccessory == "huge dildo">>
		<br>$args[0].slaveName has been given a
		<<if $args[0].vagina >= 3>>
			massive dildo to permanently gape her cunt.
		<<else>>
			large dildo for her pussy, since it must be stretched before it can accommodate a huge one.
			<<set $args[0].vaginalAccessory = "large dildo">>
		<</if>>
	<<elseif $args[0].vaginalAccessory == "none">>
		<br>$args[0].slaveName's item for her pussy has been changed to be nothing.
	<<else>>
		<br>$args[0].slaveName has been given a $args[0].vaginalAccessory for her pussy,
	<</if>>
<</if>>
<</if>>
<</if>>

<<if ($args[0].dick > 0)>>
<<if $args[0].anus == 0>>
<<if (_currentRule.aVirginDickAccessory !== "no default setting")>>
<<if ($args[0].dickAccessory !== _currentRule.aVirginDickAccessory)>>
	<<set $args[0].dickAccessory = _currentRule.aVirginDickAccessory>>
	<<if $args[0].dickAccessory == "none">>
		<br>$args[0].slaveName's dick accessory has been changed to be nothing.
	<<else>>
		<br>$args[0].slaveName has been given a $args[0].dickAccessory for her cock.
	<</if>>
<</if>>
<</if>>
<<else>>
<<if (_currentRule.dickAccessory !== "no default setting")>>
<<if ($args[0].dickAccessory !== _currentRule.dickAccessory)>>
	<<set $args[0].dickAccessory = _currentRule.dickAccessory>>
	<<if $args[0].dickAccessory == "none">>
		<br>$args[0].slaveName's dick accessory has been changed to be nothing.
	<<else>>
		<br>$args[0].slaveName has been given a $args[0].dickAccessory for her cock.
	<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if ($args[0].vaginalAccessory !== "anal chastity") && ($args[0].vaginalAccessory !== "combined chastity") && ($args[0].dickAccessory !== "anal chastity") && ($args[0].dickAccessory !== "combined chastity")>>
<<if $args[0].anus == 0>>
<<if (_currentRule.aVirginButtplug !== "no default setting")>>
<<if ($args[0].buttplug !== _currentRule.aVirginButtplug)>>
	<<set $args[0].buttplug = _currentRule.aVirginButtplug>>
	<<if ($args[0].buttplug == "huge plug")>>
		<br>$args[0].slaveName has been given a
		<<if ($args[0].anus >= 3)>>
			massive plug to permanently gape her asshole.
		<<else>>
			<<set $args[0].buttplug = "large plug">>
			large buttplug for her asshole, since it must be stretched before it can accommodate a huge one.
		<</if>>
	<<elseif $args[0].buttplug == "none">>
		<br>$args[0].slaveName's item for her pussy has been changed to be nothing.
	<<else>>
		<br>$args[0].slaveName has been given a $args[0].buttplug for her asshole.
	<</if>>
<</if>>
<</if>>
<<else>>
<<if (_currentRule.buttplug !== "no default setting")>>
<<if ($args[0].buttplug !== _currentRule.buttplug)>>
	<<set $args[0].buttplug = _currentRule.buttplug>>
	<<if ($args[0].buttplug == "huge plug")>>
		<br>$args[0].slaveName has been given a
		<<if ($args[0].anus >= 3)>>
			massive plug to permanently gape her asshole.
		<<else>>
			<<set $args[0].buttplug = "large plug">>
			large buttplug for her asshole, since it must be stretched before it can accommodate a huge one.
		<</if>>
	<<elseif $args[0].buttplug == "none">>
		<br>$args[0].slaveName's item for her pussy has been changed to be nothing.
	<<else>>
		<br>$args[0].slaveName has been given a $args[0].buttplug for her asshole.
	<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if (_currentRule.shoes !== "no default setting")>>
<<if ($args[0].shoes !== _currentRule.shoes)>>
<<if ($args[0].amp != 1)>>
	<<set $args[0].shoes = _currentRule.shoes>>
	<br>$args[0].slaveName's shoes have been set to $args[0].shoes.
<</if>>
<</if>>
<</if>>

<<if (_currentRule.bellyAccessory !== "no default setting")>>
<<if ($args[0].bellyAccessory !== _currentRule.bellyAccessory)>>
	<<if ((($args[0].preg >= 10) && ($args[0].bellyImplant >= 2000)) && ((_currentRule.bellyAccessory == "a small empathy belly") or (_currentRule.bellyAccessory is "a medium empathy belly") || (_currentRule.bellyAccessory == "a large empathy belly") || (_currentRule.bellyAccessory == "a huge empathy belly")))>>
	<br>$args[0].slaveName's natural belly is too big to properly wear an empathy belly.
	<<else>>
	<<set $args[0].bellyAccessory = _currentRule.bellyAccessory>>
	<br>$args[0].slaveName has been given the proper belly accessory to wear.
	<</if>>
<</if>>
<</if>>

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

<<if (_currentRule.growth !== "no default setting")>>
<<if ($args[0].indentureRestrictions < 2)>>
<<if (_currentRule.growth == "girlish")>>
	<<if ($args[0].butt < 2)>>
		<<set $args[0].drugs = "butt injections">>
		<br>$args[0].slaveName's butt is tiny, so she's been put on buttock growth drugs.
	<<elseif ($args[0].boobs < 350)>>
		<<set $args[0].drugs = "breast injections">>
		<br>$args[0].slaveName's tits are tiny, so she's been put on breast growth drugs.
	<<elseif ($args[0].lips <= 20)>>
		<<set $args[0].drugs = "lip injections">>
		<br>$args[0].slaveName's lips are average, so she's been put on lip growth injections.
	<<elseif ($args[0].drugs == "lip injections") || ($args[0].drugs == "breast injections") || ($args[0].drugs == "butt injections")>>
		<<set $args[0].drugs = "no drugs">>
		<br>$args[0].slaveName has reached growth targets and has been taken off growth injections.
	<</if>>
<<elseif (_currentRule.growth == "stacked")>>
	<<if ($args[0].butt < 2)>>
		<<set $args[0].drugs = "butt injections">>
		<br>$args[0].slaveName's butt is tiny, so she's been put on buttock growth drugs.
	<<elseif ($args[0].butt < 4) && ($args[0].hips > -2)>>
		<<set $args[0].drugs = "butt injections">>
		<br>$args[0].slaveName's hips can support a bigger butt, so she's been put on buttock growth drugs.
	<<elseif ($args[0].boobs < 1000)>>
		<<set $args[0].drugs = "breast injections">>
		<br>$args[0].slaveName's tits aren't large, so she's been put on breast growth drugs.
	<<elseif ($args[0].dick > 0) && ($args[0].dick < 4) && ($args[0].balls > 0)>>
		<<set $args[0].drugs = "penis enhancement">>
		<br>$args[0].slaveName's dick isn't large, so she's been put on penis enhancement.
	<<elseif ($args[0].lips <= 20)>>
		<<set $args[0].drugs = "lip injections">>
		<br>$args[0].slaveName's has been put on lip growth injections.
	<<elseif ($args[0].scrotum > 0) && ($args[0].balls < 4) && ($args[0].balls > 0)>>
		<<set $args[0].drugs = "testicle enhancement">>
		<br>$args[0].slaveName's balls aren't large, so she's been put on testicle enhancement.
	<<elseif $args[0].drugs != "no drugs">>
		<<set $args[0].drugs = "no drugs">>
		<br>$args[0].slaveName has reached growth targets and has been taken off growth injections.
	<</if>>
<<else>>
	<<if ($args[0].hips > -1) && ($args[0].butt < 6) && ($args[0].butt < ($args[0].boobs/500))>>
		<<set $args[0].drugs = "butt injections">>
		<br>$args[0].slaveName's hips can support a bigger butt, and her butt is behind her tits, so she's been put on butt injections.
	<<elseif ($args[0].hips > 0) && ($args[0].butt < 8) && ($args[0].butt < ($args[0].boobs/500))>>
		<<set $args[0].drugs = "butt injections">>
		<br>$args[0].slaveName's hips can support a bigger butt, and her butt is behind her tits, so she's been put on butt injections.
	<<elseif ($args[0].hips > 1) && ($args[0].butt < 9) && ($args[0].butt < ($args[0].boobs/500))>>
		<<set $args[0].drugs = "butt injections">>
		<br>$args[0].slaveName's hips can support a bigger butt, and her butt is behind her tits, so she's been put on butt injections.
	<<elseif ($args[0].boobs <= 9000) && ($args[0].boobs < ($args[0].butt*500))>>
		<<set $args[0].drugs = "breast injections">>
		<br>$args[0].slaveName's boobs could be bigger and are behind her butt, so she's been put on breast injections.
	<<elseif ($args[0].lips <= 40)>>
		<<set $args[0].drugs = "lip injections">>
		<br>$args[0].slaveName has been put on lip growth injections.
	<<elseif ($args[0].dick > 0) && ($args[0].dick < 6)>>
		<<set $args[0].drugs = "penis enhancement">>
		<br>$args[0].slaveName's dick could be bigger and still function, so she's been put on penis enhancement.
	<<elseif ($args[0].scrotum > 0) && ($args[0].balls < 6) && ($args[0].balls > 0)>>
		<<set $args[0].drugs = "testicle enhancement">>
		<br>$args[0].slaveName's balls could be bigger, so she's been put on testicle enhancement.
	<<elseif ($args[0].butt < 9)>>
		<<set $args[0].drugs = "butt injections">>
		<br>$args[0].slaveName's butt could be bigger, so she's been put on butt injections.
	<<elseif ($args[0].boobs <= 9000)>>
		<<set $args[0].drugs = "breast injections">>
		<br>$args[0].slaveName could handle bigger tits, so she's been put on breast injections.
	<<elseif ($args[0].dick > 0) && ($args[0].dick < 10) && (_currentRule.growth == "unlimited")>>
		<<set $args[0].drugs = "penis enhancement">>
		<br>$args[0].slaveName's dick could be bigger, so she's been put on penis enhancement.
	<<elseif ($args[0].boobs < 24000) && (_currentRule.growth == "unlimited")>>
		<<set $args[0].drugs = "breast injections">>
		<br>$args[0].slaveName's boobs could be bigger, so she's been put on breast injections.
	<<elseif $args[0].drugs != "no drugs">>
		<<set $args[0].drugs = "no drugs">>
		<br>$args[0].slaveName has reached growth targets and has been taken off growth injections.
	<</if>>
<</if>>
<</if>>
<</if>>

<<if (_currentRule.curatives != "no default setting")>>
<<if $args[0].curatives != _currentRule.curatives>>
	<<if _currentRule.curatives == 2>>
		<<if $args[0].health > 100>>
			<br>$args[0].slaveName has been	put on preventatives, since curatives cannot improve her health further.
			<<set $args[0].curatives = 1>>
		<<else>>
			<br>$args[0].slaveName has been	put on curatives.
			<<set $args[0].curatives = _currentRule.curatives>>
		<</if>>
	<<else>>
		<br>$args[0].slaveName has been	<<if _currentRule.aphrodisiacs > 0>>put on preventatives<<else>>taken off health drugs<</if>>.
		<<set $args[0].curatives = _currentRule.curatives>>
	<</if>>
<</if>>
<</if>>

<<if (_currentRule.aphrodisiacs != "no default setting")>>
<<if $args[0].aphrodisiacs != _currentRule.aphrodisiacs>>
	<br>$args[0].slaveName has been	<<if _currentRule.aphrodisiacs > 0>>put on the proper<<else>>taken off<</if>> aphrodisiacs.
	<<set $args[0].aphrodisiacs = _currentRule.aphrodisiacs>>
<</if>>
<</if>>

<<if ($args[0].dick > 0)>>
<<if ($args[0].balls == 0)>>
<<if (_currentRule.gelding !== "no default setting")>>
<<if ($args[0].hormones !== _currentRule.gelding)>>
	<<set $args[0].hormones = _currentRule.gelding>>
	<<if $args[0].indentureRestrictions >= 2>>
		<<set $args[0].hormones = Math.clamp($args[0].hormones, -1, 1)>>
	<</if>>
	<br>$args[0].slaveName is a gelding, so she has been put on the appropriate hormones.
<</if>>
<</if>>
<<elseif ($args[0].balls > 0)>>
<<if (_currentRule.XY !== "no default setting")>>
<<if ($args[0].hormones !== _currentRule.XY)>>
<<if ($args[0].assignment != "recruit girls")>>
<<if ($args[0].assignment != "be the Wardeness")>>
<<if ($args[0].assignment != "be the Madam")>>
<<if ($args[0].assignment != "be the Collectrix")>>
	<<set $args[0].hormones = _currentRule.XY>>
	<<if $args[0].indentureRestrictions >= 2>>
		<<set $args[0].hormones = Math.clamp($args[0].hormones, -1, 1)>>
	<</if>>
	<br>$args[0].slaveName is a shemale, so she has been put on the appropriate hormones.
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if ($args[0].vagina > -1)>>
<<if ($args[0].dick == 0)>>
<<if (_currentRule.XX !== "no default setting")>>
<<if ($args[0].hormones !== _currentRule.XX)>>
	<<set $args[0].hormones = _currentRule.XX>>
	<<if $args[0].indentureRestrictions >= 2>>
		<<set $args[0].hormones = Math.clamp($args[0].hormones, -1, 1)>>
	<</if>>
	<br>$args[0].slaveName is a female, so she has been put on the appropriate hormonal regime.
	<</if>>
<</if>>
<</if>>
<<if ($args[0].ovaries == 1)>>
<<if ($args[0].preg > -2)>>
<<if ($args[0].preg < 1)>>
<<if (_currentRule.preg !== "no default setting")>>
<<if (_currentRule.preg == -1)>>
	<<set $args[0].preg = -1>>
	<<if $args[0].drugs == "fertility drugs">>
		<<set $args[0].drugs = "no drugs">>
	<</if>>
	<br>$args[0].slaveName is a fertile female, so she has been put on the appropriate contraceptive regime.
<<elseif (_currentRule.preg == 0)>>
	<<set $args[0].preg = 0>>
	<<if $args[0].drugs == "fertility drugs">>
		<<set $args[0].drugs = "no drugs">>
	<</if>>
	<br>$args[0].slaveName is a fertile female, so she has been put on the appropriate contraceptive regime.
<<elseif (_currentRule.preg == 1)>>
	<<set $args[0].preg = 0>>
	<<set $args[0].drugs = "fertility drugs">>
	<<set $args[0].hormones = 0>>
	<br>$args[0].slaveName is a fertile female, so she has been put on the appropriate contraceptive regime.
<<elseif (_currentRule.preg == 2)>>
	<<set $args[0].drugs = "fertility drugs">>
	<<set $args[0].hormones = 2>>
	<<set $args[0].preg = 0>>
	<br>$args[0].slaveName is a fertile female, so she has been put on the appropriate contraceptive regime.
<<elseif (_currentRule.preg == 3) and $args[0].indentureRestrictions < 1>>
	<<set $args[0].drugs = "super fertility drugs">>
	<<set $args[0].hormones = 0>>
	<<set $args[0].preg = 0>>
	<br>$args[0].slaveName is a fertile female, so she has been put on the appropriate contraceptive regime.
<<elseif (_currentRule.preg == 4) and $args[0].indentureRestrictions < 1>>
	<<set $args[0].drugs = "super fertility drugs">>
	<<set $args[0].hormones = 2>>
	<<set $args[0].preg = 0>>
	<br>$args[0].slaveName is a fertile female, so she has been put on the appropriate contraceptive regime.
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if $args[0].fuckdoll == 0>>

<<if (_currentRule.livingRules !== "no default setting")>>
<<if ($args[0].fetish == "mindbroken")>>
	<<if ($args[0].livingRules !== "spare")>>
	<<set $args[0].livingRules = "spare">>
	<br>Since $args[0].slaveName is mindbroken her living standard has been set to spare.
	<</if>>
<<elseif $args[0].livingRules !== _currentRule.livingRules>>
	<<if _currentRule.livingRules !== "luxurious">>
		<<if $roomsPopulation <= $rooms-0.5>>
			<<set $args[0].livingRules = _currentRule.livingRules>>
			<br>$args[0].slaveName's living standard has been set to _currentRule.livingRules.
			<<if $args[0].relationship >= 4>><<set $roomsPopulation += 0.5>><<else>><<set $roomsPopulation += 1>><</if>>
		<<else>>
			<<set $args[0].livingRules = "normal">>
			<br>$args[0].slaveName's living standard has been set to normal, since there is no room for her to occupy.
		<</if>>
	<<else>>
		<<set $args[0].livingRules = _currentRule.livingRules>>
		<br>$args[0].slaveName's living standard has been set to _currentRule.livingRules.
	<</if>>
<</if>>
<</if>>

<<if (_currentRule.speechRules !== "no default setting")>>
<<if ($args[0].fetish == "mindbroken")>>
	<<if ($args[0].speechRules !== "restrictive")>>
	<<set $args[0].speechRules = "restrictive">>
	<br>Since $args[0].slaveName is mindbroken her speech rules have been set to restrictive.
	<</if>>
<<elseif ($args[0].speechRules !== _currentRule.speechRules)>>
	<<set $args[0].speechRules = _currentRule.speechRules>>
	<br>$args[0].slaveName's speech rules have been set to _currentRule.speechRules.
<</if>>
<</if>>

<<if ($args[0].fetish !== "mindbroken")>>
 <<if (_currentRule.relationshipRules !== "no default setting")>>
 <<if ($args[0].relationshipRules !== _currentRule.relationshipRules )>>
 	<<set $args[0].relationshipRules = _currentRule.relationshipRules >>
 	<br>$args[0].slaveName's relationship rules have been set to _currentRule.relationshipRules.
 <</if>>
 <</if>>
<</if>>

<<if (_currentRule.releaseRules !== "no default setting")>>
	<<if (_currentRule.releaseRules == "restrictive")>>
	<<SexualRelease $args[0]>>
	<<else>>
		<<set $release = 1>>
	<</if>>
	<<if ($args[0].fetish == "mindbroken") && ($args[0].releaseRules !== "permissive")>>
		<<set $args[0].releaseRules = "permissive">>
		<br>Since $args[0].slaveName is mindbroken her masturbation rules have been set to permissive.
	<<elseif ($release != 0) && ($args[0].releaseRules !== _currentRule.releaseRules)>>
	  <<set $args[0].releaseRules = _currentRule.releaseRules>>
	  <br>$args[0].slaveName's masturbation rules have been set to _currentRule.releaseRules.
	<</if>>
<</if>>

<<if (_currentRule.standardPunishment !== "no default setting")>>
 <<if ($args[0].standardPunishment !== _currentRule.standardPunishment)>>
 	<<set $args[0].standardPunishment = _currentRule.standardPunishment >>
 	<br>$args[0].slaveName's typical punishment has been updated to _currentRule.standardPunishment.
 <</if>>
<</if>>

<<if (_currentRule.standardReward !== "no default setting")>>
 <<if ($args[0].standardReward !== _currentRule.standardReward)>>
 	<<set $args[0].standardReward = _currentRule.standardReward >>
 	<br>$args[0].slaveName's typical reward has been updated to _currentRule.standardReward.
 <</if>>
<</if>>

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

<<if (_currentRule.diet !== "no default setting")>>
	<<if ($args[0].boobs >= 1600) && ($args[0].muscles <= 5) && ($args[0].amp != 1) && ((_currentRule.muscles == "no default setting") || (_currentRule.muscles == 0))>>
		<<if ($args[0].diet !== "muscle building")>>
			<<set $args[0].diet = "muscle building">>
			<br>$args[0].slaveName has big tits and no back muscles, so she's been assigned to gain some.
		<</if>>
	<<elseif ($args[0].boobs >= 1600) && ($args[0].muscles > 5) && ($args[0].diet == "muscle building") && ((_currentRule.muscles == "no default setting") || (_currentRule.muscles == 0))>>
		<<set $args[0].diet = "healthy">>
		<br>$args[0].slaveName has huge boobs, but she already has the back muscles to bear them, so she's been assigned to stop working out so hard.
	<<elseif (_currentRule.dietGrowthSupport == 1) && (($args[0].drugs == "breast injections") || ($args[0].drugs == "butt injections")) && ($args[0].weight <= 95)>>
		<<if $args[0].diet !== "fattening">>
			<<set $args[0].diet = "fattening">>
			<br>$args[0].slaveName is on drugs designed to expand major body parts, so she's been put on a fattening diet to provide her body as much fuel for growth as possible.
		<</if>>
	<<else>>
		<<if (_currentRule.diet == 0)>>
			<<if ($args[0].weight > 10)>>
				<<if ($args[0].diet !== "restricted")>>
					<<set $args[0].diet = "restricted">>
					<br>$args[0].slaveName is too fat so her diet has been set to restricted.
				<</if>>
			<<elseif ($args[0].weight < -10)>>
				<<if ($args[0].diet !== "fattening")>>
					<<set $args[0].diet = "fattening">>
					<br>$args[0].slaveName is too skinny so her diet has been set to fattening.
				<</if>>
			<<elseif (_currentRule.muscles !== "no default setting") && ($args[0].amp != 1)>>
				<<if ($args[0].muscles >= _currentRule.muscles+5)>>
					<<if ($args[0].diet !== "slimming")>>
						<<set $args[0].diet = "slimming">>
						<br>$args[0].slaveName has been put on a slimming exercise regime.
					<</if>>
				<<elseif ($args[0].muscles <= _currentRule.muscles-5)>>
					<<if ($args[0].diet !== "muscle building")>>
						<<set $args[0].diet = "muscle building">>
						<br>$args[0].slaveName has been put on a muscle building exercise regime.
					<</if>>
				<<else>>
					<<if ($args[0].diet !== "healthy")>>
						<<set $args[0].diet = "healthy">>
						<br>$args[0].slaveName is at the target weight, so her diet has been normalized.
					<</if>>
				<</if>>
			<<else>>
				<<if ($args[0].diet !== "healthy")>>
					<<set $args[0].diet = "healthy">>
					<br>$args[0].slaveName is at the target weight, so her diet has been normalized.
				<</if>>
			<</if>>
		<<elseif (_currentRule.diet == 30)>>
			<<if ($args[0].weight > 30)>>
				<<if ($args[0].diet !== "restricted")>>
					<<set $args[0].diet = "restricted">>
					<br>$args[0].slaveName is too fat so her diet has been set to restricted.
				<</if>>
			<<elseif ($args[0].weight < 20)>>
				<<if ($args[0].diet !== "fattening")>>
					<<set $args[0].diet = "fattening">>
					<br>$args[0].slaveName is too skinny so her diet has been set to fattening.
				<</if>>
			<<elseif (_currentRule.muscles !== "no default setting") && ($args[0].amp != 1)>>
				<<if ($args[0].muscles >= _currentRule.muscles+5)>>
					<<if ($args[0].diet !== "slimming")>>
						<<set $args[0].diet = "slimming">>
						<br>$args[0].slaveName has been put on a slimming exercise regime.
					<</if>>
				<<elseif ($args[0].muscles <= _currentRule.muscles-5)>>
					<<if ($args[0].diet !== "muscle building")>>
						<<set $args[0].diet = "muscle building">>
						<br>$args[0].slaveName has been put on a muscle building exercise regime.
					<</if>>
				<<else>>
					<<if ($args[0].diet !== "healthy")>>
						<<set $args[0].diet = "healthy">>
						<br>$args[0].slaveName is at the target weight, so her diet has been normalized.
					<</if>>
				<</if>>
			<<else>>
				<<if ($args[0].diet !== "healthy")>>
					<<set $args[0].diet = "healthy">>
					<br>$args[0].slaveName is at the target weight, so her diet has been normalized.
				<</if>>
			<</if>>
		<<elseif (_currentRule.diet == -30)>>
			<<if ($args[0].weight > -20)>>
				<<if ($args[0].diet !== "restricted")>>
					<<set $args[0].diet = "restricted">>
					<br>$args[0].slaveName is too fat so her diet has been set to restricted.
				<</if>>
			<<elseif ($args[0].weight < -30)>>
				<<if ($args[0].diet !== "fattening")>>
					<<set $args[0].diet = "fattening">>
					<br>$args[0].slaveName is too skinny so her diet has been set to fattening.
				<</if>>
			<<elseif (_currentRule.muscles !== "no default setting") && ($args[0].amp != 1)>>
				<<if ($args[0].muscles >= _currentRule.muscles+5)>>
					<<if ($args[0].diet !== "slimming")>>
						<<set $args[0].diet = "slimming">>
						<br>$args[0].slaveName has been put on a slimming exercise regime.
					<</if>>
				<<elseif ($args[0].muscles <= _currentRule.muscles-5)>>
					<<if ($args[0].diet !== "muscle building")>>
						<<set $args[0].diet = "muscle building">>
						<br>$args[0].slaveName has been put on a muscle building exercise regime.
					<</if>>
				<<else>>
					<<if ($args[0].diet !== "healthy")>>
						<<set $args[0].diet = "healthy">>
						<br>$args[0].slaveName is at the target weight, so her diet has been normalized.
					<</if>>
				<</if>>
			<<else>>
				<<if ($args[0].diet !== "healthy")>>
					<<set $args[0].diet = "healthy">>
					<br>$args[0].slaveName is at the target weight, so her diet has been normalized.
				<</if>>
			<</if>>
		<<elseif (_currentRule.diet == "attractive")>>
			<<if (($args[0].weight > 95) || (($args[0].weight > 30) && ($args[0].hips < 2)))>>
				<<if ($args[0].diet !== "restricted")>>
					<<set $args[0].diet = "restricted">>
					<br>$args[0].slaveName is too fat so her diet has been set to restricted.
				<</if>>
			<<elseif (($args[0].weight < -95) || (($args[0].weight < -30) && ($args[0].hips > -2)))>>
				<<if ($args[0].diet !== "fattening")>>
					<<set $args[0].diet = "fattening">>
					<br>$args[0].slaveName is too skinny so her diet has been set to fattening.
				<</if>>
			<<elseif (_currentRule.muscles !== "no default setting") && ($args[0].amp != 1)>>
				<<if ($args[0].muscles >= _currentRule.muscles+5)>>
					<<if ($args[0].diet !== "slimming")>>
						<<set $args[0].diet = "slimming">>
						<br>$args[0].slaveName has been put on a slimming exercise regime.
					<</if>>
				<<elseif ($args[0].muscles <= _currentRule.muscles-5)>>
					<<if ($args[0].diet !== "muscle building")>>
						<<set $args[0].diet = "muscle building">>
						<br>$args[0].slaveName has been put on a muscle building exercise regime.
					<</if>>
				<<else>>
					<<if ($args[0].diet !== "healthy")>>
						<<set $args[0].diet = "healthy">>
						<br>$args[0].slaveName is at the target weight, so her diet has been normalized.
					<</if>>
				<</if>>
			<<else>>
				<<if ($args[0].diet !== "healthy")>>
					<<set $args[0].diet = "healthy">>
					<br>$args[0].slaveName is at the target weight, so her diet has been normalized.
				<</if>>
			<</if>>
		<<elseif (_currentRule.diet == "XX")>>
			<<if ($args[0].diet !== "XX")>>
				<<set $args[0].diet = "XX">>
				<br>$args[0].slaveName has been put on a diet that favors feminine development.
			<</if>>
		<<elseif (_currentRule.diet == "XY")>>
			<<if ($args[0].diet !== "XY")>>
				<<set $args[0].diet = "XY">>
				<br>$args[0].slaveName has been put on a diet that favors masculine development.
			<</if>>
		<<elseif (_currentRule.diet == "XXY")>>
			<<if ($args[0].diet !== "XXY")>>
				<<set $args[0].diet = "XXY">>
				<br>$args[0].slaveName has been put on a diet that enhances a herm's unique sexuality.
			<</if>>
		<</if>>
	<</if>>
<</if>>

<<if (_currentRule.dietCum !== "no default setting")>>
	<<if $args[0].dietCum != _currentRule.dietCum>>
		<<set $args[0].dietCum = _currentRule.dietCum>>
		<<if $args[0].dietCum == 2>>
			<br>$args[0].slaveName has been put on a diet based on cum.
			<<set $args[0].dietMilk = 0>>
		<<elseif $args[0].dietCum == 1>>
			<br>$args[0].slaveName has had cum added to her diet.
		<<else>>
			<br>$args[0].slaveName has had cum removed from her diet.
		<</if>>
	<</if>>
<</if>>

<<if (_currentRule.dietMilk !== "no default setting")>>
	<<if $args[0].dietMilk != _currentRule.dietMilk>>
		<<set $args[0].dietMilk = _currentRule.dietMilk>>
		<<if $args[0].dietMilk == 2>>
			<br>$args[0].slaveName has been put on a diet based on human milk.
			<<set $args[0].dietCum = 0>>
		<<elseif $args[0].dietMilk == 1>>
			<br>$args[0].slaveName has had human milk added to her diet.
		<<else>>
			<br>$args[0].slaveName has had human milk removed from her diet.
		<</if>>
	<</if>>
<</if>>

<<if (_currentRule.teeth !== "no default setting")>>
  <<if (_currentRule.teeth == "universal")>>
	<<if ($args[0].teeth == "crooked")>>
		<<set $args[0].teeth = "straightening braces">>
		<<set $cash -= $surgeryCost>>
		<br>$args[0].slaveName has been given braces for her crooked teeth.
	<<elseif ($args[0].teeth == "normal")>>
		<<set $args[0].teeth = "cosmetic braces">>
		<<set $cash -= $surgeryCost>>
		<br>$args[0].slaveName has been given cosmetic braces.
	<</if>>
  <<elseif (_currentRule.teeth == "straighten")>>
	<<if ($args[0].teeth == "crooked")>>
		<<set $args[0].teeth = "straightening braces">>
		<<set $cash -= $surgeryCost>>
		<br>$args[0].slaveName has been given braces for her crooked teeth.
	<<elseif ($args[0].teeth == "cosmetic braces")>>
		<<set $args[0].teeth = "normal">>
		<br>$args[0].slaveName has gotten her braces off, since her teeth are straight.
	<</if>>
  <<elseif (_currentRule.teeth == "none")>>
	<<if ($args[0].teeth == "straightening braces")>>
		<<set $args[0].teeth = "crooked">>
		<br>$args[0].slaveName has gotten her braces off.
	<<elseif ($args[0].teeth == "cosmetic braces")>>
		<<set $args[0].teeth = "normal">>
		<br>$args[0].slaveName has gotten her braces off.
	<</if>>
	<</if>>
<</if>>

<<set _tmp = lastEyeColorRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.eyeColor !== "no default setting")>>
<<if ($args[0].eyeColor !== _currentRule.eyeColor)>>
  <<set $args[0].eyeColor = _currentRule.eyeColor>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName has been given $args[0].eyeColor contact lenses.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastMakeupRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.makeup !== "no default setting")>>
<<if ($args[0].makeup !== _currentRule.makeup)>>
  <<set $args[0].makeup = _currentRule.makeup>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName has been assigned the standard makeup.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastNailsRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if ($args[0].amp != 1)>>
<<if (_currentRule.nails !== "no default setting")>>
<<if ($args[0].nails !== _currentRule.nails)>>
  <<set $args[0].nails = _currentRule.nails>>
  <<set $cash -= $modCost>>
	<br>$args[0].slaveName has been assigned the standard nails.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastHColorRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.hColor !== "no default setting")>>
<<if ($args[0].hColor !== _currentRule.hColor)>>
  <<set $args[0].hColor = _currentRule.hColor>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's hair has been dyed _currentRule.hColor.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastHStyleRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.hStyle !== "no default setting")>>
<<if ($args[0].hStyle !== _currentRule.hStyle)>>
<br>$args[0].slaveName's hair has been
<<if (_currentRule.hStyle == "shaved")>>
	<<set $args[0].hLength = 0>>
	shaved.
<<else>>
	restyled.
<</if>>
<<set $args[0].hStyle = _currentRule.hStyle>>
<<set $cash -= $modCost>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastHLengthRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.hLength !== "no default setting")>>
<<if ($args[0].hLength !== _currentRule.hLength)>>
<<if ($args[0].hLength > _currentRule.hLength)>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's hair has been cut; it
<<else>>
	<<set $cash -= $modCost*Math.trunc((_currentRule.hLength-$args[0].hLength)/10)>>
	<br>$args[0].slaveName has been given extensions; her hair
<</if>>
is now _currentRule.hLength cm long.
<<set $args[0].hLength = _currentRule.hLength>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastPubicHColorRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.pubicHColor !== "no default setting")>>
<<if ($args[0].pubicHColor !== _currentRule.pubicHColor)>>
  <<set $args[0].pubicHColor = _currentRule.pubicHColor>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's pubic hair, if present, has been dyed _currentRule.pubicHColor.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastPubicHStyleRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.pubicHStyle !== "no default setting")>>
<<if ($args[0].pubicHStyle !== _currentRule.pubicHStyle)>>
  <<set $args[0].pubicHStyle = _currentRule.pubicHStyle>>
  <<set $cash -= $modCost>>
	<br>$args[0].slaveName's pubic hair has been restyled; it is now _currentRule.pubicHStyle.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastUnderArmHColorRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.underArmHColor !== "no default setting")>>
<<if ($args[0].underArmHColor !== _currentRule.underArmHColor)>>
	<<set $args[0].underArmHColor = _currentRule.underArmHColor>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's underarm hair, if present, has been dyed _currentRule.underArmHColor.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastUnderArmHStyleRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.underArmHStyle !== "no default setting")>>
<<if ($args[0].underArmHStyle !== _currentRule.underArmHStyle)>>
	<<set $args[0].underArmHStyle = _currentRule.underArmHStyle>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's underarm hair has been restyled; it is now _currentRule.underArmHStyle.
<</if>>
<</if>>
<</if>>

<<if (_currentRule.nipplesPiercing == 0)>>
<<if $args[0].nipplesPiercing != 0>>
	<<set $args[0].nipplesPiercing = 0>>
	<br>$args[0].slaveName's nipple piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.areolaePiercing == 0)>>
<<if $args[0].areolaePiercing != 0>>
	<<set $args[0].areolaePiercing = 0>>
	<br>$args[0].slaveName's areolae piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.clitPiercing == 0)>>
<<if $args[0].clitPiercing != 0>>
	<<set $args[0].clitPiercing = 0>>
	<<if $args[0].dick > 0>>
		<br>$args[0].slaveName's frenulum piercing has been removed.
	<<else>>
		<br>$args[0].slaveName's clit piercing has been removed.
	<</if>>
<</if>>
<</if>>
<<if (_currentRule.vaginaPiercing == 0)>>
<<if $args[0].vaginaPiercing != 0>>
	<<set $args[0].vaginaPiercing = 0>>
	<br>$args[0].slaveName's labia piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.dickPiercing == 0)>>
<<if $args[0].dickPiercing != 0>>
	<<set $args[0].dickPiercing = 0>>
	<br>$args[0].slaveName's shaft piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.anusPiercing == 0)>>
<<if $args[0].anusPiercing != 0>>
	<<set $args[0].anusPiercing = 0>>
	<br>$args[0].slaveName's asshole piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.lipsPiercing == 0)>>
<<if $args[0].lipsPiercing != 0>>
	<<set $args[0].lipsPiercing = 0>>
	<br>$args[0].slaveName's lip piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.tonguePiercing == 0)>>
<<if $args[0].tonguePiercing != 0>>
	<<set $args[0].tonguePiercing = 0>>
	<br>$args[0].slaveName's tongue piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.earPiercing == 0)>>
<<if $args[0].earPiercing != 0>>
	<<set $args[0].earPiercing = 0>>
	<br>$args[0].slaveName's ear piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.nosePiercing == 0)>>
<<if $args[0].nosePiercing != 0>>
	<<set $args[0].nosePiercing = 0>>
	<br>$args[0].slaveName's nose piercing has been removed.
<</if>>
<</if>>
<<if (_currentRule.eyebrowPiercing == 0)>>
<<if $args[0].eyebrowPiercing != 0>>
	<<set $args[0].eyebrowPiercing = 0>>
	<br>$args[0].slaveName's eyebrow piercings have been removed.
<</if>>
<</if>>
<<if (_currentRule.navelPiercing == 0)>>
<<if $args[0].navelPiercing != 0>>
	<<set $args[0].navelPiercing = 0>>
	<br>$args[0].slaveName's navel piercing have been removed.
<</if>>
<</if>>
<<if (_currentRule.corsetPiercing == 0)>>
<<if $args[0].corsetPiercing != 0>>
	<<set $args[0].corsetPiercing = 0>>
	<br>$args[0].slaveName's corset piercings have been removed.
<</if>>
<</if>>

<<set _tmp = lastNipplesPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.nipplesPiercing !== "no default setting")>>
<<if (_currentRule.nipplesPiercing != 0)>>
<<if $args[0].nipplesPiercing !== _currentRule.nipplesPiercing>>
	<<set $args[0].nipplesPiercing = _currentRule.nipplesPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's nipples have been pierced.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastAreolaePiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.areolaePiercing !== "no default setting")>>
<<if (_currentRule.areolaePiercing != 0)>>
<<if $args[0].areolaePiercing !== _currentRule.areolaePiercing>>
	<<set $args[0].areolaePiercing = _currentRule.areolaePiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's areolae have been given stud piercings.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastClitPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.clitPiercing !== "no default setting")>>
<<if ($args[0].clitPiercing != 3)>>
<<if (_currentRule.clitPiercing != 0)>>
<<if $args[0].clitPiercing !== _currentRule.clitPiercing>>
	<<set $args[0].clitPiercing = _currentRule.clitPiercing>>
	<<if $args[0].dick > 0>>
		<br>$args[0].slaveName's frenulum has been pierced.
	<<else>>
		<br>$args[0].slaveName's clit has been pierced.
	<</if>>
	<<if _currentRule.clitPiercing == 3>>
	 <<set $cash -= 1000>>
	<<else>>
	 <<set $cash -= $modCost>>
	<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if ($args[0].clitPiercing == 3)>>
	<<set _used = 0>>
	<<set _tmp = lastClitSettingRule($args[0], $defaultRules)>>
	<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
	<<if (_currentRule.clitSetting !== "no default setting")>>
	<<if $args[0].clitSetting !== _currentRule.clitSetting>>
		<<set $args[0].clitSetting = _currentRule.clitSetting, _used = 1>>
		<br>$args[0].slaveName's smart piercing has been set to $args[0].clitSetting.
	<<else>>
		<<if $args[0].fetishStrength < 100>><<set _used = 1>><</if>>
	<</if>>
	<</if>>
	<</if>>
	<<if _used == 0>>
		<<set _tmp = lastClitSettingXYRule($args[0], $defaultRules)>>
		<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
		<<if _currentRule.clitSettingXY !== "no default setting">>
		<<if $args[0].attrXY < _currentRule.clitSettingXY>>
			<<set $args[0].clitSetting = "men", _used = 1>>
			<br>$args[0].slaveName's smart piercing has been set to encourage attraction to men.
		<<elseif $args[0].attrXY >= _currentRule.clitSettingXY + 10>>
			<<set $args[0].clitSetting = "anti-men", _used = 1>>
			<br>$args[0].slaveName's smart piercing has been set to discourage attraction to men.
		<</if>>
		<</if>>
		<</if>>
	<</if>>
	<<if _used == 0>>
		<<set _tmp = lastClitSettingXXRule($args[0], $defaultRules)>>
		<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
		<<if _currentRule.clitSettingXX !== "no default setting">>
		<<if $args[0].attrXX < _currentRule.clitSettingXX>>
			<<set $args[0].clitSetting = "women", _used = 1>>
			<br>$args[0].slaveName's smart piercing has been set to encourage attraction to women.
		<<elseif $args[0].attrXX >= _currentRule.clitSettingXX + 10>>
			<<set $args[0].clitSetting = "anti-women", _used = 1>>
			<br>$args[0].slaveName's smart piercing has been set to discourage attraction to women.
		<</if>>
		<</if>>
		<</if>>
	<</if>>
	<<if _used == 0>>
		<<set _tmp = lastClitSettingEnergyRule($args[0], $defaultRules)>>
		<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
		<<if _currentRule.clitSettingEnergy !== "no default setting">>
		<<if $args[0].energy < _currentRule.clitSettingEnergy>>
			<<set $args[0].clitSetting = "all", _used = 1>>
			<br>$args[0].slaveName's smart piercing has been set to enhance libido.
		<<elseif $args[0].energy >= _currentRule.clitSettingEnergy + 10>>
			<<set $args[0].clitSetting = "none", _used = 1>>
			<br>$args[0].slaveName's smart piercing has been set to suppress libido.
		<</if>>
		<</if>>
		<</if>>
	<</if>>
<</if>>

<<set _tmp = lastVaginaPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if $args[0].vagina != -1>>
<<if (_currentRule.vaginaPiercing !== "no default setting")>>
<<if (_currentRule.vaginaPiercing != 0)>>
<<if $args[0].vaginaPiercing !== _currentRule.vaginaPiercing>>
	<<set $args[0].vaginaPiercing = _currentRule.vaginaPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's pussylips have been pierced.
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastDickPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if $args[0].dick > 0>>
<<if (_currentRule.dickPiercing !== "no default setting")>>
<<if (_currentRule.dickPiercing != 0)>>
<<if $args[0].dickPiercing !== _currentRule.dickPiercing>>
	<<set $args[0].dickPiercing = _currentRule.dickPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's shaft has been pierced.
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastAnusPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.anusPiercing !== "no default setting")>>
<<if (_currentRule.anusPiercing != 0)>>
<<if $args[0].anusPiercing !== _currentRule.anusPiercing>>
	<<set $args[0].anusPiercing = _currentRule.anusPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's asshole has been pierced.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastLipsPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.lipsPiercing !== "no default setting")>>
<<if (_currentRule.lipsPiercing != 0)>>
<<if $args[0].lipsPiercing !== _currentRule.lipsPiercing>>
	<<set $args[0].lipsPiercing = _currentRule.lipsPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's lips have been pierced.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastTonguePiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.tonguePiercing !== "no default setting")>>
<<if (_currentRule.tonguePiercing != 0)>>
<<if $args[0].tonguePiercing !== _currentRule.tonguePiercing>>
	<<set $args[0].tonguePiercing = _currentRule.tonguePiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's tongue has been pierced.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastEarPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.earPiercing !== "no default setting")>>
<<if (_currentRule.earPiercing != 0)>>
<<if $args[0].earPiercing !== _currentRule.earPiercing>>
	<<set $args[0].earPiercing = _currentRule.earPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's ears have been pierced.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastNosePiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.nosePiercing !== "no default setting")>>
<<if (_currentRule.nosePiercing != 0)>>
<<if $args[0].nosePiercing !== _currentRule.nosePiercing>>
	<<set $args[0].nosePiercing = _currentRule.nosePiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's nose has been pierced.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastEyebrowPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.eyebrowPiercing !== "no default setting")>>
<<if (_currentRule.eyebrowPiercing != 0)>>
<<if $args[0].eyebrowPiercing !== _currentRule.eyebrowPiercing>>
	<<set $args[0].eyebrowPiercing = _currentRule.eyebrowPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's eyebrows have been pierced.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastNavelPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.navelPiercing !== "no default setting")>>
<<if (_currentRule.navelPiercing != 0)>>
<<if $args[0].navelPiercing !== _currentRule.navelPiercing>>
	<<set $args[0].navelPiercing = _currentRule.navelPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName's navel has been pierced.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastCorsetPiercingRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.corsetPiercing !== "no default setting")>>
<<if (_currentRule.corsetPiercing != 0)>>
<<if $args[0].corsetPiercing !== _currentRule.corsetPiercing>>
	<<set $args[0].corsetPiercing = _currentRule.corsetPiercing>>
	<<set $cash -= $modCost>>
	<br>$args[0].slaveName has been given a set of corset piercings.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastBoobsTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.boobsTat !== "no default setting")>>
<<if ($args[0].boobsTat !== _currentRule.boobsTat)>>
	<<set $args[0].boobsTat = _currentRule.boobsTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's chest has been tattooed.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastButtTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.buttTat !== "no default setting")>>
<<if ($args[0].buttTat !== _currentRule.buttTat)>>
	<<set $args[0].buttTat = _currentRule.buttTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's butt has been tattooed.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastVaginaTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.vaginaTat !== "no default setting")>>
<<if ($args[0].vaginaTat !== _currentRule.vaginaTat)>>
	<<set $args[0].vaginaTat = _currentRule.vaginaTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's abdomen has been tattooed.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastDickTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if ($args[0].dick > 0)>>
<<if (_currentRule.dickTat !== "no default setting")>>
<<if ($args[0].dickTat !== _currentRule.dickTat)>>
	<<set $args[0].dickTat = _currentRule.dickTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's dick has been tattooed.
<</if>>
<</if>>
<</if>>
<</if>>

<<set _tmp = lastLipsTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.lipsTat !== "no default setting")>>
<<if ($args[0].lipsTat !== _currentRule.lipsTat)>>
	<<set $args[0].lipsTat = _currentRule.lipsTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's face has been tattooed.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastAnusTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.anusTat !== "no default setting")>>
<<if ($args[0].anusTat !== _currentRule.anusTat)>>
	<<set $args[0].anusTat = _currentRule.anusTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's asshole has been modded.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastShouldersTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.shouldersTat !== "no default setting")>>
<<if ($args[0].shouldersTat !== _currentRule.shouldersTat)>>
	<<set $args[0].shouldersTat = _currentRule.shouldersTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's shoulders have been tattooed.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastArmsTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.armsTat !== "no default setting")>>
<<if ($args[0].armsTat !== _currentRule.armsTat)>>
	<<set $args[0].armsTat = _currentRule.armsTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's arms have been tattooed.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastLegsTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.legsTat !== "no default setting")>>
<<if ($args[0].legsTat !== _currentRule.legsTat)>>
	<<set $args[0].legsTat = _currentRule.legsTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's legs have been tattooed.
<</if>>
<</if>>
<</if>>

<<set _tmp = lastStampTatRule($args[0], $defaultRules)>>
<<if (_tmp != null) && (_tmp.ID == _currentRule.ID)>>
<<if (_currentRule.stampTat !== "no default setting")>>
<<if ($args[0].stampTat !== _currentRule.stampTat)>>
	<<set $args[0].stampTat = _currentRule.stampTat>>
	<<set $cash -= $modCost>>
  <br>$args[0].slaveName's lower back has been tattooed.
<</if>>
<</if>>
<</if>>

<<if (_currentRule.pornFameSpending !== "no default setting")>>
<<if ($args[0].devotion > 95)>>
<<if ($args[0].trust > 95)>>
<<if ($args[0].prestige < 3)>>
<<if ($args[0].pornFameSpending !== _currentRule.pornFameSpending)>>
  <<set $args[0].pornFameSpending = _currentRule.pornFameSpending>>
  <br>$args[0].slaveName's porn publicity has been corrected.
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if (_currentRule.autoBrand == 1)>>
<<if ($args[0].brand == 0)>>
<<if ($args[0].health > -20)>>
	<<set $args[0].brand = $brandDesign>>
	<<set $args[0].brandLocation = $brandTarget>>
	<<if ($args[0].devotion < 18)>><<set $args[0].devotion -= 5>><</if>>
	<<set $args[0].trust -= 5>>
	<<set $args[0].health -= 10>>
	<br>$args[0].slaveName has been branded, with @@color:gold;fear@@<<if ($args[0].devotion < 18)>>, @@color:mediumorchid;regard@@,<</if>> and @@color:red;health@@
consequences.
<</if>>
<</if>>
<</if>>

<<set _exclude = false>>
<<if _currentRule.excludeSpecialSlaves>>
	<<if (($HeadGirl != 0) && ($HeadGirl.ID == $args[0].ID)) || (($Bodyguard != 0) && ($Bodyguard.ID == $args[0].ID)) || (($Recruiter != 0) && ($Recruiter.ID == $args[0].ID)) || (($Concubine != 0) && ($Concubine.ID == $args[0].ID)) || (($Nurse != 0) && ($Nurse.ID == $args[0].ID)) || (($Attendant != 0) && ($Attendant.ID == $args[0].ID)) || (($Madam != 0) || ($Madam.ID == $args[0].ID)) || (($DJ != 0) && ($DJ.ID == $args[0].ID)) || (($Milkmaid != 0) && ($Milkmaid.ID == $args[0].ID)) || (($Stewardess != 0 ) && ($Stewardess.ID == $args[0].ID)) || (($Schoolteacher != 0) && ($Schoolteacher.ID == $args[0].ID)) || (($Wardeness != 0) && ($Wardeness.ID == $args[0].ID))>>
		<<set _exclude = true>>
	<</if>>
<</if>>

<<if $args[0].assignmentVisible != 1>>
	<<set _exclude = true>>
<</if>>

<<if !_exclude>>
<<switch _currentRule.assignFacility>>
<<case "hgsuite">>
	<<if ($args[0].indentureRestrictions <= 0) && ($args[0].assignment != "live with your Head Girl")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
<<case "arcade">>
	<<if ($arcade > $arcadeSlaves) && ($args[0].indentureRestrictions <= 0) && ($args[0].assignment != "be confined in the arcade") && $args[0].breedingMark != 1>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
<<case "mastersuite">>
	<<if ($masterSuite > $masterSuiteSlaves) && ($args[0].devotion > 20) || (($args[0].devotion >= -50) && ($args[0].trust < -20)) || ($args[0].trust < -50)>>
	<<if ($args[0].assignment != "serve in the master suite")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
	<<else>>
		<<if ($args[0].assignment == "serve in the master suite")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
<<case "clinic">>
	<<if ($clinic > $clinicSlaves) && ($args[0].health < 20) || (($args[0].chem > 15) && ($clinicUpgradeFilters == 1)) || (($args[0].bellyImplant > 100) && ($bellyImplants == 1)) || $args[0].preg > 1>>
	<<if ($args[0].assignment != "get treatment in the clinic")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
	<<else>>
		<<if ($args[0].assignment == "get treatment in the clinic")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
<<case "spa">>
	<<if ($spa > $spaSlaves) && ($args[0].health < 20) || ($args[0].trust < 60) || ($args[0].devotion <= 60) || ($args[0].fetish == "mindbroken") && ($args[0].devotion >= -20)>>
	<<if ($args[0].assignment != "rest in the spa")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
	<<else>>
		<<if ($args[0].assignment == "rest in the spa")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
<<case "brothel">>
	<<if ($brothel > $brothelSlaves) && ($args[0].devotion > 50) || (($args[0].devotion >= -50) && ($args[0].trust < -20)) || ($args[0].trust < -50) || ($args[0].trust > 50) && $args[0].breedingMark != 1>>
	<<if ($args[0].assignment != "work in the brothel")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
	<<else>>
		<<if ($args[0].assignment == "work in the brothel")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
<<case "club">>
	<<if ($club > $clubSlaves)  && ($args[0].devotion > 50) || (($args[0].devotion >= -50) && ($args[0].trust < -20)) || ($args[0].trust < -50) || ($args[0].trust > 50) && $args[0].breedingMark != 1>>
	<<if ($args[0].assignment != "serve in the club")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
	<<else>>
		<<if ($args[0].assignment == "serve in the club")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
<<case "dairy">>
	<<if ($dairy > $dairySlaves+$bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren)>>
	<<if ($args[0].indentureRestrictions > 0) && ($dairyRestraintsSetting > 1)>>
	<<elseif (($args[0].indentureRestrictions > 1) && ($dairyRestraintsSetting > 0)) || ($args[0].breedingMark == 1 && $dairyRestriantsSettings > 0) || (($dairyPregSetting > 0) && ((_Slave.bellyImplant != 0) || (_Slave.pregType >= 50)))>>
	<<else>>
		<<if ($args[0].lactation > 0) || ($args[0].balls > 0) || (($dairyFeedersUpgrade == 1) && ($dairyFeedersSetting > 0))>>
		<<if ($args[0].devotion > 20) || (($args[0].devotion >= -50) && ($args[0].trust < -20)) || ($args[0].trust < -50) || ($args[0].amp == 1) || ($dairyRestraintsUpgrade == 1)>>
		<<if ($dairyStimulatorsSetting < 2) || ($args[0].anus > 2) || ($dairyPrepUpgrade == 1)>>
		<<if ($dairyPregSetting < 2) || ($args[0].vagina > 2) || ($args[0].ovaries == 0) || ($dairyPrepUpgrade == 1)>>
	<<if ($args[0].assignment != "work in the dairy")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
		<<else>>
			<<if ($args[0].assignment == "work in the dairy")>>
				<<include "Rules Facility Remove">>
			<</if>>
		<</if>>
		<<else>>
			<<if ($args[0].assignment == "work in the dairy")>>
				<<include "Rules Facility Remove">>
			<</if>>
		<</if>>
		<<else>>
			<<if ($args[0].assignment == "work in the dairy")>>
				<<include "Rules Facility Remove">>
			<</if>>
		<</if>>
		<<else>>
			<<if ($args[0].assignment == "work in the dairy")>>
				<<include "Rules Facility Remove">>
			<</if>>
		<</if>>
	<</if>>
	<</if>>
<<case "servantsquarters">>
	<<if ($servantsQuarters > $servantsQuartersSlaves) && ($args[0].devotion >= -20) || (($args[0].devotion >= -50) && ($args[0].trust <= 20)) || ($args[0].trust < -20)>>
	<<if ($args[0].assignment != "work as a servant")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
	<<else>>
		<<if ($args[0].assignment == "work as a servant")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
<<case "schoolroom">>
	<<if ($schoolroom > $schoolroomSlaves) && ($args[0].devotion >= -20) || (($args[0].devotion >= -50) && ($args[0].trust < -20)) || ($args[0].trust < -50)>>
	<<if ($args[0].intelligenceImplant < 1) || ($args[0].accent+$schoolroomUpgradeLanguage > 2) || ($args[0].oralSkill <= 10) || ($args[0].whoreSkill <= 10) || ($args[0].entertainSkill <= 10) || ($args[0].analSkill < 1) || (($args[0].vaginalSkill < 1) && ($args[0].vagina > 0))>>
	<<if ($args[0].assignment != "learn in the schoolroom")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
	<</if>>
	<<else>>
		<<if ($args[0].assignment == "learn in the schoolroom")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
	<<else>>
		<<if ($args[0].assignment == "learn in the schoolroom")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
<<case "cellblock">>
	<<if ($cellblock > $cellblockSlaves ) && (($args[0].devotion < -20) && ($args[0].trust >= -20)) || (($args[0].devotion < -50) && ($args[0].trust >= -50))>>
	<<if ($args[0].assignment != "be confined in the cellblock")>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
		<<if ($personalAttention == $args[0].ID)>>
			$args[0].slaveName no longer has your personal attention; you plan to focus on business.
		<</if>>
		<<assignJob $args[0] _currentRule.assignFacility>>
		<</if>>
	<<else>>
		<<if ($args[0].assignment == "be confined in the cellblock")>>
			<<include "Rules Facility Remove">>
		<</if>>
	<</if>>
<</switch>>
<</if>>

<<if !_exclude>>
<<if def _currentRule.setAssignment && _currentRule.setAssignment !== "none">>
	<<if ($args[0].assignment !== _currentRule.setAssignment)>>
		<<set $args[0].assignment = _currentRule.setAssignment>>
		<br>$args[0].slaveName has automatically been assigned to $args[0].assignment.
	<</if>>
<</if>>
<</if>>

<</for>>
<</widget>>

/%
	Call as <<CheckAutoRulesActivate SlaveObject>>
%/
<<widget "CheckAutoRulesActivate">>
<<if (ndef $args[0].currentRules) || ($args[0].currentRules.length < 1)>>
	<<set $args[0].currentRules = []>>
<</if>>

<<for _r = 0; _r < $defaultRules.length; _r++>>
<<set _currentRule = $defaultRules[_r]>>
<<set _rule = _r+1>>

<<if (def _currentRule.excludedSlaves) && (_currentRule.excludedSlaves.length > 0)>>
	<<if ruleSlaveExcluded($args[0], _currentRule)>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<if (def _currentRule.selectedSlaves) && (_currentRule.selectedSlaves.length > 0)>>
	<<if !ruleSlaveSelected($args[0], _currentRule)>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<if (def _currentRule.facility) && (_currentRule.facility.length > 0)>>
	<<if !ruleAppliedToSlaveFacility(_currentRule, $args[0])>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<if (def _currentRule.excludeFacility) && (_currentRule.excludeFacility.length > 0)>>
	<<if ruleExcludeSlaveFacility(_currentRule, $args[0])>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<if (def _currentRule.assignment) && (_currentRule.assignment.length > 0)>>
	<<if !ruleAssignment(_currentRule.assignment, $args[0].assignment)>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>
<<if (def _currentRule.excludeAssignment) && (_currentRule.excludeAssignment.length > 0)>>
	<<if ruleAssignment(_currentRule.excludeAssignment, $args[0].assignment)>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<switch _currentRule.activation>>
<<case "custom">>	/* for betterRA */
	<<set _isActive = parseAndEvaluate(_currentRule.customActivationText, $args[0])>>
	<<if _isActive>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
				<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "always">>
	<<if !ruleApplied($args[0], _currentRule.ID)>>
		<<set $args[0].currentRules.push(_currentRule.ID)>>
		<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
	<</if>>
<<case "none">>
	<<if ruleApplied($args[0], _currentRule.ID)>>
		<<RARemoveRule>>
	<</if>>
<<case "devotion">>
	<<if checkThresholds($args[0].devotion, _currentRule)>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
			<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "trust">>
	<<if checkThresholds($args[0].trust, _currentRule)>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
			<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "health">>
	<<if ($args[0].assignment == "live with your Head Girl") && ($args[0].health <= 100)>>
		<<if checkThresholds($args[0].health, _currentRule)>>
			<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
				<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
			<</if>>
		<<else>>
			<<if ruleApplied($args[0], _currentRule.ID)>>
				<<RARemoveRule>>
			<</if>>
		<</if>>
	<<elseif $args[0].health <= 90>>
		<<if checkThresholds($args[0].health, _currentRule)>>
			<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
				<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
			<</if>>
		<<else>>
			<<if ruleApplied($args[0], _currentRule.ID)>>
				<<RARemoveRule>>
			<</if>>
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "sex drive">>
	<<if checkThresholds($args[0].energy, _currentRule)>>
		<<if ($args[0].attrKnown == 1) && (ruleApplied($args[0], _currentRule.ID) == false)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
			<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "age">>
	<<if checkThresholds($args[0].physicalAge, _currentRule)>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
			<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "weight">>
	<<if checkThresholds($args[0].weight, _currentRule)>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
			<br>Rule _rule (_currentRule.name) is now applying to $args[0].slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "lactation">>
	<<if checkThresholds($args[0].lactation, _currentRule)>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<set $dump = $args[0].currentRules.pluck([_r])>>
			<<include "Rules Facility Remove">>
			<<continue>>
		<</if>>
	<</if>>
<<case "pregnancy week">>
	<<if checkThresholds($args[0].preg, _currentRule)>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<set $dump = $args[0].currentRules.pluck([_r])>>
			<<include "Rules Facility Remove">>
			<<continue>>
		<</if>>
	<</if>>
<<case "pregnancy foetuses">>
	<<if (checkThresholds($args[0].pregType, _currentRule) && $args[0].preg > 10)>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<set $dump = $args[0].currentRules.pluck([_r])>>
			<<include "Rules Facility Remove">>
			<<continue>>
		<</if>>
	<</if>>
<<case "belly implant volume">>
	<<if checkThresholds($args[0].bellyImplant, _currentRule)>>
		<<if !ruleApplied($args[0], _currentRule.ID)>>
			<<set $args[0].currentRules.push(_currentRule.ID)>>
		<</if>>
	<<else>>
		<<if ruleApplied($args[0], _currentRule.ID)>>
			<<set $dump = $args[0].currentRules.pluck([_r])>>
			<<include "Rules Facility Remove">>
			<<continue>>
		<</if>>
	<</if>>
<</switch>>
<</for>>

<<set $args[0].currentRules = $args[0].currentRules.sort(function(a, b) { return a-b; });>>
<</widget>>
