:: DefaultRules [script]
// this code applies RA rules onto slaves

window.DefaultRules = (function() {
	"use strict";
	let V;
	let r;

	function DefaultRules(slave) {
		if (slave.useRulesAssistant === 0) return r; //exempted
		
		V = State.variables;
		r = "";
		let rule = MergeRules(slave);
		if (Object.keys(rule).length === 0) return r; // no rules apply

		AssignJobToSlave(slave, rule);
		if(slave.fuckdoll === 0) {
			ProcessClothing(slave, rule);
			ProcessCollar(slave, rule);
			ProcessEyewear(slave, rule);
			ProcessEarwear(slave, rule);
			ProcessDildos(slave, rule);
			ProcessDickAccessories(slave, rule);
			ProcessAnalAccessories(slave, rule);
			ProcessShoes(slave, rule);
			ProcessBellyAccessories(slave, rule);
			ProcessLegAccessory(slave, rule);
		}
		ProcessBellyImplant(slave, rule);
		if (isFertile(slave))
			ProcessContraceptives(slave, rule);
		ProcessOtherDrugs(slave, rule);
		ProcessAssetGrowthDrugs(slave, rule);
		ProcessEnema(slave, rule);
		ProcessDiet(slave, rule);
		ProcessCuratives(slave, rule);
		ProcessAphrodisiacs(slave, rule);
		ProcessPenisHormones(slave, rule);
		ProcessFemaleHormones(slave, rule);
		ProcessPregnancyDrugs(slave, rule);
		if(slave.fuckdoll === 0) {
			ProcessLivingStandard(slave, rule);
			ProcessSpeech(slave, rule);
			ProcessRelationship(slave, rule);
			ProcessRelease(slave, rule);
			ProcessPunishment(slave, rule);
			ProcessReward(slave, rule);
		}
		ProcessToyHole(slave, rule);
		ProcessDietCum(slave, rule);
		ProcessDietMilk(slave, rule);
		if (V.arcologies[0].FSHedonisticDecadenceResearch === 1)
			ProcessSolidFood(slave, rule);
		ProcessTeeth(slave, rule);
		ProcessStyle(slave, rule);
		ProcessPiercings(slave, rule);
		ProcessSmartPiercings(slave, rule);
		ProcessTattoos(slave, rule);
		ProcessPornFeedEnabled(slave, rule);
		ProcessPorn(slave, rule);
		ProcessLabel(slave, rule);
		return r;
	}

	function MergeRules(slave) {
		// merge all rules applying on a slave into one big rule
		const rules = V.defaultRules.filter(x => ruleAppliesP(x.condition, slave));
		slave.currentRules = rules.map(x => x.ID);
		return mergeRules(rules.map(x => ProcessAssignments(slave, Object.assign({}, x.set))));
	}

	function ProcessAssignments(slave, rule) {
		// Before merging rules, we process assignments for each rule separately so we can remove slaves from facilities when they no longer qualify, even if the final "winning" rule assigns them elsewhere 
		// We also ignore inapplicable assignments for the current slave, so we only merge assignments that are valid 
		switch (rule.setAssignment) {
			case "no default setting":
				delete rule.setAssignment;
				break;
			
			case "rest":
			case "please you":
				// slaves always qualify for this assignment 
				break;

			case "live with your Head Girl":
				if ((V.HGSuiteSlaves < 1 && slave.indentureRestrictions <= 0))
					break;
				else {
					RAFacilityRemove(slave, rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "be confined in the arcade":
				if ((V.arcadeSlaves < V.arcade && slave.indentureRestrictions <= 0 && (slave.breedingMark != 1 || V.propOutcome === 0)))
					break;
				else {
					RAFacilityRemove(slave, rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "serve in the master suite":
				if ((V.masterSuiteSlaves < V.masterSuite && (slave.devotion > 20 || slave.trust < -50 || (slave.devotion >= -50 && slave.trust < -20))))
					break;
				else {
					RAFacilityRemove(slave, rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "get treatment in the clinic":
				if ((V.clinicSlaves < V.clinic && (slave.health < 20 || (slave.chem > 15 && V.Nurse !== 0 && V.clinicUpgradeFilters == 1)) || ((slave.bellyImplant > -1) && (V.bellyImplants == 1)) || slave.preg > 1))
					break;
				else {
					RAFacilityRemove(slave, rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "rest in the spa":
				if ((V.spaSlaves < V.spa) && (slave.health < 20) || (slave.trust < 60) || (slave.devotion <= 60) || (slave.fetish == "mindbroken") && (slave.devotion >= -20))
					break;
				else {
					RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "work as a nanny":
				if ((V.nurserySlaves < V.nursery) && !slave.fuckdoll && (slave.devotion > 20 || slave.trust > 20))
					break;
				else {
					RAFacilityRemove(slave, rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "work in the brothel":
				if ((V.brothelSlaves < V.brothel && (slave.devotion > 50 || slave.trust > 50 || slave.trust < -50 || (slave.devotion >= -50 && slave.trust < -20)) && (slave.breedingMark != 1 || V.propOutcome === 0)))
					break;
				else {
					RAFacilityRemove(slave, rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "serve in the club":
				if ((V.clubSlaves < V.club && (slave.devotion > 50 || slave.trust > 50 || slave.trust < -50 || (slave.devotion >= -50 && slave.trust < -20)) && (slave.breedingMark != 1 || V.propOutcome === 0)))
					break;
				else {
					RAFacilityRemove(slave, rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "work in the dairy":
				if ((V.dairy > V.dairySlaves+V.bioreactorsXY+V.bioreactorsXX+V.bioreactorsHerm+V.bioreactorsBarren)) {
					if ((slave.indentureRestrictions > 0) && (V.dairyRestraintsSetting > 1))
						break;
					else if (((slave.indentureRestrictions > 1) && (V.dairyRestraintsSetting > 0)) || (slave.breedingMark == 1 && V.propOutcome == 1 && V.dairyRestriantsSettings > 0) || ((V.dairyPregSetting > 0) && ((slave.bellyImplant != -1) || (slave.broodmother !== 0))))
						break;
					else {
						if ((slave.lactation > 0 || ((V.dairySlimMaintainUpgrade === 0 || V.dairySlimMaintain === 0) && (slave.boobs > 300 || slave.dick === 0 || V.dairyImplantsSetting == 1) && V.dairyImplantsSetting != 2)) || (slave.balls > 0)) {
							if ((slave.devotion > 20) || ((slave.devotion >= -50) && (slave.trust < -20)) || (slave.trust < -50) || (slave.amp == 1) || (V.dairyRestraintsUpgrade == 1)) {
								if ((V.dairyStimulatorsSetting < 2) || (slave.anus > 2) || (V.dairyPrepUpgrade == 1)) {
									if ((V.dairyPregSetting < 2) || (slave.vagina > 2) || (slave.ovaries === 0) || (V.dairyPrepUpgrade == 1))
										break;
									else {
										RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
										delete rule.setAssignment;
									}
								} else {
									RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
									delete rule.setAssignment;
								}
							} else {
								RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
								delete rule.setAssignment;
							}
						} else {
							RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
							delete rule.setAssignment;
						}
					}
				}
				break;

			case "work as a servant":
				if ((V.servantsQuartersSlaves < V.servantsQuarters && canSee(slave) && canWalk(slave) && (slave.devotion >= -20 || slave.trust < -20 || (slave.devotion >= -50 && slave.trust <= 20))))
					break;
				else {
					RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "learn in the schoolroom":
				if ((V.schoolroomSlaves < V.schoolroom && slave.fetish != "mindbroken" && (slave.devotion >= -20 || slave.trust < -50 || (slave.devotion >= -50 && slave.trust < -20))))
					if ((slave.intelligenceImplant < 30) || (slave.voice !== 0 && slave.accent+V.schoolroomUpgradeLanguage > 2) || (slave.oralSkill <= 10+V.schoolroomUpgradeSkills*20) || (slave.whoreSkill <= 10+V.schoolroomUpgradeSkills*20) || (slave.entertainSkill <= 10+V.schoolroomUpgradeSkills*20) || (slave.analSkill < 10+V.schoolroomUpgradeSkills*20) || ((slave.vagina >= 0) && (slave.vaginalSkill < 10+V.schoolroomUpgradeSkills*20)))
						break;
					else {
						RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
						delete rule.setAssignment;
					}
				else {
					RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "be confined in the cellblock":
				if ((V.cellblockSlaves < V.cellblock && ((slave.devotion < -20 && slave.trust >= -20) || (slave.devotion < -50 && slave.trust >= -50))))
					break;
				else {
					RAFacilityRemove(slave,rule); // before deleting rule.setAssignment 
					delete rule.setAssignment;
				}
				break;

			case "take classes":
				if (slave.intelligenceImplant < 15 && slave.fetish != "mindbroken" && (slave.devotion >= -20 || slave.trust < -50 || (slave.trust < -20 && slave.devotion >= -50)))
					break;
				else
					delete rule.setAssignment;
				break;

			case "choose her own job":
				if ((slave.fetish != "mindbroken"))
					break;
				else
					delete rule.setAssignment;
				break;

			case "get milked":
				if ((slave.lactation > 0 || slave.balls > 0))
					break;
				else
					delete rule.setAssignment;
				break;

			case "be a servant":
				if ((canWalk(slave) && canSee(slave) && (slave.devotion >= -20 || slave.trust < -50 || (slave.trust < -20 && slave.devotion >= -50))))
					break;
				else
					delete rule.setAssignment;
				break;

			case "work a glory hole":
				if (slave.indentureRestrictions <= 0 && (slave.breedingMark != 1 || V.propOutcome === 0))
					break;
				else
					delete rule.setAssignment;
				break;

			case "whore":
			case "serve the public":
			case "stay confined":
				if ((slave.fuckdoll === 0) && (slave.breedingMark != 1 || V.propOutcome === 0))
					break;
				else
					delete rule.setAssignment;
				break;

			default:
				r += `<span class="red">raWidgets missing case for assignment 'V.{rule.setAssignment}'</span>.`;
				break;
		}
		return rule;
	}

	function AssignJobToSlave(slave, rule) {
		// place slave on assignment defined by the rule
		if ((rule.setAssignment !== undefined && rule.setAssignment != "no default setting")) {
			if (((rule.setAssignment == "choose her own job" && !slave.choosesOwnAssignment) || rule.setAssignment != slave.assignment)) {
				switch (rule.setAssignment) {
					case "live with your Head Girl":
						r += `<br>${slave.slaveName} has been automatically assigned to live in your Head Girl's private suite.`;
						break;
					case "be confined in the arcade":
						r += `<br>${slave.slaveName} has been automatically assigned to be confined in ${V.arcadeName}.`;
						break;
					case "serve in the master suite":
						r += `<br>${slave.slaveName} has been automatically assigned to ${V.masterSuiteName}.`;
						break;
					case "get treatment in the clinic":
						r += `<br>${slave.slaveName} has been automatically assigned to get treatment in ${V.clinicName}.`;
						break;
					case "rest in the spa":
						r += `<br>${slave.slaveName} has been automatically assigned to rest in ${V.spaName}.`;
						break;
					case "work as a nanny":
						r += `<br>${slave.slaveName} has been automatically assigned to work in ${V.nurseryName}.`;
						break;
					case "work in the brothel":
						r += `<br>${slave.slaveName} has been automatically assigned to work in ${V.brothelName}.`;
						break;
					case "serve in the club":
						r += `<br>${slave.slaveName} has been automatically assigned to serve in ${V.clubName}.`;
						break;
					case "work in the dairy":
						r += `<br>${slave.slaveName} has been automatically assigned to be milked in ${V.dairyName}.`;
						break;
					case "work as a servant":
						r += `<br>${slave.slaveName} has been automatically assigned to work in ${V.servantsQuartersName}.`;
						break;
					case "learn in the schoolroom":
						r += `<br>${slave.slaveName} has been automatically assigned to study in ${V.schoolroomName}.`;
						break;
					case "be confined in the cellblock":
						r += `<br>${slave.slaveName} has been automatically assigned to be confined in ${V.cellblockName}.`;
						break;
					case "choose her own job":
						r += `<br>${slave.slaveName} is now allowed to select her own assignments.`;
						break;
					default:
						r += `<br>${slave.slaveName} has been automatically assigned to ${rule.setAssignment}.`;
						break;
				}
				assignJob(slave, rule.setAssignment);
			}
		}
	}

	function ProcessClothing(slave, rule) {
		// apply clothes to slave
		if ((rule.clothes !== undefined) && (rule.clothes !== "no default setting")) {
			if ((rule.clothes == "choosing her own clothes")) {
				if ((slave.choosesOwnClothes === 0)) {
					slave.clothes = "choosing her own clothes";
					slave.choosesOwnClothes = 1;
					r += `<br>${slave.slaveName} is now allowed to choose her own clothes.`;
				}
			} else if ((slave.clothes !== rule.clothes)) {
				slave.clothes = rule.clothes;
				slave.choosesOwnClothes = 0;
				r += `<br>${slave.slaveName} is now wearing ${slave.clothes}.`;
			}
		}
	}

	function ProcessCollar(slave, rule) {
		// apply collar to slave
		if ((rule.collar !== undefined) && (rule.collar != "no default setting")) {
			if ((slave.collar !== rule.collar)) {
				r += '<br>';
				if ((rule.collar == "preg biometrics" && slave.preg <= -1)) {
					slave.collar = "none";
					r += `${slave.slaveName} cannot utilize preg biometrics. `;
				} else if ((rule.collar == "massive dildo gag" && slave.oralSkill <= 50)) {
					slave.collar = "none";
					r += `${slave.slaveName} lacks the oral skill to successfully keep the massive dildo gag in her throat. `;
				} else
					slave.collar = rule.collar;
				if ((slave.collar == "none"))
					r += `${slave.slaveName} has been given no collar.`;
				else
					r += `${slave.slaveName} has been given a ${slave.collar} collar.`;
			}
		}
	}

	function ProcessEyewear(slave, rule) {
		// apply glasses, contacts to slave
		if ((rule.eyewear !== undefined) && (rule.eyewear !== "no default setting")) {
			switch (rule.eyewear) {
				case "correct with glasses":
					if (slave.eyes == -1) {
						if (slave.eyewear != "corrective glasses") {
							slave.eyewear = "corrective glasses";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given corrective glasses.`;
						}
					} else {
						if (slave.eyewear != "none") {
							slave.eyewear = "none";
							r += `<br>${slave.slaveName}'s eyewear has been removed.`;
						}
					}
					break;

				case "correct with contacts":
					if (slave.eyes == -1) {
						if (slave.eyewear != "corrective contacts") {
							slave.eyewear = "corrective contacts";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given corrective contacts.`;
						}
					} else {
						if (slave.eyewear != "none") {
							slave.eyewear = "none";
							r += `<br>${slave.slaveName}'s eyewear has been removed.`;
						}
					}
					break;

				case "blur with glasses":
					if (slave.eyes > -1) {
						if (slave.eyewear != "blurring glasses") {
							slave.eyewear = "blurring glasses";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given blurring glasses.`;
						}
					} else {
						if (slave.eyewear != "none") {
							slave.eyewear = "none";
							r += `<br>${slave.slaveName}'s eyewear has been removed.`;
						}
					}
					break;

				case "blur with contacts":
					if (slave.eyes > -1) {
						if (slave.eyewear != "blurring contacts") {
							slave.eyewear = "blurring contacts";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given blurring contacts.`;
						}
					} else {
						if (slave.eyewear != "none") {
							slave.eyewear = "none";
							r += `<br>${slave.slaveName}'s eyewear has been removed.`;
						}
					}
					break;

				case "universal glasses":
					if (slave.eyes == -1) {
						if (slave.eyewear != "corrective glasses") {
							slave.eyewear = "corrective glasses";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given corrective glasses.`;
						}
					} else {
						if (slave.eyewear != "glasses") {
							slave.eyewear = "glasses";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given decorative glasses.`;
						}
					}
					break;

				default:
					if (slave.eyewear != "none") {
						slave.eyewear = "none";
						r += `<br>${slave.slaveName}'s eyewear has been removed.`;
					}
					break;
			}
		}
	}

	function ProcessEarwear(slave, rule) {
		// apply earplugs to slave
		if ((rule.earwear !== undefined) && (rule.earwear !== "no default setting")) {
			switch (rule.earwear) {
				case "correct with hearing aids":
					if (slave.hears == -1) {
						if (slave.earwear != "hearing aids") {
							slave.earwear = "hearing aids";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given hearing aids.`;
						}
					} else {
						if (slave.earwear != "none") {
							slave.earwear = "none";
							r += `<br>${slave.slaveName}'s earwear has been removed.`;
						}
					}
					break;

				case "muffle with ear plugs":
					if (slave.hears > -1) {
						if (slave.earwear != "muffling ear plugs") {
							slave.earwear = "muffling ear plugs";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given muffling ear plugs.`;
						}
					} else {
						if (slave.earwear != "none") {
							slave.earwear = "none";
							r += `<br>${slave.slaveName}'s earwear has been removed.`;
						}
					}
					break;

				case "deafen with ear plugs":
					if (slave.hears > -2) {
						if (slave.earwear != "deafening ear plugs") {
							slave.earwear = "deafening ear plugs";
							V.cash -= V.modCost;
							r += `<br>${slave.slaveName} has been given deafening ear plugs.`;
						}
					} else {
						if (slave.earwear != "none") {
							slave.earwear = "none";
							r += `<br>${slave.slaveName}'s earwear has been removed.`;
						}
					}
					break;

				default:
					if (slave.earwear != "none") {
						slave.earwear = "none";
						r += `<br>${slave.slaveName}'s earwear has been removed.`;
					}
					break;
			}
		}
	}

	function ProcessDildos(slave, rule) {
		// apply vaginal dildos to slave
		if (slave.vagina === 0)
			ProcessVVirginDildos(slave, rule);
		else if ((slave.vagina > 0) && (slave.anus === 0))
			ProcessAVirginDildos(slave, rule);
		else if (slave.vagina > 0)
			ProcessNonVirginDildos(slave, rule);
	}

	function ProcessVVirginDildos(slave, rule) {
		// apply vaginal dildos to varginal virgins
		if ((rule.virginAccessory !== undefined) && (rule.virginAccessory !== "no default setting")) {
			if (slave.vaginalAccessory !== rule.virginAccessory) {
				slave.vaginalAccessory = rule.virginAccessory;
				switch (slave.vaginalAccessory) {
					case "huge dildo":
						r += `<br>${slave.slaveName} is a virgin and has been given a `;
						if (slave.vagina >= 2)
							r += `massive dildo to permanently gape her cunt.`;
						else {
							r += `large dildo for her pussy, since it must be stretched before it can accommodate a huge one.`;
							slave.vaginalAccessory = "large dildo";
						}
						break;

					case "long dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so the virgin ${slave.slaveName} has been given a standard length dildo for her pussy.`;
							slave.vaginalAccessory = "dildo";
						}
						break;

					case "long, large dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so the virgin ${slave.slaveName} has been given a standard length large dildo for her pussy.`;
							slave.vaginalAccessory = "large dildo";
						}
						break;

					case "long, huge dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so the virgin ${slave.slaveName} has been given a standard length huge dildo for her pussy.`;
							slave.vaginalAccessory = "huge dildo";
						} else {
							r += `<br>slave.slaveName is a virgin and has been given a `;
							if (slave.vagina >= 2)
								r += `massive and oversized dildo to permanently gape her cunt.`;
							else {
								r += `long, large dildo for her pussy, since it must be stretched before it can accommodate a huge one.`;
								slave.vaginalAccessory = "long, large dildo";
							}
						}
						break;

					case "none":
						r += `<br>${slave.slaveName} is a virgin and has been instructed not to use a vaginal accessory.`;
						break;

					default:
						r += `<br>${slave.slaveName} is a virgin and has been given a ${slave.vaginalAccessory} for her pussy.`;
						break;
				}
			}
		}
	}

	function ProcessAVirginDildos(slave, rule) {
		// apply vaginal dildos to anal virgins
		if ((rule.aVirginAccessory !== undefined) && (rule.aVirginAccessory !== "no default setting")) {
			if (slave.vaginalAccessory !== rule.aVirginAccessory) {
				slave.vaginalAccessory = rule.aVirginAccessory;
				switch (slave.vaginalAccessory) {
					case "huge dildo":
						r += `<br>${slave.slaveName} is a virgin and has been given a `;
						if (slave.vagina >= 2)
							r += `massive dildo to permanently gape her cunt.`;
						else {
							r += `large dildo for her pussy, since it must be stretched before it can accommodate a huge one.`;
							slave.vaginalAccessory = "large dildo";
						}
						break;

					case "long dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so the virgin ${slave.slaveName} has been given a standard length dildo for her pussy.`;
							slave.vaginalAccessory = "dildo";
						}
						break;

					case "long, large dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so the virgin ${slave.slaveName} has been given a standard length large dildo for her pussy.`;
							slave.vaginalAccessory = "large dildo";
						}
						break;

					case "long, huge dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so the virgin ${slave.slaveName} has been given a standard length huge dildo for her pussy.`;
							slave.vaginalAccessory = "huge dildo";
						} else {
							r += `<br>${slave.slaveName} is a virgin and has been given a `;
							if (slave.vagina >= 2)
								r += `massive and oversized dildo to permanently gape her cunt.`;
							else {
								r += `long, large dildo for her pussy, since it must be stretched before it can accommodate a huge one.`;
								slave.vaginalAccessory = "long, large dildo";
							}
						}
						break;

					case "none":
						r += `<br>slave.slaveName is a virgin and has been instructed not to use a vaginal accessory.`;
						break;

					default:
						r += `<br>slave.slaveName is a virgin and has been given a slave.vaginalAccessory for her pussy.`;
						break;
				}
			}
		}
	}

	function ProcessNonVirginDildos(slave, rule) {
		// apply vaginal dildos to non-virgins
		if ((rule.vaginalAccessory !== undefined) && (rule.vaginalAccessory !== "no default setting")) {
			if (slave.vaginalAccessory !== rule.vaginalAccessory) {
				slave.vaginalAccessory = rule.vaginalAccessory;
				switch (slave.vaginalAccessory) {
					case "huge dildo":
						r += `<br>${slave.slaveName} has been given a `;
						if (slave.vagina >= 2)
							r += `massive dildo to permanently gape her cunt.`;
						else {
							r += `large dildo for her pussy, since it must be stretched before it can accommodate a huge one.`;
							slave.vaginalAccessory = "large dildo";
						}
						break;

					case "long dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so ${slave.slaveName} has been given a standard length dildo for her pussy.`;
							slave.vaginalAccessory = "dildo";
						}
						break;

					case "long, large dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so ${slave.slaveName} has been given a standard length large dildo for her pussy.`;
							slave.vaginalAccessory = "large dildo";
						}
						break;

					case "long, huge dildo":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of cervix penetrating dildos on marked slaves, so ${slave.slaveName} has been given a standard length huge dildo for her pussy.`;
							slave.vaginalAccessory = "huge dildo";
						} else {
							r += `<br>${slave.slaveName} has been given a `;
							if (slave.vagina >= 2)
								r += `massive and oversized dildo to permanently gape her cunt.`;
							else {
								r += `long, large dildo for her pussy, since it must be stretched before it can accommodate a huge one.`;
								slave.vaginalAccessory = "long, large dildo";
							}
						}
						break;
					case "none":
						r += `<br>${slave.slaveName} has been instructed not to use a vaginal accessory.`;
						break;

					default:
						r += `<br>${slave.slaveName} has been given a slave.vaginalAccessory for her pussy.`;
						break;
				}
			}
		}
	}

	function ProcessDickAccessories(slave, rule) {
		// apply dick accessories to slave
		if ((slave.dick > 0)) {
			if (slave.anus === 0) {
				if ((rule.aVirginDickAccessory !== undefined) && (rule.aVirginDickAccessory !== "no default setting")) {
					if ((slave.dickAccessory !== rule.aVirginDickAccessory)) {
						slave.dickAccessory = rule.aVirginDickAccessory;
						if (slave.dickAccessory == "none")
							r += `<br>${slave.slaveName} is a virgin and has been instructed not to wear a dick accessory.`;
						else
							r += `<br>${slave.slaveName} is a virgin and has been given a ${slave.dickAccessory} accessory for her cock.`;
					}
				}
			} else {
				if ((rule.dickAccessory !== undefined) && (rule.dickAccessory !== "no default setting")) {
					if ((slave.dickAccessory !== rule.dickAccessory)) {
						slave.dickAccessory = rule.dickAccessory;
						if (slave.dickAccessory == "none")
							r += `<br>${slave.slaveName} has been instructed not to wear a dick accessory.`;
						else
							r += `<br>${slave.slaveName} has been given a ${slave.dickAccessory} accessory for her cock.`;
					}
				}
			}
		}
	}

	function ProcessShoes(slave, rule) {
		// apply shoes to slave
		if ((rule.shoes !== undefined) && (rule.shoes !== "no default setting")) {
			if ((slave.shoes !== rule.shoes)) {
				if ((slave.amp != 1)) {
					slave.shoes = rule.shoes;
					r += `<br>${slave.slaveName}'s shoes have been set to ${slave.shoes}.`;
				}
			}
		}
	}

	function ProcessBellyAccessories(slave, rule) {
		// apply belly accessories to slave
		if ((rule.bellyAccessory !== undefined) && (rule.bellyAccessory !== "no default setting")) {
			if ((slave.bellyAccessory !== rule.bellyAccessory)) {
				if ((slave.belly >= 1500 || slave.weight >= 130) && setup.fakeBellies.includes(rule.bellyAccessory)) {
					r += `<br>${slave.slaveName}'s natural belly is too big to properly wear an empathy belly.`;
					slave.bellyAccessory = "none";
				} else {
					slave.bellyAccessory = rule.bellyAccessory;
					if (slave.bellyAccessory == "none")
						r += `<br>${slave.slaveName} has been instructed not to wear a torso accessory.`;
					else
						r += `<br>${slave.slaveName} has been given ${slave.bellyAccessory} to wear.`;
				}
			}
		}
	}

	function ProcessLegAccessory(slave, rule) {
		if (rule.legAccessory !== undefined && rule.legAccessory !== "no default setting" && slave.amp !== 1 && slave.legAccessory !== rule.legAccessory) {
			slave.legAccessory = rule.legAccessory;
			r += `<br>${slave.slaveName}'s leg accessory was set to ${rule.legAccessory}.`;
		}
	}

	function ProcessAnalAccessories(slave, rule) {
		// apply buttplugs to slave
		if ((slave.vaginalAccessory !== "anal chastity") && (slave.vaginalAccessory !== "combined chastity") && (slave.dickAccessory !== "anal chastity") && (slave.dickAccessory !== "combined chastity")) {
			if (slave.anus === 0)
				ProcessAnalVirginButtplugs(slave, rule);
			else
				ProcessNonVirginButtplugs(slave, rule);
		}
	}

	function ProcessAnalVirginButtplugs(slave, rule) {
		// apply buttplugs to virgins
		if ((rule.aVirginButtplug !== undefined) && (rule.aVirginButtplug !== "no default setting")) {
			if ((slave.buttplug !== rule.aVirginButtplug)) {
				slave.buttplug = rule.aVirginButtplug;
				switch (slave.buttplug) {
					case "huge plug":
						r += `<br>${slave.slaveName} is an anal virgin and has been given a `;
						if ((slave.anus >= 2))
							r += `massive plug to permanently gape her asshole.`;
						else {
							slave.buttplug = "large plug";
							r += `large buttplug for her asshole, since it must be stretched before it can accommodate a huge one.`;
						}
						break;

					case "long plug":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of anal plugs that can damage a growing fetus on marked slaves, so the anal virgin ${slave.slaveName} has been given a standard length plug for her anus.`;
							slave.buttplug = "plug";
						}
						break;

					case "long, large plug":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of anal plugs that can damage a growing fetus on marked slaves, so the anal virgin ${slave.slaveName} has been given a standard length large plug for her anus.`;
							slave.buttplug = "large plug";
						}
						break;

					case "long, huge plug":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of anal plugs that can damage a growing fetus on marked slaves, so the anal virgin ${slave.slaveName} has been given a standard length huge plug for her anus.`;
							slave.buttplug = "huge plug";
						} else {
							r += `<br>slave.slaveName is an anal virgin and has been given a `;
							if (slave.anus >= 2)
								r += `massive and oversized plug to permanently gape her asshole.`;
							else {
								r += `long, large buttplug for her asshole, since it must be stretched before it can accommodate a huge one.`;
								slave.buttplug = "long, large plug";
							}
						}
						break;

					case "none":
						r += `<br>${slave.slaveName} is an anal virgin and has been instructed not to use an anal accessory.`;
						break;

					default:
						r += `<br>${slave.slaveName} is an anal virgin and has been given a slave.buttplug for her asshole.`;
						break;
				}
			}
		}
	}

	function ProcessNonVirginButtplugs(slave, rule) {
		// apply buttplugs to non-virgins
		if ((rule.buttplug !== undefined) && (rule.buttplug !== "no default setting")) {
			if ((slave.buttplug !== rule.buttplug)) {
				slave.buttplug = rule.buttplug;
				switch (slave.buttplug) {
					case "huge plug":
						r += `<br>${slave.slaveName} has been given a `;
						if ((slave.anus >= 2))
							r += `massive plug to permanently gape her asshole.`;
						else {
							slave.buttplug = "large plug";
							r += `large buttplug for her asshole, since it must be stretched before it can accommodate a huge one.`;
						}
						break;

					case "long plug":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of anal plugs that can damage a growing fetus on marked slaves, so ${slave.slaveName} has been given a standard length plug for her anus.`;
							slave.buttplug = "plug";
						}
						break;
						
					case "long, large plug":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of anal plugs that can damage a growing fetus on marked slaves, so ${slave.slaveName} has been given a standard length large plug for her anus.`;
							slave.buttplug = "large plug";
						}
						break;

					case "long, huge plug":
						if (slave.breedingMark == 1 && V.propOutcome == 1) {
							r += `<br>Breeding regulations forbid the use of anal plugs that can damage a growing fetus on marked slaves, so ${slave.slaveName} has been given a standard length huge plug for her anus.`;
							slave.buttplug = "huge plug";
						} else {
							r += `<br>${slave.slaveName} has been given a `;
							if (slave.anus >= 2)
								r += `massive and oversized plug to permanently gape her asshole.`;
							else {
								r += `long, large buttplug for her asshole, since it must be stretched before it can accommodate a huge one.`;
								slave.buttplug = "long, large plug";
							}
						}
						break;

					case "none":
						r += `<br>${slave.slaveName} has been instructed not to use an anal accessory.`;
						break;

					default:
						r += `<br>${slave.slaveName} has been given a slave.buttplug for her asshole.`;
						break;
				}
			}
		}
	}

	function ProcessBellyImplant(slave, rule) {
		// Here is belly implant size control, it's used in Surgery Degradation passage to setup devotion and trust changes.
		// silent calls to surgery degradation have been replaced with a js function, which is less hacky
		if ((rule.bellyImplantVol !== undefined) && slave.bellyImplant >= 0 && rule.bellyImplantVol >= 0) {
			r += "<br>";
			if (slave.health > -10 ) {
				let diff = rule.bellyImplantVol - slave.bellyImplant;
				if (diff >= 5000 && slave.bellyPain === 0 && slave.health > 50) {
					r += `${slave.slaveName}'s belly is way too small, so she has been directed to have intensive belly implant filling procedures throughout this week.`;
					slave.bellyImplant += 1000;
					slave.bellyPain += 2;
					BellySurgery(slave, diff);
				} else if (diff >= 500 && slave.bellyPain < 2 ) {
					r += `${slave.slaveName}'s belly has not reached the desired size, so she has been directed to have belly implant filling procedures throughout this week.`;
					slave.bellyImplant += 500;
					slave.bellyPain += 1;
					BellySurgery(slave, diff);
				} else if (diff <= -5000 ) {
					r += `${slave.slaveName}'s belly is way too big, so she has been directed to have intensive belly implant draining procedures throughout this week.`;
					slave.bellyImplant -= 1000;
					BellySurgery(slave, diff);
				} else if (diff <= -500 ) {
					r += `${slave.slaveName}'s belly is too big, so she has been directed to have belly implant draining procedures throughout this week.`;
					slave.bellyImplant -= 500;
					BellySurgery(slave, diff);
				}
			} else {
				r += `${slave.slaveName} is not healthy enough to safely adjust her belly implant.`;
			}
		}
	}

	function BellySurgery(slave, volume) {
		// this is a port of the belly implant portion of surgeryDegradation.tw
		// that way, we don't have to use ugly hacks
		// the original still exists, and may be worth replacing
		if (volume > 0) { // bellyUp
			SetBellySize(slave);
			if (slave.bellyPain === 1) {
				if (slave.devotion > 50) {
					slave.devotion += 4;
				} else if (slave.devotion >= -20) {
					slave.trust -= 5;
				} else {
					slave.trust -= 10;
					slave.devotion -= 5;
				}
			} else if (slave.bellyPain === 2) {
				if (slave.devotion > 50) {
					slave.devotion += 2;
				} else if (slave.devotion >= -20) {
					slave.trust -= 7;
				} else {
					slave.trust -= 12;
					slave.devotion -= 7;
				}
			}
		} else { // bellyDown
			if (slave.bellyImplant < 0)
				slave.bellyImplant = 0;
			SetBellySize(slave);
			if (slave.devotion > 50) {
				slave.devotion += 3;
				slave.trust += 3;
			} else if (slave.devotion >= -20) {
				slave.trust += 2;
			} else {
				slave.devotion += 1;
				slave.trust -= 10;
			}
		}
	}

	function ProcessContraceptives(slave, rule) {
		if ((rule.preg !== undefined) && (rule.preg !== "no default setting")) {
			if (rule.preg === true && slave.preg === 0) {
				r += `<br>${slave.slaveName} is being given contraceptives.`;
				slave.preg = -1;
			} else if (slave.preg === -1 && rule.preg === false) {
				r += `<br>${slave.slaveName} is no longer being put on contraceptives.`;
				slave.preg = 0;
			}
		}
	}

	function ProcessAssetGrowthDrugs(slave, rule) {
		// Asset Growth 
		const growth_drugs = new Set(["breast injections", "intensive breast injections", "breast redistributors", "butt injections", "intensive butt injections", "butt redistributors", "lip injections", "lip atrophiers", "penis enhancement", "intensive penis enhancement", "penis atrophiers", "testicle enhancement", "intensive testicle enhancement", "testicle atrophiers", "hyper breast injections", "hyper butt injections", "hyper penis enhancement", "hyper testicle enhancement"]);
		if ((slave.drugs == "super fertility drugs" || slave.drugs == "fertility drugs") && isFertile(slave)) {
			r += `<br>${slave.slaveName} is on ${slave.drugs} and will not be considered for drug enhancement until that regime is complete.`;
			return;
		} else if ((rule.growth_boobs == "no default setting" && rule.growth_butt == "no default setting" && rule.growth_lips == "no default setting" && rule.growth_dick == "no default setting" && rule.growth_dick == "no default setting" && rule.growth_balls == "no default setting")) {
			return;
		}
		if (slave.assignmentVisible) { // More resource intensive version with prioritizing. Possible to give this a toggle rather than basing it on visibility. 
			let _priorities = [];
			if (rule.growth_boobs != "no default setting") {
				let _priority;
				if (slave.boobs < rule.growth_boobs) {
					_priority = {drug: "breast injections", weight: (rule.growth_boobs-slave.boobs)/rule.growth_boobs};
					_priorities.push(_priority);
				} else if ((slave.boobs > parseInt(rule.growth_boobs)+200) && slave.weight < 100 && (V.arcologies[0].FSSlimnessEnthusiastResearch == 1)) {
					_priority = {
						drug: "breast redistributors",
						weight: (1+((slave.boobs-slave.boobsImplant-rule.growth_boobs)/rule.growth_boobs)) };
					_priorities.push(_priority);
				}
			}
			if (rule.growth_butt != "no default setting") {
				let _priority;
				if (slave.butt < rule.growth_butt) {
					_priority = {drug: "butt injections", weight: (rule.growth_butt-slave.butt)/rule.growth_butt};
					_priorities.push(_priority);
				} else if ((Math.trunc(slave.butt) > rule.growth_butt) && slave.weight < 100 && (V.arcologies[0].FSSlimnessEnthusiastResearch == 1)) {
					_priority = {
						drug: "butt redistributors",
						weight: (1+((slave.butt-slave.buttImplant-rule.growth_butt)/rule.growth_butt)) };
					_priorities.push(_priority);
				}
			}
			if (rule.growth_lips != "no default setting") {
				let _priority;
				if (slave.lips < rule.growth_lips) {
					_priority = {drug: "lip injections", weight: (rule.growth_lips-slave.lips)/rule.growth_lips};
					_priorities.push(_priority);
				} else if ((slave.lips > rule.growth_lips) && (V.arcologies[0].FSSlimnessEnthusiastResearch == 1)) {
					_priority = {
						drug: "lip atrophiers",
						weight: (1+((slave.lips-slave.lipsImplant-rule.growth_lips)/rule.growth_lips))};
					_priorities.push(_priority);
				}
			}
			if (rule.growth_dick != "no default setting" && slave.dick) {
				let _priority;
				if (slave.dick < rule.growth_dick) {
					_priority = {drug: "penis enhancement", weight: (rule.growth_dick-slave.dick)/rule.growth_dick};
					_priorities.push(_priority);
				} else if ((slave.dick > rule.growth_dick) && (V.arcologies[0].FSSlimnessEnthusiastResearch == 1)) {
					_priority = {
						drug: "penis atrophiers",
						weight: (1+((slave.dick-rule.growth_dick)/rule.growth_dick))};
					_priorities.push(_priority);
				}
			}
			if (rule.growth_balls != "no default setting" && slave.balls) {
				let _priority;
				if (slave.balls < rule.growth_balls) {
					_priority = {drug: "testicle enhancement", weight: (rule.growth_balls-slave.balls)/rule.growth_balls};
					_priorities.push(_priority);
				} else if ((slave.balls > rule.growth_balls) && (V.arcologies[0].FSSlimnessEnthusiastResearch == 1)) {
					_priority = {
						drug: "testicle atrophiers",
						weight: (1+((slave.balls-rule.growth_balls)/rule.growth_balls))};
					_priorities.push(_priority);
				}
			}
			if (_priorities.length > 1) {
				_priorities = _priorities.sort(function(a, b){if(a.weight > b.weight) return -1; if(a.weight < b.weight) return 1; return 0;});
				if (slave.drugs != _priorities[0].drug) {
					slave.drugs = _priorities[0].drug;
					r += `<br>${slave.slaveName} has been put on `;
					if (rule.growth_intensity && slave.drugs != "lip injections" && slave.health > 0) {
						slave.drugs = "intensive " + slave.drugs;
						r += `${slave.drugs}, since she's healthy enough to take them, and `;
					} else {
						r += `${slave.drugs}, since `;
					}
					r += `that part of her body is ${Math.trunc(_priorities[0].weight*100)}% `;
					if (_priorities[0].weight < 1) r+= "below ";
					else r+= "above ";
					r += "the targeted size.";
				}
				return;
			} else if (_priorities.length > 0) {
				if (slave.drugs != _priorities[0].drug) {
					slave.drugs = _priorities[0].drug;
					r += `<br>${slave.slaveName} has been put on `;
					if (rule.growth_intensity && slave.drugs != "lip injections" && slave.health > 0) {
						slave.drugs = "intensive " + slave.drugs;
						r += `${slave.drugs}, since she's healthy enough to take them, and `;
					} else
						r += `${slave.drugs}, since `;
					r += `that is the only part of her body that does not meet the targeted size.`;
				}
				return;
			} else if (growth_drugs.has(slave.drugs)) {
				slave.drugs = "no drugs";
				r += `<br>${slave.slaveName}'s body has met all relevant growth targets, so her pharmaceutical regime has been ended.`;
				return;
			}
		} else {
			let _hyper;
			if (V.arcologies[0].FSAssetExpansionistResearch == 1)
				_hyper = "hyper ";
			else
				_hyper = "";
			if (rule.growth_boobs != "no default setting") {
				if (slave.boobs < rule.growth_boobs) {
					if (slave.drugs != _hyper + "breast injections") {
						slave.drugs = _hyper + "breast injections";
						r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
					}
					return;
				}
			}
			if (rule.growth_butt != "no default setting") {
				if (slave.butt < rule.growth_butt) {
					if (slave.drugs != _hyper + "butt injections") {
						slave.drugs = _hyper + "butt injections";
						r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
					}
					return;
				}
			}
			if (rule.growth_lips != "no default setting") {
				if (slave.lips < rule.growth_lips) {
					if (slave.drugs != "lip injections") {
						slave.drugs = "lip injections";
						r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
					}
					return;
				}
			}
			if (rule.growth_dick != "no default setting" && slave.dick) {
				if (slave.dick < rule.growth_dick) {
					if (slave.drugs != _hyper + "penis enhancement") {
						slave.drugs = _hyper + "penis enhancement";
						r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
					}
					return;
				}
			}
			if (rule.growth_balls != "no default setting" && slave.balls) {
				if (slave.balls < rule.growth_balls) {
					if (slave.drugs != _hyper + "testicle enhancement") {
						slave.drugs = _hyper + "testicle enhancement";
						r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
					}
					return;
				}
			}
			if (V.arcologies[0].FSSlimnessEnthusiastResearch == 1) {
				if (rule.growth_boobs != "no default setting") {
					if (slave.boobs-slave.boobsImplant > parseInt(rule.growth_boobs)+200 && slave.weight < 100) {
						if (slave.drugs != "breast redistributors") {
							slave.drugs = "breast redistributors";
							r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
						}
						return;
					}
				}
				if (rule.growth_butt != "no default setting") {
					if (Math.trunc(slave.butt-slave.buttImplant) > rule.growth_butt && slave.weight < 100) {
						if (slave.drugs != "butt redistributors") {
							slave.drugs = "butt redistributors";
							r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
						}
						return;
					}
				}
				if (rule.growth_lips != "no default setting") {
					if (slave.lips-slave.lipsImplant > rule.growth_lips) {
						if (slave.drugs != "lip atrophiers") {
							slave.drugs = "lip atrophiers";
							r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
						}
						return;
					}
				}
				if (rule.growth_dick != "no default setting" && slave.dick) {
					if (slave.dick > rule.growth_dick) {
						if (slave.drugs != "penis atrophiers") {
							slave.drugs = "penis atrophiers";
							r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
						}
						return;
					}
				}
				if (rule.growth_balls != "no default setting" && slave.balls) {
					if (slave.balls > rule.growth_balls) {
						if (slave.drugs != "testicle atrophiers") {
							slave.drugs = "testicle atrophiers";
							r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
						}
						return;
					}
				}
			}
			if (growth_drugs.has(slave.drugs)) {
				slave.drugs = "no drugs";
				r += `<br>${slave.slaveName} has met all relevant growth targets, so her pharmaceutical regime has been ended.`;
				return;
			}
		}
	}

	function ProcessOtherDrugs(slave, rule) {
		// Other Drugs 
		if (slave.indentureRestrictions < 2 && rule.drug !== "no default setting" && slave.drugs !== rule.drug) {
			let flag = true;
			switch (rule.drug) {
			case "anti-aging cream":
				if (slave.visualAge < 18)
					flag = false;
				break;

			case "growth stimulants":
				if (!(slave.height < 274 && slave.height < Math.clamp((Height.mean(slave) * 1.25),0,274)))
					flag = false;
				break;

			case "sag-B-gone":
				if (!(slave.boobs > 250 && slave.boobShape != "saggy"))
					flag = false;
				break;

			case "female hormone injections":
				if (!((slave.breedingMark != 1 || V.propOutcome == 0) && (slave.ovaries == 1 || slave.mpreg == 1) && slave.pubertyXX === 0))
					flag = false;
				break;

			case "male hormone injections":
				if (!((slave.breedingMark != 1 || V.propOutcome == 0) && slave.balls > 0 && slave.pubertyXY === 0))
					flag = false;
				break;
				
			case "psychosuppressants":
				if (!(slave.intelligence > -100 && slave.indentureRestrictions < 1))
					flag = false;
				break;
			
			case "breast injections":
				if (!(slave.boobs < 48000))
					flag = false;
				break;
			
			case "hyper breast injections":
				if (!(slave.boobs < 25000))
					flag = false;
				break;
			
			case "breast redistributors":
				if (!(slave.boobs - slave.boobsImplant > 100))
					flag = false;
				break;
			
			case "butt injections":
				if (!(slave.butt < 9))
					flag = false;
				break;
			
			case "hyper butt injections":
				if (!(slave.butt < 20))
					flag = false;
				break;
			
			case "hyper butt injections":
				if (!(slave.butt < 20))
					flag = false;
				break;
			
			case "nipple atrophiers":
				if (!(["huge", "puffy", "cute"].includes(slave.nipples)))
					flag = false;
				break;
				
			case "butt redistributors":
				if (!(slave.buttImplant > 0))
					flag = false;
				break;
			
			case "lip injections":
				if (!(slave.lips <= 95 || (slave.lips <= 85 && V.seeExtreme !== 1)))
					flag = false;
				break;
			
			case "lip atrophiers":
				if (!(slave.lips - slave.lipsImplant > 0))
					flag = false;
				break;
			
			case "super fertility drugs":
				if (!(slave.indentureRestrictions < 1 && (slave.breedingMark !== 1 || V.propOutcome == 0)))
					flag = false;
				break;
			
			case "penis enhancement":
				if (!((slave.dick > 0 && slave.dick < 10) || slave.clit < 5))
					flag = false;
				break;
			
			case "hyper penis enhancement":
				if (!((slave.dick > 0 && slave.dick < 31) || slave.clit < 5))
					flag = false;
				break;
				
			case "penis atrophiers":
				if (!(slave.dick > 1))
					flag = false;
				break;
			
			case "testicle enhancement":
				if (!(slave.balls > 0))
					flag = false;
				break;
			
			case "hyper testicle enhancement":
				if (!(slave.balls > 0))
					flag = false;
				break;
			
			case "testicle atrophiers":
				if (!(slave.balls > 1))
					flag = false;
				break;
			
			case "clitoris atrophiers":
				if (!(slave.clit > 0))
					flag = false;
				break;
			
			case "labia atrophiers":
				if (!(slave.labia > 0))
					flag = false;
				break;
			
			case "appetite suppressors":
				if (!(slave.weight <= -95))
					flag = false;
				break;
				
			case "female hormone injections":
				if (!((slave.breedingMark !== 1 || V.propOutcome == 0) && (slave.ovaries === 1 || slave.mpreg === 1) && slave.pubertyXX === 0))
					flag = false;
				break;
			
			case "male hormone injections":
				if (!(slave.balls > 0 && slave.pubertyXY === 0))
					flag = false;
				break;
				
			default:
				break;
			}
			if (flag) {
				slave.drugs = rule.drug;
				r += `<br>${slave.slaveName} has been put on ${slave.drugs}.`;
			} else {
				slave.drugs = "no drugs";
				r += `<br>${slave.slaveName} cannot benefit from her assigned drug and has been defaulted to ${slave.drugs}`;
			}
		}
	}

	function ProcessEnema(slave, rule) {
		if ((rule.inflationType !== undefined) && (rule.inflationType !== "no default setting")) {
			if (slave.inflationType !== rule.inflationType) {
				if ((slave.inflationType === "curative" && slave.health > 90) || (slave.inflationType === "tightener" && slave.anus <= 1 && slave.vagina <= 1)) {
					r += `<br>${slave.slaveName} cannot benefit from her assigned enema and has been defaulted to none.`;
					slave.inflation = 0;
					slave.inflationType = "none";
					slave.inflationMethod = 0;
					slave.milkSource = 0;
					slave.cumSource = 0;
					SetBellySize(slave);
				} else if ((rule.inflationType === "curative" && slave.health > 90) || (rule.inflationType === "tightener" && slave.anus <= 1 && slave.vagina <= 1)) {
				} else {
					r += `<br>${slave.slaveName}'s current enema regimen has been set to ${rule.inflationType}.`;
					slave.inflation = 1;
					slave.inflationType = rule.inflationType;
					slave.inflationMethod = 2;
					slave.milkSource = 0;
					slave.cumSource = 0;
					SetBellySize(slave);
				}
			}
			if (slave.inflationType !== "none" && slave.inflation > 1 && slave.health < -50) {
				r += `<br>${slave.slaveName}'s current enema regimen risks death, so it has been reduced to a less threatening level.`;
				slave.inflation = 1;
				SetBellySize(slave);
			} else if (slave.inflation > 1 && (slave.bellyPreg >= 1500 || slave.bellyImplant >= 1500)) {
				r += `<br>${slave.slaveName}'s current enema is too much for her body, so it has been reduced.`;
				slave.inflation = 1;
				SetBellySize(slave);
			} else if (slave.inflationType === "none") {
				slave.inflation = 0;
				slave.inflationMethod = 0;
				slave.milkSource = 0;
				slave.cumSource = 0;
				SetBellySize(slave);
			}
		}
	}

	function ProcessDiet(slave, rule) {
		// Diet Setting 
		if (rule.diet !== undefined && rule.diet !== "no default setting") {
			/*
			if ((slave.boobs >= 1600) && (slave.muscles <= 5) && (slave.amp != 1) && ((rule.muscles == "no default setting") || (rule.muscles === 0))) {
				if ((slave.diet !== "muscle building")) {
					slave.diet = "muscle building"
					r += `<br>${slave.slaveName} has big tits and no back muscles, so she's been assigned to gain some.`
				}
			} else if ((slave.boobs >= 1600) && (slave.muscles > 5) && (slave.diet == "muscle building") && ((rule.muscles == "no default setting") || (rule.muscles === 0))) {
			*/
			if (rule.diet === "healthy" && slave.diet !== "healthy") {
				slave.diet = "healthy";
				r += `<br>${slave.slaveName} has been assigned to a healthy diet.`;
			} else if ((slave.boobs >= 1600) && (slave.muscles > 5) && (slave.diet == "muscle building") && ((rule.muscles == "no default setting") || (rule.muscles === 0))) {
				slave.diet = "healthy";
				r += `<br>${slave.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.`;
			} else if ((rule.dietGrowthSupport == 1) && ((slave.drugs == "breast injections") || (slave.drugs == "butt injections")) && (slave.weight <= 95)) {
				if (slave.diet !== "fattening") {
					slave.diet = "fattening";
					r += `<br>${slave.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.`;
				}
			} else {
				if (!(isNaN(rule.diet))) {
					if ((slave.weight - rule.diet) > 5) {
						if ((slave.diet !== "restricted")) {
							slave.diet = "restricted";
							r += `<br>${slave.slaveName} is too fat so her diet has been set to restricted.`;
						}
						
					} else if ((slave.weight - rule.diet) < -5) {
						if ((slave.diet !== "fattening")) {
							slave.diet = "fattening";
							r += `<br>${slave.slaveName} is too skinny so her diet has been set to fattening.`;
						}
					} else if ((rule.muscles !== undefined) && (rule.muscles !== "no default setting") && (slave.amp != 1)) {
						if ((slave.muscles >= rule.muscles+8)) {
							if ((slave.diet !== "slimming")) {
								slave.diet = "slimming";
								r += `<br>${slave.slaveName} has been put on a slimming exercise regime.`;
							}
						} else if ((slave.muscles <= rule.muscles-2)) {
							if ((slave.diet !== "muscle building")) {
								slave.diet = "muscle building";
								r += `<br>${slave.slaveName} has been put on a muscle building exercise regime.`;
							}
						} else {
							if ((slave.diet !== "healthy")) {
								slave.diet = "healthy";
								r += `<br>${slave.slaveName} is at the target weight, so her diet has been normalized.`;
							}
						}
					} else {
						if ((slave.diet !== "healthy")) {
							slave.diet = "healthy";
							r += `<br>${slave.slaveName} is at the target weight, so her diet has been normalized.`;
						}
					}
				} else if ((rule.diet == "attractive")) {
					if (((slave.weight > 95) || ((slave.weight > 30) && (slave.hips < 2)))) {
						if ((slave.diet !== "restricted")) {
							slave.diet = "restricted";
							r += `<br>${slave.slaveName} is too fat so her diet has been set to restricted.`;
						}
					} else if (((slave.weight < -95) || ((slave.weight < -30) && (slave.hips > -2)))) {
						if ((slave.diet !== "fattening")) {
							slave.diet = "fattening";
							r += `<br>${slave.slaveName} is too skinny so her diet has been set to fattening.`;
						}
					} else if ((rule.muscles !== undefined) && (rule.muscles !== "no default setting") && (slave.amp != 1)) {
						if ((slave.muscles >= rule.muscles+8)) {
							if ((slave.diet !== "slimming")) {
								slave.diet = "slimming";
								r += `<br>${slave.slaveName} has been put on a slimming exercise regime.`;
							}
						} else if ((slave.muscles <= rule.muscles-2)) {
							if ((slave.diet !== "muscle building")) {
								slave.diet = "muscle building";
								r += `<br>${slave.slaveName} has been put on a muscle building exercise regime.`;
							}
						} else {
							if ((slave.diet !== "healthy")) {
								slave.diet = "healthy";
								r += `<br>${slave.slaveName} is at the target weight, so her diet has been normalized.`;
							}
						}
					} else {
						if ((slave.diet !== "healthy")) {
							slave.diet = "healthy";
							r += `<br>${slave.slaveName} is at the target weight, so her diet has been normalized.`;
						}
					}
				} else if ((rule.diet == "XX")) {
					if ((slave.diet !== "XX")) {
						slave.diet = "XX";
						r += `<br>${slave.slaveName} has been put on a diet that favors feminine development.`;
					}
				} else if ((rule.diet == "XY")) {
					if ((slave.diet !== "XY")) {
						slave.diet = "XY";
						r += `<br>${slave.slaveName} has been put on a diet that favors masculine development.`;
					}
				} else if ((rule.diet == "XXY")) {
					if (slave.balls > 0 && (slave.ovaries == 1 || slave.mpreg == 1)) {
						if ((slave.diet !== "XXY")) {
							slave.diet = "XXY";
							r += `<br>${slave.slaveName} has been put on a diet that enhances a herm's unique sexuality.`;
						}
					} else {
						if ((slave.diet !== "healthy")) {
							slave.diet = "healthy";
							r += `<br>${slave.slaveName} has been put on a standard diet since she is not a hermaphrodite.`;
						}
					}
				} else if ((rule.diet == "cleansing")) {
					if (((slave.diet !== "cleansing") && (slave.health < 100))) {
						slave.diet = "cleansing";
						r += `<br>${slave.slaveName} has been put on a diet of cleansers.`;
					}
				} else if ((rule.diet == "fertility")) {
					if (canGetPregnant(slave)) {
						if ((slave.diet !== "fertility")) {
							slave.diet = "fertility";
							r += `<br>${slave.slaveName} has been put on a diet to enhance fertility.`;
						}
					} else {
						if ((slave.diet !== "healthy")) {
							slave.diet = "healthy";
							if (slave.pregKnown === 0 && slave.preg > 0) {
								r += `<br>${slave.slaveName} has been put on a standard diet since tests reveal she has become pregnant.`;
								slave.pregKnown = 1;
							} else {
								r += `<br>${slave.slaveName} has been put on a standard diet since she is currently unable to become pregnant.`;
							}
						}
					}
				} else if ((rule.diet == "cum production")) {
					if ((slave.balls > 0)) {
						if ((slave.diet !== "cum production")) {
							slave.diet = "cum production";
							r += `<br>${slave.slaveName} has been put on a diet to promote cum production.`;
						}
					} else {
						if ((slave.diet !== "healthy")) {
							slave.diet = "healthy";
							r += `<br>${slave.slaveName} has been put on a standard diet since she is no longer able to produce cum.`;
						}
					}
				}
			}
		} else if ((rule.muscles !== undefined) && (rule.muscles !== "no default setting") && (slave.amp != 1)) { // no diet rule, muscles only 
			if ((slave.muscles >= rule.muscles+8)) {
				if ((slave.diet !== "slimming")) {
					slave.diet = "slimming";
					r += `<br>${slave.slaveName} has been put on a slimming exercise regime.`;
				}
			} else if ((slave.muscles <= rule.muscles-2)) {
				if ((slave.diet !== "muscle building")) {
					slave.diet = "muscle building";
					r += `<br>${slave.slaveName} has been put on a muscle building exercise regime.`;
				}
			} else {
				if ((slave.diet !== "healthy")) {
					slave.diet = "healthy";
					r += `<br>${slave.slaveName} has achieved the target musculature, so her exercise regime has been normalized.`;
				}
			}
		}

		if (slave.drugs === "appetite suppressors" && slave.diet !== "restricted") {
			slave.drugs = "no drugs";
			r += `<br>${slave.slaveName} is no longer losing weight, so she's no longer being given appetite suppressors.`;
		} else if (slave.diet === "restricted" && V.arcologies[0].FSSlimnessEnthusiastResearch == 1 && (slave.drugs == "no drugs" || slave.drugs == "none")) {
			slave.drugs = "appetite suppressors";
			r += `<br>${slave.slaveName} is losing weight so she will be given weight loss pills.`;
		}
	}

	function ProcessCuratives(slave, rule) {
		if ((rule.curatives !== undefined) && (rule.curatives !== "no default setting")) {
			if (slave.curatives !== rule.curatives) {
				if (rule.curatives === 2) {
					if (slave.health > 100) {
						if ((slave.curatives != 1)) {
							r += `<br>${slave.slaveName} has been put on preventatives, since curatives cannot improve her health further.`;
							slave.curatives = 1;
						}
					} else {
						r += `<br>${slave.slaveName} has been put on curatives.`;
						slave.curatives = rule.curatives;
					}
				} else {
					r += `<br>${slave.slaveName} has been ${rule.curatives > 0 ? `put on preventatives` : `taken off health drugs`}`;
					slave.curatives = rule.curatives;
				}
			}
		}
	}

	function ProcessAphrodisiacs(slave, rule) {
		if ((rule.aphrodisiacs !== undefined) && (rule.aphrodisiacs != "no default setting")) {
			if (slave.aphrodisiacs != rule.aphrodisiacs) {
				r += `<br>${slave.slaveName} has been ${rule.aphrodisiacs > 0 ? `put on the proper` : `taken off`} aphrodisiacs.`;
				slave.aphrodisiacs = rule.aphrodisiacs;
			}
		}
	}

	function ProcessPenisHormones(slave, rule) {
		if ((slave.dick > 0)) {
			if ((slave.balls === 0)) {
				if ((rule.gelding !== undefined) && (rule.gelding !== "no default setting")) {
					if ((slave.hormones !== rule.gelding)) {
						const _oldHormones = slave.hormones;
						slave.hormones = rule.gelding;
						if (slave.indentureRestrictions >= 2) {
							slave.hormones = Math.clamp(slave.hormones, -1, 1);
						}
						if (slave.hormones != _oldHormones) {
							r += `<br>${slave.slaveName} is a gelding, so she has been put on the appropriate hormonal regime.`;
						}
					}
				}
			} else if ((slave.balls > 0)) {
				if ((rule.XY !== undefined) && (rule.XY !== "no default setting")) {
					if ((slave.hormones !== rule.XY)) {
						if ((slave.assignment != "recruit girls")) {
							if ((slave.assignment != "be the Wardeness")) {
								if ((slave.assignment != "be the Madam")) {
									const _oldHormones = slave.hormones;
									slave.hormones = rule.XY;
									if (slave.indentureRestrictions >= 2) {
										slave.hormones = Math.clamp(slave.hormones, -1, 1);
									}
									if (slave.hormones != _oldHormones) {
										r += `<br>${slave.slaveName} is a shemale, so she has been put on the appropriate hormonal regime.`;
									}
								}
							}
						}
					}
				}
			}
		}
	}

	function ProcessFemaleHormones(slave, rule) {
		if ((slave.vagina > -1) && (slave.dick === 0) && (rule.XX !== undefined) && (rule.XX !== "no default setting")) {
			if ((slave.hormones !== rule.XX)) {
				const _oldHormones = slave.hormones;
				slave.hormones = rule.XX;
				if (slave.indentureRestrictions >= 2) {
					slave.hormones = Math.clamp(slave.hormones, -1, 1);
				}
				if (slave.hormones != _oldHormones) {
					r += `<br>${slave.slaveName} is a female, so she has been put on the appropriate hormonal regime.`;
				}
			}
		}
	}

	function ProcessPregnancyDrugs(slave, rule) {
		if (slave.pregKnown == 1 && rule.pregSpeed != "no default setting" && (slave.breedingMark != 1 || V.propOutcome == 0) && slave.indentureRestrictions < 1 && slave.broodmother === 0) {
			if (rule.pregSpeed == "slow" && slave.preg < 35) {
				slave.pregControl = "slow gestation";
				r += `<br>${slave.slaveName} is pregnant, so she has been put on the gestation slowing agents.`;
			} else if (rule.pregSpeed == "fast" && slave.preg < 35 && slave.health > -50) {
				slave.pregControl = "speed up";
				r += `<br>${slave.slaveName} is pregnant, so she has been put on rapid gestation agents. CAUTION! Can be dangerous. Clinic supervision is recommended.`;
			} else if (rule.pregSpeed == "suppress" && slave.preg > 34 && slave.health > -50) {
				slave.pregControl = "labor supressors";
				r += `<br>${slave.slaveName} is ready to birth, so she has been put on labor suppressing agents.`;
			} else if (rule.pregSpeed == "stimulate" && slave.preg >= 37 && slave.health > -50) {
				slave.labor = 1;
				slave.induce = 1;
				V.birthee = 1;
				r += `<br>slave.slaveName is ready to birth, so her labor has been stimulated.`;
			} else if (rule.pregSpeed == "fast" && slave.pregControl == "speed up" && slave.health <= -50) {
				slave.pregControl = "none";
				r += `<br>${slave.slaveName} is on rapid gestation agents and dangerously unhealthy, so her agent regimen has been stopped.`;
			} else if (rule.pregSpeed == "suppress" && slave.pregControl == "labor supressors" && slave.health <= -50) {
				slave.pregControl = "none";
				r += `<br>${slave.slaveName} is on labor suppression agents and unhealthy, so her agent regimen has been stopped.`;
			}
		}
	}

	function ProcessLivingStandard(slave, rule) {
		if ((rule.livingRules !== undefined) && (rule.livingRules !== "no default setting")) {
			if (setup.facilityCareers.includes(slave.assignment)) {
				r += ``; // `<br>${slave.slaveName}'s living standards are controlled by her assignment.`;
			} else if (((slave.assignment == "be your Head Girl") && (V.HGSuite == 1)) || ((slave.assignment == "guard you") && (V.dojo > 1))) {
				r += `<br>${slave.slaveName} has a private room.`;
			} else if ((slave.fetish == "mindbroken")) {
				if ((slave.livingRules !== "spare")) {
					slave.livingRules = "spare";
					r += `<br>Since ${slave.slaveName} is mindbroken her living standard has been set to spare.`;
				}
			} else if (slave.livingRules !== rule.livingRules) {
				if (rule.livingRules !== "luxurious") {
					if (V.roomsPopulation <= V.rooms-0.5) {
						slave.livingRules = rule.livingRules;
						r += `<br>${slave.slaveName}'s living standard has been set to ${rule.livingRules}.`;
						if (slave.relationship >= 4)
							V.roomsPopulation += 0.5;
						else
							V.roomsPopulation += 1;
					} else {
						slave.livingRules = "normal";
						r += `<br>${slave.slaveName}'s living standard has been set to normal, since there is no room for her to occupy.`;
					}
				} else {
					slave.livingRules = rule.livingRules;
					r += `<br>${slave.slaveName}'s living standard has been set to ${rule.livingRules}.`;
				}
			}
		}
	}

	function ProcessSpeech(slave, rule) {
		if ((rule.speechRules !== undefined) && (rule.speechRules !== "no default setting")) {
			if ((slave.fetish == "mindbroken")) {
				if ((slave.speechRules !== "restrictive")) {
					slave.speechRules = "restrictive";
					r += `<br>Since ${slave.slaveName} is mindbroken her speech rules have been set to restrictive.`;
				}
			} else if ((slave.speechRules !== rule.speechRules)) {
				slave.speechRules = rule.speechRules;
				r += `<br>${slave.slaveName}'s speech rules have been set to ${rule.speechRules}.`;
			}
		}
	}

	function ProcessRelationship(slave, rule) {
		if ((slave.fetish !== "mindbroken")) {
			if ((rule.relationshipRules !== undefined) && (rule.relationshipRules !== "no default setting")) {
				if ((slave.relationshipRules !== rule.relationshipRules )) {
					slave.relationshipRules = rule.relationshipRules ;
					r += `<br>${slave.slaveName}'s relationship rules have been set to ${rule.relationshipRules}.`;
				}
			}
		}
	}

	function ProcessRelease(slave, rule) {
		if ((rule.releaseRules !== undefined) && (rule.releaseRules !== "no default setting")) {
			let _release = 0;
			if (rule.releaseRules === "restrictive" &&
				!(["serve the public", "serve in the club", "whore", "work in the brothel", "please you", "serve in the master suite", "be a subordinate slave", "work a glory hole", "be confined in the arcade", "get milked", "work in the dairy", "be your Head Girl"].contains(slave.assignment)))
				_release = 1;
			else
				_release = 1;
			if ((slave.fetish == "mindbroken") && (slave.releaseRules !== "permissive")) {
				slave.releaseRules = "permissive";
				r += `<br>Since ${slave.slaveName} is mindbroken her masturbation rules have been set to permissive.`;
			} else if ((slave.amp === 1 || slave.fuckdoll > 0) && (slave.releaseRules === "masturbation")) {
				slave.releaseRules = "restrictive";
				r += `<br>Since ${slave.slaveName} is unable to masturbate, her masturbation rules have been set to restrictive.`;
			} else if ((_release !== 0) && (slave.releaseRules !== rule.releaseRules)) {
				slave.releaseRules = rule.releaseRules;
				r += `<br>${slave.slaveName}'s masturbation rules have been set to ${rule.releaseRules}.`;
			}
		}
	}

	function ProcessPunishment(slave, rule) {
		if ((rule.standardPunishment !== undefined) && (rule.standardPunishment !== "no default setting")) {
			if ((slave.standardPunishment !== rule.standardPunishment)) {
				slave.standardPunishment = rule.standardPunishment ;
				r += `<br>${slave.slaveName}'s typical punishment has been updated to ${rule.standardPunishment}.`;
			}
		}
	}

	function ProcessReward(slave, rule) {
		if ((rule.standardReward !== undefined) && (rule.standardReward !== "no default setting")) {
			if ((slave.standardReward !== rule.standardReward)) {
				slave.standardReward = rule.standardReward ;
				r += `<br>${slave.slaveName}'s typical reward has been updated to ${rule.standardReward}.`;
			}
		}
	}

	function ProcessToyHole(slave, rule) {
		if ((rule.toyHole !== undefined) && (rule.toyHole !== "no default setting")) {
			if (rule.toyHole === "pussy") {
				if (slave.vagina > 0 && canDoVaginal(slave)) {
					slave.toyHole = rule.toyHole ;
					r += `<br>${slave.slaveName} has been instructed to use her ${rule.toyHole} to please you.`;
				} else if (slave.toyHole !== "all her holes") {
					slave.toyHole = "all her holes" ;
					r += `<br>${slave.slaveName}'s hole preference has defaulted to all her holes.`;
				}
			} else if (rule.toyHole === "ass") {
				if (slave.anus > 0 && canDoAnal(slave)) {
					slave.toyHole = rule.toyHole ;
					r += `<br>${slave.slaveName} has been instructed to use her ${rule.toyHole} to please you.`;
				} else if (slave.toyHole !== "all her holes") {
					slave.toyHole = "all her holes" ;
					r += `<br>${slave.slaveName}'s hole preference has defaulted to all her holes.`;
				}
			} else if (rule.toyHole === "dick") {
				if (slave.dick > 0 && canPenetrate(slave)) {
					slave.toyHole = rule.toyHole ;
					r += `<br>${slave.slaveName} has been instructed to use her ${rule.toyHole} to please you.`;
				} else if (slave.toyHole !== "all her holes") {
					slave.toyHole = "all her holes" ;
					r += `<br>${slave.slaveName}'s hole preference has defaulted to all her holes.`;
				}
			} else if ((slave.toyHole !== rule.toyHole)) {
				slave.toyHole = rule.toyHole ;
				r += `<br>${slave.slaveName} has been instructed to use her ${rule.toyHole} to please you.`;
			}
		}
	}

	function ProcessDietCum(slave, rule) {
		if ((rule.dietCum !== undefined) && (rule.dietCum !== "no default setting")) {
			if (slave.dietCum != rule.dietCum) {
				slave.dietCum = rule.dietCum;
				if (slave.dietCum == 2) {
					r += `<br>${slave.slaveName} has been put on a diet based on cum.`;
					slave.dietMilk = 0;
				}
				if (slave.dietCum == 1)
					r += `<br>${slave.slaveName} has had cum added to her diet.`;
				else
					r += `<br>${slave.slaveName} has had cum removed from her diet.`;
			}
		}
	}

	function ProcessDietMilk(slave, rule) {
		if ((rule.dietMilk !== undefined) && (rule.dietMilk !== "no default setting")) {
			if (slave.dietMilk != rule.dietMilk) {
				slave.dietMilk = rule.dietMilk;
				if (slave.dietMilk == 2) {
					r += `<br>${slave.slaveName} has been put on a diet based on human milk.`;
					slave.dietCum = 0;
				}
				if (slave.dietMilk == 1)
					r += `<br>${slave.slaveName} has had human milk added to her diet.`;
				else
					r += `<br>${slave.slaveName} has had human milk removed from her diet.`;
			}
		}
	}
	
	function ProcessSolidFood(slave, rule) {
		if ((rule.onDiet !== undefined) && (rule.onDiet !== "no default setting")) {
			if ((slave.onDiet !== rule.onDiet)) {
				slave.onDiet = rule.onDiet ;
				if (slave.onDiet == 1)
					r += `<br>${slave.slaveName} is not permitted to eat the solid slave food.`;
				else
					r += `<br>${slave.slaveName} is permitted to eat the solid slave food.`;
			}
		}
	}

	function ProcessTeeth(slave, rule) {
		if ((rule.teeth !== undefined) && (rule.teeth !== "no default setting")) {
			if ((rule.teeth == "universal")) {
				if ((slave.teeth == "crooked")) {
					slave.teeth = "straightening braces";
					V.cash -= V.surgeryCost;
					r += `<br>${slave.slaveName} has been given braces for her crooked teeth.`;
				} else if ((slave.teeth == "normal")) {
					slave.teeth = "cosmetic braces";
					V.cash -= V.surgeryCost;
					r += `<br>${slave.slaveName} has been given cosmetic braces.`;
				}
			} else if ((rule.teeth == "straighten")) {
				if ((slave.teeth == "crooked")) {
					slave.teeth = "straightening braces";
					V.cash -= V.surgeryCost;
					r += `<br>${slave.slaveName} has been given braces for her crooked teeth.`;
				} else if ((slave.teeth == "cosmetic braces")) {
					slave.teeth = "normal";
					r += `<br>${slave.slaveName} has gotten her braces off, since her teeth are straight.`;
				}
			} else if ((rule.teeth == "none")) {
				if ((slave.teeth == "straightening braces")) {
					slave.teeth = "crooked";
					r += `<br>${slave.slaveName} has gotten her braces off.`;
				} else if ((slave.teeth == "cosmetic braces")) {
					slave.teeth = "normal";
					r += `<br>${slave.slaveName} has gotten her braces off.`;
				}
			}
		}
	}

	function ProcessStyle(slave, rule) {
		if (rule.eyeColor !== undefined && (rule.eyeColor !== "no default setting")) {
			if ((slave.eyeColor !== rule.eyeColor)) {
				slave.eyeColor = rule.eyeColor;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName} has been given ${slave.eyeColor} contact lenses.`;
			}
		}

		if (rule.makeup !== undefined && (rule.makeup !== "no default setting")) {
			if ((slave.makeup !== rule.makeup)) {
				slave.makeup = rule.makeup;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName} has been assigned the standard makeup.`;
			}
		}

		if ((slave.amp != 1)) {
			if (rule.nails !== undefined && (rule.nails !== "no default setting")) {
				if ((slave.nails !== rule.nails)) {
					slave.nails = rule.nails;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName} has been assigned the standard nails.`;
				}
			}
		}

		if (rule.hColor !== undefined && (rule.hColor !== "no default setting")) {
			if (slave.bald != 1) {
				if ((slave.hColor !== rule.hColor)) {
					slave.hColor = rule.hColor;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s hair has been dyed ${rule.hColor}.`;
				}
			}
		}

		if (rule.hStyle !== undefined && (rule.hStyle !== "no default setting")) {
			if (slave.bald != 1) {
				if ((slave.hStyle !== rule.hStyle)) {
					slave.hStyle = rule.hStyle;
					V.cash -= V.modCost;
					if ((rule.hStyle == "shaved")) {
						slave.hLength = 0;
						r += `<br>${slave.slaveName}'s hair has been shaved.`;
					} else
						r += `<br>${slave.slaveName}'s hair has been restyled.`;
				}
			}
		}

		if (rule.hLength !== undefined && (rule.hLength !== "no default setting")) {
			if (slave.bald != 1) {
				if ((slave.hLength !== rule.hLength)) {
					if ((slave.hLength > rule.hLength)) {
						V.cash -= V.modCost;
						r += `<br>${slave.slaveName}'s hair has been cut; it `;
					} else {
						V.cash -= V.modCost*Math.trunc((rule.hLength-slave.hLength)/10);
						r += `<br>${slave.slaveName} has been given extensions; her hair `;
					}
				r += `is now ${lengthToEitherUnit(rule.hLength)} long.`;
				slave.hLength = rule.hLength;
				}
			}
		}

		if (rule.haircuts !== undefined && (rule.haircuts !== "no default setting")) {
			if (slave.bald != 1) {
				if (rule.haircuts === 1 && slave.haircuts !== 1) {
					r += `<br>${slave.slaveName}'s hair will now be maintained at ${lengthToEitherUnit(slave.hLength)} long.`;
					slave.haircuts = 1;
				} else if (rule.haircuts === 0 && slave.haircuts !== 0) {
					r += `<br>${slave.slaveName}'s hair length will no longer be maintained.`;
					slave.haircuts = 0;
				}
			}
		}

		if (rule.eyebrowHColor !== undefined && (rule.eyebrowHColor !== "no default setting")) {
			if (slave.eyebrowHStyle != "bald" && slave.eyebrowHStyle != "hairless") {
				if ((slave.eyebrowHColor !== rule.eyebrowHColor)) {
					slave.eyebrowHColor = rule.eyebrowHColor;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s eyebrow hair, if present, has been dyed ${rule.eyebrowHColor}.`;
				}
			}
		}

		if (rule.eyebrowHStyle !== undefined && (rule.eyebrowHStyle !== "no default setting")) {
			if (slave.eyebrowHStyle != "bald" && slave.eyebrowHStyle != "hairless") {
				if ((slave.eyebrowHStyle !== rule.eyebrowHStyle)) {
					slave.eyebrowHStyle = rule.eyebrowHStyle;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s eyebrow hair has been restyled; they are now ${rule.eyebrowHStyle}.`;
				}
			}
		}

		if (rule.eyebrowFullness !== undefined && (rule.eyebrowFullness !== "no default setting")) {
			if (slave.eyebrowHStyle != "bald" && slave.eyebrowHStyle != "hairless") {
				if ((slave.eyebrowFullness !== rule.eyebrowFullness)) {
					slave.eyebrowFullness = rule.eyebrowFullness;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s eyebrow hair thickness has been adjusted; they are now ${rule.eyebrowFullness}.`;
				}
			}
		}

		if (rule.pubicHColor !== undefined && (rule.pubicHColor !== "no default setting")) {
			if (slave.pubicHStyle != "bald" && slave.pubicHStyle != "hairless") {
				if ((slave.pubicHColor !== rule.pubicHColor)) {
					slave.pubicHColor = rule.pubicHColor;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s pubic hair, if present, has been dyed ${rule.pubicHColor}.`;
				}
			}
		}

		if (rule.pubicHStyle !== undefined && (rule.pubicHStyle !== "no default setting")) {
			if (slave.pubicHStyle != "bald" && slave.pubicHStyle != "hairless") {
				if ((slave.pubicHStyle !== rule.pubicHStyle)) {
					slave.pubicHStyle = rule.pubicHStyle;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s pubic hair has been restyled; it is now ${rule.pubicHStyle}.`;
				}
			}
		}

		if (rule.underArmHColor !== undefined && (rule.underArmHColor !== "no default setting")) {
			if (slave.underArmHStyle != "bald" && slave.underArmHStyle != "hairless") {
				if ((slave.underArmHColor !== rule.underArmHColor)) {
					slave.underArmHColor = rule.underArmHColor;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s underarm hair, if present, has been dyed ${rule.underArmHColor}.`;
				}
			}
		}

		if (rule.underArmHStyle !== undefined && (rule.underArmHStyle !== "no default setting")) {
			if (slave.underArmHStyle != "bald" && slave.underArmHStyle != "hairless") {
				if ((slave.underArmHStyle !== rule.underArmHStyle)) {
					slave.underArmHStyle = rule.underArmHStyle;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s underarm hair has been restyled; it is now ${rule.underArmHStyle}.`;
				}
			}
		}

		if (rule.eyebrowHColor !== undefined && (rule.eyebrowHColor !== "no default setting")) {
			if (slave.eyebrowHStyle != "bald") {
				if ((slave.eyebrowHColor !== rule.eyebrowHColor)) {
					slave.eyebrowHColor = rule.eyebrowHColor;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s eyebrow hair, if present, has been dyed ${rule.eyebrowHColor}.`;
				}
			}
		}

		if (rule.eyebrowHStyle !== undefined && (rule.eyebrowHStyle !== "no default setting")) {
			if (slave.eyebrowHStyle != "bald") {
				if ((slave.eyebrowHStyle !== rule.eyebrowHStyle)) {
					slave.eyebrowHStyle = rule.eyebrowHStyle;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s eyebrow hair has been restyled; it is now ${rule.eyebrowHStyle}.`;
				}
			}
		}

		if (rule.eyebrowFullness !== undefined && (rule.eyebrowFullness !== "no default setting")) {
			if (slave.eyebrowHStyle != "bald") {
				if ((slave.eyebrowFullness !== rule.eyebrowFullness)) {
					slave.eyebrowFullness = rule.eyebrowFullness;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s eyebrow hair has been reshaped; it is now ${rule.eyebrowFullness}.`;
				}
			}
		}

		if (rule.skinColor !== undefined && rule.skinColor !== "no default setting" && rule.skinColor !== slave.skin) {
			slave.skin = rule.skinColor;
			r += `<br>${slave.slaveName}'s skin color has been set to ${rule.skinColor}.`;
		}
	}

	function ProcessPiercings(slave, rule) {
		if (rule.nipplesPiercing !== undefined && (rule.nipplesPiercing !== "no default setting")) {
			if ((slave.nipplesPiercing !== rule.nipplesPiercing)) {
				if ((rule.nipplesPiercing === 0)) {
					slave.nipplesPiercing = 0;
					r += `<br>${slave.slaveName}'s nipple piercings have been removed.`;
				} else if (slave.nipples !== "fuckable") {
					slave.nipplesPiercing = rule.nipplesPiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s nipples have been pierced.`;
				} else {
					r += `<br>${slave.slaveName}'s nipples are inverted and cannot be pierced.`;
				}
			}
		}

		if (rule.areolaePiercing !== undefined && (rule.areolaePiercing !== "no default setting")) {
			if ((slave.areolaePiercing !== rule.areolaePiercing)) {
				if ((rule.areolaePiercing === 0)) {
					slave.areolaePiercing = 0;
					r += `<br>${slave.slaveName}'s areolae piercings have been removed.`;
				} else {
					slave.areolaePiercing = rule.areolaePiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s areolae have been given stud piercings.`;
				}
			}
		}

		if (rule.clitPiercing !== undefined && (rule.clitPiercing !== "no default setting")) {
			if ((slave.clitPiercing !== rule.clitPiercing)) {
				if ((rule.clitPiercing === 0)) {
					slave.clitPiercing = 0;
					if (slave.dick > 0)
						r += `<br>${slave.slaveName}'s frenulum piercing has been removed.`;
					else
						r += `<br>${slave.slaveName}'s clit piercing has been removed.`;

				} else if ((slave.vagina != -1) || (slave.dick !== 0)) {
					slave.clitPiercing = rule.clitPiercing;
					if (slave.dick > 0)
						r += `<br>${slave.slaveName}'s frenulum has been pierced.`;
					else
						r += `<br>${slave.slaveName}'s clit has been pierced.`;

					if (rule.clitPiercing == 3)
						V.cash -= 1000;
					else
						V.cash -= V.modCost;
				}
			}
		}

		if ((slave.vagina != -1)) {
			if (rule.vaginaPiercing !== undefined && (rule.vaginaPiercing !== "no default setting")) {
				if ((slave.vaginaPiercing !== rule.vaginaPiercing)) {
					if ((rule.vaginaPiercing === 0)) {
						slave.vaginaPiercing = 0;
						r += `<br>${slave.slaveName}'s labia piercings have been removed.`;
					} else {
						slave.vaginaPiercing = rule.vaginaPiercing;
						V.cash -= V.modCost;
						r += `<br>${slave.slaveName}'s pussylips have been pierced.`;
					}
				}
			}
		}

		if ((slave.dick > 0)) {
			if (rule.dickPiercing !== undefined && (rule.dickPiercing !== "no default setting")) {
				if ((slave.dickPiercing !== rule.dickPiercing)) {
					if ((rule.dickPiercing === 0)) {
						slave.dickPiercing = 0;
						r += `<br>${slave.slaveName}'s shaft piercings have been removed.`;
					} else {
						slave.dickPiercing = rule.dickPiercing;
						V.cash -= V.modCost;
						r += `<br>${slave.slaveName}'s shaft has been pierced.`;
					}
				}
			}
		}

		if (rule.anusPiercing !== undefined && (rule.anusPiercing !== "no default setting")) {
			if ((slave.anusPiercing !== rule.anusPiercing)) {
				if ((rule.anusPiercing === 0)) {
					slave.anusPiercing = 0;
					r += `<br>${slave.slaveName}'s asshole piercings have been removed.`;
				} else {
					slave.anusPiercing = rule.anusPiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s asshole has been pierced.`;
				}
			}
		}

		if (rule.lipsPiercing !== undefined && (rule.lipsPiercing !== "no default setting")) {
			if ((slave.lipsPiercing !== rule.lipsPiercing)) {
				if ((rule.lipsPiercing === 0)) {
					slave.lipsPiercing = 0;
					r += `<br>${slave.slaveName}'s lip piercings have been removed.`;
				} else {
					slave.lipsPiercing = rule.lipsPiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s lips have been pierced.`;
				}
			}
		}

		if (rule.tonguePiercing !== undefined && (rule.tonguePiercing !== "no default setting")) {
			if ((slave.tonguePiercing !== rule.tonguePiercing)) {
				if ((rule.tonguePiercing === 0)) {
					slave.tonguePiercing = 0;
					r += `<br>${slave.slaveName}'s tongue piercings have been removed.`;
				} else {
					slave.tonguePiercing = rule.tonguePiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s tongue has been pierced.`;
				}
			}
		}

		if (rule.earPiercing !== undefined && (rule.earPiercing !== "no default setting")) {
			if ((slave.earPiercing !== rule.earPiercing)) {
				if ((rule.earPiercing === 0)) {
					slave.earPiercing = 0;
					r += `<br>${slave.slaveName}'s ear piercings have been removed.`;
				} else {
					slave.earPiercing = rule.earPiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s ears have been pierced.`;
				}
			}
		}

		if (rule.nosePiercing !== undefined && (rule.nosePiercing !== "no default setting")) {
			if ((slave.nosePiercing !== rule.nosePiercing)) {
				if ((rule.nosePiercing === 0)) {
					slave.nosePiercing = 0;
					r += `<br>${slave.slaveName}'s nose piercing has been removed.`;
				} else {
					slave.nosePiercing = rule.nosePiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s nose has been pierced.`;
				}
			}
		}

		if (rule.eyebrowPiercing !== undefined && (rule.eyebrowPiercing !== "no default setting")) {
			if ((slave.eyebrowPiercing !== rule.eyebrowPiercing)) {
				if ((rule.eyebrowPiercing === 0)) {
					slave.eyebrowPiercing = 0;
					r += `<br>${slave.slaveName}'s eyebrow piercings have been removed.`;
				} else {
					slave.eyebrowPiercing = rule.eyebrowPiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s eyebrows have been pierced.`;
				}
			}
		}

		if (rule.navelPiercing !== undefined && (rule.navelPiercing !== "no default setting")) {
			if ((slave.navelPiercing !== rule.navelPiercing)) {
				if ((rule.navelPiercing === 0)) {
					slave.navelPiercing = 0;
					r += `<br>${slave.slaveName}'s navel piercing have been removed.`;
				} else {
					slave.navelPiercing = rule.navelPiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s navel has been pierced.`;
				}
			}
		}

		if (rule.corsetPiercing !== undefined && (rule.corsetPiercing !== "no default setting")) {
			if ((slave.corsetPiercing !== rule.corsetPiercing)) {
				if ((rule.corsetPiercing === 0)) {
					slave.corsetPiercing = 0;
					r += `<br>${slave.slaveName}'s corset piercings have been removed.`;
				} else {
					slave.corsetPiercing = rule.corsetPiercing;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName} has been given a set of corset piercings.`;
				}
			}
		}
	}

	function ProcessSmartPiercings(slave, rule) {
		if ((slave.clitPiercing == 3)) {
			let _used = 0;
			if (rule.clitSetting !== undefined && (rule.clitSetting !== "no default setting")) {
				if (slave.clitSetting !== rule.clitSetting) {
					slave.clitSetting = rule.clitSetting;
					_used = 1;
					r += `<br>${slave.slaveName}'s smart piercing has been set to ${slave.clitSetting}.`;
				} else if (slave.fetishStrength < 100) {
					_used = 1;
				}
			}
			if (_used === 0) {
				if (rule.clitSettingEnergy !== undefined && (rule.clitSettingEnergy !== "no default setting")) {
					if (slave.energy < rule.clitSettingEnergy) {
						if (slave.clitSetting !== "all") {
							r += `<br>${slave.slaveName}'s smart piercing has been set to enhance libido.`;
						}
						slave.clitSetting = "all";
						_used = 1;
					} else if (slave.energy >= rule.clitSettingEnergy + 10) {
						if (slave.clitSetting !== "none") {
							r += `<br>${slave.slaveName}'s smart piercing has been set to suppress libido.`;
						}
						slave.clitSetting = "none";
						_used = 1;
					}
				}
			}
			if (_used === 0) {
				if (rule.clitSettingXY !== undefined && (rule.clitSettingXY !== "no default setting")) {
					if (slave.attrXY < rule.clitSettingXY) {
						if (slave.clitSetting !== "men") {
							r += `<br>${slave.slaveName}'s smart piercing has been set to encourage attraction to men.`;
						}
						slave.clitSetting = "men";
						_used = 1;
					} else if (slave.attrXY >= rule.clitSettingXY + 10) {
						if (slave.clitSetting !== "anti-men") {
							r += `<br>${slave.slaveName}'s smart piercing has been set to discourage attraction to men.`;
						}
						slave.clitSetting = "anti-men";
						_used = 1;
					}
				}
			}
			if (_used === 0) {
				if (rule.clitSettingXX !== undefined && (rule.clitSettingXX !== "no default setting")) {
					if (slave.attrXX < rule.clitSettingXX) {
						if (slave.clitSetting !== "women") {
							r += `<br>${slave.slaveName}'s smart piercing has been set to encourage attraction to women.`;
						}
						slave.clitSetting = "women";
						_used = 1;
					} else if (slave.attrXX >= rule.clitSettingXX + 10) {
						if (slave.clitSetting !== "anti-women") {
							r += `<br>${slave.slaveName}'s smart piercing has been set to discourage attraction to women.`;
						}
						slave.clitSetting = "anti-women";
						_used = 1;
					}
				}
			}
		}
	}

	function ProcessTattoos(slave, rule) {
		if (rule.boobsTat !== undefined && (rule.boobsTat !== "no default setting")) {
			if ((slave.boobsTat !== rule.boobsTat)) {
				slave.boobsTat = rule.boobsTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s chest has been tattooed.`;
			}
		}

		if (rule.buttTat !== undefined && (rule.buttTat !== "no default setting")) {
			if ((slave.buttTat !== rule.buttTat)) {
				slave.buttTat = rule.buttTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s butt has been tattooed.`;
			}
		}

		if (rule.vaginaTat !== undefined && (rule.vaginaTat !== "no default setting")) {
			if ((slave.vaginaTat !== rule.vaginaTat)) {
				slave.vaginaTat = rule.vaginaTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s abdomen has been tattooed.`;
			}
		}

		if ((slave.dick > 0)) {
			if (rule.dickTat !== undefined && (rule.dickTat !== "no default setting")) {
				if ((slave.dickTat !== rule.dickTat)) {
					slave.dickTat = rule.dickTat;
					V.cash -= V.modCost;
					r += `<br>${slave.slaveName}'s dick has been tattooed.`;
				}
			}
		}

		if (rule.lipsTat !== undefined && (rule.lipsTat !== "no default setting")) {
			if ((slave.lipsTat !== rule.lipsTat)) {
				slave.lipsTat = rule.lipsTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s face has been tattooed.`;
			}
		}

		if (rule.anusTat !== undefined && (rule.anusTat !== "no default setting")) {
			if ((slave.anusTat !== rule.anusTat)) {
				slave.anusTat = rule.anusTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s asshole has been modded.`;
			}
		}

		if (rule.shouldersTat !== undefined && (rule.shouldersTat !== "no default setting")) {
			if ((slave.shouldersTat !== rule.shouldersTat)) {
				slave.shouldersTat = rule.shouldersTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s shoulders have been tattooed.`;
			}
		}

		if (rule.armsTat !== undefined && (rule.armsTat !== "no default setting")) {
			if ((slave.armsTat !== rule.armsTat)) {
				slave.armsTat = rule.armsTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s arms have been tattooed.`;
			}
		}

		if (rule.legsTat !== undefined && (rule.legsTat !== "no default setting")) {
			if ((slave.legsTat !== rule.legsTat)) {
				slave.legsTat = rule.legsTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s legs have been tattooed.`;
			}
		}

		if (rule.stampTat !== undefined && (rule.stampTat !== "no default setting")) {
			if ((slave.stampTat !== rule.stampTat)) {
				slave.stampTat = rule.stampTat;
				V.cash -= V.modCost;
				r += `<br>${slave.slaveName}'s lower back has been tattooed.`;
			}
		}
		if ((rule.autoBrand == 1)) {
			if ((slave.brand === 0)) {
				if ((slave.health > -20)) {
					slave.brand = V.brandDesign;
					slave.brandLocation = V.brandTarget;
					if ((slave.devotion < 18))
						slave.devotion -= 5;
					slave.trust -= 5;
					slave.health -= 10;
					r += `<br>${slave.slaveName} has been branded, with <span class="gold">fear</span>${slave.devotion < 18? `, <span class="mediumorchid">regard,</span>`:``} and <span class="red">health</span> consequences.`;
				}
			}
		}
	}

	function ProcessPornFeedEnabled(slave, rule) {
		if (rule.pornFeed === undefined || rule.pornFeed === "no default setting") {
			return;
		}
		if (rule.pornFeed === slave.pornFeed) {
			return;
		}
		slave.pornFeed = rule.pornFeed;
		let yesno = slave.pornFeed ? "are now" : "are no longer";
		if (slave.pornFeed === 0) {slave.pornFameSpending = 0};
		r += `<br>Highlights of ${slave.slaveName}'s sex life ${yesno} being released.`;
	}

	function ProcessPorn(slave, rule) {
		if ((rule.pornFameSpending !== undefined) && (rule.pornFameSpending !== "no default setting")) {
			if ((slave.pornPrestige < 3)) {
				if ((slave.pornFameSpending !== rule.pornFameSpending)) {
					slave.pornFameSpending = rule.pornFameSpending;
					r += `<br>${slave.slaveName}'s porn publicity has been corrected.`;
				}
			}
		}
	}
	
	function ProcessLabel(slave, rule) {
		if (rule.label !== "no default setting" && !slave.customLabel.includes("["+rule.label+"]")) {
			slave.customLabel = slave.customLabel + "[" + rule.label + "]";
			r += `<br>${slave.slaveName} has been tagged as ${rule.label}`;
		} 

		if (rule.removeLabel !== "no default setting" && slave.customLabel.includes("["+rule.removeLabel+"]")) {
			slave.customLabel = slave.customLabel.replace("["+rule.removeLabel+"]", "");
			r += `<br>${slave.slaveName}'s tag [${rule.removeLabel}] is removed.`;
		}
	}

	return DefaultRules;
})();
