code:
App.UI.surrogacy = function() {
	const node = new DocumentFragment();
	const receptrix = getReceptrix();
	const donatrix = getDonatrix();
	const impregnatrix = getImpregnatrix();
	const wombIndex = V.wombIndex;
	const slave = getSlave(V.AS);
	let r = [];

	function getReceptrix() {
		if (V.receptrix && V.receptrix.ID) {
			return V.receptrix.ID === -1 ? V.PC : getSlave(V.receptrix.ID);
		}
	}

	function getDonatrix() {
		if (V.donatrix && V.donatrix.ID) {
			return V.donatrix.ID === -1 ? V.PC : getSlave(V.donatrix.ID);
		}
	}

	function getImpregnatrix() {
		if (V.impregnatrix && V.impregnatrix.ID) {
			if (V.impregnatrix.ID === -1) {
				return V.PC;
			} else {
				return findFather(V.impregnatrix.ID);
			}
		}
	}

	switch (V.surgeryType) {
		case "surrogacy":
			if (receptrix.ID === -1) {
				r.push(`Since the surgery required only a local anesthetic, you remain fully aware of the procedure as the autosurgery carries it out. You slowly rise to your feet, a hand to your lower belly, appreciating the new life growing within you.`);
				V.PC.pregKnown = 1;
				WombSurrogate(V.PC, 1, donatrix, impregnatrix.ID, 1);
				WombNormalizePreg(V.PC);
			} else {
				receptrix.pregKnown = 1;
				WombSurrogate(receptrix, 1, donatrix, impregnatrix.ID, 1);
				WombNormalizePreg(receptrix);
				const {
					He,
					he, his, him
				} = getPronouns(receptrix);
				if (receptrix.fetish === Fetish.MINDBROKEN) {
					r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
				} else if (receptrix.fetish === "pregnancy" && receptrix.fetishStrength > 60 && receptrix.fetishKnown === 1) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. ${He} was overjoyed at the sight of the syringe containing ${his} future child emptying into ${his} womb.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He} is  filled with joy over the life settling into ${his} womb and can't wait to see the result. ${He}'s so pleased that ${he} now trusts your plans for ${his} body.`);
					receptrix.trust += 4;
					receptrix.devotion += 10;
				} else if (receptrix.devotion > 50) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. ${He} watched the syringe containing ${his} new pregnancy empty into ${his} womb with rapt attention.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He}'s <span class="devotion inc">grateful</span> that you think ${him} worthy of carrying this child, and a little nervous about how ${he}'ll perform as a surrogate.`);
					receptrix.devotion += 4;
				} else if (receptrix.devotion >= -20) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. From the syringe making contact with ${his} skin, to the egg's delivery into ${his} womb and ${his} subsequent impregnation, ${he} couldn't look away.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He} understands the realities of ${his} life as a slave, so it isn't much of a shock. ${He} is <span class="trust dec">sensibly fearful</span> of your total power over ${his} body.`);
					receptrix.trust -= 10;
				} else {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. The moment ${he} realized what was happening, ${he} shut ${his} eyes tight, only opening them again as ${he} feels the slight tingle of the injector exiting ${his} lower abdomen.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He} does not understand the realities of ${his} life as a slave at a core level, so ${he}'s terrified and angry that you have forced ${him} to bear this child, even more so as ${he} realizes ${he} doesn't know who the father is. ${He} is sensibly fearful of your total power over ${his} body and the future of the life ${he} now harbors within ${him}.`);
					receptrix.trust -= 15;
					receptrix.devotion -= 15;
				}
			}
			V.receptrix = 0;
			V.impregnatrix = 0;
			V.donatrix = 0;
			break;
		case "transplant":
		case "transplant all": {
			const bulk = V.surgeryType === "transplant all";
			const child = bulk ? "children" : "child";
			let fetus;
			if (receptrix.ID === -1) {
				r.push(`Since the surgery required only a local anesthetic, you are very aware that you are now carrying ${slave.slaveName}'s ${child}. You slowly`);
				if (canWalk(V.PC)) {
					r.push(`rise to your feet, a hand to`);
				} else if (canMove(V.PC)) {
					r.push(`rise to a sitting position, a hand to`);
				} else if (isMovable(V.PC)) {
					r.push(`run a hand across`);
				}
				r.push(`your lower belly, appreciating the new ${bulk ? "lives" : "life"} growing within you.`);
				if (bulk) {
					for (let wombi = 0; wombi < slave.womb.length; wombi++) {
						if (slave.womb[wombi].age < 4 && (!FutureSocieties.isActive('FSRestart') || V.eugenicsFullControl === 1 || mother.breedingMark === 0 || V.propOutcome === 0 || (slave.womb[wombi].fatherID !== -1 && slave.womb[wombi].fatherID !== -6))) {
							fetus = WombRemoveFetus(slave, wombi);
							WombAddFetus(V.PC, fetus);
							wombi--;
						}
					}
				} else {
					fetus = WombRemoveFetus(slave, wombIndex);
					WombAddFetus(V.PC, fetus);
				}
				V.PC.pregKnown = 1;
				V.PC.preg = WombMaxPreg(V.PC);
				slave.preg = WombMaxPreg(slave);
				WombNormalizePreg(V.PC);
				WombNormalizePreg(slave);
			} else {
				if (bulk) {
					for (let wombi = 0; wombi < donatrix.womb.length; wombi++) {
						if (donatrix.womb[wombi].age < 4 && (!FutureSocieties.isActive('FSRestart') || V.eugenicsFullControl === 1 || mother.breedingMark === 0 || V.propOutcome === 0 || (donatrix.womb[wombi].fatherID !== -1 && donatrix.womb[wombi].fatherID !== -6))) {
							fetus = WombRemoveFetus(donatrix, wombi);
							WombAddFetus(receptrix, fetus);
							wombi--;
						}
					}
				} else {
					fetus = WombRemoveFetus(donatrix, wombIndex);
					WombAddFetus(receptrix, fetus);
				}
				receptrix.pregKnown = 1;
				receptrix.preg = WombMaxPreg(receptrix);
				donatrix.preg = WombMaxPreg(donatrix);
				WombNormalizePreg(receptrix);
				WombNormalizePreg(donatrix);
				if (donatrix.ID === -1) {
					V.PC = donatrix;
				}
				const {
					He,
					he, his, him
				} = getPronouns(receptrix);
				if (receptrix.fetish === Fetish.MINDBROKEN) {
					r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
				} else if ((receptrix.fetish === "pregnancy") && (receptrix.fetishStrength > 60) && (receptrix.fetishKnown === 1)) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. ${He} was overjoyed at the sight of the syringe containing ${his} future ${child} emptying into ${his} womb.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He} is  filled with joy over the life resettling into ${his} womb and can't wait to see the result. ${He}'s so pleased that ${he} now trusts your plans for ${his} body.`);
					receptrix.trust += 4;
					receptrix.devotion += 10;
				} else if (receptrix.devotion > 50) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. ${He} watched the syringe containing ${his} new pregnancy empty into ${his} womb with rapt attention.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He}'s <span class="devotion inc">grateful</span> that you think ${him} worthy of carrying ${bulk ? "these children" : "this child"} in`);
					if (donatrix.ID === -1) {
						r.push(`your stead,`);
					} else {
						r.push(`lieu of ${donatrix.slaveName},`);
					}
					r.push(`and a little nervous about how ${he}'ll perform as a surrogate.`);
					receptrix.devotion += 4;
				} else if (receptrix.devotion >= -20) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. From the syringe making contact with ${his} skin, to the egg's delivery into ${his} womb and ${his} subsequent impregnation, ${he} couldn't look away.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He} understands the realities of ${his} life as a slave, so it isn't much of a shock. ${He} is sensibly fearful of your total power over ${his} body and how you are forcing`);
					if (donatrix.ID === -1) {
						r.push(`your pregnancy upon ${him}.`);
					} else {
						r.push(`${him} to carry what should have been ${donatrix.slaveName}'s burden.`);
					}
					receptrix.trust -= 10;
				} else {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. The moment ${he} realized what was happening, ${he} shut ${his} eyes tight, only opening them again as ${he} feels the slight tingle of the injector exiting ${his} lower abdomen.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He} does not understand the realities of ${his} life as a slave at a core level, so ${he}'s <span class="devotion dec">terrified and angry</span> that you have forced ${him} to`);
					if (donatrix.ID === -1) {
						r.push(`carry your ${child} instead of doing so yourself.`);
					} else {
						r.push(`bear ${bulk ? "these children" : "this child"} in lieu of ${donatrix.slaveName}.`);
					}
					r.push(`${He} is <span class="trust dec">sensibly fearful</span> of your total power over ${his} body and who else's troubles may be levied upon ${him}.`);
					receptrix.trust -= 15;
					receptrix.devotion -= 15;
				}
			}
			V.receptrix = 0;
			V.donatrix = 0;
			V.wombIndex = 0;
			break;
		}
		case "clone":
			if (receptrix.ID === -1) {
				r.push(`Since the surgery required only a local anesthetic, you remain fully aware of the procedure as the autosurgery carries it out. You slowly rise to your feet, a hand to your lower belly, appreciating the clone growing within you.`);
				V.PC.pregKnown = 1;
				WombImpregnateClone(V.PC, 1, donatrix, 1);
				WombNormalizePreg(V.PC);
			} else {
				receptrix.pregKnown = 1;
				WombImpregnateClone(receptrix, 1, donatrix, 1);
				WombNormalizePreg(receptrix);
				const {
					He,
					he, his, him
				} = getPronouns(receptrix);
				if (receptrix.fetish === Fetish.MINDBROKEN) {
					r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen,`);
					if (receptrix.ID === donatrix.ID) {
						r.push(`but has no idea ${he} carries ${his} own clone.`);
					} else {
						r.push(`${he} knows that ${he} has been impregnated.`);
					}
				} else if (receptrix.fetish === "pregnancy" && receptrix.fetishStrength > 60 && receptrix.fetishKnown === 1) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. ${He} was overjoyed at the sight of the syringe containing ${his}`);
						if (receptrix.ID === donatrix.ID) {
							r.push(`clone`);
						} else {
							r.push(`future child`);
						}
						r.push(`emptying into ${his} womb.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated${(receptrix.ID === donatrix.ID) ? `, but not that ${he} now bears ${his} own clone` : ''}.`);
					}
					r.push(`${He} is  filled with joy over the life settling into ${his} womb and can't wait to see the result. ${He}'s so pleased that ${he} now trusts your plans for ${his} body.`);
					receptrix.trust += 4;
					receptrix.devotion += 10;
				} else if (receptrix.devotion > 50) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. ${He} watched the syringe containing ${his} new pregnancy empty into ${his} womb with rapt attention.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated${(receptrix.ID === donatrix.ID) ? `, but not that ${he} now bears ${his} own clone` : ''}.`);
					}
					r.push(`${He}'s <span class="devotion inc">grateful</span> that you think ${him} worthy of carrying this child, and a little nervous about how ${he}'ll perform as a surrogate.`);
					receptrix.devotion += 4;
				} else if (receptrix.devotion >= -20) {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. From the syringe making contact with ${his} skin, to the egg's delivery into ${his} womb and ${his} subsequent impregnation, ${he} couldn't look away.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated${(receptrix.ID === donatrix.ID) ? `, but not that ${he} now bears ${his} own clone` : ''}.`);
					}
					r.push(`${He} understands the realities of ${his} life as a slave, so it isn't much of a shock. ${He} is <span class="trust dec">sensibly fearful</span> of your total power over ${his} body.`);
					receptrix.trust -= 10;
				} else {
					if (canSee(receptrix)) {
						r.push(`Since the surgery required only a local anesthetic, ${receptrix.slaveName} remained fully aware throughout the procedure. The moment ${he} realized what was happening, ${he} shut ${his} eyes tight, only opening them again as ${he} feels the slight tingle of the injector exiting ${his} lower abdomen.`);
					} else {
						r.push(`${receptrix.slaveName} leaves the surgery with a certain warmth in ${his} lower abdomen, ${he} knows that ${he} has been impregnated.`);
					}
					r.push(`${He} does not understand the realities of ${his} life as a slave at a core level, so ${he}'s <span class="devotion dec">terrified and angry</span> that you have forced ${him} to bear`);
					if (receptrix.ID === donatrix.ID) {
						r.push(`${his} own clone and potential replacement.`);
					} else {
						r.push(`this child, even more so as ${he} realizes ${he} doesn't know who the father is.`);
					}
					r.push(`${He} is <span class="trust dec">sensibly fearful</span> of your total power over ${his} body and the future of the life ${he} now harbors within ${him}.`);
					receptrix.trust -= 15;
					receptrix.devotion -= 15;
				}
			}
			V.receptrix = 0;
			V.donatrix = 0;
	}
	App.Events.addParagraph(node, r);
	return node;
};


code:
/* subscribe to game save/load events */
Save.onLoad.add(App.EventHandlers.onLoad);
Save.onSave.add(App.EventHandlers.onSave);

/* ### Every-time listeners #### */

$(document).on(":storyready", () => {
	App.EventHandlers.storyReady();
});

$(document).on(":passageinit", () => {
	App.Utils.PassageSwitchHandler.execute();
	App.UI.Tabs.clear();
	App.Reminders.clear();
	App.UI.StoryCaption.encyclopedia = "";
	profileEvents.passageinit();
});

$(document).on(":passagestart", event => {
	App.Debug.slavesConsistency(event);
	Object.defineProperty(State.temporary, "S", {
		get: () => S,
		enumerable: true
	});
	profileEvents.passagestart();
});

$(document).on(":passagerender", () => {
	profileEvents.passagerender();
});

$(document).on(":passagedisplay", () => {
	profileEvents.passagedisplay();
});

$(document).on(":passageend", ev => {
	profileEvents.passageend(ev.content);
});

/* ### One-time listeners ### */

$(document).one(":passagestart", () => {
	App.EventHandlers.optionsChanged();
});

repo_name: Arkerthan/fc

license: mit


code:
[submodule "submodules/sugarcube-2"]
	branch = fc


code:
{
	const getProxy = App.Utils.Diff.getProxy;

	App.Testing.executeTest("Overwrite first level", () => {
	}, () => {
		let proxy = getProxy({a: 1});

		proxy.a = 2;

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {a: 1});
		App.Testing.equals(proxy.a, 2);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {a: 2});
	}, () => {
	});

	App.Testing.executeTest("Overwrite second level", () => {
	}, () => {
		let proxy = getProxy({c: {a: 1}});

		proxy.c.a = 2;

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {c: {a: 1}});
		App.Testing.equals(proxy.c.a, 2);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {c: {a: 2}});
	}, () => {
	});

	App.Testing.executeTest("Delete first level", () => {
	}, () => {
		let proxy = getProxy({a: 1});

		delete proxy.a;

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {a: 1});
		App.Testing.hasNoProperty(proxy, "a");

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {});
	}, () => {
	});

	App.Testing.executeTest("Delete in second level", () => {
	}, () => {
		let proxy = getProxy({c: {a: 1}});

		delete proxy.c.a;

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {c: {a: 1}});
		App.Testing.hasProperty(proxy, "c");
		App.Testing.hasNoProperty(proxy.c, "a");

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {c: {}});
	}, () => {
	});

	App.Testing.executeTest("Delete with second level", () => {
	}, () => {
		let proxy = getProxy({c: {a: 1}});

		delete proxy.c;

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {c: {a: 1}});
		App.Testing.hasNoProperty(proxy, "c");

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {});
	}, () => {
	});

	App.Testing.executeTest("add value", () => {
	}, () => {
		let proxy = getProxy({});

		proxy.d = 7;

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {});
		App.Testing.hasProperty(proxy, "d");
		App.Testing.equals(proxy.d, 7);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {d: 7});
	}, () => {
	});

	App.Testing.executeTest("add object", () => {
	}, () => {
		let proxy = getProxy({});

		proxy.d = {a: 5};

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {});
		App.Testing.hasProperty(proxy, "d");
		App.Testing.hasProperty(proxy.d, "a");
		App.Testing.equals(proxy.d.a, 5);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {d: {a: 5}});
	}, () => {
	});

	App.Testing.executeTest("Overwrite array entry", () => {
	}, () => {
		let proxy = getProxy({b: [1, 2]});

		proxy.b[1] = 5;

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {b: [1, 2]});
		App.Testing.equals(proxy.b, [1, 5]);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {b: [1, 5]});
	}, () => {
	});

	App.Testing.executeTest("array push", () => {
	}, () => {
		let proxy = getProxy({b: [1, 2]});

		proxy.b.push(5);

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {b: [1, 2]});
		App.Testing.equals(proxy.b, [1, 2, 5]);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {b: [1, 2, 5]});
	}, () => {
	});

	App.Testing.executeTest("array pop", () => {
	}, () => {
		let proxy = getProxy({b: [1, 2]});

		proxy.b.pop();

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {b: [1, 2]});
		App.Testing.equals(proxy.b, [1]);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {b: [1]});
	}, () => {
	});

	App.Testing.executeTest("new array unshift", () => {
	}, () => {
		let proxy = getProxy({});

		proxy.d = {a: [5]};
		proxy.d.a.unshift(9);

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {});
		App.Testing.hasProperty(proxy.d, "a");
		App.Testing.equals(proxy.d.a, [9, 5]);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original, {d: {a: [9, 5]}});
	}, () => {
	});

	App.Testing.executeTest("remove one eye", () => {
	}, () => {
		let proxy = getProxy({eye: new App.Entity.EyeState()});

		eyeSurgery(proxy, "left", "remove");

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {eye: new App.Entity.EyeState()});
		App.Testing.equals(proxy.eye.left, null);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original.eye.left, null);
	}, () => {
	});

	App.Testing.executeTest("remove both eyes", () => {
	}, () => {
		let proxy = getProxy({eye: new App.Entity.EyeState()});

		eyeSurgery(proxy, "both", "remove");

		const original = proxy.diffOriginal;

		App.Testing.equals(original, {eye: new App.Entity.EyeState()});
		App.Testing.equals(proxy.eye.left, null);
		App.Testing.equals(proxy.eye.right, null);

		App.Utils.Diff.applyDiff(original, proxy.diffChange);
		App.Testing.equals(original.eye.left, null);
		App.Testing.equals(original.eye.right, null);
	}, () => {
	});

	// Do this last
	App.Testing.unitDone();
}


code:
{
	class MockSlave {
		ID;
		mother;
		father;

		constructor(id) {
			this.ID = id;
		}
	}

	class MockMating {
		constructor(fatherId, motherId, ...childrenIds) {
			for (let id of childrenIds) {
				if (id === fatherId || id === motherId) {
					throw new Error("cannot give birth to self");
				}
			}

			this.fatherId = fatherId;
			this.motherId = motherId;
			this.childrenIds = childrenIds;
		}
	}

	class MockWorld {
		slavesArray;

		constructor(matings) {
			this.slavesArray = [];

			let slavesById = {};
			let meetSlave = (id) => {
				if (!slavesById[id]) {
					let slave = new MockSlave(id);
					this.slavesArray.push(slave);
					slavesById[id] = slave;
				}

				return slavesById[id];
			};

			for (let mating of matings) {
				let father = meetSlave(mating.fatherId);
				let mother = meetSlave(mating.motherId);
				for (let id of mating.childrenIds) {
					let child = meetSlave(id);
					child.father = father.ID;
					child.mother = mother.ID;
				}
			}
		}

		findSlaveState(id) {
			return this.slavesArray.find(slave => slave.ID === id) || null;
		}
	}

	let testCoefficientForSlave = function(name, mockMatings, slaveId, expectedCoefficientOfInbreeding) {
		App.Testing.executeTest(name, () => {}, () => {
			let tolerance = .00000000001;

			let world = new MockWorld(mockMatings);
			let c = ibc._test.coeff_slave(world, world.findSlaveState(slaveId));
			App.Testing.isType(c, "number");
			App.Testing.notNaN(c);
			App.Testing.inRange(c, expectedCoefficientOfInbreeding, tolerance);
		}, () => {});
	};

	// references:
	// Introduction to Quantitative Genetics - Doulas S. Falconer, 1989
	// Genetic and Quantitative Aspects of Genealogy - F.M. Lancaster, 2015
	testCoefficientForSlave("basic outbred mating, 1",[new MockMating(1, 2, 3, 4)], 1, 0);
	testCoefficientForSlave("basic outbred mating, 2",[new MockMating(1, 2, 3, 4)], 4, 0);
	testCoefficientForSlave("basic self-mating, 1", [new MockMating(1, 1, 3, 4)], 4, 1 / 2);
	testCoefficientForSlave("basic self-mating, 2", [new MockMating(1, 1, 3, 4)], 1, 0);
	testCoefficientForSlave("basic child-parent mating",[new MockMating(1, 2, 3), new MockMating(2, 3, 4)], 4, 1 / 4);
	testCoefficientForSlave("basic sibling mating",[new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5)], 5, 1 / 4);
	testCoefficientForSlave("basic half-sibling mating",[new MockMating(1, 2, 3), new MockMating(2, 4, 5), new MockMating(3, 5, 6)], 6, 1 / 8);
	testCoefficientForSlave("basic first cousin mating",[new MockMating(1, 2, 3, 4), new MockMating(5, 3, 6), new MockMating(4, 7, 8), new MockMating(6, 8, 9)], 9, 1 / 16);
	testCoefficientForSlave("double first cousin mating",[new MockMating(1, 2, 3, 4), new MockMating(5, 6, 7, 8),
		new MockMating(3, 7, 9), new MockMating(4, 8, 10), new MockMating(9, 10, 11)], 11, 1 / 8);
	testCoefficientForSlave("aunt-niece mating",[new MockMating(1, 2, 3, 4), new MockMating(4, 5, 6), new MockMating(3, 6, 7)], 7, 1 / 8);
	let scenario53 = [new MockMating(1, 2, 3, 4), new MockMating(5, 6, 7, 8), new MockMating(3, 7, 9, 10), new MockMating(4, 8, 11),
		new MockMating(12, 9, 13), new MockMating(10, 11, 14), new MockMating(13, 14, 15)];
	testCoefficientForSlave("problem 5.3 from Falconer, 1",scenario53, 14, 1 / 8);  //
	testCoefficientForSlave("problem 5.3 from Falconer, 2",scenario53, 15, 3 / 32);
	testCoefficientForSlave("example in figure 64 from Lancaster",[new MockMating(1, 2, 4, 5), new MockMating(3, 4, 7), new MockMating(5, 6, 8), new MockMating(7, 8, 9), new MockMating(9, 10, 12, 13),
		new MockMating(11, 12, 15), new MockMating(13, 14, 16), new MockMating(15, 16, 17, 18)], 17, 33 / 512);
	testCoefficientForSlave("example in figure 65 from Lancaster",[new MockMating(1, 2, 4, 5), new MockMating(3, 4, 7), new MockMating(5, 6, 8), new MockMating(7, 8, 10, 11),
		new MockMating(9, 10, 13), new MockMating(11, 12, 14), new MockMating(13, 14, 15)], 15, 9 / 128);
	testCoefficientForSlave("example in figure 66 from Lancaster",[new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5, 6), new MockMating(5, 6, 7, 8), new MockMating(7, 8, 9)], 9, 1 / 2);
	testCoefficientForSlave("example in figure 66 from Lancaster, extended by one more generation's worth of mating between siblings",[new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5, 6), new MockMating(5, 6, 7, 8), new MockMating(7, 8, 9, 10),
		new MockMating(9, 10, 11)], 11, 19 / 32);
	// from here the preceding scenario of regular sibling-mating is extended by several more steps; by rules given in Falconer, the coefficient ck for step k, where step k follows
	// step j which follows step i, should be ck = 1/4 + cj/2 + ci/4, and so that is how the expected values used in the next few tests were calculated
	testCoefficientForSlave("extended, 1: 43/64 = 1/4 + (19/32) / 2 + (1/2) / 4",[new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5, 6), new MockMating(5, 6, 7, 8), new MockMating(7, 8, 9, 10),
		new MockMating(9, 10, 11, 12), new MockMating(11, 12, 13)], 13, 43 / 64);
	testCoefficientForSlave("extended, 2",[new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5, 6), new MockMating(5, 6, 7, 8), new MockMating(7, 8, 9, 10),
		new MockMating(9, 10, 11, 12), new MockMating(11, 12, 13, 14), new MockMating(13, 14, 15)], 15, 94 / 128);
	testCoefficientForSlave("extended, 3", [new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5, 6), new MockMating(5, 6, 7, 8), new MockMating(7, 8, 9, 10),
		new MockMating(9, 10, 11, 12), new MockMating(11, 12, 13, 14), new MockMating(13, 14, 15, 16), new MockMating(15, 16, 17)], 17, 201 / 256);
	testCoefficientForSlave("extended, 4", [new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5, 6), new MockMating(5, 6, 7, 8), new MockMating(7, 8, 9, 10),
		new MockMating(9, 10, 11, 12), new MockMating(11, 12, 13, 14), new MockMating(13, 14, 15, 16), new MockMating(15, 16, 17, 18), new MockMating(17, 18, 19)], 19, 423 / 512);
	testCoefficientForSlave("extended, 5", [new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5, 6), new MockMating(5, 6, 7, 8), new MockMating(7, 8, 9, 10),
		new MockMating(9, 10, 11, 12), new MockMating(11, 12, 13, 14), new MockMating(13, 14, 15, 16), new MockMating(15, 16, 17, 18), new MockMating(17, 18, 19, 20),
		new MockMating(19, 20, 21)], 21, 880 / 1024);
	// Does not apply to current algorithm: as of this writing, the ten-generations-of-sisterfucking test immediately above is enough to occupy the game's coefficient-of-inbreeding calculation algorithm for a few minutes
	// on a ~4Ghz CPU.  this is very silly.  when you read this, that algorithm should have been replaced by a much faster one, allowing the above test to be comfortably run again.
	let scenario70 = [new MockMating(1, 2, 6), new MockMating(2, 3, 7), new MockMating(3, 4, 8), new MockMating(5, 6, 9), new MockMating(7, 8, 10),
		new MockMating(9, 10, 12), new MockMating(10, 11, 13), new MockMating(12, 13, 14), new MockMating(12, 14, 15)];  // example in figure 70 from Lancaster
	testCoefficientForSlave("example in figure 70 from Lancaster, 1", scenario70, 2, 0);
	testCoefficientForSlave("example in figure 70 from Lancaster, 2", scenario70, 10, 1 / 8);
	testCoefficientForSlave("example in figure 70 from Lancaster, 3", scenario70, 12, 1 / 32);
	testCoefficientForSlave("example in figure 70 from Lancaster, 4", scenario70, 15, 85 / 256);
	let scenarioXXX = [new MockMating(1, 2, 5, 6), new MockMating(3, 4, 7, 8), new MockMating(5, 6, 9, 10), new MockMating(5, 7, 11), new MockMating(5, 8, 12),
		new MockMating(5, 9, 13), new MockMating(9, 10, 14), new MockMating(5, 11, 15), new MockMating(10, 12, 16), new MockMating(13, 16, 17),
		new MockMating(4, 16, 18), new MockMating(14, 15, 19), new MockMating(6, 17, 20), new MockMating(6, 18, 21), new MockMating(6, 19, 22),
		new MockMating(20, 21, 23), new MockMating(22, 23, 24)];  // an invented example meant to represent a typical situation in a respectable arcology
	testCoefficientForSlave("change, 1",scenarioXXX, 24, 633 / 2048);  // here the expected coefficient was retrieved from the algorithm being tested and was not separately verified by hand,
	// so this test could conceivably be wrong, but at least it can catch changes...
	testCoefficientForSlave("change, 2",[new MockMating(1, 2, 3, 4), new MockMating(3, 4, 5, 6), new MockMating(5, 6, 7, 8), new MockMating(7, 8, 9, 10), new MockMating(9, 10, 11, 12),
		new MockMating(11, 12, 13), new MockMating(13, 14, 15),
		new MockMating(5, 5, 16), new MockMating(15, 16, 17)], 17, 1 / 4);  // an example in which the old and new algorithms actually gave different results - the first one such to have been observed! It seems that the old algorithm was wrong
	testCoefficientForSlave("negative IDs, 1",[new MockMating(-120, -120, 87)], 87, 1 / 2);  // negative IDs need to be accepted (not bothering to test any weird special IDs like -1 here though)
	testCoefficientForSlave("negative IDs, 2",[new MockMating(-999, -998, -300), new MockMating(-300, -998, 300)], 300, 1 / 4);

	// Do this last
	App.Testing.unitDone();
}


code:
// Define Test framework and register all tests

// To run all tests, type 'App.Loader.executeTests()' in the browser console. Make sure the HTML file has not been
// moved from the 'bin/' directory

// First, create the test framework
App.Testing = (function() {
	// First, abstract away anything test unrelated
	const group = App.Loader.getGroup("../tests");

	function addTestUnit(path) {
		group.queueSubscript(path);
	}

	let unitTotal = 0;
	let unitSuccesses = 0;

	function start() {
		App.Loader.nextScript();
	}

	function unitDone() {
		console.log("Group '" + App.Loader.lastScript + "' done. Successful tests:", unitSuccesses, "of", unitTotal);
		unitTotal = 0;
		unitSuccesses = 0;
		App.Loader.nextScript();
	}

	// Actual Testing functionality
	class TestError extends Error {
	}

	/**
	 * @param {string} name Unique test name
	 * @param {null|(()=>void)} prepare Prepare the global state
	 * @param {!(()=>void)} test Do the actual testing
	 * @param {null|(()=>void)} cleanup Clean the global state up
	 */
	function executeTest(name, prepare, test, cleanup) {
		unitTotal++;
		try {
			if (prepare != null) {
				prepare();
			}
		} catch (e) {
			console.log("PREPARE_FAILED", name, e);
			tryCleanup(name, cleanup);
			return;
		}
		try {
			test();
		} catch (e) {
			console.log("TEST_FAILED", name, e);
			tryCleanup(name, cleanup);
			return;
		}
		if (tryCleanup(name, cleanup)) {
			unitSuccesses++;
		}
	}

	/**
	 * @param {string} name Unique test name
	 * @param {null|(()=>void)} cleanup Clean the global state up
	 */
	function tryCleanup(name, cleanup) {
		try {
			if (cleanup != null) {
				cleanup();
			}
		} catch (e) {
			console.log("CLEANUP_FAILED", name, e);
			return false;
		}
		return true;
	}

	function equals(actual, expected) {
		if (!_.isEqual(actual, expected)) {
			throw new TestError("Actual value does not match expected value");
		}
	}

	/**
	 * @param {object} obj
	 * @param {string} property
	 */
	function hasProperty(obj, property) {
		if (obj[property] === undefined) {
			throw new TestError("Expected property does not exist");
		}
	}

	/**
	 * @param {object} obj
	 * @param {string} property
	 */
	function hasNoProperty(obj, property) {
		if (obj[property] !== undefined) {
			throw new TestError("Unexpected property exists");
		}
	}

	function isType(value, expected) {
		if (!(typeof value === expected)) {
			throw new TestError("Actual type does not match expected type");
		}
	}

	function notNaN(value) {
		if (Number.isNaN(value)) {
			throw new TestError("Expected valid number, got NaN.");
		}
	}

	function inRange(value, target, tolerance) {
		if (Math.abs(value - target) > tolerance) {
			throw new TestError(`Value ${value} outside range. Expected ${target} with tolerance ${tolerance}.`);
		}
	}

	return {
		addTestUnit, start, unitDone, executeTest,
		equals, hasProperty, hasNoProperty: hasNoProperty, isType, notNaN, inRange,
	};
})();

// Now load all tests
App.Testing.addTestUnit("diffProxy");
App.Testing.addTestUnit("ibc");

// Finally, execute the tests
App.Testing.start();


code:
:root {
    /* base */
    --background-color: #1c1d24;
    --sidebar-color: #212534;/*#2b2f42;*/
    --sidebar-hover-color: #40486e;
    --text-color: #e1e1e1;
    --divider-color: #888;

    /* button */
    --button-color: #2b2640;
    --button-border-color: #2b2640;
    --button-selected-color: #524064;
    --button-hover-color: #524064;
    --button-disabled-color: #22162e;

    --link-color: #6574cd;
    --link-hover-color: #6589e7;
}

.aquamarine, .aquamarine a, .skill, .skill a { color: #43e9e9 }
.coral, .coral a, .fetish.loss, .fetish.loss a { color: #ff8b39 }
.cyan, .cyan a, .hotkey { color: #00dfdf }
/*
.darkgoldenrod, .darkgoldenrod a, .trust.extremely-terrified, .trust.extremely-terrified a { color: darkgoldenrod }
.darkred, .darkred a, .defiant.full, .defiant.full a { color: darkred }
.darkviolet, .darkviolet a, .devotion.hateful, .devotion.hateful a { color: darkviolet }
*/
.deeppink, .deeppink a, .devotion.devoted, .devotion.devoted a { color: #ff4dad }
/*
.steelblue, .steelblue a { color: steelblue }
*/
.deepskyblue, .deepskyblue a, .intelligent, .intelligent a { color: #26bdef }
/*
.dodgerblue, .dodgerblue a { color: dodgerblue }
.blue, .blue a { color: blue }
*/
.gold, .gold a, .trust.dec, .trust.dec a, .trust.frightened, .trust.frightened a { color: #ffd90c }
/*
.goldenrod, .goldenrod a, .trust.terrified, .trust.terrified a { color: goldenrod }
.gray, .gray a { color: gray }
*/
.green, .green a, .reputation.inc, .reputation.inc a, .improvement, .improvement a, .flaw.break, .flaw.break a, .skill.inc, .skill.inc a, .positive, .positive a { color: #18af18 }
.hotpink, .hotpink a, .devotion.inc, .devotion.inc a, .devotion.accept, .devotion.accept a { color: #ff86c3 }
/*
.lawngreen, .lawngreen a { color: lawngreen }
.lightblue, .lightblue a { color: lightblue }
*/
.lightcoral, .lightcoral a, .fetish.gain, .fetish.gain a { color: #e762e3 }
.lightgreen, .lightgreen a, .relationship, .relationship a { color: #00cb7a }
/*
.lightpink, .lightpink a { color: lightpink }
.lightsalmon, .lightsalmon a, .fetish.inc, .fetish.inc a { color: lightsalmon }
*/
.lime, .lime a, .change.positive, .change.positive a, .virginity.loss, .virginity.loss a, .pregnant, .pregnant a { color: #40ff40 }
.limegreen, .limegreen a { color: limegreen }
.magenta, .magenta a, .devotion.worship, .devotion.worship a { color: #ff36ff }
.mediumaquamarine, .mediumaquamarine a, .trust.inc, .trust.inc a, .trust.careful, .trust.careful a { color: #52d3d3 }

.mediumorchid, .mediumorchid a, .devotion.dec, .devotion.dec a, .devotion.resistant, .devotion.resistant a { color: #bc60d3 }
/*
.mediumseagreen, .mediumseagreen a, .trust.trusting, .trust.trusting a { color: mediumseagreen }
*/
.orange, .orange a, .stupid, .stupid a, .change.negative, .change.negative a, .defiant.careful, .defiant.careful a, .intro.question { color: #ffbb3e }
/*
.orangered, .orangered a, .defiant.inc, .defiant.inc a, .defiant.bold, .defiant.bold, .education.neg a { color: orangered }
.orchid, .orchid a { color: orchid }
*/
.pink, .pink a, .slave.name.simple, .slave-name { color: #ff9fc3 }
.red, .red a, .health.dec, .health.dec a, .cash.dec, .cash.dec a, .flaw.gain, .flaw.gain a, .error, .error a, .elites.loss, .elites.loss a, .reputation.dec, .reputation.dec a, .warning, .warning a { color: #ff3131 }
/*.seagreen, .seagreen a, .trust.prof-trusting, .trust.prof-trusting a { color: seagreen }
.springgreen, .springgreen a, .skill.player, .skill.player a { color: springgreen }
*/
.tan, .tan a { color: #d2b48c }
/*
.chocolate, .chocolate a { color: chocolate }
.saddlebrown, .saddlebrown a { color: saddlebrown }
.teal, .teal a { color: teal }
*/
.yellow, .yellow a, .noteworthy, .noteworthy a, .devotion.ambivalent, .devotion.ambivalent a, .trust.fearful, .trust.fearful a { color: #f7f754 }
.yellowgreen, .yellowgreen a, .cash.inc, .cash.inc a, .cash, .cash a { color: #9acd32 }


code:
#init-screen {
	color: var(--text-color);
	background-color: var(--background-color);
}


code:
body {
	color: var(--text-color);
	background-color: var(--background-color);
}

a {
	color: var(--link-color);
}

a:hover {
	color: var(--link-hover-color);
}

button {
	color: var(--text-color);
	background-color: var(--button-color);
	border: 1px solid var(--button-border-color);
}

button:hover {
	background-color: var(--button-hover-color);
	border-color: var(--button-border-color);
}

button:disabled {
	background-color: var(--button-disabled-color);
	border: 1px solid var(--button-border-color);
}

input, select, textarea {
	color: #e1e1e1;
	background-color: transparent;
	border: 1px solid var(--button-border-color);
}

input:not(:disabled):focus, select:not(:disabled):focus, textarea:not(:disabled):focus,
input:not(:disabled):hover, select:not(:disabled):hover, textarea:not(:disabled):hover {
	background-color: #2b2640;
	border-color: var(--button-selected-color);
}

hr {
	border-top: 1px solid var(--divider-color);
}


code:
#ui-dialog-titlebar {
	background-color: var(--sidebar-color);
}
#ui-dialog-body {
	background-color: var(--background-color);
	border: 1px solid var(--divider-color);
}
#ui-dialog-body hr {
	background-color: var(--divider-color);
}


code:
/* Saves dialog styling. */
#ui-dialog-body.saves > *:not(:first-child) {
	border-top-color: var(--divider-color);
}
#ui-dialog-body.saves tr:not(:first-child) {
	border-top-color: var(--divider-color);
}
#ui-dialog-body.saves .empty {
	color: var(--text-color);
}


code:
#ui-bar {
	background-color: var(--sidebar-color);
	border-right: 1px solid var(--divider-color);
}
#ui-bar a:hover {
	text-decoration: underline;
}
#ui-bar hr {
	border-color: var(--divider-color);
}
#ui-bar-toggle{
	color: #444;
	border: 1px solid var(--divider-color);
	border-right: none;
}
#ui-bar-toggle:hover {
	background-color: var(--sidebar-hover-color);
	border-color: var(--divider-color);
}
#menu ul {
	border: 1px solid var(--divider-color);
}
#menu li:not(:first-child) {
	border-top: 1px solid var(--divider-color);
}
#menu li a {
	color: var(--text-color);
	background-color: transparent;
	border: none;
}
#menu li a:hover {
	background-color: var(--sidebar-hover-color);
	text-decoration: none;
}


code:
div.building.basement {
	border-top-color: #8F8F8F;
	background-image: repeating-linear-gradient(135deg, transparent, transparent 20px, #8F8F8F 20px, #8F8F8F 30px);
}

div.building .row .penthouse{
	border-color: #5daad7;
}

div.building .row .apartments{
	border-color: #3eaf3e;
}

div.building .row .private{
	border-color: #cb1a1a;
}

div.building .row .pit{
	border-color: #d94c18;
}

div.building div.innerCell {
	background-color: var(--background-color);
}

div.building div.decorative {
	outline-color: black;
}

/* introduction special formatting */
/* makes all links unusable */
.intro div.building a {
	color: var(--text-color);
}

div.building div.row div.dairy {
	border-color: saddlebrown;
}


code:
div.card {
	/*border: none;*/
	border-color: #384678;
	background-color: #212534;
	box-shadow: 10px 10px 5px #282d40;
}


code:
.lrgRender > div.mask, .lrgVector > div.mask {
	background: linear-gradient(90deg, rgba(28, 29, 36, 1), rgba(28, 29, 36, 0.8) 60%, rgba(28, 29, 36, 0));
}

.clear-formatting {
	color: var(--text-color);
}


code:
div.options-group .comment {
	color: #575757;
}


code:
div.quick-links div.toggle {
	background-color: var(--button-color);
}

div.quick-links div.toggle:hover {
	background-color: var(--button-hover-color);
}

div.quick-links div.menu-link {
	background-color: var(--button-disabled-color);
	border-color: var(--button-border-color);
	box-shadow: var(--button-border-color);
}

div.quick-links div.notification:not(.category)::after,
div.quick-links div.category.notification.collapsed > div.toggle::after {
	content: "\e80b";
}


code:
:root {
    /* base */
    --background-color: #fff;
    --sidebar-color: #ccf;
    --sidebar-hover-color: #99f;
    --text-color: #000;
    --divider-color: #888;

    /* button */
    --button-color: #b38cd9;
    --button-border-color: #9966cc;
    --button-selected-color: #663399;
    --button-hover-color: #ccb3e6;
    --button-disabled-color: #8c70a9;

    --link-color: #2A52B7;
    --link-hover-color: #446DD5;
}

.aquamarine, .aquamarine a, .skill, .skill a { color: #008563 }
.coral, .coral a, .fetish.loss, .fetish.loss a { color: #8a5c2e }
.cyan, .cyan a, .hotkey { color: #008585 }
/*
.darkgoldenrod, .darkgoldenrod a, .trust.extremely-terrified, .trust.extremely-terrified a { color: darkgoldenrod }
.darkred, .darkred a, .defiant.full, .defiant.full a { color: darkred }
.darkviolet, .darkviolet a, .devotion.hateful, .devotion.hateful a { color: darkviolet }
.deeppink, .deeppink a, .devotion.devoted, .devotion.devoted a { color: deeppink }
.steelblue, .steelblue a { color: steelblue }
*/
.deepskyblue, .deepskyblue a, .intelligent, .intelligent a { color: #00B4F0 }
/*
.dodgerblue, .dodgerblue a { color: dodgerblue }
.blue, .blue a { color: blue }
*/
.gold, .gold a, .trust.dec, .trust.dec a, .trust.frightened, .trust.frightened a { color: #cc8d00 }
/*
.goldenrod, .goldenrod a, .trust.terrified, .trust.terrified a { color: goldenrod }
.gray, .gray a { color: gray }
*/
.green, .green a, .reputation.inc, .reputation.inc a, .improvement, .improvement a, .flaw.break, .flaw.break a, .skill.inc, .skill.inc a, .positive, .positive a { color: #006600 }
/*
.hotpink, .hotpink a, .devotion.inc, .devotion.inc a, .devotion.accept, .devotion.accept a { color: hotpink }
.lawngreen, .lawngreen a { color: lawngreen }
.lightblue, .lightblue a { color: lightblue }
*/
.lightcoral, .lightcoral a, .fetish.gain, .fetish.gain a { color: #B85C00 }
.lightgreen, .lightgreen a, .relationship, .relationship a { color: #008550 }
/*
.lightpink, .lightpink a { color: lightpink }
.lightsalmon, .lightsalmon a, .fetish.inc, .fetish.inc a { color: lightsalmon }
.lime, .lime a, .change.positive, .change.positive a, .virginity.loss, .virginity.loss a, .pregnant, .pregnant a { color: lime }
.limegreen, .limegreen a { color: limegreen }
.magenta, .magenta a, .devotion.worship, .devotion.worship a { color: magenta }
*/
.mediumaquamarine, .mediumaquamarine a, .trust.inc, .trust.inc a, .trust.careful, .trust.careful a { color: #0F6161 }
/*
.mediumorchid, .mediumorchid a, .devotion.dec, .devotion.dec a, .devotion.resistant, .devotion.resistant a { color: mediumorchid }
.mediumseagreen, .mediumseagreen a, .trust.trusting, .trust.trusting a { color: mediumseagreen }
*/
.orange, .orange a, .stupid, .stupid a, .change.negative, .change.negative a, .defiant.careful, .defiant.careful a, .intro.question { color: #B85C00 }
/*
.orangered, .orangered a, .defiant.inc, .defiant.inc a, .defiant.bold, .defiant.bold, .education.neg a { color: orangered }
.orchid, .orchid a { color: orchid }
*/
.pink, .pink a, .slave.name.simple, .slave-name { color: #E00070 }
/*
.red, .red a, .health.dec, .health.dec a, .cash.dec, .cash.dec a, .flaw.gain, .flaw.gain a, .error, .error a, .elites.loss, .elites.loss a, .reputation.dec, .reputation.dec a, .warning, .warning a { color: red }
.seagreen, .seagreen a, .trust.prof-trusting, .trust.prof-trusting a { color: seagreen }
.springgreen, .springgreen a, .skill.player, .skill.player a { color: springgreen }
*/
.tan, .tan a { color: #846E58 }
/*
.chocolate, .chocolate a { color: chocolate }
.saddlebrown, .saddlebrown a { color: saddlebrown }
.teal, .teal a { color: teal }
*/
.yellow, .yellow a, .noteworthy, .noteworthy a, .devotion.ambivalent, .devotion.ambivalent a, .trust.fearful, .trust.fearful a { color: #cc9600 }
.yellowgreen, .yellowgreen a, .cash.inc, .cash.inc a, .cash, .cash a { color: #677f1f }


code:
body {
	color: var(--text-color);
	background-color: var(--background-color);
}

a {
	color: var(--link-color);
}

a:hover {
	color: var(--link-hover-color);
}

button {
	color: var(--text-color);
	background-color: var(--button-color);
	border: 1px solid var(--button-border-color);
}

button:hover {
	background-color: var(--button-hover-color);
	border-color: var(--button-border-color);
}

button:disabled {
	background-color: var(--button-disabled-color);
	border: 1px solid var(--button-border-color);
}

input, select, textarea {
	color: #333;
	background-color: transparent;
	border: 1px solid var(--button-border-color);
}

input:not(:disabled):focus, select:not(:disabled):focus, textarea:not(:disabled):focus,
input:not(:disabled):hover, select:not(:disabled):hover, textarea:not(:disabled):hover {
	background-color: #e5d9f2;
	border-color: var(--button-selected-color);
}

hr {
	border-top: 1px solid var(--divider-color);
}


code:
#ui-dialog-titlebar {
	background-color: var(--divider-color);
}
#ui-dialog-body {
	background-color: var(--sidebar-color);
	border: 1px solid var(--divider-color);
}
#ui-dialog-body hr {
	background-color: var(--divider-color);
}


code:
div.building.basement {
	border-top-color: #8F8F8F;
	background-image: repeating-linear-gradient(135deg, transparent, transparent 20px, #8F8F8F 20px, #8F8F8F 30px);
}

div.building div.innerCell {
	background-color: var(--background-color);
}

div.building div.decorative {
	outline-color: black;
}

/* introduction special formatting */
/* makes all links unusable */
.intro div.building a {
	color: var(--text-color);
}

div.building div.row div.dairy {
	border-color: saddlebrown;
}


code:
div.card {
	/*border: none;*/
	border-color: #cccccc;
	background-color: #e6e6e6;
	box-shadow: 10px 10px 5px #b3b3b3;
}


code:
.lrgRender > div.mask, .lrgVector > div.mask {
	background: linear-gradient(90deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.8) 60%, rgba(255, 255, 255, 0));
}

.clear-formatting {
	color: var(--text-color);
}


code:
# Themes

Every subdirectory is a distinct theme. The compiled theme is placed in `bin/` and can be loaded ingame via the options
page.

## Creating new themes

Files inside these directories are combined into one CSS file based on
alphabetical ordering. The light theme is recommended as a base for creating new themes.

For quick testing run `App.UI.Theme.loadTheme("yourTheme.css")` in the browser console. This will unload the current
theme and load the new theme. If you modify the same file it is effectively reloading. Supplying no argument (eg.
`App.UI.Theme.loadTheme()`) will unload any theme.


code:
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Start.tw
src/config/start.tw

repo_name: TheBoi/fc

path: .gitignore


code:
# Ignore everything in this directory
*
# Except this file
!.gitignore


code:
#!/bin/bash

# Will add all *.tw files to StoryIncludes.
rm src/config/start.tw
cp src/config/start.tw.proto start.tw.tmp
find src -name '*.tw' -print >>start.tw.tmp
mv start.tw.tmp src/config/start.tw

HASH=`git log -n1 |grep commit | sed 's/commit //'`

./devTools/tweeGo/tweego -o bin/FC_pregmod.html src/config/start.tw

rm src/config/start.tw

path: compile


code:
#!/bin/bash

# Will add all *.tw files to StoryIncludes.
rm src/config/start.tw
cp src/config/start.tw.proto start.tw.tmp
find src -name '*.tw' -print >>start.tw.tmp
mv start.tw.tmp src/config/start.tw

HASH=`git log -n1 |grep -m1 commit | sed 's/commit //'`

./devTools/tweeGo/tweego -o bin/FC_pregmod_$HASH.html src/config/start.tw

rm src/config/start.tw

echo "FC_pregmod_$HASH.html" compilation finished.

path: compile-git


code:
@echo off
:: Free Cities Basic Compiler - Windows x86_64

:: Will add all *.tw files to StoryIncludes.
del src\config\start.tw
copy src\config\start.tw.proto start.tw.tmp >nul
>>start.tw.tmp (for /r "src" %%F in (*.tw) do echo %%F)
move start.tw.tmp src\config\start.tw >nul

CALL "%~dp0devTools\tweeGo\tweego.exe" -o "%~dp0bin/FC_pregmod.html" "%~dp0src\config\start.tw"

del src\config\start.tw
ECHO Done


code:
@echo off
:: Free Cities Basic Compiler - Windows x86_64
:: Will wait for keypress before terminating.

:: Will add all *.tw files to StoryIncludes.
del src\config\start.tw
copy src\config\start.tw.proto start.tw.tmp >nul
>>start.tw.tmp (for /r "src" %%F in (*.tw) do echo %%F)
move start.tw.tmp src\config\start.tw >nul

CALL "%~dp0devTools\tweeGo\tweego.exe" -o "%~dp0bin/FC_pregmod.html" "%~dp0src\config\start.tw"

del src\config\start.tw

ECHO Done
PAUSE


code:
:: slave generation widgets [nobr]

<<widget "NationalityToRace">>

<<if $fixedRace == 0>>

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

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

<<else>>

<<switch $fixedRace>>
<<case "white">>
	<<set $activeSlave.nationality to $whiteNationalities.random()>>
<<case "asian">>
	<<set $activeSlave.nationality to $asianNationalities.random()>>
<<case "latina">>
	<<set $activeSlave.nationality to $latinaNationalities.random()>>
<<case "middle eastern">>
	<<set $activeSlave.nationality to $middleEasternNationalities.random()>>
<<case "black">>
	<<set $activeSlave.nationality to $blackNationalities.random()>>
<<case "indo-aryan">>
	<<set $activeSlave.nationality to $indoAryan"Nationalities.random()>>
<<case "pacific islander">>
	<<set $activeSlave.nationality to $pacificIslanderNationalities.random()>>
<<case "malay">>
	<<set $activeSlave.nationality to $malayNationalities.random()>>
<<case "amerindian">>
	<<set $activeSlave.nationality to $amerindianNationalities.random()>>
<<case "southern european">>
	<<set $activeSlave.nationality to $southernEuropean"Nationalities.random()>>
<<case "semitic">>
	<<set $activeSlave.nationality to $semiticNationalities.random()>>
<</switch>>
<<set $activeSlave.race = $fixedRace>>

<</if>>

<<if $arcologies[0].FSSupremacistLawME != 0>>
<<if $activeSlave.race == $arcologies[0].FSSupremacistRace>>
	<<set $activeSlave.race to "mixed race">>
<</if>>
<</if>>

<</widget>>

<<widget "NationalityToName">>

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

<</widget>>

<<widget "NationalityToAccent">>

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

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

<<if $activeSlave.nationality is $language>>
	<<set $activeSlave.accent to 0>>
<</if>>

<</widget>>

path: devNotes/Slave Generation Widgets.txt


code:
########################################################################################################################
#
# sugarcube-2.py
#
# Copyright (c) 2013-2017 Thomas Michael Edwards <tmedwards@motoslave.net>. All rights reserved.
# Use of this source code is governed by a Simplified BSD License which can be found in the LICENSE file.
#
########################################################################################################################

import os, os.path, header
from collections import OrderedDict

class Header (header.Header):

	def filesToEmbed(self):
		userLibPath = self.path + os.sep + 'userlib.js'
		if os.path.isfile(userLibPath):
			return OrderedDict([
				('"USER_LIB"', userLibPath)
			])
		else:
			return OrderedDict()

	def storySettings(self):
		return "SugarCube 2.x does not support the StorySettings special passage.\n\nInstead, you should use its configuration object, config.\n    See: http://www.motoslave.net/sugarcube/2/docs/config-object.html"

	def isEndTag(self, name, tag):
		return (name == ('/' + tag) or name == ('end' + tag))

	def nestedMacros(self):
		return [
				# standard macros
				'append',
				'button',
				'capture',
				'createplaylist',
				'for',
				'if',
				'link',
				'linkappend',
				'linkprepend',
				'linkreplace',
				'nobr',
				'prepend',
				'repeat',
				'replace',
				'script',
				'switch',
				'silently',
				'timed',
				'widget',
				# deprecated macros
				'click'
			]

	def passageTitleColor(self, passage):
		additionalSpecialPassages = [
				'PassageDone',
				'PassageFooter',
				'PassageHeader',
				'PassageReady',
				'StoryBanner',
				'StoryCaption',
				'StoryShare'
			]
		if passage.isStylesheet():
			return ((111, 49, 83), (234, 123, 184))
		elif passage.isScript():
			return ((89, 66, 28), (226, 170, 80))
		elif ('widget' in passage.tags):
			return ((80, 106, 26), (134, 178, 44))
		elif passage.isInfoPassage() or (passage.title in additionalSpecialPassages):
			return ((28, 89, 74), (41, 214, 113))
		elif passage.title == 'Start':
			return ('#4ca333', '#4bdb24')

	def passageChecks(self):
		return super(Header, self).passageChecks()


code:
How to mod (basic doc):

1. All sources now in the src subdir, in separate files. 1 passage = 1 file.

2. Special files and dir's:
    - src/config 		- configuration of the story is here.
    - src/config/start.tw 	- contains list of .tw passage files, regenerated automatic, by building scripts. Do not change by hands. (origial passage Start from pregmod renamed and moved to src/events/intro/introSummary.tw)
    - src/js/storyJS.tw		- special passage with [script] tag - contain all native JavaScript from pregmod.
    - devTools/tweeGo/targets/sugarcube-2/userlib.js - on original FC JS moved here (I deleted it after moving JS to storyJS.tw). Compare to storyJS.tw but do not copy file here. May conflict with src/js/storyJS.tw if copied.
    - src/pregmod 		- I put all pregmod-only passages here.
    - .gitignore 		- special file for git - to ignore some files. For example - compilation results.

3. Compilation:

    Windows:
    Run compile.bat - result will be file bin/FC_pregmod.html
    Second run of compile.but will overwrite bin/FC_pregmod.html without prompt.

    Linux:
    Ensure executable permission on file "devTools/tweeGo/tweego" (not tweego.exe!)
    Ensure executable permission on file "compile"
    In the root dir of sources (where you see src, devTools, bin...) run command "./compile" from console
    compile-git will produce the same result file but with current commit hash in filename.

    Mac:
    Don't supported directly (I don't have access to Mac for testing).
    But potentially can be used linux compilation script if you download tweego for mac from here: https://bitbucket.org/tmedwards/tweego/downloads/ and replace linux executable with mac executable in ./devTools/tweeGo/ folder. This is not tested though.

4. Simple comparing and merging with original FC:

    Use meld tool. Place folder FreeCities (original FC sources tree) near FreeCitiesPregmod (this sources tree) and use command:
    meld FreeCities FreeCitiesPregmod
    or just select these folders in meld's GUI.

5. All modders will be wery grateful if any, who make some changes to game, with .html file also post his/her resulting src folder tree.

6. For contributors to pregmod: if you don't use git, then you need to post yours version of src folder tree, not just produced FC_pregmod.html file!!! This html file can't be reverted to proper sources, and useless as contribution!

7. Git workflow:
    - Master branch is pregmod-master. Only Pregmodder can add something to it directly. Always contain his last public changes.
    - pregmod-dev - branch with experimental code mainly by pregmodfan.
    - Any contributions will be placed in separate branches like pregmod-mod-<something> (if it's ready to merge with master complete feature/mod) or pregmod-contrib-<something> if it's partial work until contributions is reviewed.

    Typical cycle with git:
	1. Make account on gitgud if you don't have usable one.
	2. Fork main repository through gitgud interface. (Or pull changes from main repo if you already have fork.)
	3. Clone your fork to local machine witn git client  (Or pull changes if already cloned.)
	4. Make you changes as you like, commit, and push result into your forked repository (with git client).
	5. Make merge request through gitgud interface.