From b2f3e16769bcd4d89b64c084b7a488bfb10af170 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Thu, 22 Jul 2021 23:19:56 +1200
Subject: [PATCH 01/19] Inital commit

---
 src/Mods/SecExp/events/attackReport.js    | 287 -----------
 src/Mods/SecExp/events/conflictReport.js  | 592 ++++++++++++++++++++++
 src/Mods/SecExp/events/rebellionReport.js | 344 -------------
 3 files changed, 592 insertions(+), 631 deletions(-)
 create mode 100644 src/Mods/SecExp/events/conflictReport.js

diff --git a/src/Mods/SecExp/events/attackReport.js b/src/Mods/SecExp/events/attackReport.js
index 74ca53f5bc8..8fe41c2fed1 100644
--- a/src/Mods/SecExp/events/attackReport.js
+++ b/src/Mods/SecExp/events/attackReport.js
@@ -1,287 +1,5 @@
 App.Events.attackReport = function() {
-	V.nextButton = "Continue";
-	V.nextLink = "Scheduled Event";
-	V.encyclopedia = "Battles";
-	const casualtiesReport = function(type, loss, squad=null) {
-		const isSpecial = squad && App.SecExp.unit.list().slice(1).includes(type);
-		let r = [];
-		if (loss <= 0) {
-			r.push(`No`);
-		} else if (loss <= (isSpecial ? (squad.troops * 0.2) : 10)) {
-			r.push(`Light`);
-		} else if (loss <= (isSpecial ? (squad.troops * 0.4) : 30)) {
-			r.push(`Moderate`);
-		} else if (loss <= (isSpecial ? (squad.troops * 0.6) : 60)) {
-			r.push(`Heavy`);
-		} else {
-			r.push(`Catastrophic`);
-		}
-		r.push(`casualties suffered.`);
-		if (App.SecExp.unit.list().includes(type)) {
-			if (squad.troops <= 0) {
-				squad.active = 0;
-				r.push(`Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit.`);
-				if (type === "bots") {
-					r.push(`It will take quite the investment to rebuild them.`);
-				} else {
-					r.push(`The remnants will be sent home honored as veterans or reorganized in a new unit.`);
-				}
-			} else if (squad.troops <= 10) {
-				r.push(`The unit has very few operatives left, it risks complete annihilation if deployed again.`);
-			}
-		}
-		return r.join(" ");
-	};
-	function loopThroughUnits(units, type) {
-		for (const unit of units) {
-			if (App.SecExp.unit.isDeployed(unit)) {
-				if (V.SecExp.war.losses > 0) {
-					loss = lossesList.pluck();
-					loss = Math.clamp(loss, 0, unit.troops);
-				}
-
-				const r = [`${type !== "bots" ? `${unit.platoonName}` : `Security drones`}: ${casualtiesReport(type, loss, unit)}`];
-				if (type !== "bots") {
-					unit.battlesFought++;
-					if (loss > 0) {
-						const med = Math.round(Math.clamp(loss * unit.medics * 0.25, 1, loss));
-						if (unit.medics === 1) {
-							r.push(`Some men were saved by their medics.`);
-						}
-						unit.troops -= Math.trunc(Math.clamp(loss - med, 0, unit.maxTroops));
-						V.SecExp.units[type].dead += Math.trunc(loss - med);
-					}
-					if (unit.training < 100 && random(1, 100) > 60) {
-						r.push(`Experience has increased.`);
-						unit.training += random(5, 15) + (majorBattle ? 1 : 0) * random(5, 15);
-					}
-				} else if (type === "bots" && loss > 0) {
-					unit.troops -= loss;
-				}
-				App.Events.addNode(node, r, "div");
-			}
-		}
-	}
-
-	const node = new DocumentFragment();
-	let r = [];
-
-	V.SecExp.war.attacker.losses = Math.trunc(V.SecExp.war.attacker.losses);
-	if (V.SecExp.war.attacker.losses > V.SecExp.war.attacker.troops) {
-		V.SecExp.war.attacker.losses = V.SecExp.war.attacker.troops;
-	}
-	V.SecExp.core.totalKills += V.SecExp.war.attacker.losses;
-	V.SecExp.war.losses = Math.trunc(V.SecExp.war.losses);
-	let loot = 0;
-	let loss = 0;
-	let captives;
 	const lossesList = [];
-
-	// result
-	const majorBattle = V.SecExp.war.type.includes("Major");
-	const majorBattleMod = !majorBattle ? 1 : 2;
-	if (majorBattle) {
-		V.SecExp.battles.major++;
-	}
-	if (V.SecExp.war.result === 3) {
-		App.UI.DOM.makeElement("h1", `Victory!`, "strong");
-		V.SecExp.battles.lossStreak = 0;
-		V.SecExp.battles.victoryStreak += 1;
-		V.SecExp.battles.victories++;
-	} else if (V.SecExp.war.result === -3) {
-		App.UI.DOM.makeElement("h1", `Defeat!`, "strong");
-		V.SecExp.battles.lossStreak += 1;
-		V.SecExp.battles.victoryStreak = 0;
-		V.SecExp.battles.losses++;
-	} else if (V.SecExp.war.result === 2) {
-		App.UI.DOM.makeElement("h1", `Partial victory!`, "strong");
-		V.SecExp.battles.victories++;
-	} else if (V.SecExp.war.result === -2) {
-		App.UI.DOM.makeElement("h1", `Partial defeat!`, "strong");
-		V.SecExp.battles.losses++;
-	} else if (V.SecExp.war.result === -1) {
-		App.UI.DOM.makeElement("h1", `We surrendered`, "strong");
-		V.SecExp.battles.losses++;
-	} else if (V.SecExp.war.result === 0) {
-		App.UI.DOM.makeElement("h1", `Failed bribery!`, "strong");
-		V.SecExp.battles.losses++;
-	} else if (V.SecExp.war.result === 1) {
-		App.UI.DOM.makeElement("h1", `Successful bribery!`, "strong");
-		V.SecExp.battles.victories++;
-	}
-	let end = (V.SecExp.battles.victoryStreak >= 2 || V.SecExp.battles.lossStreak >= 2) ? `,` : `.`;
-
-	r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was attacked by`);
-	if (V.SecExp.war.attacker.type === "raiders") {
-		r.push(`a band of wild raiders,`);
-	} else if (V.SecExp.war.attacker.type === "free city") {
-		r.push(`a contingent of mercenaries hired by a competing free city,`);
-	} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-		r.push(`a group of freedom fighters bent on the destruction of the institution of slavery,`);
-	} else if (V.SecExp.war.attacker.type === "old world") {
-		r.push(`an old world nation boasting a misplaced sense of superiority,`);
-	}
-
-	r.push(`${num(Math.trunc(V.SecExp.war.attacker.troops))} men strong.`);
-	if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) {
-		r.push(`Our defense forces, ${num(Math.trunc(App.SecExp.battle.troopCount()))} strong, clashed with them`);
-		if (V.SecExp.war.terrain === "urban") {
-			r.push(`in the streets of`);
-			if (V.SecExp.war.terrain === "urban") {
-				r.push(`the old world city surrounding the arcology,`);
-			} else {
-				r.push(`of the free city,`);
-			}
-		} else if (V.SecExp.war.terrain === "rural") {
-			r.push(`in the rural land surrounding the free city,`);
-		} else if (V.SecExp.war.terrain === "hills") {
-			r.push(`on the hills around the free city,`);
-		} else if (V.SecExp.war.terrain === "coast") {
-			r.push(`along the coast just outside the free city,`);
-		} else if (V.SecExp.war.terrain === "outskirts") {
-			r.push(`just against the walls of the arcology,`);
-		} else if (V.SecExp.war.terrain === "mountains") {
-			r.push(`in the mountains overlooking the arcology,`);
-		} else if (V.SecExp.war.terrain === "wasteland") {
-			r.push(`in the wastelands outside the free city territory,`);
-		} else if (V.SecExp.war.terrain === "international waters") {
-			r.push(`in the water surrounding the free city,`);
-		} else if (["a sunken ship", "an underwater cave"].includes(V.SecExp.war.terrain)) {
-			r.push(`in <strong>${V.SecExp.war.terrain}</strong> near the free city`);
-		}
-		if (V.SecExp.war.attacker.losses !== V.SecExp.war.attacker.troops) {
-			r.push(`inflicting ${V.SecExp.war.attacker.losses} casualties, while sustaining`);
-			if (V.SecExp.war.losses > 1) {
-				r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties`);
-			} else if (V.SecExp.war.losses > 0) {
-				r.push(`a casualty`);
-			} else {
-				r.push(`zero`);
-			}
-			r.push(`themselves.`);
-		} else {
-			r.push(`completely annihilating their troops, while sustaining`);
-			if (V.SecExp.war.losses > 1) {
-				r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties.`);
-			} else if (V.SecExp.war.losses > 0) {
-				r.push(`a casualty.`);
-			} else {
-				r.push(`zero casualties.`);
-			}
-		}
-	}
-	if (V.SecExp.war.result === 3) {
-		if (V.SecExp.war.turns <= 5) {
-			r.push(`The fight was quick and one sided, our men easily stopped the`);
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`disorganized horde's futile attempt at raiding your arcology${end}`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`mercenaries dead in their tracks${end}`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`freedom fighters dead in their tracks${end}`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`old world soldiers dead in their tracks${end}`);
-			}
-		} else if (V.SecExp.war.turns <= 7) {
-			r.push(`The fight was hard, but in the end our men stopped the`);
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`disorganized horde attempt at raiding your arcology${end}`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`slavers attempt at weakening your arcology${end}`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`fighters attack${end}`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`soldiers of the old world${end}`);
-			}
-		} else {
-			r.push(`The fight was long and hard, but our men managed to stop the`);
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`horde raiding party${end}`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`free city mercenaries${end}`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`freedom fighters${end}`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`old world soldiers${end}`);
-			}
-		}
-		if (V.SecExp.battles.victoryStreak >= 2) {
-			r.push(`adding another victory to the growing list of our military's successes.`);
-		} else if (V.SecExp.battles.lossStreak >= 2) {
-			r.push(`finally putting an end to a series of unfortunate defeats.`);
-		}
-	} else if (V.SecExp.war.result === -3) {
-		if (V.SecExp.war.turns <= 5) {
-			r.push(`The fight was quick and one sided, our men were easily crushed by the`);
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`barbaric horde of raiders${end}`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`consumed mercenary veterans sent against us${end}`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`fanatical fury of the freedom fighters${end}`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`discipline of the old world armies${end}`);
-			}
-		} else if (V.SecExp.war.turns <= 7) {
-			r.push(`The fight was hard and in the end the`);
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`bandits proved too much to handle for our men${end}`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`slavers proved too much to handle for our men${end}`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`freedom fighters proved too much to handle for our men${end}`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`old world proved too much to handle for our men${end}`);
-			}
-		} else {
-			r.push(`The fight was long and hard, but despite their bravery the`);
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`horde proved too much for our men${end}`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`mercenary slavers proved too much for our men${end}`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`freedom fighters fury proved too much for our men${end}`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`old world troops proved too much for our men${end}`);
-			}
-		}
-		if (V.SecExp.battles.victoryStreak >= 2) {
-			r.push(`so interrupting a long series of military successes.`);
-		} else if (V.SecExp.battles.lossStreak >= 2) {
-			r.push(`confirming the long list of recent failures our armed forces collected.`);
-		}
-	} else if (V.SecExp.war.result === 2) {
-		r.push(`The fight was long and hard, but in the end our men managed to repel the`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			r.push(`raiders, though not without difficulty.`);
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			r.push(`mercenaries, though not without difficulty.`);
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			r.push(`freedom fighters, though not without difficulty.`);
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			r.push(`old world soldiers, though not without difficulty.`);
-		}
-	} else if (V.SecExp.war.result === -2) {
-		r.push(`The fight was long and hard. Our men in the end had to yield to the`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			r.push(`horde raiders, which was fortunately unable to capitalize on their victory.`);
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			r.push(`slavers, which were fortunately unable to capitalize on their victory.`);
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			r.push(`freedom fighters, which were fortunately unable to capitalize on their victory.`);
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			r.push(`old world soldiers, which were fortunately unable to capitalize on their victory.`);
-		}
-	} else if (V.SecExp.war.result === -1) {
-		r.push(`You gave your troops the order to surrender, obediently they stand down.`);
-	} else if (V.SecExp.war.result === 0) {
-		r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`);
-	} else if (V.SecExp.war.result === 1) {
-		r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`);
-	}
-
-	App.Events.addParagraph(node, r);
-	r = [];
 	// calculates effects on the city
 	if (V.SecExp.war.result === 3) {
 		r.push(`Thanks to your victory, your <span class="green">reputation</span> and <span class="darkviolet">authority</span> increased. You were also able to capture`);
@@ -976,11 +694,6 @@ App.Events.attackReport = function() {
 	}
 
 	// resets variables
-	V.SecExp.units.bots.isDeployed = 0;
-	for (const squad of App.SecExp.unit.humanSquads()) {
-		squad.isDeployed = 0;
-	}
-	App.Events.addParagraph(node, r);
 	return node;
 
 	function unitsBattleReport() {
diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
new file mode 100644
index 00000000000..140475ebf6a
--- /dev/null
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -0,0 +1,592 @@
+App.Events.conflictReport = function() {
+	V.nextButton = "Continue";
+	V.nextLink = "Scheduled Event";
+	V.encyclopedia = "Battles";
+	
+	let lostSlaves;
+	let r = [];
+	// Battles
+	let loot = 0;
+	let loss = 0;
+	let captives;
+	const end = (V.SecExp.battles.victoryStreak >= 2 || V.SecExp.battles.lossStreak >= 2) ? `,` : `.`;
+
+	const allKilled = V.SecExp.war.attacker.losses === V.SecExp.war.attacker.troops;
+	const result = V.SecExp.war.result;
+
+	const inBattle = V.SecExp.war.type.includes("Attack");
+	const isMajorBattle = inBattle && V.SecExp.war.type.includes("Major");
+	const majorBattleMod = !isMajorBattle ? 1 : 2;
+	const inRebellion = V.SecExp.war.type.includes("Rebellion");
+	const slaveRebellion = V.SecExp.war.type.includes("Slave");
+	const type = inBattle ? "battles" : "rebellions";
+
+	/**
+	 * @param {string} [type]
+	 * @param {number} [loss]
+	 * @param {Object} [squad=null]
+	 * @returns {string}
+	 */
+	const casualtiesReport = function(type, loss, squad=null) {
+		const isSpecial = squad && App.SecExp.unit.list().slice(1).includes(type);
+		let r = [];
+		if (loss <= 0) {
+			r.push(`No`);
+		} else if (loss <= (isSpecial ? (squad.troops * 0.2) : 10)) {
+			r.push(`Light`);
+		} else if (loss <= (isSpecial ? (squad.troops * 0.4) : 30)) {
+			r.push(`Moderate`);
+		} else if (loss <= (isSpecial ? (squad.troops * 0.6) : 60)) {
+			r.push(`Heavy`);
+		} else {
+			r.push(`Catastrophic`);
+		}
+		r.push(`casualties suffered.`);
+		if (App.SecExp.unit.list().includes(type)) {
+			if (squad.troops <= 0) {
+				squad.active = 0;
+				r.push(`Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit.`);
+				if (type === "bots") {
+					r.push(`It will take quite the investment to rebuild them.`);
+				} else {
+					r.push(`The remnants will be sent home honored as veterans or reorganized in a new unit.`);
+				}
+			} else if (squad.troops <= 10) {
+				r.push(`The unit has very few operatives left, it risks complete annihilation if deployed again.`);
+			}
+		}
+		return r.join(" ");
+	};
+
+	// Battles
+   /**
+	* @param {Array} [units]
+	* @param {string} [type]
+	* @returns {Node}
+	*/
+	function loopThroughUnits(units, type) {
+		for (const unit of units) {
+			if (App.SecExp.unit.isDeployed(unit)) {
+				if (V.SecExp.war.losses > 0) {
+					loss = lossesList.pluck();
+					loss = Math.clamp(loss, 0, unit.troops);
+				}
+
+				const r = [`${type !== "bots" ? `${unit.platoonName}` : `Security drones`}: ${casualtiesReport(type, loss, unit)}`];
+				if (type !== "bots") {
+					unit.battlesFought++;
+					if (loss > 0) {
+						const med = Math.round(Math.clamp(loss * unit.medics * 0.25, 1, loss));
+						if (unit.medics === 1) {
+							r.push(`Some men were saved by their medics.`);
+						}
+						unit.troops -= Math.trunc(Math.clamp(loss - med, 0, unit.maxTroops));
+						V.SecExp.units[type].dead += Math.trunc(loss - med);
+					}
+					if (unit.training < 100 && random(1, 100) > 60) {
+						r.push(`Experience has increased.`);
+						unit.training += random(5, 15) + (majorBattle ? 1 : 0) * random(5, 15);
+					}
+				} else if (type === "bots" && loss > 0) {
+					unit.troops -= loss;
+				}
+				App.Events.addNode(node, r, "div");
+			}
+		}
+	}
+	
+	// Rebellions
+	/**
+	 * @param {string} [target]
+	 * @param {number} [value]
+	 * @param {number} [cost=2000]
+	 */
+	const setRepairTime = function(target, value, cost=2000) {
+		V.SecExp.rebellions.repairTime[target] = 3 + random(1) - value;
+		cashX(-cost, "war");
+		return IncreasePCSkills('engineering', 0.1);
+	};
+
+	/**
+	 * @param {number} [lowerClass]
+	 * @param {number} [slaves]
+	 * @param {number} [prosperity]
+	 * @returns {Void}
+	 */
+	const arcologyEffects = function(lowerClass, slaves, prosperity) {
+		V.lowerClass -= random(lowerClass);
+		App.SecExp.slavesDamaged(random(slaves));
+		V.arcologies[0].prosperity -= random(prosperity);
+	};
+
+	/**
+	 * Does the target become wounded?
+	 * @param {string} [target]
+	 * @returns {string}
+	 */
+	const checkWoundStatus = function(target) {
+		let slave;
+		let woundChance = 0;
+		const r = [];
+		if (target === "PC") {
+			if (V.PC.career === "mercenary" || V.PC.career === "gang") {
+				woundChance -= 5;
+			} else if (V.PC.skill.warfare >= 75) {
+				woundChance -= 3;
+			}
+			if (V.personalArms >= 1) {
+				woundChance -= 5;
+			}
+			if (V.PC.physicalAge >= 60) {
+				woundChance += random(1, 5);
+			}
+			if (V.PC.belly > 5000) {
+				woundChance += random(1, 5);
+			}
+			if (V.PC.boobs >= 1000) {
+				woundChance += random(1, 5);
+			}
+			if (V.PC.butt >= 4) {
+				woundChance += random(1, 5);
+			}
+			if (V.PC.preg >= 30) {
+				woundChance += random(1, 5);
+			}
+			if (V.PC.balls >= 20) {
+				woundChance += random(5, 10);
+			}
+			if (V.PC.balls >= 9) {
+				woundChance += random(1, 5);
+			}
+			woundChance *= random(1, 2);
+		} else {
+			if (target === "Concubine") {
+				slave = S.Concubine;
+			} else if (target === "Bodyguard") {
+				slave = S.Bodyguard;
+			}
+
+			if (!slave) {
+				return ``;
+			}
+
+			if (slave.skill.combat === 1) {
+				woundChance -= 2;
+			}
+			woundChance -= 0.25 * (getLimbCount(slave, 105));
+			if (slave.health.condition >= 50) {
+				woundChance -= 1;
+			}
+			if (slave.weight > 130) {
+				woundChance += 1;
+			}
+			if (slave.muscles < -30) {
+				woundChance += 1;
+			}
+			if (getBestVision(slave) === 0) {
+				woundChance += 1;
+			}
+			if (slave.heels === 1) {
+				woundChance += 1;
+			}
+			if (slave.boobs >= 1400) {
+				woundChance += 1;
+			}
+			if (slave.butt >= 6) {
+				woundChance += 1;
+			}
+			if (slave.belly >= 10000) {
+				woundChance += 1;
+			}
+			if (slave.dick >= 8) {
+				woundChance += 1;
+			}
+			if (slave.balls >= 8) {
+				woundChance += 1;
+			}
+			if (slave.intelligence + slave.intelligenceImplant < -95) {
+				woundChance += 1;
+			}
+			woundChance *= random(2, 4);
+		}
+
+		if (random(1, 100) <= woundChance) {
+			if (target === "PC") {
+				healthDamage(V.PC, 60);
+				r.push(`A lucky shot managed to find its way to you, leaving a painful, but thankfully not lethal, wound.`);
+			} else {
+				const woundType = App.SecExp.inflictBattleWound(slave);
+				const {his, him} = getPronouns(slave);
+				if (target === "Concubine") {
+					r.push(`Your Concubine was unfortunately caught in the crossfire.`);
+				} else {
+					r.push(`During one of the assaults your Bodyguard was hit.`);
+				}
+				if (woundType === "voice") {
+					r.push(`A splinter pierced ${his} throat, severing ${his} vocal cords.`);
+				} else if (woundType === "eyes") {
+					r.push(`A splinter hit ${his} face, severely damaging ${his} eyes.`);
+				} else if (woundType === "legs") {
+					r.push(`An explosion near ${him} caused the loss of both of ${his} legs.`);
+				} else if (woundType === "arm") {
+					r.push(`An explosion near ${him} caused the loss of one of ${his} arms.`);
+				} else if (woundType === "flesh") {
+					r.push(`A stray shot severely wounded ${him}.`);
+				}
+			}
+		} else if (target === "PC") {
+			r.push(`Fortunately you managed to avoid injury.`);
+		}
+		return r.join(" ");
+	};
+
+	/**
+	 * @param {FC.SecExp.PlayerHumanUnitType} [unit]
+	 * @param {number} [averageLosses]
+	 */
+	const rebellingUnitsFate = function(unit, averageLosses) {
+		let manpower = 0;
+		const node = new DocumentFragment();
+		const r = [];
+		const rebels = {ID: [], names: []};
+
+		const Dissolve = function() {
+			App.SecExp.unit.unitFree(unit).add(manpower);
+			for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
+				u.loyalty = Math.clamp(u.loyalty - random(10, 40), 0, 100);
+			}
+			return `Units dissolved.`;
+		};
+		const Purge = function() {
+			App.SecExp.unit.unitFree(unit).add(manpower * 0.5);
+			return `Dissidents purged and units dissolved.`;
+		};
+		const Execute = function() {
+			for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
+				u.loyalty = Math.clamp(u.loyalty + random(10, 40), 0, 100);
+			}
+			return `Units executed. Dissent will not be tolerated.`;
+		};
+
+		App.UI.DOM.appendNewElement("div", node);
+		for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
+			if (V.SecExp.war.rebellingID.contains(u.ID)) {
+				rebels.names.push(`${u.platoonName}`);
+				rebels.ID.push(u.ID);
+				manpower += Math.clamp(u.troops - random(averageLosses), 0, u.troops);
+			}
+		}
+
+		if (rebels.ID.length > 0) {
+			V.SecExp.units[unit].squads.deleteWith((u) => rebels.ID.contains(u.ID));
+			V.SecExp.battles.lastSelection.deleteWith((u) => rebels.ID.contains(u.ID));
+			if (unit === "slaves") {
+				r.push(`${toSentence(rebels.names)} decided in their blind arrogance to betray you.`);
+			} else if (unit === "militia") {
+				r.push(`${toSentence(rebels.names)} had the gall to betray you and join your enemies.`);
+			} else if (unit === "mercs") {
+				r.push(`${toSentence(rebels.names)} made the grave mistake of betraying you.`);
+			}
+			if (V.SecExp.war.result < 2) { // rebellion loss
+				r.push(`They participated in the looting following the battle, then vanished in the wastes.`);
+				cashX(forceNeg(1000 * rebels.ID.length), "war");
+			} else { // rebellion win
+				App.Events.addResponses(node, [
+					new App.Events.Result(
+						`Dissolve the units`,
+						Dissolve,
+						`Manpower will be refunded, but will negatively influence the loyalty of the other units`
+					),
+					new App.Events.Result(
+						`Purge the dissidents and dissolve the units`,
+						Purge,
+						`Will not influence the loyalty of the other units, but half the manpower will be refunded.`
+					),
+					new App.Events.Result(
+						`Execute them all`,
+						Execute,
+						`Will positively influence the loyalty of the other units, but manpower will not be refunded.`
+					),
+				]);
+			}
+			App.Events.addNode(node, r, "div");
+		}
+		return node;
+	};
+	
+	V.SecExp.war.attacker.losses = Math.trunc(V.SecExp.war.attacker.losses);
+	if (V.SecExp.war.attacker.losses > V.SecExp.war.attacker.troops) {
+		V.SecExp.war.attacker.losses = V.SecExp.war.attacker.troops;
+	}
+	V.SecExp.core.totalKills += V.SecExp.war.attacker.losses;
+	V.SecExp.war.losses = Math.trunc(V.SecExp.war.losses);
+	
+	if (isMajorBattle) {
+		V.SecExp.battles.major++;
+	}
+	
+	const node = new DocumentFragment();
+	if (result === 3 || result === 2) {
+		App.UI.DOM.appendNewElement("h1", node, `${result === 2 ? 'Partial ' : ''}Victory!`, "strong");
+		V.SecExp[type].victories++;
+		if (inBattle && result === 3) {
+			V.SecExp.battles.lossStreak = 0;
+			V.SecExp.battles.victoryStreak++;
+		}
+	} else if (result === -3 || result === -2) {
+		App.UI.DOM.appendNewElement("h1", node, `${result === -2 ? 'Partial ' : ''}Defeat!`, "strong");
+		V.SecExp[type].losses++;
+		if (inBattle && result === -3) {
+			V.SecExp.battles.lossStreak++;
+			V.SecExp.battles.victoryStreak = 0;
+		}
+	} else if (result === -1) {
+		App.UI.DOM.appendNewElement("h1", node, `We surrendered`, "strong");
+		V.SecExp[type].losses++;
+	} else if (V.SecExp.war.result === 0) { // Battles only
+		App.UI.DOM.makeElement("h1", `Failed bribery!`, "strong");
+		V.SecExp.battles.losses++;
+	} else if (V.SecExp.war.result === 1) { // Battles only
+		App.UI.DOM.makeElement("h1", `Successful bribery!`, "strong");
+		V.SecExp.battles.victories++;
+	}
+	App.UI.DOM.appendNewElement("hr", node);
+	
+	r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was`);
+	if (inBattle) {
+		r.push(`attacked by`);
+			if (V.SecExp.war.attacker.type === "raiders") {
+			r.push(`a band of wild raiders,`);
+		} else if (V.SecExp.war.attacker.type === "free city") {
+			r.push(`a contingent of mercenaries hired by a competing free city,`);
+		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+			r.push(`a group of freedom fighters bent on the destruction of the institution of slavery,`);
+		} else if (V.SecExp.war.attacker.type === "old world") {
+			r.push(`an old world nation boasting a misplaced sense of superiority,`);
+		}
+		r.push(`${num(Math.trunc(V.SecExp.war.attacker.troops))} men strong.`);
+	} else {
+		r.push(`inflamed by the fires of rebellion. ${num(Math.trunc(V.SecExp.war.attacker.troops))} rebels from all over the structure dared rise up`);
+		if (slaveRebellion) {
+			r.push(`against their owners and conquer their freedom through blood.`);
+		} else {
+			r.push(`to dethrone their arcology owner.`);
+		}
+	}
+	
+	if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) {
+		r.push(`Our defense forces, ${num(Math.trunc(App.SecExp.battle.troopCount()))} strong,`);
+		if (inBattle) {
+			r.push(`clashed with them`);
+			if (V.SecExp.war.terrain === "urban") {
+				r.push(`in the streets of the old world city surrounding the arcology,`);
+			} else if (V.SecExp.war.terrain === "rural") {
+				r.push(`in the rural land surrounding the free city,`);
+			} else if (V.SecExp.war.terrain === "hills") {
+				r.push(`on the hills around the free city,`);
+			} else if (V.SecExp.war.terrain === "coast") {
+				r.push(`along the coast just outside the free city,`);
+			} else if (V.SecExp.war.terrain === "outskirts") {
+				r.push(`just against the walls of the arcology,`);
+			} else if (V.SecExp.war.terrain === "mountains") {
+				r.push(`in the mountains overlooking the arcology,`);
+			} else if (V.SecExp.war.terrain === "wasteland") {
+				r.push(`in the wastelands outside the free city territory,`);
+			} else if (V.SecExp.war.terrain === "international waters") {
+				r.push(`in the water surrounding the free city,`);
+			} else if (["a sunken ship", "an underwater cave"].includes(V.SecExp.war.terrain)) {
+				r.push(`in <strong>${V.SecExp.war.terrain}</strong> near the free city`);
+			}
+		} else {
+			r.push(`fought with them street by street`);
+		}
+
+		if (allKilled) {
+			r.push(`completely annihilating their troops, while sustaining`);
+		} else {
+			r.push(`inflicting ${V.SecExp.war.attacker.losses} casualties, while sustaining`);
+		}
+		if (V.SecExp.war.losses > 1) {
+			r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties`);
+		} else if (V.SecExp.war.losses > 0) {
+			r.push(`a casualty`);
+		} else {
+			r.push(`zero casualties`);
+		}
+		r.push(`${allKilled ? '' : 'themselves'}.`);
+		
+		if (inRebellion) {
+			App.SecExp.slavesDamaged(V.SecExp.war.attacker.losses);
+		}
+		
+		if (V.SecExp.war.result === 3) {
+			if (V.SecExp.war.turns <= 5) {
+				r.push(`The fight was quick and one sided, our men easily stopped the`);
+				if (inBattle) {
+					if (V.SecExp.war.attacker.type === "raiders") {
+						r.push(`disorganized horde's futile attempt at raiding your arcology${end}`);
+					} else if (V.SecExp.war.attacker.type === "free city") {
+						r.push(`mercenaries dead in their tracks${end}`);
+					} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+						r.push(`freedom fighters dead in their tracks${end}`);
+					} else if (V.SecExp.war.attacker.type === "old world") {
+						r.push(`old world soldiers dead in their tracks${end}`);
+					}
+				} else {
+					r.push(`disorganized revolt in a few well aimed assaults.`);
+				}
+			} else if (V.SecExp.war.turns <= 7) {
+				r.push(`The fight was hard, but in the end our men stopped the`);
+				if (inBattle) {
+					if (V.SecExp.war.attacker.type === "raiders") {
+						r.push(`disorganized horde attempt at raiding your arcology${end}`);
+					} else if (V.SecExp.war.attacker.type === "free city") {
+						r.push(`slavers attempt at weakening your arcology${end}`);
+					} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+						r.push(`fighters attack${end}`);
+					} else if (V.SecExp.war.attacker.type === "old world") {
+						r.push(`soldiers of the old world${end}`);
+					}
+				} else {
+					r.push(`disorganized revolt with several well aimed assaults.`);
+				}
+			} else {
+				r.push(`The fight was long and hard, but our men managed to stop the`);
+				if (inBattle) {
+					if (V.SecExp.war.attacker.type === "raiders") {
+						r.push(`horde raiding party${end}`);
+					} else if (V.SecExp.war.attacker.type === "free city") {
+						r.push(`free city mercenaries${end}`);
+					} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+						r.push(`freedom fighters${end}`);
+					} else if (V.SecExp.war.attacker.type === "old world") {
+						r.push(`old world soldiers${end}`);
+					}
+				} else {
+					r.push(`revolt before it could accumulate momentum.`);
+				}
+			}
+			if (inBattle && V.SecExp.battles.victoryStreak >= 2) {
+				r.push(`adding another victory to the growing list of our military's successes.`);
+			} else if (inBattle && V.SecExp.battles.lossStreak >= 2) {
+				r.push(`finally putting an end to a series of unfortunate defeats.`);
+			}
+		} else if (V.SecExp.war.result === -3) {
+			if (V.SecExp.war.turns <= 5) {
+				r.push(`The fight was quick and one sided, our men were easily crushed by the`);
+				if (inBattle) {
+					if (V.SecExp.war.attacker.type === "raiders") {
+						r.push(`barbaric horde of raiders${end}`);
+					} else if (V.SecExp.war.attacker.type === "free city") {
+						r.push(`consumed mercenary veterans sent against us${end}`);
+					} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+						r.push(`fanatical fury of the freedom fighters${end}`);
+					} else if (V.SecExp.war.attacker.type === "old world") {
+						r.push(`discipline of the old world armies${end}`);
+					}
+				} else {
+					r.push(`furious charge of the rebels.`);
+				}
+			} else if (V.SecExp.war.turns <= 7) {
+				r.push(`The fight was hard and in the end the`);
+				if (inBattle) {
+					if (V.SecExp.war.attacker.type === "raiders") {
+						r.push(`bandits proved too much to handle for our men${end}`);
+					} else if (V.SecExp.war.attacker.type === "free city") {
+						r.push(`slavers proved too much to handle for our men${end}`);
+					} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+						r.push(`freedom fighters proved too much to handle for our men${end}`);
+					} else if (V.SecExp.war.attacker.type === "old world") {
+						r.push(`old world proved too much to handle for our men${end}`);
+					}
+				} else {
+					r.push(`rebels proved too much to handle for our men.`);
+				}
+			} else {
+				r.push(`The fight was long and hard, but despite their bravery the`);
+				if (inBattle) {
+					if (V.SecExp.war.attacker.type === "raiders") {
+						r.push(`horde proved too much for our men${end}`);
+					} else if (V.SecExp.war.attacker.type === "free city") {
+						r.push(`mercenary slavers proved too much for our men${end}`);
+					} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+						r.push(`freedom fighters fury proved too much for our men${end}`);
+					} else if (V.SecExp.war.attacker.type === "old world") {
+						r.push(`old world troops proved too much for our men${end}`);
+					}
+				} else {
+					r.push(`rebels proved too much for our men.`);
+				}
+			}
+			if (inBattle && V.SecExp.battles.victoryStreak >= 2) {
+				r.push(`so interrupting a long series of military successes.`);
+			} else if (inBattle && V.SecExp.battles.lossStreak >= 2) {
+				r.push(`confirming the long list of recent failures our armed forces collected.`);
+			}
+		} else if (V.SecExp.war.result === 2) {
+			r.push(`The fight was long and hard, but in the end our men managed to`);
+			if (inBattle) {
+				r.push(`repel the`);
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`raiders, though not without difficulty.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`mercenaries, though not without difficulty.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`freedom fighters, though not without difficulty.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`old world soldiers, though not without difficulty.`);
+				}
+			} else {
+				r.push(`stop the revolt, though not without difficulty.`);
+			}
+		} else if (V.SecExp.war.result === -2) {
+			r.push(`The fight was long and hard. Our men in the end had to yield to the`);
+			if (inBattle) {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`horde raiders, which was fortunately unable to capitalize on their victory.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`slavers, which were fortunately unable to capitalize on their victory.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`freedom fighters, which were fortunately unable to capitalize on their victory.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`old world soldiers, which were fortunately unable to capitalize on their victory.`);
+				}
+			} else {
+				r.push(`the rebels, which were fortunately unable to capitalize on their victory.`);
+			}
+		} else if (V.SecExp.war.result === -1) {
+			r.push(`You gave your troops the order to surrender, obediently they stand down.`);
+		} else if (V.SecExp.war.result === 0) {
+			r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`);
+		} else if (V.SecExp.war.result === 1) {
+			r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`);
+		}
+		
+		if (inRebellion && V.SecExp.rebellions.sfArmor) {
+			r.push(`More units were able to survive thanks to wearing ${V.SF.Lower}'s combat armor suits.`);
+		}
+		App.Events.addParagraph(node, r);
+		r = [];
+		
+	}
+	
+	
+	App.Events.addParagraph(node, r);
+	// resets variables
+	if (inBattle) {
+		V.SecExp.units.bots.isDeployed = 0;
+		for (const squad of App.SecExp.unit.humanSquads()) {
+			squad.isDeployed = 0;
+		}
+	} else {
+		App.UI.DOM.appendNewElement("p", node, unitsRebellionReport());
+		V.SecExp.rebellions[V.SecExp.war.type.toLowerCase().replace(' rebellion', '') + 'Progress'] = 0;
+		V.SecExp.rebellions.tension = Math.clamp(V.SecExp.rebellions.tension - random(50, 100), 0, 100);
+		if (slaveRebellion) {
+			V.SecExp.rebellions.citizenProgress = Math.clamp(V.SecExp.rebellions.citizenProgress - random(50, 100), 0, 100);
+		} else {
+			V.SecExp.rebellions.slaveProgress = Math.clamp(V.SecExp.rebellions.slaveProgress - random(50, 100), 0, 100);
+		}
+	}
+	return node;
+}
diff --git a/src/Mods/SecExp/events/rebellionReport.js b/src/Mods/SecExp/events/rebellionReport.js
index 663cea8f7f5..72bb65dbf4f 100644
--- a/src/Mods/SecExp/events/rebellionReport.js
+++ b/src/Mods/SecExp/events/rebellionReport.js
@@ -1,338 +1,4 @@
 App.Events.rebellionReport = function() {
-	V.nextButton = "Continue";
-	V.nextLink = "Scheduled Event";
-	V.encyclopedia = "Battles";
-
-	let lostSlaves;
-	let r = [];
-	const node = new DocumentFragment();
-	const slaveRebellion = V.SecExp.war.type.includes("Slave");
-	const allKilled = V.SecExp.war.attacker.losses === V.SecExp.war.attacker.troops;
-	const result = V.SecExp.war.result;
-
-	/**
-	 * @param {string} [target]
-	 * @param {number} [value]
-	 */
-	const setRepairTime = function(target, value, cost=2000) {
-		V.SecExp.rebellions.repairTime[target] = 3 + random(1) - value;
-		cashX(-cost, "war");
-		return IncreasePCSkills('engineering', 0.1);
-	};
-
-	/**
-	 * @param {string} [type]
-	 * @param {number} [loss]
-	 */
-	const casualtiesReport = function(type, loss, squad=null) {
-		const isSpecial = squad && App.SecExp.unit.list().slice(1).includes(type);
-		let r = [];
-		if (loss <= 0) {
-			r.push(`No`);
-		} else if (loss <= (isSpecial ? (squad.troops * 0.2) : 10)) {
-			r.push(`Light`);
-		} else if (loss <= (isSpecial ? (squad.troops * 0.4) : 30)) {
-			r.push(`Moderate`);
-		} else if (loss <= (isSpecial ? (squad.troops * 0.6) : 60)) {
-			r.push(`Heavy`);
-		} else {
-			r.push(`Catastrophic`);
-		}
-		r.push(`casualties suffered.`);
-		if (App.SecExp.unit.list().includes(type)) {
-			if (squad.troops <= 0) {
-				squad.active = 0;
-				r.push(`Unfortunately the losses they took were simply too great, their effective combatants are in so small number you can no longer call them a deployable unit.`);
-				if (type === "bots") {
-					r.push(`It will take quite the investment to rebuild them.`);
-				} else {
-					r.push(`The remnants will be sent home honored as veterans or reorganized in a new unit.`);
-				}
-			} else if (squad.troops <= 10) {
-				r.push(`The unit has very few operatives left, it risks complete annihilation if deployed again.`);
-			}
-		}
-		return r.join(" ");
-	};
-
-	/**
-	 * @param {number} [lowerClass]
-	 * @param {number} [slaves]
-	 * @param {number} [prosperity]
-	 */
-	const arcologyEffects = function(lowerClass, slaves, prosperity) {
-		V.lowerClass -= random(lowerClass);
-		App.SecExp.slavesDamaged(random(slaves));
-		V.arcologies[0].prosperity -= random(prosperity);
-	};
-
-	/**
-	 * Does the target become wounded?
-	 * @param {string} [target]
-	 * @returns {string}
-	 */
-	const checkWoundStatus = function(target) {
-		let slave;
-		let woundChance = 0;
-		const r = [];
-		if (target === "PC") {
-			if (V.PC.career === "mercenary" || V.PC.career === "gang") {
-				woundChance -= 5;
-			} else if (V.PC.skill.warfare >= 75) {
-				woundChance -= 3;
-			}
-			if (V.personalArms >= 1) {
-				woundChance -= 5;
-			}
-			if (V.PC.physicalAge >= 60) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.belly > 5000) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.boobs >= 1000) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.butt >= 4) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.preg >= 30) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.balls >= 20) {
-				woundChance += random(5, 10);
-			}
-			if (V.PC.balls >= 9) {
-				woundChance += random(1, 5);
-			}
-			woundChance *= random(1, 2);
-		} else {
-			if (target === "Concubine") {
-				slave = S.Concubine;
-			} else if (target === "Bodyguard") {
-				slave = S.Bodyguard;
-			}
-
-			if (!slave) {
-				return ``;
-			}
-
-			if (slave.skill.combat === 1) {
-				woundChance -= 2;
-			}
-			woundChance -= 0.25 * (getLimbCount(slave, 105));
-			if (slave.health.condition >= 50) {
-				woundChance -= 1;
-			}
-			if (slave.weight > 130) {
-				woundChance += 1;
-			}
-			if (slave.muscles < -30) {
-				woundChance += 1;
-			}
-			if (getBestVision(slave) === 0) {
-				woundChance += 1;
-			}
-			if (slave.heels === 1) {
-				woundChance += 1;
-			}
-			if (slave.boobs >= 1400) {
-				woundChance += 1;
-			}
-			if (slave.butt >= 6) {
-				woundChance += 1;
-			}
-			if (slave.belly >= 10000) {
-				woundChance += 1;
-			}
-			if (slave.dick >= 8) {
-				woundChance += 1;
-			}
-			if (slave.balls >= 8) {
-				woundChance += 1;
-			}
-			if (slave.intelligence + slave.intelligenceImplant < -95) {
-				woundChance += 1;
-			}
-			woundChance *= random(2, 4);
-		}
-
-		if (random(1, 100) <= woundChance) {
-			if (target === "PC") {
-				healthDamage(V.PC, 60);
-				r.push(`A lucky shot managed to find its way to you, leaving a painful, but thankfully not lethal, wound.`);
-			} else {
-				const woundType = App.SecExp.inflictBattleWound(slave);
-				const {his, him} = getPronouns(slave);
-				if (target === "Concubine") {
-					r.push(`Your Concubine was unfortunately caught in the crossfire.`);
-				} else {
-					r.push(`During one of the assaults your Bodyguard was hit.`);
-				}
-				if (woundType === "voice") {
-					r.push(`A splinter pierced ${his} throat, severing ${his} vocal cords.`);
-				} else if (woundType === "eyes") {
-					r.push(`A splinter hit ${his} face, severely damaging ${his} eyes.`);
-				} else if (woundType === "legs") {
-					r.push(`An explosion near ${him} caused the loss of both of ${his} legs.`);
-				} else if (woundType === "arm") {
-					r.push(`An explosion near ${him} caused the loss of one of ${his} arms.`);
-				} else if (woundType === "flesh") {
-					r.push(`A stray shot severely wounded ${him}.`);
-				}
-			}
-		} else if (target === "PC") {
-			r.push(`Fortunately you managed to avoid injury.`);
-		}
-		return r.join(" ");
-	};
-
-	/**
-	 * @param {FC.SecExp.PlayerHumanUnitType} [unit]
-	 * @param {number} [averageLosses]
-	 */
-	const rebellingUnitsFate = function(unit, averageLosses) {
-		let manpower = 0;
-		const node = new DocumentFragment();
-		const r = [];
-		const rebels = {ID: [], names: []};
-
-		const Dissolve = function() {
-			App.SecExp.unit.unitFree(unit).add(manpower);
-			for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
-				u.loyalty = Math.clamp(u.loyalty - random(10, 40), 0, 100);
-			}
-			return `Units dissolved.`;
-		};
-		const Purge = function() {
-			App.SecExp.unit.unitFree(unit).add(manpower * 0.5);
-			return `Dissidents purged and units dissolved.`;
-		};
-		const Execute = function() {
-			for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
-				u.loyalty = Math.clamp(u.loyalty + random(10, 40), 0, 100);
-			}
-			return `Units executed. Dissent will not be tolerated.`;
-		};
-
-		App.UI.DOM.appendNewElement("div", node);
-		for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
-			if (V.SecExp.war.rebellingID.contains(u.ID)) {
-				rebels.names.push(`${u.platoonName}`);
-				rebels.ID.push(u.ID);
-				manpower += Math.clamp(u.troops - random(averageLosses), 0, u.troops);
-			}
-		}
-
-		if (rebels.ID.length > 0) {
-			V.SecExp.units[unit].squads.deleteWith((u) => rebels.ID.contains(u.ID));
-			V.SecExp.battles.lastSelection.deleteWith((u) => rebels.ID.contains(u.ID));
-			if (unit === "slaves") {
-				r.push(`${toSentence(rebels.names)} decided in their blind arrogance to betray you.`);
-			} else if (unit === "militia") {
-				r.push(`${toSentence(rebels.names)} had the gall to betray you and join your enemies.`);
-			} else if (unit === "mercs") {
-				r.push(`${toSentence(rebels.names)} made the grave mistake of betraying you.`);
-			}
-			if (V.SecExp.war.result < 2) { // rebellion loss
-				r.push(`They participated in the looting following the battle, then vanished in the wastes.`);
-				cashX(forceNeg(1000 * rebels.ID.length), "war");
-			} else { // rebellion win
-				App.Events.addResponses(node, [
-					new App.Events.Result(
-						`Dissolve the units`,
-						Dissolve,
-						`Manpower will be refunded, but will negatively influence the loyalty of the other units`
-					),
-					new App.Events.Result(
-						`Purge the dissidents and dissolve the units`,
-						Purge,
-						`Will not influence the loyalty of the other units, but half the manpower will be refunded.`
-					),
-					new App.Events.Result(
-						`Execute them all`,
-						Execute,
-						`Will positively influence the loyalty of the other units, but manpower will not be refunded.`
-					),
-				]);
-			}
-			App.Events.addNode(node, r, "div");
-		}
-		return node;
-	};
-
-	V.SecExp.war.attacker.losses = Math.trunc(V.SecExp.war.attacker.losses);
-	if (V.SecExp.war.attacker.losses > V.SecExp.war.attacker.troops) {
-		V.SecExp.war.attacker.losses = V.SecExp.war.attacker.troops;
-	}
-	V.SecExp.core.totalKills += V.SecExp.war.attacker.losses;
-	V.SecExp.war.losses = Math.trunc(V.SecExp.war.losses);
-
-	if (result === 3 || result === 2) {
-		App.UI.DOM.appendNewElement("h1", node, `${result === 2 ? 'Partial ' : ''}Victory!`, "strong");
-		V.SecExp.rebellions.victories++;
-	} else if (result === -3 || result === -2) {
-		App.UI.DOM.appendNewElement("h1", node, `${result === -2 ? 'Partial ' : ''}Defeat!`, "strong");
-		V.SecExp.rebellions.losses++;
-	} else if (result === -1) {
-		App.UI.DOM.appendNewElement("h1", node, `We surrendered`, "strong");
-		V.SecExp.rebellions.losses++;
-	}
-	App.UI.DOM.appendNewElement("hr", node);
-
-	r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was inflamed by the fires of rebellion. ${num(Math.trunc(V.SecExp.war.attacker.troops))} rebels from all over the structure dared rise up`);
-	if (slaveRebellion) {
-		r.push(`against their owners and conquer their freedom through blood.`);
-	} else {
-		r.push(`to dethrone their arcology owner.`);
-	}
-	r.push(`Our defense force, ${num(App.SecExp.battle.troopCount())} strong, fought with them street by street`);
-	if (allKilled) {
-		r.push(`completely annihilating their troops, while sustaining`);
-	} else {
-		r.push(`inflicting ${V.SecExp.war.attacker.losses} casualties, while sustaining`);
-	}
-	if (V.SecExp.war.losses > 1) {
-		r.push(`${num(Math.trunc(V.SecExp.war.losses))} casualties`);
-	} else if (V.SecExp.war.losses > 0) {
-		r.push(`a casualty`);
-	} else {
-		r.push(`zero casualties`);
-	}
-	r.push(`${allKilled ? '' : 'themselves'}.`);
-	if (V.SecExp.rebellions.sfArmor) {
-		r.push(`More units were able to survive thanks to wearing ${V.SF.Lower}'s combat armor suits.`);
-	}
-	App.Events.addNode(node, r);
-	r = [];
-
-	App.SecExp.slavesDamaged(V.SecExp.war.attacker.losses);
-	if (result === 3) {
-		if (V.SecExp.war.turns <= 5) {
-			r.push(`The fight was quick and one sided: our men easily stopped the disorganized revolt in a few well aimed assaults.`);
-		} else if (V.SecExp.war.turns <= 7) {
-			r.push(`The fight was hard, but in the end our men stopped the disorganized revolt with several well aimed assaults.`);
-		} else {
-			r.push(`The fight was long and hard, but in the end our men stopped the revolt before it could accumulate momentum.`);
-		}
-	} else if (result === -3) {
-		if (V.SecExp.war.turns <= 5) {
-			r.push(`The fight was quick and one sided: our men were easily crushed by the furious charge of the rebels.`);
-		} else if (V.SecExp.war.turns <= 7) {
-			r.push(`The fight was hard and in the end the rebels proved too much to handle for our men.`);
-		} else {
-			r.push(`The fight was long and hard, but despite their bravery the rebels proved too much for our men.`);
-		}
-	} else if (result === 2) {
-		r.push(`The fight was long and hard, but in the end our men managed to stop the revolt, though not without difficulty.`);
-	} else if (result === -2) {
-		r.push(`The fight was long and hard. In the end, our men had to yield to the rebelling slaves, which were fortunately unable to capitalize on their victory.`);
-	} else if (result === -1) {
-		r.push(`You gave your troops the order to surrender; they obediently stand down.`);
-	}
-	App.Events.addNode(node, r);
-	r = [];
-
 	// Effects
 	if (result === 3 || result === 2) {
 		node.append(` Thanks to your victory, your `, App.UI.DOM.makeElement("span", `reputation`, "green"), ` and `, App.UI.DOM.makeElement("span", `authority`, "darkviolet"), ` increased.`);
@@ -537,16 +203,6 @@ App.Events.rebellionReport = function() {
 			}
 		}
 	}
-	App.Events.addNode(node, r);
-
-	App.UI.DOM.appendNewElement("p", node, unitsRebellionReport());
-	V.SecExp.rebellions[V.SecExp.war.type.toLowerCase().replace(' rebellion', '') + 'Progress'] = 0;
-	V.SecExp.rebellions.tension = Math.clamp(V.SecExp.rebellions.tension - random(50, 100), 0, 100);
-	if (slaveRebellion) {
-		V.SecExp.rebellions.citizenProgress = Math.clamp(V.SecExp.rebellions.citizenProgress - random(50, 100), 0, 100);
-	} else {
-		V.SecExp.rebellions.slaveProgress = Math.clamp(V.SecExp.rebellions.slaveProgress - random(50, 100), 0, 100);
-	}
 	return node;
 
 	function unitsRebellionReport() {
-- 
GitLab


From 241c096e4b37b0a02e6e2e6125b43fab2099edbb Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Fri, 23 Jul 2021 23:39:14 +1200
Subject: [PATCH 02/19] conversion finished

---
 src/005-passages/eventsPassages.js        |    9 +-
 src/Mods/SecExp/events/attackReport.js    |  764 --------------
 src/Mods/SecExp/events/conflictHandler.js |    2 +-
 src/Mods/SecExp/events/conflictReport.js  | 1115 +++++++++++++++++++--
 src/Mods/SecExp/events/rebellionReport.js |  339 -------
 5 files changed, 1012 insertions(+), 1217 deletions(-)
 delete mode 100644 src/Mods/SecExp/events/attackReport.js
 delete mode 100644 src/Mods/SecExp/events/rebellionReport.js

diff --git a/src/005-passages/eventsPassages.js b/src/005-passages/eventsPassages.js
index 6bc374dc415..152b8015682 100644
--- a/src/005-passages/eventsPassages.js
+++ b/src/005-passages/eventsPassages.js
@@ -6,14 +6,9 @@ new App.DomPassage("Nonrandom Event",
 	}
 );
 
-new App.DomPassage("attackReport",
+new App.DomPassage("conflictReport",
 	() => {
-		return App.Events.attackReport();
-	}
-);
-new App.DomPassage("rebellionReport",
-	() => {
-		return App.Events.rebellionReport();
+		return App.Events.conflictHandler();
 	}
 );
 new App.DomPassage("conflictHandler",
diff --git a/src/Mods/SecExp/events/attackReport.js b/src/Mods/SecExp/events/attackReport.js
deleted file mode 100644
index 8fe41c2fed1..00000000000
--- a/src/Mods/SecExp/events/attackReport.js
+++ /dev/null
@@ -1,764 +0,0 @@
-App.Events.attackReport = function() {
-	const lossesList = [];
-	// calculates effects on the city
-	if (V.SecExp.war.result === 3) {
-		r.push(`Thanks to your victory, your <span class="green">reputation</span> and <span class="darkviolet">authority</span> increased. You were also able to capture`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			repX(4000 * majorBattleMod, "war");
-			V.SecExp.core.authority += 800 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			repX(6000 * majorBattleMod, "war");
-			V.SecExp.core.authority += 1200 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			repX(7500 * majorBattleMod, "war");
-			V.SecExp.core.authority += 1500 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			repX(8000 * majorBattleMod, "war");
-			V.SecExp.core.authority += 1600 * majorBattleMod;
-		}
-		if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 50) {
-			r.push(`a small amount of attackers,`);
-			captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
-		} else if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 100) {
-			r.push(`an healthy group of attackers,`);
-			captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
-		} else if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 150) {
-			r.push(`a big group of attackers,`);
-			captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
-		} else if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 200) {
-			r.push(`a huge group of attackers,`);
-			captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
-		} else if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses > 200) {
-			r.push(`a great amount of attackers,`);
-			captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
-		}
-		r.push(`and some of their equipment, which once sold produced`);
-		if (V.SecExp.war.attacker.equip === 0) {
-			r.push(`<span class="yellowgreen">a small amount of cash.</span>`);
-			loot += 1000 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.equip === 1) {
-			r.push(`<span class="yellowgreen">a moderate amount of cash.</span>`);
-			loot += 5000 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.equip === 2) {
-			r.push(`<span class="yellowgreen">a good amount of cash.</span>`);
-			loot += 10000 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.equip === 3) {
-			r.push(`<span class="yellowgreen">a great amount of cash.</span>`);
-			loot += 15000 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.equip === 4) {
-			r.push(`<span class="yellowgreen">wealth worthy of the mightiest warlord.</span>`);
-			loot += 20000 * majorBattleMod;
-		}
-		if (V.SecExp.edicts.defense.privilege.mercSoldier === 1 && App.SecExp.battle.deployedUnits('mercs') >= 1) {
-			r.push(`Part of the loot is distributed to your mercenaries.`);
-			captives = Math.trunc(captives * 0.6);
-			loot = Math.trunc(loot * 0.6);
-		}
-		cashX(loot, "war");
-		App.Events.addParagraph(node, r);
-		r = [];
-		r.push(`Damage to the infrastructure was <span class="yellow">virtually non-existent,</span> costing only pocket cash to bring the structure back to normal. The inhabitants as well reported little to no injuries, because of this the prosperity of the arcology did not suffer.`);
-		r.push(`${IncreasePCSkills('engineering', 0.1)}`);
-		cashX(forceNeg(1000 * majorBattleMod), "war");
-		if (V.SecExp.battles.victoryStreak >= 3) {
-			r.push(`It seems your victories over the constant threats directed your way is having <span class="green">a positive effect on the prosperity of the arcology,</span> due to the security your leadership affords.`);
-			V.arcologies[0].prosperity += 5 * majorBattleMod;
-		}
-	} else if (V.SecExp.war.result === -3) {
-		r.push(`Due to your defeat, your <span class="red">reputation</span> and <span class="red">authority</span> decreased. Obviously your troops were not able to capture anyone or anything.`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			repX(forceNeg(400 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 400 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			repX(forceNeg(600 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 600 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			repX(forceNeg(750 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 750 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			repX(forceNeg(800 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 800 * majorBattleMod;
-		}
-		App.Events.addParagraph(node, r);
-		r = [];
-		r.push(`In the raiding following the battle <span class="red">the arcology sustained heavy damage,</span> which will cost quite the amount of cash to fix. Reports of <span class="red">citizens or slaves killed or missing</span> flood your office for a few days following the defeat.`);
-		r.push(`${IncreasePCSkills('engineering', 0.1)}`);
-		cashX(forceNeg(5000 * majorBattleMod), "war");
-		if (V.week <= 30) {
-			V.lowerClass -= random(100) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(150) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(5) * majorBattleMod;
-		} else if (V.week <= 60) {
-			V.lowerClass -= random(120) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(170) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(10) * majorBattleMod;
-		} else if (V.week <= 90) {
-			V.lowerClass -= random(140) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(190) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(15) * majorBattleMod;
-		} else if (V.week <= 120) {
-			V.lowerClass -= random(160) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(210) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(20) * majorBattleMod;
-		} else {
-			V.lowerClass -= random(180) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(230) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(25) * majorBattleMod;
-		}
-		if (V.SecExp.battles.lossStreak >= 3) {
-			r.push(`This only confirms the fears of many, <span class="red">your arcology is not safe</span> and it is clear their business will be better somewhere else.`);
-			V.arcologies[0].prosperity -= 5 * majorBattleMod;
-		}
-	} else if (V.SecExp.war.result === 2) {
-		r.push(`Thanks to your victory, your <span class="green">reputation</span> and <span class="darkviolet">authority</span> slightly increased. Our men were not able to capture any combatants, however some equipment was seized during the enemy's hasty retreat,`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			repX(1000 * majorBattleMod, "war");
-			V.SecExp.core.authority += 200 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			repX(1500 * majorBattleMod, "war");
-			V.SecExp.core.authority += 300 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			repX(2000 * majorBattleMod, "war");
-			V.SecExp.core.authority += 450 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			repX(2100 * majorBattleMod, "war");
-			V.SecExp.core.authority += 500 * majorBattleMod;
-		}
-		r.push(`which once sold produced`);
-		if (V.SecExp.war.attacker.equip === 0) {
-			r.push(`<span class="yellowgreen">a bit of cash.</span>`);
-			loot += 500 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.equip === 1) {
-			r.push(`<span class="yellowgreen">a small amount of cash.</span>`);
-			loot += 2500 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.equip === 2) {
-			r.push(`<span class="yellowgreen">a moderate amount of cash.</span>`);
-			loot += 5000 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.equip === 3) {
-			r.push(`<span class="yellowgreen">a good amount of cash.</span>`);
-			loot += 7500 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.equip === 4) {
-			r.push(`<span class="yellowgreen">a great amount of cash.</span>`);
-			loot += 10000 * majorBattleMod;
-		}
-		if (V.SecExp.edicts.defense.privilege.mercSoldier === 1 && App.SecExp.battle.deployedUnits('mercs') >= 1) {
-			r.push(`Part of the loot is distributed to your mercenaries.`);
-			loot = Math.trunc(loot * 0.6);
-		}
-		cashX(loot, "war");
-		App.Events.addParagraph(node, r);
-		r = [];
-		r.push(`Damage to the city was <span class="red">limited,</span> it won't take much to rebuild. Very few citizens or slaves were involved in the fight and even fewer met their end, safeguarding the prosperity of the arcology.`);
-		r.push(`${IncreasePCSkills('engineering', 0.1)}`);
-		cashX(forceNeg(2000 * majorBattleMod), "war");
-		V.lowerClass -= random(10) * majorBattleMod;
-		App.SecExp.slavesDamaged(random(20) * majorBattleMod);
-	} else if (V.SecExp.war.result === -2) {
-		r.push(`It was a close defeat, but nonetheless your <span class="red">reputation</span> and <span class="red">authority</span> slightly decreased. Your troops were not able to capture anyone or anything.`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			repX(forceNeg(40 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 40 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			repX(forceNeg(60 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 60 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			repX(forceNeg(75 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 75 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			repX(forceNeg(80 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 80 * majorBattleMod;
-		}
-		App.Events.addParagraph(node, r);
-		r = [];
-		r.push(`The enemy did not have the strength to raid the arcology for long, still <span class="red">the arcology sustained some damage,</span> which will cost a moderate amount of cash to fix. Some citizens and slaves found themselves on the wrong end of a gun and met their demise.`);
-		r.push(`Some business sustained heavy damage, slightly impacting the arcology's prosperity.`);
-		r.push(`${IncreasePCSkills('engineering', 0.1)}`);
-		cashX(forceNeg(3000 * majorBattleMod), "war");
-		if (V.week <= 30) {
-			V.lowerClass -= random(50) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(75) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(2) * majorBattleMod;
-		} else if (V.week <= 60) {
-			V.lowerClass -= random(60) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(85) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(5) * majorBattleMod;
-		} else if (V.week <= 90) {
-			V.lowerClass -= random(70) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(95) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(7) * majorBattleMod;
-		} else if (V.week <= 120) {
-			V.lowerClass -= random(80) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(105) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(10) * majorBattleMod;
-		} else {
-			V.lowerClass -= random(90) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(115) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(12) * majorBattleMod;
-		}
-	} else if (V.SecExp.war.result === -1) {
-		r.push(`Rather than waste the lives of your men you decided to surrender, hoping your enemy will cause less damage if you indulge them, this is however a big hit to your status. Your <span class="red">reputation</span> and <span class="red">authority</span> are significantly impacted.`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			repX(forceNeg(600 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 600 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			repX(forceNeg(800 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 800 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			repX(forceNeg(1000 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 1000 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			repX(forceNeg(1200 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 1200 * majorBattleMod;
-		}
-		App.Events.addParagraph(node, r);
-		r = [];
-		r.push(`The surrender allows the arcology to survive <span class="red">mostly intact,</span> however reports of <span class="red">mass looting and killing of citizens</span> flood your office for a few days.`);
-		r.push(`${IncreasePCSkills('engineering', 0.1)}`);
-		cashX(forceNeg(1000 * majorBattleMod), "war");
-		if (V.week <= 30) {
-			V.lowerClass -= random(80) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(120) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(5) * majorBattleMod;
-		} else if (V.week <= 60) {
-			V.lowerClass -= random(100) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(140) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(10) * majorBattleMod;
-		} else if (V.week <= 90) {
-			V.lowerClass -= random(120) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(160) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(15) * majorBattleMod;
-		} else if (V.week <= 120) {
-			V.lowerClass -= random(140) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(180) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(20) * majorBattleMod;
-		} else {
-			V.lowerClass -= random(160) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(200) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(25) * majorBattleMod;
-		}
-	} else if (V.SecExp.war.result === 0) {
-		r.push(`Unfortunately your adversary did not accept your money.`);
-		if (V.SecExp.war.attacker.type === "freedom fighters") {
-			r.push(`Their ideological crusade would not allow such thing.`);
-		} else {
-			r.push(`They saw your attempt as nothing more than admission of weakness.`);
-		}
-		r.push(`There was no time to organize a defense and so the enemy walked into the arcology as it was his. Your reputation and authority suffer a hit.`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			repX(forceNeg(400 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 400 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			repX(forceNeg(600 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 600 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			repX(forceNeg(750 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 750 * majorBattleMod;
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			repX(forceNeg(800 * majorBattleMod), "war");
-			V.SecExp.core.authority -= 800 * majorBattleMod;
-		}
-		V.SecExp.core.authority = Math.clamp(V.SecExp.core.authority, 0, 20000);
-		App.Events.addParagraph(node, r);
-		r = [];
-		r.push(`Fortunately the arcology survives <span class="yellow">mostly intact,</span> however reports of <span class="red">mass looting and killing of citizens</span> flood your office for a few days.`);
-		r.push(`${IncreasePCSkills('engineering', 0.1)}`);
-		cashX(-1000, "war");
-		if (V.week <= 30) {
-			V.lowerClass -= random(80) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(120) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(5) * majorBattleMod;
-		} else if (V.week <= 60) {
-			V.lowerClass -= random(100) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(140) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(10) * majorBattleMod;
-		} else if (V.week <= 90) {
-			V.lowerClass -= random(120) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(160) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(15) * majorBattleMod;
-		} else if (V.week <= 120) {
-			V.lowerClass -= random(140) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(180) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(20) * majorBattleMod;
-		} else {
-			V.lowerClass -= random(160) * majorBattleMod;
-			App.SecExp.slavesDamaged(random(200) * majorBattleMod);
-			V.arcologies[0].prosperity -= random(25) * majorBattleMod;
-		}
-		App.Events.addParagraph(node, r);
-		r = [];
-	} else if (V.SecExp.war.result === 1) {
-		r.push(`The attackers wisely take the money offered them to leave your territory without further issues. The strength of the Free Cities was never in their guns but in their dollars, and today's events are the perfect demonstration of such strength.`);
-		r.push(`Your <span class="green">reputation slightly increases.</span>`);
-		if (V.SecExp.war.attacker.type === "raiders") {
-			repX(500 * majorBattleMod, "war");
-		} else if (V.SecExp.war.attacker.type === "free city") {
-			repX(750 * majorBattleMod, "war");
-		} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-			repX(1000 * majorBattleMod, "war");
-		} else if (V.SecExp.war.attacker.type === "old world") {
-			repX(1250 * majorBattleMod, "war");
-		}
-		cashX(forceNeg(App.SecExp.battle.bribeCost()), "war");
-	}
-	if (!Number.isInteger(V.lowerClass)) {
-		if (isNaN(V.lowerClass)) {
-			r.push(App.UI.DOM.makeElement("div", `Error: lowerClass is NaN, please report this issue`, "red"));
-		} else if (V.lowerClass > 0) {
-			V.lowerClass = Math.trunc(V.lowerClass);
-		} else {
-			V.lowerClass = 0;
-		}
-	}
-	if (!Number.isInteger(V.NPCSlaves)) {
-		if (isNaN(V.NPCSlaves)) {
-			r.push(App.UI.DOM.makeElement("div", `Error: NPCSlaves is NaN, please report this issue`, "red"));
-		} else if (V.NPCSlaves > 0) {
-			V.NPCSlaves = Math.trunc(V.NPCSlaves);
-		} else {
-			V.NPCSlaves = 0;
-		}
-	}
-
-	App.Events.addParagraph(node, r);
-	r = [];
-	if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) {
-		App.Events.addParagraph(node, App.SecExp.commanderEffectiveness("report"));
-		r = [];
-
-		// tactics
-		if (V.SecExp.war.commander === "PC") {
-			r.push(`You`);
-		} else {
-			r.push(`Your commander`);
-		}
-		if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-			r.push(`chose to employ "bait and bleed" tactics or relying on quick attacks and harassment to tire and wound the enemy until their surrender.`);
-		} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-			r.push(`chose to employ "guerrilla" tactics or relying on stealth, terrain knowledge and subterfuge to undermine and ultimately destroy the enemy.`);
-		} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-			r.push(`chose to employ "choke points" tactics or the extensive use of fortified or highly defensive positions to slow down and eventually stop the enemy.`);
-		} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-			r.push(`chose to employ "interior lines" tactics or exploiting the defender's shorter front to quickly disengage and concentrate troops when and where needed.`);
-		} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-			r.push(`chose to employ "pincer maneuver" tactics or attempting to encircle the enemy by faking a collapsing center front.`);
-		} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-			r.push(`chose to employ "defense in depth" tactics or relying on mobility to disengage and exploit overextended enemy troops by attacking their freshly exposed flanks.`);
-		} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-			r.push(`chose to employ "blitzkrieg" tactics or shattering the enemy's front-line with a violent, concentrated armored assault.`);
-		} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-			r.push(`chose to employ "human wave" tactics or overwhelming the enemy's army with a massive infantry assault.`);
-		}
-		if (V.SecExp.war.terrain === "urban") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`The urban terrain synergized well with bait and bleed tactics, slowly chipping away at the enemy's forces from the safety of the narrow streets and empty buildings.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`The urban terrain synergized well with guerrilla tactics, eroding your enemy's determination from the safety of the narrow streets and empty buildings.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`The urban environment offers many opportunities to hunker down and stop the momentum of the enemy's assault while keeping your soldiers in relative safety.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`While the urban environment offers many highly defensive position, it does restrict movement and with it the advantages of exploiting interior lines.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`The urban terrain does not allow for wide maneuvers, the attempts of your forces to encircle the attackers are mostly unsuccessful.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`While the urban environment offers many defensive positions, it limits mobility, limiting the advantages of using a defense in depth tactic.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The urban terrain is difficult to traverse, making your troops attempt at a lightning strike unsuccessful.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The urban terrain offers great advantages to the defender, your men find themselves in great disadvantage while mass assaulting the enemy's position.`);
-			}
-		} else if (V.SecExp.war.terrain === "rural") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`The open terrain of rural lands does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`The open terrain of rural lands does not offer many hiding spots, making it harder for your men to perform guerrilla actions effectively.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`The open terrain of rural lands does not offer many natural choke points, making it hard for your troops to funnel the enemy towards highly defended positions.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`The open terrain allows your men to easily exploit the superior mobility of the defender, making excellent use of interior lines to strike where it hurts.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`The open terrain affords your men great mobility, allowing them to easily position themselves for envelopment.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.`);
-			}
-		} else if (V.SecExp.war.terrain === "hills") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`While the hills offer some protection, they also make it harder to maneuver; bait and bleed tactics will not be 100% effective here.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`The hills offer protection to both your troops and your enemy's, making it harder for your men to accomplish guerrilla attacks effectively.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`While not as defensible as mountains, hills offer numerous opportunities to funnel the enemy towards highly defensible choke points.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`The limited mobility on hills hampers the capability of your troops to exploit the defender's greater mobility afforded by interior lines.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`Limited mobility due to the hills is a double edged sword, affording your men a decent shot at encirclement.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`The limited mobility on hills hampers the capability of your troops to use elastic defense tactics.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The limited mobility on hills hampers the capability of your troops to organize lightning strikes.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The defensibility of hills makes it harder to accomplish victory through mass assaults.`);
-			}
-		} else if (V.SecExp.war.terrain === "coast") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`On the coast there's little space and protection to effectively employ bait and bleed tactics.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`On the coast there's little space and protection to effectively employ guerrilla tactics.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`Amphibious attacks are difficult in the best of situations; the defender has a very easy time funneling the enemy towards their key defensive positions.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`While in an amphibious landing mobility is not the defender's best weapon, exploiting interior lines still affords your troops some advantages.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`Attempting to encircle a landing party is not the best course of action, but not the worst either.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`In an amphibious assault it's very easy for the enemy to overextend, making defense in depth tactics quite effective.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The rough, restricted terrain does not lend itself well to lightning strikes, but the precarious position of the enemy still gives your mobile troops tactical superiority.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The rough, restricted terrain does not lend itself well to mass assaults, but the precarious position of the enemy still gives your troops tactical superiority.`);
-			}
-		} else if (V.SecExp.war.terrain === "outskirts") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops bait and bleed tactics would require.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops guerrilla tactics would require.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`The imposing structure of the arcology itself provides plenty of opportunities to create fortified choke points from which to shatter the enemy assault.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`While the presence of the arcology near the battlefield is an advantage, it does limit maneuverability, lowering overall effectiveness of interior lines tactics.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`While the presence of the arcology near the battlefield is an advantage, it does limit maneuverability, lowering the chances of making an effective encirclement.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`Having the arcology near the battlefield means there are limited available maneuvers to your troops, who still needs to defend the structure, making defense in depth tactics not as effective.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`While an assault may save the arcology from getting involved at all, having the imposing structure so near does limit maneuverability and so the impetus of the lightning strike.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`While an attack may save the arcology from getting involved at all, having the imposing structure so near does limit maneuverability and so the impetus of the mass assault.`);
-			}
-		} else if (V.SecExp.war.terrain === "mountains") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`While the mountains offer great protection, they also limit maneuverability; bait and bleed tactics will not be quite as effective here.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`The mountains offer many excellent hiding spots and defensive positions, making guerrilla tactics very effective.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`The mountains offer plenty of opportunity to build strong defensive positions from which to shatter the enemy's assault.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`While the rough terrain complicates maneuvers, the defensive advantages offered by the mountains offsets its negative impact.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective encirclement in this environment.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`While mobility is limited, defensive positions are plentiful; your men are not able to fully exploit overextended assaults, but are able to better resist them.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective lightning strike in this environment.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective mass assault in this environment.`);
-			}
-		} else if (V.SecExp.war.terrain === "wasteland") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`While the wastelands are mostly open terrain, there are enough hiding spots to make bait and bleed tactics work well enough.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`While the wastelands are mostly open terrain, there are enough hiding spots to make guerrilla tactics work well enough.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`The wastelands are mostly open terrain; your men have a difficult time setting up effective fortified positions.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`The wastelands, while rough, are mostly open terrain, where your men can exploit to the maximum the superior mobility of the defender.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`The wastelands, while rough, are mostly open terrain; your men can set up an effective encirclement here.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`The wastelands, while rough, are mostly open terrain, allowing your men to liberally maneuver to exploit overextended enemies.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The wastelands, while rough, are mostly open terrain, where your men are able to mount effective lightning strikes.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The wastelands, while rough, are mostly open terrain, where your men are able to mount effective mass assaults.`);
-			}
-		} else if (V.SecExp.war.terrain === "international waters") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`The open terrain of international waters does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`The open terrain of international waters does not offer many hiding spots, making it harder for your men to perform guerrilla actions effectively.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`The open terrain of international waters does not offer many natural choke points, making it hard for your troops to funnel the enemy towards highly defended positions.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`The open terrain allows your men to easily exploit the superior mobility of the defender, making excellent use of interior lines to strike where it hurts.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`The open terrain affords your men great mobility, allowing them to easily position themselves for envelopment.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.`);
-			}
-		} else if (V.SecExp.war.terrain === "an underwater cave") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`The tight terrain of an underwater cave does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`The tight terrain of an underwater cave does offers many hiding spots, making it easier for your men to perform guerrilla actions effectively.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`The tight terrain of an underwater cave offers many natural choke points, making it easy for your troops to funnel the enemy towards highly defended positions.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`The tight terrain makes it hard for your men to easily exploit the superior mobility of the defender.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`The tight terrain hinders the mobility of your army, allowing them to easily position themselves for envelopment.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`The tight terrain hinders the mobility of your army, allowing them to exploit overextended assaults and concentrate where and when it matters.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The tight terrain hinders the mobility of your army, making it easier to accomplish concentrated lightning strikes.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The tight terrain hinders the mobility of your army, making it easier to overwhelm the enemy with mass assaults.`);
-			}
-		} else if (V.SecExp.war.terrain === "a sunken ship") {
-			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-				r.push(`The tight terrain of a sunken ship lends itself well to bait and bleed tactics, making it easier for your men to achieve tactical superiority.`);
-			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-				r.push(`The tight terrain of a sunken ship offers many hiding spots, making it easy for your men to perform guerrilla actions effectively.`);
-			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-				r.push(`The tight terrain of a sunken ship offers many natural choke points, making it easy for your troops to funnel the enemy towards highly defended positions.`);
-			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-				r.push(`The tight terrain does not allow your men to easily exploit the superior mobility of the defender.`);
-			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-				r.push(`The open terrain hinders the mobility of your army, allowing them to easily position themselves for envelopment.`);
-			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-				r.push(`The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.`);
-			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-				r.push(`The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.`);
-			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-				r.push(`The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.`);
-			}
-		}
-
-		if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`Since the bands of raiders are used to be on high alert and on the move constantly, bait and bleed tactics are not effective against them.`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`The modern armies hired by Free Cities are decently mobile, which means quick hit and run attacks will be less successful, but their discipline and confidence still make them quite susceptible to this type of attack.`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harassment tactics.`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`Freedom fighters live every day as chasing and being chased by far superior forces, they are far more experienced than your troops in this type of warfare and much less susceptible to it.`);
-			}
-		} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`Since the bands of raiders are used to be on high alert and on the move constantly, guerrilla tactics are not effective against them.`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`The modern armies hired by Free Cities are highly mobile, which means quick hit and run attacks will be less successful, but their discipline and confidence still make them quite susceptible to this type of attack.`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harassment tactics.`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`Freedom fighters live every day as chasing and being chased by far superior forces, they are far more experienced than your troops in this type of warfare and much less susceptible to it.`);
-			}
-		} else if (V.SecExp.war.chosenTactic === "Choke Points") {
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`Raiders lack heavy weaponry or armor, so making use of fortified positions is an excellent way to dissipate the otherwise powerful momentum of their assault.`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`The high tech equipment Free Cities can afford to give their guns for hire means there's no defensive position strong enough to stop them, still the relatively low numbers means they will have to take a careful approach, slowing them down.`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`Old world armies have both the manpower and the equipment to conquer any defensive position, making use of strong fortifications will only bring you this far against them.`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`The lack of specialized weaponry means freedom fighters have a rather hard time overcoming tough defensive positions, unfortunately they have also a lot of experience in avoiding them.`);
-			}
-		} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`The highly mobile horde of raiders will not give much room for your troops to maneuver, lowering their tactical superiority.`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`While decently mobile, Free Cities forces are not in high enough numbers to risk maintaining prolonged contact, allowing your troops to quickly disengage and redeploy where it hurts.`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`Old world armies are not famous for the mobility, which makes them highly susceptible to any tactic that exploits maneuverability and speed.`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`While not the best equipped army, the experience and mobility typical of freedom fighters groups make them tough targets for an army that relies itself on mobility.`);
-			}
-		} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`While numerous, the undisciplined masses of raiders are easy prey for encirclements.`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`While decently mobile, the low number of Free Cities expedition forces make them good candidates for encirclements.`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`The discipline and numbers of old world armies make them quite difficult to encircle.`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`While not particularly mobile, freedom fighters are used to fight against overwhelming odds, diminishing the effectiveness of the encirclement.`);
-			}
-		} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`While their low discipline makes them prime candidates for an elastic defense type of strategy, their high numbers limit your troops maneuverability.`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`With their low numbers Free Cities mercenaries are quite susceptible to this type of tactic, despite their mobility.`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`With their low mobility old world armies are very susceptible to this type of strategy.`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`Low mobility and not particularly high numbers mean freedom fighters can be defeated by employing elastic defense tactics.`);
-			}
-		} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`With their low discipline and lack of heavy equipment, lightning strikes are very effective against raider hordes.`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`Having good equipment and discipline on their side, Free Cities expeditions are capable of responding to even strong lightning strikes.`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`While disciplined, old world armies low mobility makes them highly susceptible to lightning strikes.`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`While not well equipped, freedom fighters have plenty of experience fighting small, mobile attacks, making them difficult to defeat with lightning strikes.`);
-			}
-		} else if (V.SecExp.war.chosenTactic === "Human Wave") {
-			if (V.SecExp.war.attacker.type === "raiders") {
-				r.push(`The hordes of raiders are much more experienced than your soldiers in executing mass assaults and they also have a lot more bodies to throw in the grinder.`);
-			} else if (V.SecExp.war.attacker.type === "free city") {
-				r.push(`The good equipment and mobility of Free Cities mercenaries cannot save them from an organized mass assault.`);
-			} else if (V.SecExp.war.attacker.type === "old world") {
-				r.push(`Unfortunately the discipline and good equipment of old world armies allow them to respond well against a mass assault.`);
-			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
-				r.push(`The relative low numbers and not great equipment typical of freedom fighters make them susceptible to being overwhelmed by an organized mass assault.`);
-			}
-		}
-		r.push(`In the end`);
-		if (V.SecExp.war.commander === "PC") {
-			r.push(`you were`);
-		} else {
-			r.push(`your commander was`);
-		}
-		if (V.SecExp.war.tacticsSuccessful) {
-			r.push(`<span class="green">able to successfully employ ${V.SecExp.war.chosenTactic} tactics,</span> greatly enhancing`);
-		} else {
-			r.push(`<span class="red">not able to effectively employ ${V.SecExp.war.chosenTactic} tactics,</span> greatly affecting`);
-		}
-		r.push(`the efficiency of your army.`);
-		App.Events.addParagraph(node, r);
-		r = [];
-		node.append(unitsBattleReport());
-
-		if (
-			V.SF.Toggle && V.SF.Active >= 1 &&
-			(V.SF.Squad.Firebase >= 7 || V.SF.Squad.GunS >= 1 || V.SF.Squad.Satellite >= 5 || V.SF.Squad.GiantRobot >= 6 || V.SF.Squad.MissileSilo >= 1)
-		) {
-			// SF upgrades effects
-			App.Events.addParagraph(node, r);
-			r = [];
-			if (V.SF.Squad.Firebase >= 7) {
-				r.push(`The artillery pieces installed around ${V.SF.Lower}'s firebase provided vital fire support to the troops in the field.`);
-			}
-			if (V.SF.Squad.GunS >= 1) {
-				r.push(`The gunship gave our troops an undeniable advantage in recon capabilities, air superiority and fire support.`);
-			}
-			if (V.SF.Squad.Satellite >= 5 && V.SF.SatLaunched > 0) {
-				r.push(`The devastating power of ${V.SF.Lower}'s satellite was employed with great efficiency against the enemy.`);
-			}
-			if (V.SF.Squad.GiantRobot >= 6) {
-				r.push(`The giant robot of ${V.SF.Lower} proved to be a great boon to our troops, shielding many from the worst the enemy had to offer.`);
-			}
-			if (V.SF.Squad.MissileSilo >= 1) {
-				r.push(`The missile silo exterminated many enemy soldiers even before the battle would begin.`);
-			}
-		}
-	}// closes check for surrender and bribery
-
-	App.Events.addParagraph(node, r);
-	r = [];
-
-	let menialPrice = Math.trunc((V.slaveCostFactor * 1000) / 100) * 100;
-	menialPrice = Math.clamp(menialPrice, 500, 1500);
-
-	captives = Math.trunc(captives);
-	if (captives > 0) {
-		let candidates = 0;
-		r.push(`During the battle ${captives} attackers were captured.`);
-		if (random(1, 100) <= 25) {
-			candidates = Math.min(captives, random(1, 3));
-			r.push(`${capFirstChar(num(candidates, true))} of them have the potential to be sex slaves.`);
-		}
-
-		const sell = function() {
-			cashX((menialPrice * captives), "menialTransfer");
-			return `Captives sold`;
-		};
-
-		const keep = function() {
-			V.menials += (captives - candidates);
-			for (let i = 0; i < candidates; i++) {
-				const generateFemale = random(0, 99) < V.seeDicks;
-				let slave = GenerateNewSlave((generateFemale ? "XY" : "XX"), {minAge: 16, maxAge: 32, disableDisability: 1});
-				slave.weight = (generateFemale ? random(-20, 30) : random(0, 30));
-				slave.muscles = (generateFemale ? random(15, 80) : random(25, 80));
-				slave.waist = (generateFemale ? random(10, 80) : random(-20, 20));
-				slave.skill.combat = 1;
-				slave.origin = `$He is an enslaved ${V.SecExp.war.attacker.type} soldier captured during a battle.`;
-				newSlave(slave); // skip New Slave Intro
-			}
-			return `Captives primarily added as menial slaves.`;
-		};
-
-		App.Events.addResponses(node, [
-			new App.Events.Result(`sell them all immediately`, sell),
-			new App.Events.Result(`keep them as primarily menial slaves`, keep),
-		]);
-	}
-
-	// resets variables
-	return node;
-
-	function unitsBattleReport() {
-		const el = document.createElement("div");
-		if (V.SecExp.war.losses >= 0) {
-			if (V.SecExp.war.losses > 0) {
-				// if the losses are more than zero
-				// generates a list of randomized losses, from which each unit picks one at random
-				let losses = V.SecExp.war.losses;
-				const averageLosses = Math.trunc(losses / App.SecExp.battle.deployedUnits());
-				let assignedLosses;
-				for (let i = 0; i < App.SecExp.battle.deployedUnits(); i++) {
-					assignedLosses = Math.trunc(Math.clamp(averageLosses + random(-5, 5), 0, 100));
-					if (assignedLosses > losses) {
-						assignedLosses = losses;
-						losses = 0;
-					} else {
-						losses -= assignedLosses;
-					}
-					lossesList.push(assignedLosses);
-				}
-				if (losses > 0) {
-					lossesList[random(lossesList.length - 1)] += losses;
-				}
-				lossesList.shuffle();
-
-				// sanity check for losses
-				let count = 0;
-				for (let i = 0; i < lossesList.length; i++) {
-					if (!Number.isInteger(lossesList[i])) {
-						lossesList[i] = 0;
-					}
-					count += lossesList[i];
-				}
-				if (count < V.SecExp.war.losses) {
-					const rand = random(lossesList.length - 1);
-					lossesList[rand] += V.SecExp.war.losses - count;
-				} else if (count > V.SecExp.war.losses) {
-					const diff = count - V.SecExp.war.losses;
-					const rand = random(lossesList.length - 1);
-					lossesList[rand] = Math.clamp(lossesList[rand] - diff, 0, 100);
-				}
-			}
-
-			if (V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.war.deploySF) {
-				if (V.SecExp.war.losses > 0) {
-					loss = lossesList.pluck();
-					loss = Math.clamp(loss, 0, V.SF.ArmySize);
-					V.SF.ArmySize -= loss;
-				}
-				App.UI.DOM.appendNewElement("div", el, `${num(V.SF.ArmySize)} soldiers from ${V.SF.Lower} joined the battle: casualtiesReport(type, loss)`);
-			}
-			for (const unitClass of App.SecExp.unit.list()) {
-				if (App.SecExp.battle.deployedUnits(unitClass) >= 1) {
-					if (unitClass !== 'bots') {
-						loopThroughUnits(V.SecExp.units[unitClass].squads, unitClass);
-					} else {
-						loopThroughUnits([V.SecExp.units.bots], unitClass);
-					}
-				}
-			}
-		} else {
-			App.UI.DOM.appendNewElement("div", el, `Error: losses are a negative number or NaN`, "red");
-		}// closes check for more than zero casualties
-
-		return el;
-	}
-};
diff --git a/src/Mods/SecExp/events/conflictHandler.js b/src/Mods/SecExp/events/conflictHandler.js
index 094090297be..36624b0b382 100644
--- a/src/Mods/SecExp/events/conflictHandler.js
+++ b/src/Mods/SecExp/events/conflictHandler.js
@@ -542,7 +542,7 @@ App.Events.conflictHandler = function() {
 		V.gameover = `${isMajorBattle ? "major battle" : "Rebellion"} defeat`;
 		atEnd("Gameover");
 	} else {
-		atEnd(inBattle ? "attackReport" : "rebellionReport");
+		atEnd("conflictReport");
 	}
 	return node;
 };
diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
index 140475ebf6a..29719848220 100644
--- a/src/Mods/SecExp/events/conflictReport.js
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -2,15 +2,15 @@ App.Events.conflictReport = function() {
 	V.nextButton = "Continue";
 	V.nextLink = "Scheduled Event";
 	V.encyclopedia = "Battles";
-	
-	let lostSlaves;
-	let r = [];
+
 	// Battles
 	let loot = 0;
 	let loss = 0;
 	let captives;
 	const end = (V.SecExp.battles.victoryStreak >= 2 || V.SecExp.battles.lossStreak >= 2) ? `,` : `.`;
 
+	let lostSlaves;
+	let r = [];
 	const allKilled = V.SecExp.war.attacker.losses === V.SecExp.war.attacker.troops;
 	const result = V.SecExp.war.result;
 
@@ -20,6 +20,7 @@ App.Events.conflictReport = function() {
 	const inRebellion = V.SecExp.war.type.includes("Rebellion");
 	const slaveRebellion = V.SecExp.war.type.includes("Slave");
 	const type = inBattle ? "battles" : "rebellions";
+	const hasLosses = V.SecExp.war.losses > 0;
 
 	/**
 	 * @param {string} [type]
@@ -58,7 +59,6 @@ App.Events.conflictReport = function() {
 		return r.join(" ");
 	};
 
-	// Battles
    /**
 	* @param {Array} [units]
 	* @param {string} [type]
@@ -67,12 +67,17 @@ App.Events.conflictReport = function() {
 	function loopThroughUnits(units, type) {
 		for (const unit of units) {
 			if (App.SecExp.unit.isDeployed(unit)) {
-				if (V.SecExp.war.losses > 0) {
+				let r = [];
+				if (hasLosses) {
 					loss = lossesList.pluck();
 					loss = Math.clamp(loss, 0, unit.troops);
 				}
 
-				const r = [`${type !== "bots" ? `${unit.platoonName}` : `Security drones`}: ${casualtiesReport(type, loss, unit)}`];
+				if (inRebellion) {
+					r.push(`${type !== "bots" ? `${unit.platoonName}` : `Security drones`}: ${casualtiesReport(type, loss, unit)}`);
+				} else {
+					r.push(`${s.platoonName} participated in the battle. They remained loyal to you. ${casualtiesReport(u, loss, s)}`);
+				}
 				if (type !== "bots") {
 					unit.battlesFought++;
 					if (loss > 0) {
@@ -94,7 +99,7 @@ App.Events.conflictReport = function() {
 			}
 		}
 	}
-	
+
 	// Rebellions
 	/**
 	 * @param {string} [target]
@@ -118,7 +123,82 @@ App.Events.conflictReport = function() {
 		App.SecExp.slavesDamaged(random(slaves));
 		V.arcologies[0].prosperity -= random(prosperity);
 	};
+	
+	/**
+	 * @param {FC.SecExp.PlayerHumanUnitType} [unit]
+	 * @param {number} [averageLosses]
+	 */
+	const rebellingUnitsFate = function(unit, averageLosses) {
+		let manpower = 0;
+		const node = new DocumentFragment();
+		const r = [];
+		const rebels = {ID: [], names: []};
+
+		const Dissolve = function() {
+			App.SecExp.unit.unitFree(unit).add(manpower);
+			for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
+				u.loyalty = Math.clamp(u.loyalty - random(10, 40), 0, 100);
+			}
+			return `Units dissolved.`;
+		};
+		const Purge = function() {
+			App.SecExp.unit.unitFree(unit).add(manpower * 0.5);
+			return `Dissidents purged and units dissolved.`;
+		};
+		const Execute = function() {
+			for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
+				u.loyalty = Math.clamp(u.loyalty + random(10, 40), 0, 100);
+			}
+			return `Units executed. Dissent will not be tolerated.`;
+		};
+
+		App.UI.DOM.appendNewElement("div", node);
+		for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
+			if (V.SecExp.war.rebellingID.contains(u.ID)) {
+				rebels.names.push(`${u.platoonName}`);
+				rebels.ID.push(u.ID);
+				manpower += Math.clamp(u.troops - random(averageLosses), 0, u.troops);
+			}
+		}
 
+		if (rebels.ID.length > 0) {
+			V.SecExp.units[unit].squads.deleteWith((u) => rebels.ID.contains(u.ID));
+			V.SecExp.battles.lastSelection.deleteWith((u) => rebels.ID.contains(u.ID));
+			if (unit === "slaves") {
+				r.push(`${toSentence(rebels.names)} decided in their blind arrogance to betray you.`);
+			} else if (unit === "militia") {
+				r.push(`${toSentence(rebels.names)} had the gall to betray you and join your enemies.`);
+			} else if (unit === "mercs") {
+				r.push(`${toSentence(rebels.names)} made the grave mistake of betraying you.`);
+			}
+			if (V.SecExp.war.result < 2) { // rebellion loss
+				r.push(`They participated in the looting following the battle, then vanished in the wastes.`);
+				cashX(forceNeg(1000 * rebels.ID.length), "war");
+			} else { // rebellion win
+				App.Events.addResponses(node, [
+					new App.Events.Result(
+						`Dissolve the units`,
+						Dissolve,
+						`Manpower will be refunded, but will negatively influence the loyalty of the other units`
+					),
+					new App.Events.Result(
+						`Purge the dissidents and dissolve the units`,
+						Purge,
+						`Will not influence the loyalty of the other units, but half the manpower will be refunded.`
+					),
+					new App.Events.Result(
+						`Execute them all`,
+						Execute,
+						`Will positively influence the loyalty of the other units, but manpower will not be refunded.`
+					),
+				]);
+			}
+			App.Events.addNode(node, r, "div");
+		}
+		return node;
+	};
+
+	// Battles
 	/**
 	 * Does the target become wounded?
 	 * @param {string} [target]
@@ -240,91 +320,16 @@ App.Events.conflictReport = function() {
 		return r.join(" ");
 	};
 
-	/**
-	 * @param {FC.SecExp.PlayerHumanUnitType} [unit]
-	 * @param {number} [averageLosses]
-	 */
-	const rebellingUnitsFate = function(unit, averageLosses) {
-		let manpower = 0;
-		const node = new DocumentFragment();
-		const r = [];
-		const rebels = {ID: [], names: []};
-
-		const Dissolve = function() {
-			App.SecExp.unit.unitFree(unit).add(manpower);
-			for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
-				u.loyalty = Math.clamp(u.loyalty - random(10, 40), 0, 100);
-			}
-			return `Units dissolved.`;
-		};
-		const Purge = function() {
-			App.SecExp.unit.unitFree(unit).add(manpower * 0.5);
-			return `Dissidents purged and units dissolved.`;
-		};
-		const Execute = function() {
-			for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
-				u.loyalty = Math.clamp(u.loyalty + random(10, 40), 0, 100);
-			}
-			return `Units executed. Dissent will not be tolerated.`;
-		};
-
-		App.UI.DOM.appendNewElement("div", node);
-		for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
-			if (V.SecExp.war.rebellingID.contains(u.ID)) {
-				rebels.names.push(`${u.platoonName}`);
-				rebels.ID.push(u.ID);
-				manpower += Math.clamp(u.troops - random(averageLosses), 0, u.troops);
-			}
-		}
-
-		if (rebels.ID.length > 0) {
-			V.SecExp.units[unit].squads.deleteWith((u) => rebels.ID.contains(u.ID));
-			V.SecExp.battles.lastSelection.deleteWith((u) => rebels.ID.contains(u.ID));
-			if (unit === "slaves") {
-				r.push(`${toSentence(rebels.names)} decided in their blind arrogance to betray you.`);
-			} else if (unit === "militia") {
-				r.push(`${toSentence(rebels.names)} had the gall to betray you and join your enemies.`);
-			} else if (unit === "mercs") {
-				r.push(`${toSentence(rebels.names)} made the grave mistake of betraying you.`);
-			}
-			if (V.SecExp.war.result < 2) { // rebellion loss
-				r.push(`They participated in the looting following the battle, then vanished in the wastes.`);
-				cashX(forceNeg(1000 * rebels.ID.length), "war");
-			} else { // rebellion win
-				App.Events.addResponses(node, [
-					new App.Events.Result(
-						`Dissolve the units`,
-						Dissolve,
-						`Manpower will be refunded, but will negatively influence the loyalty of the other units`
-					),
-					new App.Events.Result(
-						`Purge the dissidents and dissolve the units`,
-						Purge,
-						`Will not influence the loyalty of the other units, but half the manpower will be refunded.`
-					),
-					new App.Events.Result(
-						`Execute them all`,
-						Execute,
-						`Will positively influence the loyalty of the other units, but manpower will not be refunded.`
-					),
-				]);
-			}
-			App.Events.addNode(node, r, "div");
-		}
-		return node;
-	};
-	
 	V.SecExp.war.attacker.losses = Math.trunc(V.SecExp.war.attacker.losses);
 	if (V.SecExp.war.attacker.losses > V.SecExp.war.attacker.troops) {
 		V.SecExp.war.attacker.losses = V.SecExp.war.attacker.troops;
 	}
 	V.SecExp.core.totalKills += V.SecExp.war.attacker.losses;
 	V.SecExp.war.losses = Math.trunc(V.SecExp.war.losses);
-	
 	if (isMajorBattle) {
 		V.SecExp.battles.major++;
 	}
-	
+
 	const node = new DocumentFragment();
 	if (result === 3 || result === 2) {
 		App.UI.DOM.appendNewElement("h1", node, `${result === 2 ? 'Partial ' : ''}Victory!`, "strong");
@@ -351,7 +356,7 @@ App.Events.conflictReport = function() {
 		V.SecExp.battles.victories++;
 	}
 	App.UI.DOM.appendNewElement("hr", node);
-	
+
 	r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was`);
 	if (inBattle) {
 		r.push(`attacked by`);
@@ -373,7 +378,7 @@ App.Events.conflictReport = function() {
 			r.push(`to dethrone their arcology owner.`);
 		}
 	}
-	
+
 	if (V.SecExp.war.result !== 1 && V.SecExp.war.result !== 0 && V.SecExp.war.result !== -1) {
 		r.push(`Our defense forces, ${num(Math.trunc(App.SecExp.battle.troopCount()))} strong,`);
 		if (inBattle) {
@@ -414,11 +419,10 @@ App.Events.conflictReport = function() {
 			r.push(`zero casualties`);
 		}
 		r.push(`${allKilled ? '' : 'themselves'}.`);
-		
 		if (inRebellion) {
 			App.SecExp.slavesDamaged(V.SecExp.war.attacker.losses);
 		}
-		
+
 		if (V.SecExp.war.result === 3) {
 			if (V.SecExp.war.turns <= 5) {
 				r.push(`The fight was quick and one sided, our men easily stopped the`);
@@ -543,7 +547,7 @@ App.Events.conflictReport = function() {
 			r.push(`The fight was long and hard. Our men in the end had to yield to the`);
 			if (inBattle) {
 				if (V.SecExp.war.attacker.type === "raiders") {
-					r.push(`horde raiders, which was fortunately unable to capitalize on their victory.`);
+					r.push(`horde of raiders, which was fortunately unable to capitalize on their victory.`);
 				} else if (V.SecExp.war.attacker.type === "free city") {
 					r.push(`slavers, which were fortunately unable to capitalize on their victory.`);
 				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
@@ -552,34 +556,933 @@ App.Events.conflictReport = function() {
 					r.push(`old world soldiers, which were fortunately unable to capitalize on their victory.`);
 				}
 			} else {
-				r.push(`the rebels, which were fortunately unable to capitalize on their victory.`);
-			}
-		} else if (V.SecExp.war.result === -1) {
-			r.push(`You gave your troops the order to surrender, obediently they stand down.`);
-		} else if (V.SecExp.war.result === 0) {
-			r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`);
-		} else if (V.SecExp.war.result === 1) {
-			r.push(`You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.`);
+				r.push(`rebels, which were fortunately unable to capitalize on their victory.`);
+			}
 		}
-		
+
 		if (inRebellion && V.SecExp.rebellions.sfArmor) {
 			r.push(`More units were able to survive thanks to wearing ${V.SF.Lower}'s combat armor suits.`);
 		}
 		App.Events.addParagraph(node, r);
 		r = [];
-		
+
+		// Effects
+		if (result === 3 || result === 2) {
+			node.append(` Thanks to your victory, your `, App.UI.DOM.makeElement("span", `reputation`, "green"), ` and `, App.UI.DOM.makeElement("span", `authority`, "darkviolet"), `${result === 2 ? 'slightly' : ''} increased.`);
+			if (inRebellion) {
+				if (slaveRebellion) {
+					App.UI.DOM.appendNewElement("div", node, `Many of the rebelling slaves were recaptured and punished.`);
+				} else {
+					App.UI.DOM.appendNewElement("div", node, `Many of the rebelling citizens were captured and punished, many others enslaved.`);
+				}
+				App.UI.DOM.appendNewElement("div", node, `The instigators were executed one after another in a public trial that lasted for almost three days.`);
+				if (slaveRebellion) {
+					V.NPCSlaves -= random(10, 30);
+				} else {
+					V.lowerClass -= random(10, 30);
+				}
+				repX((result === 3 ? random(800, 1000) : random(600, 180)), "war");
+				V.SecExp.core.authority += (result === 3 ? random(800, 1000) : random(600, 800));
+			} else {
+				if (result === 3) {
+					App.UI.DOM.appendNewElement("span", node, " You were also able to capture");
+					if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 50) {
+						r.push(`a small amount of attackers,`);
+						captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
+					} else if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 100) {
+						r.push(`an healthy group of attackers,`);
+						captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
+					} else if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 150) {
+						r.push(`a big group of attackers,`);
+						captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
+					} else if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 200) {
+						r.push(`a huge group of attackers,`);
+						captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
+					} else if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses > 200) {
+						r.push(`a great amount of attackers,`);
+						captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
+					}
+					r.push(`and some of their equipment,`);
+				} else {
+					App.UI.DOM.appendNewElement("span", node, " Our men were not able to capture any combatants, however some equipment was seized during the enemy's hasty retreat,");
+				}
+				if (V.SecExp.war.attacker.type === "raiders") {
+					repX((result === 3 ? 4000 : 1000) * majorBattleMod, "war");
+					V.SecExp.core.authority += (result === 3 ? 800 : 200) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					repX((result === 3 ? 6000 : 1500) * majorBattleMod, "war");
+					V.SecExp.core.authority += (result === 3 ? 1200 : 300) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					repX((result === 3 ? 7500 : 2000) * majorBattleMod, "war");
+					V.SecExp.core.authority += (result === 3 ? 1500 : 450) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					repX((result === 3 ? 8000 : 2100) * majorBattleMod, "war");
+					V.SecExp.core.authority += (result === 3 ? 1600 : 500) * majorBattleMod;
+				}
+				r.push(`which once sold produced`);
+				if (V.SecExp.war.attacker.equip === 0) {
+					r.push(`<span class="yellowgreen">a ${result === 3 ? 'small amount' : 'bit'} of cash.</span>`);
+					loot += (result === 3 ? 1000 : 500) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.equip === 1) {
+					r.push(`<span class="yellowgreen">a ${result === 3 ? 'moderate' : 'small'} amount of cash.</span>`);
+					loot += (result === 3 ? 5000 : 2500) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.equip === 2) {
+					r.push(`<span class="yellowgreen">a ${result === 3 ? 'good' : 'moderate'} amount of cash.</span>`);
+					loot += (result === 3 ? 10000 : 5000) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.equip === 3) {
+					r.push(`<span class="yellowgreen">a ${result === 3 ? 'great' : 'good'} amount of cash.</span>`);
+					loot += (result === 3 ? 15000 : 7500) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.equip === 4) {
+					r.push(`<span class="yellowgreen">${result === 3 ? 'wealth worthy of the mightiest warlord' : 'a great amount of cash'}.</span>`);
+					loot += (result === 3 ? 20000 : 10000) * majorBattleMod;
+				}
+				if (V.SecExp.edicts.defense.privilege.mercSoldier === 1 && App.SecExp.battle.deployedUnits('mercs') >= 1) {
+					r.push(`Part of the loot is distributed to your mercenaries.`);
+					if (result === 3) {
+						captives = Math.trunc(captives * 0.6);
+					}
+					loot = Math.trunc(loot * 0.6);
+				}
+				cashX(loot, "war");
+				App.Events.addParagraph(node, r);
+				r = [];
+				if (result === 3) {
+					r.push(`Damage to the city was <span class="red">limited,</span> it won't take much to rebuild. Very few citizens or slaves were involved in the fight and even fewer met their end, safeguarding the prosperity of the arcology.`);
+				} else {
+					r.push(`Damage to the infrastructure was <span class="yellow">virtually non-existent,</span> costing only pocket cash to bring the structure back to normal. The inhabitants as well reported little to no injuries, because of this the prosperity of the arcology did not suffer.`);
+				}
+				r.push(`${IncreasePCSkills('engineering', 0.1)}`);
+				cashX(forceNeg((result === 3 ? 1000 : 2000) * majorBattleMod), "war");
+				if (result === 3) {
+					if (V.SecExp.battles.victoryStreak >= 3) {
+						r.push(`It seems your victories over the constant threats directed your way is having <span class="green">a positive effect on the prosperity of the arcology,</span> due to the security your leadership affords.`);
+						V.arcologies[0].prosperity += 5 * majorBattleMod;
+					}
+				} else {
+					V.lowerClass -= random(10) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(20) * majorBattleMod);
+				}
+			}
+		} else if (result === -3 || result === -2) {
+			if (inRebellion) {
+				node.append(` Thanks to your defeat, your `, App.UI.DOM.makeElement("span", `reputation`, "red"), ` and `, App.UI.DOM.makeElement("span", `authority`, "red"), ` decreased.`);
+				if (slaveRebellion) {
+					App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling slaves managed to escape, while others remained in the arcology for days looting and hunting their former masters. The arcology will bear the scars of this day for a long time.`);
+					V.lowerClass -= (result === -3 ? random(50, 100) : random(40, 80));
+					lostSlaves = Math.trunc((V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.8);
+					App.SecExp.slavesDamaged(lostSlaves);
+				} else {
+					App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling citizens remained in the arcology for days looting and hunting their former arcology. We will bear the scars of this day for a long time.`);
+					V.lowerClass -= Math.trunc((V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.6);
+				}
+				repX((result === -3 ? random(-800, -1000) : random(-600, -800)), "war");
+				V.SecExp.core.authority -= (result === -3 ? random(800, 1000) : random(600, 800));
+			} else {
+				if (result === -3) {
+					node.append(` Thanks to your defeat, your `, App.UI.DOM.makeElement("span", `reputation`, "red"), ` and `, App.UI.DOM.makeElement("span", `authority`, "red"), ` decreased. `);
+					App.UI.DOM.appendNewElement("span", node, " Obviously your troops were not able to capture anyone or anything.");
+
+					r = [];
+					r.push(`In the raiding following the battle <span class="red">the arcology sustained heavy damage,</span> which will cost quite the amount of cash to fix. Reports of <span class="red">citizens or slaves killed or missing</span> flood your office for a few days following the defeat.`);
+					if (V.SecExp.battles.lossStreak >= 3) {
+						r.push(`This only confirms the fears of many, <span class="red">your arcology is not safe</span> and it is clear their business will be better somewhere else.`);
+						V.arcologies[0].prosperity -= 5 * majorBattleMod;
+					}
+				} else {
+					App.UI.DOM.appendNewElement("span", node, `It was a close defeat, but nonetheless your <span class="red">reputation</span> and <span class="red">authority</span> slightly decreased.`);
+					App.UI.DOM.appendNewElement("span", node, " Your troops were not able to capture anyone or anything.");
+					r = [];
+					r.push(`The enemy did not have the strength to raid the arcology for long, still <span class="red">the arcology sustained some damage,</span> which will cost a moderate amount of cash to fix. Some citizens and slaves found themselves on the wrong end of a gun and met their demise.`);
+					r.push(`Some business sustained heavy damage, slightly impacting the arcology's prosperity.`);
+				}
+				r.push(`${IncreasePCSkills('engineering', 0.1)}`);
+				if (V.SecExp.war.attacker.type === "raiders") {
+					repX(forceNeg((result === -3 ? 400 : 40) * majorBattleMod), "war");
+					V.SecExp.core.authority -= (result === -3 ? 400 : 40) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					repX(forceNeg((result === -3 ? 600 : 60) * majorBattleMod), "war");
+					V.SecExp.core.authority -= (result === -3 ? 600 : 60) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					repX(forceNeg((result === -3 ? 750 : 75) * majorBattleMod), "war");
+					V.SecExp.core.authority -= (result === -3 ? 750 : 75) * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					repX(forceNeg((result === -3 ? 800 : 80) * majorBattleMod), "war");
+					V.SecExp.core.authority -= (result === -3 ? 800 : 80) * majorBattleMod;
+				}
+				
+				cashX(forceNeg((result === -3 ? 5000 : 3000) * majorBattleMod), "war");
+				if (V.week <= 30) {
+					V.lowerClass -= random(result === -3 ? 100 : 50) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(result === -3 ? 150 : 75) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(result === -3 ? 5 : 2) * majorBattleMod;
+				} else if (V.week <= 60) {
+					V.lowerClass -= random(result === -3 ? 120 : 60) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(result === -3 ? 170 : 85) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(result === -3 ? 10 : 5) * majorBattleMod;
+				} else if (V.week <= 90) {
+					V.lowerClass -= random(result === -3 ? 140 : 70) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(result === -3 ? 190 : 95) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(result === -3 ? 15 : 7) * majorBattleMod;
+				} else if (V.week <= 120) {
+					V.lowerClass -= random(result === -3 ? 160 : 80) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(result === -3 ? 210 : 105) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(result === -3 ? 20 : 10) * majorBattleMod;
+				} else {
+					V.lowerClass -= random(result === -3 ? 180 : 90) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(result === -3 ? 230 : 115) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(result === -3 ? 25 : 12) * majorBattleMod;
+				}
+			}
+		}
+
+		if (inRebellion) {
+			V.SecExp.core.authority = Math.clamp(V.SecExp.core.authority, 0, 20000);
+			if (V.SecExp.war.engageRule === 0) {
+				r.push(`Since you ordered your troops to limit their weaponry to low caliber or nonlethal, the arcology reported only`);
+				r.push(`<span class="red">minor damage.</span>`);
+				r.push(`Most citizens and non involved slaves remained unharmed, though some casualties between the civilians were inevitable.`);
+				r.push(`A few businesses were looted and burned, but the damage was pretty limited.`);
+				r.push(setRepairTime("arc", 3, 1500));
+				if (V.week <= 30) {
+					arcologyEffects(40, 65, 2);
+				} else if (V.week <= 60) {
+					arcologyEffects(50, 75, 5);
+				} else if (V.week <= 90) {
+					arcologyEffects(60, 85, 7);
+				} else if (V.week <= 120) {
+					arcologyEffects(70, 95, 10);
+				} else {
+					arcologyEffects(80, 105, 12);
+				}
+			} else if (V.SecExp.war.engageRule === 1) {
+				r.push(`You ordered your troops to limit their weaponry to non-heavy, non-explosive, because of this the arcology reported`);
+				r.push(`<span class="red">moderate damage.</span>`);
+				r.push(`Most citizens and non involved slaves remained unharmed or only lightly wounded, but many others did not make it. Unfortunately casualties between the civilians were inevitable.`);
+				r.push(`A few businesses were looted and burned, but the damage was pretty limited.`);
+				r.push(setRepairTime("arc", 5, 2000));
+				if (V.week <= 30) {
+					arcologyEffects(60, 85, 4);
+				} else if (V.week <= 60) {
+					arcologyEffects(70, 95, 7);
+				} else if (V.week <= 90) {
+					arcologyEffects(80, 105, 9);
+				} else if (V.week <= 120) {
+					arcologyEffects(90, 115, 12);
+				} else {
+					arcologyEffects(100, 125, 14);
+				}
+			} else if (V.SecExp.war.engageRule === 2) {
+				r.push(`Since you did not apply any restriction on the weapons your forces should use, the arcology reported`);
+				r.push(`<span class="red">heavy damage.</span>`);
+				r.push(`Many citizens and uninvolved slaves are reported killed or missing. Casualties between the civilians were inevitable.`);
+				r.push(`Many businesses were damaged during the battle either by the fight itself, by fires which spread unchecked for hours or by looters.`);
+				r.push(setRepairTime("arc", 7, 3000));
+				if (V.week <= 30) {
+					arcologyEffects(100, 150, 5);
+				} else if (V.week <= 60) {
+					arcologyEffects(120, 170, 10);
+				} else if (V.week <= 90) {
+					arcologyEffects(140, 190, 15);
+				} else if (V.week <= 120) {
+					arcologyEffects(160, 210, 20);
+				} else {
+					arcologyEffects(180, 230, 25);
+				}
+			} else {
+				r.push(`Thanks to the advance riot control weaponry developed by your experts, the rebels were mostly subdued or killed with`);
+				r.push(`<span class="yellow">little to no collateral damage to the arcology</span> and its inhabitants.`);
+				r.push(`A few businesses were looted, but the damage was very limited.`);
+				r.push(setRepairTime("arc", 2, 1000));
+				if (V.week <= 30) {
+					arcologyEffects(20, 45, 2);
+				} else if (V.week <= 60) {
+					arcologyEffects(30, 55, 4);
+				} else if (V.week <= 90) {
+					arcologyEffects(40, 65, 6);
+				} else if (V.week <= 120) {
+					arcologyEffects(50, 75, 8);
+				} else {
+					arcologyEffects(60, 85, 10);
+				}
+			}
+
+			if (!V.SecExp.war.reactorDefense) {
+				if (random(1, 100) <= (75 - ((V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.reactor : 0) * 25))) {
+					r.push(`Unfortunately during the fighting a group of slaves infiltrated the reactor complex and sabotaged it, causing massive power fluctuations and blackouts.`);
+					r.push(`<span class="red">time and money to repair the damage.</span>`);
+					r.push(setRepairTime("reactor", (V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.reactor : 0)));
+				} else {
+					r.push(`While the reactor was left defenseless without a garrison, there was no attempt at sabotage. Let's hope we'll always be this lucky.`);
+				}
+			} else {
+				r.push(`The garrison assigned to the reactor protected it from the multiple sabotage attempts carried out by the rebels.`);
+			}
+			App.Events.addNode(node, r, "div");
+			r = [];
+
+			if (!V.SecExp.war.waterwayDefense) {
+				if (random(1, 100) <= (75 - ((V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.waterway : 0) * 25))) {
+					r.push(`Unfortunately during the fighting a group of slaves infiltrated the water management complex and sabotaged it, causing huge water leaks throughout the arcology and severely limiting the water supply.`);
+					r.push(`<span class="red">time and money to repair the damage.</span>`);
+					r.push(setRepairTime("waterway", (V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.waterway : 0)));
+				} else {
+					r.push(`While the water management complex was left defenseless without a garrison, there was no attempt at sabotage. Let's hope we'll always be this lucky.`);
+				}
+			} else {
+				r.push(`The garrison assigned to the water management complex protected it from the sabotage attempt of the rebels.`);
+			}
+			App.Events.addNode(node, r, "div");
+			r = [];
+
+			if (!V.SecExp.war.assistantDefense) {
+				if (random(1, 100) <= (75 - ((V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.assistant : 0) * 25))) {
+					r.push(`Unfortunately during the fighting a group of slaves infiltrated the facility housing ${V.assistant.name}'s mainframe and sabotaged it. Without its AI, the arcology will be next to impossible to manage.`);
+					r.push(`<span class="red">time and money to repair the damage.</span>`);
+					r.push(setRepairTime("assistant", (V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.assistant : 0)));
+				} else {
+					r.push(`While the ${V.assistant.name}'s mainframe was left defenseless without a garrison, there was no attempt at sabotage. Let's hope we'll always be this lucky.`);
+				}
+			} else {
+				r.push(`The garrison assigned to the facility housing ${V.assistant.name}'s mainframe prevented any sabotage attempt.`);
+			}
+			App.Events.addNode(node, r, "div");
+			r = [];
+
+			if (V.SecExp.war.penthouseDefense && V.BodyguardID !== 0) {
+				r.push(`The garrison assigned to the penthouse together with your loyal Bodyguard stopped all assaults against your penthouse with ease.`);
+			} else {
+				if (random(1, 100) <= 75) {
+					r.push(`During the fighting a group of slaves assaulted the penthouse.`);
+					if (S.Bodyguard) {
+						r.push(`Your Bodyguard, ${S.Bodyguard.slaveName}, stood strong against the furious attack.`);
+					} else if (V.SecExp.war.penthouseDefense) {
+						r.push(`The garrison stood strong against the furious attack.`);
+					} else {
+						r.push(`Isolated and alone, you stood strong against the furious attack.`);
+					}
+					["PC", "Concubine", "Bodyguard"].forEach(c => r.push(checkWoundStatus(c)));
+					r.push(`<span class="red">The damage to the structure will be</span> costly to repair.`);
+					r.push(IncreasePCSkills('engineering', 0.1));
+					cashX(-2000, "war");
+				} else {
+					if (!V.SecExp.war.penthouseDefense) {
+						r.push(`While the penthouse was left without a sizable garrison, there was no dangerous assault against it. Let's hope we'll always be this lucky.`);
+					} else {
+						r.push(`There was no sizable assault against the penthouse. Let's hope we'll always be this lucky.`);
+					}
+				}
+			}
+		}
+		V.lowerClass = Math.max(V.lowerClass, 0);
+		V.NPCSlaves = Math.max(V.NPCSlaves, 0);
+		App.Events.addParagraph(node, r);
+		r = [];
+
+		if (inBattle) { // tactics
+			App.Events.addParagraph(node, App.SecExp.commanderEffectiveness("report"));
+			r = [];
+
+			r.push(`${V.SecExp.war.commander === "PC" ? 'You' : 'Your commander'}`);
+			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+				r.push(`chose to employ "bait and bleed" tactics or relying on quick attacks and harassment to tire and wound the enemy until their surrender.`);
+			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+				r.push(`chose to employ "guerrilla" tactics or relying on stealth, terrain knowledge and subterfuge to undermine and ultimately destroy the enemy.`);
+			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+				r.push(`chose to employ "choke points" tactics or the extensive use of fortified or highly defensive positions to slow down and eventually stop the enemy.`);
+			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+				r.push(`chose to employ "interior lines" tactics or exploiting the defender's shorter front to quickly disengage and concentrate troops when and where needed.`);
+			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+				r.push(`chose to employ "pincer maneuver" tactics or attempting to encircle the enemy by faking a collapsing center front.`);
+			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+				r.push(`chose to employ "defense in depth" tactics or relying on mobility to disengage and exploit overextended enemy troops by attacking their freshly exposed flanks.`);
+			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+				r.push(`chose to employ "blitzkrieg" tactics or shattering the enemy's front-line with a violent, concentrated armored assault.`);
+			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+				r.push(`chose to employ "human wave" tactics or overwhelming the enemy's army with a massive infantry assault.`);
+			}
+			if (V.SecExp.war.terrain === "urban") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`The urban terrain synergized well with bait and bleed tactics, slowly chipping away at the enemy's forces from the safety of the narrow streets and empty buildings.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`The urban terrain synergized well with guerrilla tactics, eroding your enemy's determination from the safety of the narrow streets and empty buildings.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`The urban environment offers many opportunities to hunker down and stop the momentum of the enemy's assault while keeping your soldiers in relative safety.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`While the urban environment offers many highly defensive position, it does restrict movement and with it the advantages of exploiting interior lines.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`The urban terrain does not allow for wide maneuvers, the attempts of your forces to encircle the attackers are mostly unsuccessful.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`While the urban environment offers many defensive positions, it limits mobility, limiting the advantages of using a defense in depth tactic.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The urban terrain is difficult to traverse, making your troops attempt at a lightning strike unsuccessful.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The urban terrain offers great advantages to the defender, your men find themselves in great disadvantage while mass assaulting the enemy's position.`);
+				}
+			} else if (V.SecExp.war.terrain === "rural") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`The open terrain of rural lands does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`The open terrain of rural lands does not offer many hiding spots, making it harder for your men to perform guerrilla actions effectively.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`The open terrain of rural lands does not offer many natural choke points, making it hard for your troops to funnel the enemy towards highly defended positions.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`The open terrain allows your men to easily exploit the superior mobility of the defender, making excellent use of interior lines to strike where it hurts.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`The open terrain affords your men great mobility, allowing them to easily position themselves for envelopment.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.`);
+				}
+			} else if (V.SecExp.war.terrain === "hills") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`While the hills offer some protection, they also make it harder to maneuver; bait and bleed tactics will not be 100% effective here.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`The hills offer protection to both your troops and your enemy's, making it harder for your men to accomplish guerrilla attacks effectively.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`While not as defensible as mountains, hills offer numerous opportunities to funnel the enemy towards highly defensible choke points.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`The limited mobility on hills hampers the capability of your troops to exploit the defender's greater mobility afforded by interior lines.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`Limited mobility due to the hills is a double edged sword, affording your men a decent shot at encirclement.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`The limited mobility on hills hampers the capability of your troops to use elastic defense tactics.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The limited mobility on hills hampers the capability of your troops to organize lightning strikes.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The defensibility of hills makes it harder to accomplish victory through mass assaults.`);
+				}
+			} else if (V.SecExp.war.terrain === "coast") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`On the coast there's little space and protection to effectively employ bait and bleed tactics.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`On the coast there's little space and protection to effectively employ guerrilla tactics.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`Amphibious attacks are difficult in the best of situations; the defender has a very easy time funneling the enemy towards their key defensive positions.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`While in an amphibious landing mobility is not the defender's best weapon, exploiting interior lines still affords your troops some advantages.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`Attempting to encircle a landing party is not the best course of action, but not the worst either.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`In an amphibious assault it's very easy for the enemy to overextend, making defense in depth tactics quite effective.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The rough, restricted terrain does not lend itself well to lightning strikes, but the precarious position of the enemy still gives your mobile troops tactical superiority.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The rough, restricted terrain does not lend itself well to mass assaults, but the precarious position of the enemy still gives your troops tactical superiority.`);
+				}
+			} else if (V.SecExp.war.terrain === "outskirts") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops bait and bleed tactics would require.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops guerrilla tactics would require.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`The imposing structure of the arcology itself provides plenty of opportunities to create fortified choke points from which to shatter the enemy assault.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`While the presence of the arcology near the battlefield is an advantage, it does limit maneuverability, lowering overall effectiveness of interior lines tactics.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`While the presence of the arcology near the battlefield is an advantage, it does limit maneuverability, lowering the chances of making an effective encirclement.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`Having the arcology near the battlefield means there are limited available maneuvers to your troops, who still needs to defend the structure, making defense in depth tactics not as effective.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`While an assault may save the arcology from getting involved at all, having the imposing structure so near does limit maneuverability and so the impetus of the lightning strike.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`While an attack may save the arcology from getting involved at all, having the imposing structure so near does limit maneuverability and so the impetus of the mass assault.`);
+				}
+			} else if (V.SecExp.war.terrain === "mountains") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`While the mountains offer great protection, they also limit maneuverability; bait and bleed tactics will not be quite as effective here.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`The mountains offer many excellent hiding spots and defensive positions, making guerrilla tactics very effective.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`The mountains offer plenty of opportunity to build strong defensive positions from which to shatter the enemy's assault.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`While the rough terrain complicates maneuvers, the defensive advantages offered by the mountains offsets its negative impact.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective encirclement in this environment.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`While mobility is limited, defensive positions are plentiful; your men are not able to fully exploit overextended assaults, but are able to better resist them.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective lightning strike in this environment.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The rough terrain complicates maneuvers; your men have a really hard time pulling off an effective mass assault in this environment.`);
+				}
+			} else if (V.SecExp.war.terrain === "wasteland") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`While the wastelands are mostly open terrain, there are enough hiding spots to make bait and bleed tactics work well enough.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`While the wastelands are mostly open terrain, there are enough hiding spots to make guerrilla tactics work well enough.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`The wastelands are mostly open terrain; your men have a difficult time setting up effective fortified positions.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`The wastelands, while rough, are mostly open terrain, where your men can exploit to the maximum the superior mobility of the defender.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`The wastelands, while rough, are mostly open terrain; your men can set up an effective encirclement here.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`The wastelands, while rough, are mostly open terrain, allowing your men to liberally maneuver to exploit overextended enemies.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The wastelands, while rough, are mostly open terrain, where your men are able to mount effective lightning strikes.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The wastelands, while rough, are mostly open terrain, where your men are able to mount effective mass assaults.`);
+				}
+			} else if (V.SecExp.war.terrain === "international waters") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`The open terrain of international waters does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`The open terrain of international waters does not offer many hiding spots, making it harder for your men to perform guerrilla actions effectively.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`The open terrain of international waters does not offer many natural choke points, making it hard for your troops to funnel the enemy towards highly defended positions.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`The open terrain allows your men to easily exploit the superior mobility of the defender, making excellent use of interior lines to strike where it hurts.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`The open terrain affords your men great mobility, allowing them to easily position themselves for envelopment.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.`);
+				}
+			} else if (V.SecExp.war.terrain === "an underwater cave") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`The tight terrain of an underwater cave does not lend itself well to bait and bleed tactics, making it harder for your men to achieve tactical superiority.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`The tight terrain of an underwater cave does offers many hiding spots, making it easier for your men to perform guerrilla actions effectively.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`The tight terrain of an underwater cave offers many natural choke points, making it easy for your troops to funnel the enemy towards highly defended positions.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`The tight terrain makes it hard for your men to easily exploit the superior mobility of the defender.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`The tight terrain hinders the mobility of your army, allowing them to easily position themselves for envelopment.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`The tight terrain hinders the mobility of your army, allowing them to exploit overextended assaults and concentrate where and when it matters.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The tight terrain hinders the mobility of your army, making it easier to accomplish concentrated lightning strikes.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The tight terrain hinders the mobility of your army, making it easier to overwhelm the enemy with mass assaults.`);
+				}
+			} else if (V.SecExp.war.terrain === "a sunken ship") {
+				if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+					r.push(`The tight terrain of a sunken ship lends itself well to bait and bleed tactics, making it easier for your men to achieve tactical superiority.`);
+				} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+					r.push(`The tight terrain of a sunken ship offers many hiding spots, making it easy for your men to perform guerrilla actions effectively.`);
+				} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+					r.push(`The tight terrain of a sunken ship offers many natural choke points, making it easy for your troops to funnel the enemy towards highly defended positions.`);
+				} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+					r.push(`The tight terrain does not allow your men to easily exploit the superior mobility of the defender.`);
+				} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+					r.push(`The open terrain hinders the mobility of your army, allowing them to easily position themselves for envelopment.`);
+				} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+					r.push(`The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.`);
+				} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+					r.push(`The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.`);
+				} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+					r.push(`The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.`);
+				}
+			}
+
+			if (V.SecExp.war.chosenTactic === "Bait and Bleed") {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`Since the bands of raiders are used to be on high alert and on the move constantly, bait and bleed tactics are not effective against them.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`The modern armies hired by Free Cities are decently mobile, which means quick hit and run attacks will be less successful, but their discipline and confidence still make them quite susceptible to this type of attack.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harassment tactics.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`Freedom fighters live every day as chasing and being chased by far superior forces, they are far more experienced than your troops in this type of warfare and much less susceptible to it.`);
+				}
+			} else if (V.SecExp.war.chosenTactic === "Guerrilla") {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`Since the bands of raiders are used to be on high alert and on the move constantly, guerrilla tactics are not effective against them.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`The modern armies hired by Free Cities are highly mobile, which means quick hit and run attacks will be less successful, but their discipline and confidence still make them quite susceptible to this type of attack.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harassment tactics.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`Freedom fighters live every day as chasing and being chased by far superior forces, they are far more experienced than your troops in this type of warfare and much less susceptible to it.`);
+				}
+			} else if (V.SecExp.war.chosenTactic === "Choke Points") {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`Raiders lack heavy weaponry or armor, so making use of fortified positions is an excellent way to dissipate the otherwise powerful momentum of their assault.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`The high tech equipment Free Cities can afford to give their guns for hire means there's no defensive position strong enough to stop them, still the relatively low numbers means they will have to take a careful approach, slowing them down.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`Old world armies have both the manpower and the equipment to conquer any defensive position, making use of strong fortifications will only bring you this far against them.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`The lack of specialized weaponry means freedom fighters have a rather hard time overcoming tough defensive positions, unfortunately they have also a lot of experience in avoiding them.`);
+				}
+			} else if (V.SecExp.war.chosenTactic === "Interior Lines") {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`The highly mobile horde of raiders will not give much room for your troops to maneuver, lowering their tactical superiority.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`While decently mobile, Free Cities forces are not in high enough numbers to risk maintaining prolonged contact, allowing your troops to quickly disengage and redeploy where it hurts.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`Old world armies are not famous for the mobility, which makes them highly susceptible to any tactic that exploits maneuverability and speed.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`While not the best equipped army, the experience and mobility typical of freedom fighters groups make them tough targets for an army that relies itself on mobility.`);
+				}
+			} else if (V.SecExp.war.chosenTactic === "Pincer Maneuver") {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`While numerous, the undisciplined masses of raiders are easy prey for encirclements.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`While decently mobile, the low number of Free Cities expedition forces make them good candidates for encirclements.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`The discipline and numbers of old world armies make them quite difficult to encircle.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`While not particularly mobile, freedom fighters are used to fight against overwhelming odds, diminishing the effectiveness of the encirclement.`);
+				}
+			} else if (V.SecExp.war.chosenTactic === "Defense In Depth") {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`While their low discipline makes them prime candidates for an elastic defense type of strategy, their high numbers limit your troops maneuverability.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`With their low numbers Free Cities mercenaries are quite susceptible to this type of tactic, despite their mobility.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`With their low mobility old world armies are very susceptible to this type of strategy.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`Low mobility and not particularly high numbers mean freedom fighters can be defeated by employing elastic defense tactics.`);
+				}
+			} else if (V.SecExp.war.chosenTactic === "Blitzkrieg") {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`With their low discipline and lack of heavy equipment, lightning strikes are very effective against raider hordes.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`Having good equipment and discipline on their side, Free Cities expeditions are capable of responding to even strong lightning strikes.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`While disciplined, old world armies low mobility makes them highly susceptible to lightning strikes.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`While not well equipped, freedom fighters have plenty of experience fighting small, mobile attacks, making them difficult to defeat with lightning strikes.`);
+				}
+			} else if (V.SecExp.war.chosenTactic === "Human Wave") {
+				if (V.SecExp.war.attacker.type === "raiders") {
+					r.push(`The hordes of raiders are much more experienced than your soldiers in executing mass assaults and they also have a lot more bodies to throw in the grinder.`);
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					r.push(`The good equipment and mobility of Free Cities mercenaries cannot save them from an organized mass assault.`);
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					r.push(`Unfortunately the discipline and good equipment of old world armies allow them to respond well against a mass assault.`);
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					r.push(`The relative low numbers and not great equipment typical of freedom fighters make them susceptible to being overwhelmed by an organized mass assault.`);
+				}
+			}
+			r.push(`In the end`);
+			if (V.SecExp.war.commander === "PC") {
+				r.push(`you were`);
+			} else {
+				r.push(`your commander was`);
+			}
+			if (V.SecExp.war.tacticsSuccessful) {
+				r.push(`<span class="green">able to successfully employ ${V.SecExp.war.chosenTactic} tactics,</span> greatly enhancing`);
+			} else {
+				r.push(`<span class="red">not able to effectively employ ${V.SecExp.war.chosenTactic} tactics,</span> greatly affecting`);
+			}
+			r.push(`the efficiency of your army.`);
+			App.Events.addParagraph(node, r);
+		}
+
+		let rand;
+		let count = 0;
+		let averageLosses = 0;
+		let loss = 0;
+		const lossesList = [];
+		if (hasLosses || V.SecExp.war.losses === 0) {
+			if (hasLosses) { // Generates a list of randomized losses, from which each unit picks one at random
+				averageLosses = Math.trunc(V.SecExp.war.losses / App.SecExp.battle.deployedUnits());
+				for (let i = 0; i < App.SecExp.battle.deployedUnits(); i++) {
+					let assignedLosses = Math.trunc(Math.clamp(averageLosses + random(-5, 5), 0, 100));
+					if (assignedLosses > V.SecExp.war.losses) {
+						assignedLosses = V.SecExp.war.losses;
+						V.SecExp.war.losses = 0;
+					} else {
+						V.SecExp.war.losses -= assignedLosses;
+					}
+					lossesList.push(assignedLosses);
+				}
+				if (V.SecExp.war.losses > 0) {
+					lossesList[random(lossesList.length - 1)] += V.SecExp.war.losses;
+				}
+				lossesList.shuffle();
+
+				// Sanity check for losses
+				for (let l of lossesList) {
+					if (!Number.isInteger(l)) {
+						l = 0;
+					}
+					count += l;
+				}
+				if (count < V.SecExp.war.losses) {
+					rand = random(lossesList.length - 1);
+					lossesList[rand] += V.SecExp.war.losses - count;
+				} else if (count > V.SecExp.war.losses) {
+					const diff = count - V.SecExp.war.losses;
+					rand = random(lossesList.length - 1);
+					lossesList[rand] = Math.clamp(lossesList[rand]-diff, 0, 100);
+				}
+			}
+		} else {
+			throw(`Losses are ${V.SecExp.war.losses}.`);
+		}
+
+		if (inRebellion && V.SecExp.war.irregulars > 0) {
+			if (hasLosses) {
+				loss = lossesList.pluck();
+				if (loss > V.ACitizens * 0.95) { // This is unlikely to happen, but might as well be safe
+					loss = Math.trunc(V.ACitizens * 0.95);
+				}
+			}
+			App.UI.DOM.appendNewElement("div", node, `The volunteering citizens were quickly organized into an irregular militia unit and deployed in the arcology: ${casualtiesReport('irregulars', loss)}`);
+			if (hasLosses) {
+				if (loss > V.lowerClass * 0.95) { // I suspect only lower class ever get to fight/die, but being safe
+					V.lowerClass = Math.trunc(V.lowerClass * 0.05);
+					loss -= Math.trunc(V.lowerClass * 0.95);
+					if (loss > V.middleClass * 0.95) {
+						V.middleClass = Math.trunc(V.middleClass * 0.05);
+						loss -= Math.trunc(V.middleClass *0.95);
+						if (loss > V.upperClass * 0.95) {
+							V.upperClass = Math.trunc(V.upperClass * 0.05);
+							loss -= Math.trunc(V.upperClass * 0.95);
+							if (loss > V.topClass * 0.95) {
+								V.topClass = Math.trunc(V.topClass * 0.05);
+							} else {
+								V.topClass -= loss;
+							}
+						} else {
+							V.upperClass -= loss;
+						}
+					} else {
+						V.middleClass -= loss;
+					}
+				} else {
+					V.lowerClass -= loss;
+				}
+			}
+		}
+		if (V.SF.Toggle && V.SF.Active >= 1 && (inRebellion || inBattle && V.SecExp.war.deploySF)) {
+			if (hasLosses) {
+				loss = lossesList.pluck();
+				loss = Math.clamp(loss, 0, V.SF.ArmySize);
+				V.SF.ArmySize -= loss;
+			}
+			App.UI.DOM.appendNewElement("div", node, `${capFirstChar(V.SF.Lower)}, ${num(V.SF.ArmySize)} strong, is called to arms: ${casualtiesReport('SF', loss)}`);
+		}
+		for (const unitClass of App.SecExp.unit.list()) {
+			if (App.SecExp.battle.deployedUnits(unitClass) >= 1) {
+				if (unitClass !== 'bots') {
+					loopThroughUnits(V.SecExp.units[unitClass].squads, unitClass);
+				} else {
+					loopThroughUnits([V.SecExp.units.bots], unitClass);
+				}
+			}
+		}
+
+		if (inRebellion) {
+			for (const unit of App.SecExp.unit.list().slice(1)) {
+				App.UI.DOM.appendNewElement("p", node, rebellingUnitsFate(unit, averageLosses));
+			}
+		} else {
+			if (
+				V.SF.Toggle && V.SF.Active >= 1 &&
+				(V.SF.Squad.Firebase >= 7 || V.SF.Squad.GunS >= 1 || V.SF.Squad.Satellite >= 5 || V.SF.Squad.GiantRobot >= 6 || V.SF.Squad.MissileSilo >= 1)
+			) {
+				// SF upgrades effects
+				App.Events.addParagraph(node, r);
+				r = [];
+				if (V.SF.Squad.Firebase >= 7) {
+					r.push(`The artillery pieces installed around ${V.SF.Lower}'s firebase provided vital fire support to the troops in the field.`);
+				}
+				if (V.SF.Squad.GunS >= 1) {
+					r.push(`The gunship gave our troops an undeniable advantage in recon capabilities, air superiority and fire support.`);
+				}
+				if (V.SF.Squad.Satellite >= 5 && V.SF.SatLaunched > 0) {
+					r.push(`The devastating power of ${V.SF.Lower}'s satellite was employed with great efficiency against the enemy.`);
+				}
+				if (V.SF.Squad.GiantRobot >= 6) {
+					r.push(`The giant robot of ${V.SF.Lower} proved to be a great boon to our troops, shielding many from the worst the enemy had to offer.`);
+				}
+				if (V.SF.Squad.MissileSilo >= 1) {
+					r.push(`The missile silo exterminated many enemy soldiers even before the battle would begin.`);
+				}
+			}
+			App.Events.addParagraph(node, r);
+			r = [];
+
+			let menialPrice = Math.trunc((V.slaveCostFactor * 1000) / 100) * 100;
+			menialPrice = Math.clamp(menialPrice, 500, 1500);
+			captives = Math.trunc(captives);
+			if (captives > 0) {
+				let candidates = 0;
+				r.push(`During the battle ${captives} attackers were captured.`);
+				if (random(1, 100) <= 25) {
+					candidates = Math.min(captives, random(1, 3));
+					r.push(`${capFirstChar(num(candidates, true))} of them have the potential to be sex slaves.`);
+				}
+
+				const sell = function() {
+					cashX((menialPrice * captives), "menialTransfer");
+					return `Captives sold`;
+				};
+				const keep = function() {
+					V.menials += (captives - candidates);
+					for (let i = 0; i < candidates; i++) {
+						const generateFemale = random(0, 99) < V.seeDicks;
+						let slave = GenerateNewSlave((generateFemale ? "XY" : "XX"), {minAge: 16, maxAge: 32, disableDisability: 1});
+						slave.weight = (generateFemale ? random(-20, 30) : random(0, 30));
+						slave.muscles = (generateFemale ? random(15, 80) : random(25, 80));
+						slave.waist = (generateFemale ? random(10, 80) : random(-20, 20));
+						slave.skill.combat = 1;
+						slave.origin = `$He is an enslaved ${V.SecExp.war.attacker.type} soldier captured during a battle.`;
+						newSlave(slave); // skip New Slave Intro
+					}
+					return `Captives primarily added as menial slaves.`;
+				};
+
+				App.Events.addResponses(node, [
+					new App.Events.Result(`sell them all immediately`, sell),
+					new App.Events.Result(`keep them as primarily menial slaves`, keep),
+				]);
+			}
+		}
+	} else {
+		if (result === -1) {
+			if (inRebellion) {
+				r.push(`Rather than waste the lives of your men you decided to surrender, hoping the rebels will cause less damage if you indulge them, this is however a big hit to your status.`);
+				r.push(`Your <span class="red">reputation</span> and <span class="red">authority</span> are significantly impacted.`);
+				r.push(`The surrender allows the arcology to survive <span class="yellow">mostly intact</span>`);
+				r.push(`however reports of <span class="red">mass looting and killing of citizens</span> flood your office for a few days.`);
+				App.Events.addParagraph(node, r);
+				r = [];
+
+				if (slaveRebellion) {
+					App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling slaves managed to escape, while others remained in the arcology for days looting and hunting their former masters. The arcology will bear the scars of this day for a long time.`);
+				} else {
+					App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling citizens remained in the arcology for days looting and hunting their former arcology. We will bear the scars of this day for a long time.`);
+				}
+				cashX(-1000, "war");
+				repX(random(-1000, -1200), "war");
+				V.SecExp.core.authority -= random(1000, 1200);
+				if (V.week <= 30) {
+					arcologyEffects(100, 150, 5);
+				} else if (V.week <= 60) {
+					arcologyEffects(120, 170, 10);
+				} else if (V.week <= 90) {
+					arcologyEffects(140, 190, 15);
+				} else if (V.week <= 120) {
+					arcologyEffects(160, 210, 20);
+				} else {
+					arcologyEffects(180, 230, 25);
+				}
+				V.lowerClass -= random(50, 100);
+				lostSlaves = Math.trunc((V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.8);
+				App.SecExp.slavesDamaged(lostSlaves);
+			} else {
+				r.push(`Rather than waste the lives of your men you decided to surrender, hoping your enemy will cause less damage if you indulge them, this is however a big hit to your status. Your <span class="red">reputation</span> and <span class="red">authority</span> are significantly impacted.`);
+				if (V.SecExp.war.attacker.type === "raiders") {
+					repX(forceNeg(600 * majorBattleMod), "war");
+					V.SecExp.core.authority -= 600 * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "free city") {
+					repX(forceNeg(800 * majorBattleMod), "war");
+					V.SecExp.core.authority -= 800 * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+					repX(forceNeg(1000 * majorBattleMod), "war");
+					V.SecExp.core.authority -= 1000 * majorBattleMod;
+				} else if (V.SecExp.war.attacker.type === "old world") {
+					repX(forceNeg(1200 * majorBattleMod), "war");
+					V.SecExp.core.authority -= 1200 * majorBattleMod;
+				}
+				App.Events.addParagraph(node, r);
+				r = [];
+				r.push(`The surrender allows the arcology to survive <span class="red">mostly intact,</span> however reports of <span class="red">mass looting and killing of citizens</span> flood your office for a few days.`);
+				r.push(`${IncreasePCSkills('engineering', 0.1)}`);
+				cashX(forceNeg(1000 * majorBattleMod), "war");
+				if (V.week <= 30) {
+					V.lowerClass -= random(80) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(120) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(5) * majorBattleMod;
+				} else if (V.week <= 60) {
+					V.lowerClass -= random(100) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(140) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(10) * majorBattleMod;
+				} else if (V.week <= 90) {
+					V.lowerClass -= random(120) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(160) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(15) * majorBattleMod;
+				} else if (V.week <= 120) {
+					V.lowerClass -= random(140) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(180) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(20) * majorBattleMod;
+				} else {
+					V.lowerClass -= random(160) * majorBattleMod;
+					App.SecExp.slavesDamaged(random(200) * majorBattleMod);
+					V.arcologies[0].prosperity -= random(25) * majorBattleMod;
+				}
+			}
+		} else if (result === 0) { // Battles only
+			r.push(`Unfortunately your adversary did not accept your money.`);
+			if (V.SecExp.war.attacker.type === "freedom fighters") {
+				r.push(`Their ideological crusade would not allow such thing.`);
+			} else {
+				r.push(`They saw your attempt as nothing more than admission of weakness.`);
+			}
+			r.push(`There was no time to organize a defense and so the enemy walked into the arcology as it was his. Your reputation and authority suffer a hit.`);
+			if (V.SecExp.war.attacker.type === "raiders") {
+				repX(forceNeg(400 * majorBattleMod), "war");
+				V.SecExp.core.authority -= 400 * majorBattleMod;
+			} else if (V.SecExp.war.attacker.type === "free city") {
+				repX(forceNeg(600 * majorBattleMod), "war");
+				V.SecExp.core.authority -= 600 * majorBattleMod;
+			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+				repX(forceNeg(750 * majorBattleMod), "war");
+				V.SecExp.core.authority -= 750 * majorBattleMod;
+			} else if (V.SecExp.war.attacker.type === "old world") {
+				repX(forceNeg(800 * majorBattleMod), "war");
+				V.SecExp.core.authority -= 800 * majorBattleMod;
+			}
+			V.SecExp.core.authority = Math.clamp(V.SecExp.core.authority, 0, 20000);
+			App.Events.addParagraph(node, r);
+			r = [];
+			r.push(`Fortunately the arcology survives <span class="yellow">mostly intact,</span> however reports of <span class="red">mass looting and killing of citizens</span> flood your office for a few days.`);
+			r.push(`${IncreasePCSkills('engineering', 0.1)}`);
+			cashX(-1000, "war");
+			if (V.week <= 30) {
+				V.lowerClass -= random(80) * majorBattleMod;
+				App.SecExp.slavesDamaged(random(120) * majorBattleMod);
+				V.arcologies[0].prosperity -= random(5) * majorBattleMod;
+			} else if (V.week <= 60) {
+				V.lowerClass -= random(100) * majorBattleMod;
+				App.SecExp.slavesDamaged(random(140) * majorBattleMod);
+				V.arcologies[0].prosperity -= random(10) * majorBattleMod;
+			} else if (V.week <= 90) {
+				V.lowerClass -= random(120) * majorBattleMod;
+				App.SecExp.slavesDamaged(random(160) * majorBattleMod);
+				V.arcologies[0].prosperity -= random(15) * majorBattleMod;
+			} else if (V.week <= 120) {
+				V.lowerClass -= random(140) * majorBattleMod;
+				App.SecExp.slavesDamaged(random(180) * majorBattleMod);
+				V.arcologies[0].prosperity -= random(20) * majorBattleMod;
+			} else {
+				V.lowerClass -= random(160) * majorBattleMod;
+				App.SecExp.slavesDamaged(random(200) * majorBattleMod);
+				V.arcologies[0].prosperity -= random(25) * majorBattleMod;
+			}
+		} else if (result === 1) { // Battles only
+			r.push(`The attackers wisely take the money offered them to leave your territory without further issues. The strength of the Free Cities was never in their guns but in their dollars, and today's events are the perfect demonstration of such strength.`);
+			r.push(`Your <span class="green">reputation slightly increases.</span>`);
+			if (V.SecExp.war.attacker.type === "raiders") {
+				repX(500 * majorBattleMod, "war");
+			} else if (V.SecExp.war.attacker.type === "free city") {
+				repX(750 * majorBattleMod, "war");
+			} else if (V.SecExp.war.attacker.type === "freedom fighters") {
+				repX(1000 * majorBattleMod, "war");
+			} else if (V.SecExp.war.attacker.type === "old world") {
+				repX(1250 * majorBattleMod, "war");
+			}
+			cashX(forceNeg(App.SecExp.battle.bribeCost()), "war");
+		}
 	}
-	
-	
+
 	App.Events.addParagraph(node, r);
-	// resets variables
 	if (inBattle) {
 		V.SecExp.units.bots.isDeployed = 0;
-		for (const squad of App.SecExp.unit.humanSquads()) {
-			squad.isDeployed = 0;
-		}
+		App.SecExp.unit.humanSquads().forEach(s => s.isDeployed = 0);
 	} else {
-		App.UI.DOM.appendNewElement("p", node, unitsRebellionReport());
 		V.SecExp.rebellions[V.SecExp.war.type.toLowerCase().replace(' rebellion', '') + 'Progress'] = 0;
 		V.SecExp.rebellions.tension = Math.clamp(V.SecExp.rebellions.tension - random(50, 100), 0, 100);
 		if (slaveRebellion) {
@@ -589,4 +1492,4 @@ App.Events.conflictReport = function() {
 		}
 	}
 	return node;
-}
+};
diff --git a/src/Mods/SecExp/events/rebellionReport.js b/src/Mods/SecExp/events/rebellionReport.js
deleted file mode 100644
index 72bb65dbf4f..00000000000
--- a/src/Mods/SecExp/events/rebellionReport.js
+++ /dev/null
@@ -1,339 +0,0 @@
-App.Events.rebellionReport = function() {
-	// Effects
-	if (result === 3 || result === 2) {
-		node.append(` Thanks to your victory, your `, App.UI.DOM.makeElement("span", `reputation`, "green"), ` and `, App.UI.DOM.makeElement("span", `authority`, "darkviolet"), ` increased.`);
-		if (slaveRebellion) {
-			App.UI.DOM.appendNewElement("div", node, `Many of the rebelling slaves were recaptured and punished.`);
-		} else {
-			App.UI.DOM.appendNewElement("div", node, `Many of the rebelling citizens were captured and punished, many others enslaved.`);
-		}
-		App.UI.DOM.appendNewElement("div", node, `The instigators were executed one after another in a public trial that lasted for almost three days.`);
-		if (slaveRebellion) {
-			V.NPCSlaves -= random(10, 30);
-		} else {
-			V.lowerClass -= random(10, 30);
-		}
-		repX((result === 3 ? random(800, 1000) : random(600, 180)), "war");
-		V.SecExp.core.authority += (result === 3 ? random(800, 1000) : random(600, 800));
-	} else if (result === -3 || result === -2) {
-		node.append(` Thanks to your defeat, your `, App.UI.DOM.makeElement("span", `reputation`, "red"), ` and `, App.UI.DOM.makeElement("span", `authority`, "red"), ` increased.`);
-		if (slaveRebellion) {
-			App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling slaves managed to escape, while others remained in the arcology for days looting and hunting their former masters. The arcology will bear the scars of this day for a long time.`);
-			V.lowerClass -= (result === -3 ? random(50, 100) : random(40, 80));
-			lostSlaves = Math.trunc((V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.8);
-			App.SecExp.slavesDamaged(lostSlaves);
-		} else {
-			App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling citizens remained in the arcology for days looting and hunting their former arcology. We will bear the scars of this day for a long time.`);
-			V.lowerClass -= Math.trunc((V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.6);
-		}
-		repX((result === -3 ? random(-800, -1000) : random(-600, -800)), "war");
-		V.SecExp.core.authority -= (result === -3 ? random(800, 1000) : random(600, 800));
-	} else if (result === -1) {
-		r.push(`Rather than waste the lives of your men you decided to surrender, hoping the rebels will cause less damage if you indulge them, this is however a big hit to your status.`);
-		r.push(`Your <span class="red">reputation</span> and <span class="red">authority</span> are significantly impacted.`);
-		r.push(`The surrender allows the arcology to survive <span class="yellow">mostly intact</span>`);
-		r.push(`however reports of <span class="red">mass looting and killing of citizens</span> flood your office for a few days.`);
-		App.Events.addParagraph(node, r);
-		r = [];
-
-		if (slaveRebellion) {
-			App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling slaves managed to escape, while others remained in the arcology for days looting and hunting their former masters. The arcology will bear the scars of this day for a long time.`);
-		} else {
-			App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling citizens remained in the arcology for days looting and hunting their former arcology. We will bear the scars of this day for a long time.`);
-		}
-		cashX(-1000, "war");
-		repX(random(-1000, -1200), "war");
-		V.SecExp.core.authority -= random(1000, 1200);
-		if (V.week <= 30) {
-			arcologyEffects(100, 150, 5);
-		} else if (V.week <= 60) {
-			arcologyEffects(120, 170, 10);
-		} else if (V.week <= 90) {
-			arcologyEffects(140, 190, 15);
-		} else if (V.week <= 120) {
-			arcologyEffects(160, 210, 20);
-		} else {
-			arcologyEffects(180, 230, 25);
-		}
-		V.lowerClass -= random(50, 100);
-		lostSlaves = Math.trunc((V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.8);
-		App.SecExp.slavesDamaged(lostSlaves);
-	}
-	V.SecExp.core.authority = Math.clamp(V.SecExp.core.authority, 0, 20000);
-
-	if (result !== -1) {
-		if (V.SecExp.war.engageRule === 0) {
-			r.push(`Since you ordered your troops to limit their weaponry to low caliber or nonlethal, the arcology reported only`);
-			r.push(`<span class="red">minor damage.</span>`);
-			r.push(`Most citizens and non involved slaves remained unharmed, though some casualties between the civilians were inevitable.`);
-			r.push(`A few businesses were looted and burned, but the damage was pretty limited.`);
-			r.push(setRepairTime("arc", 3, 1500));
-			if (V.week <= 30) {
-				arcologyEffects(40, 65, 2);
-			} else if (V.week <= 60) {
-				arcologyEffects(50, 75, 5);
-			} else if (V.week <= 90) {
-				arcologyEffects(60, 85, 7);
-			} else if (V.week <= 120) {
-				arcologyEffects(70, 95, 10);
-			} else {
-				arcologyEffects(80, 105, 12);
-			}
-		} else if (V.SecExp.war.engageRule === 1) {
-			r.push(`You ordered your troops to limit their weaponry to non-heavy, non-explosive, because of this the arcology reported`);
-			r.push(`<span class="red">moderate damage.</span>`);
-			r.push(`Most citizens and non involved slaves remained unharmed or only lightly wounded, but many others did not make it. Unfortunately casualties between the civilians were inevitable.`);
-			r.push(`A few businesses were looted and burned, but the damage was pretty limited.`);
-			r.push(setRepairTime("arc", 5, 2000));
-			if (V.week <= 30) {
-				arcologyEffects(60, 85, 4);
-			} else if (V.week <= 60) {
-				arcologyEffects(70, 95, 7);
-			} else if (V.week <= 90) {
-				arcologyEffects(80, 105, 9);
-			} else if (V.week <= 120) {
-				arcologyEffects(90, 115, 12);
-			} else {
-				arcologyEffects(100, 125, 14);
-			}
-		} else if (V.SecExp.war.engageRule === 2) {
-			r.push(`Since you did not apply any restriction on the weapons your forces should use, the arcology reported`);
-			r.push(`<span class="red">heavy damage.</span>`);
-			r.push(`Many citizens and uninvolved slaves are reported killed or missing. Casualties between the civilians were inevitable.`);
-			r.push(`Many businesses were damaged during the battle either by the fight itself, by fires which spread unchecked for hours or by looters.`);
-			r.push(setRepairTime("arc", 7, 3000));
-			if (V.week <= 30) {
-				arcologyEffects(100, 150, 5);
-			} else if (V.week <= 60) {
-				arcologyEffects(120, 170, 10);
-			} else if (V.week <= 90) {
-				arcologyEffects(140, 190, 15);
-			} else if (V.week <= 120) {
-				arcologyEffects(160, 210, 20);
-			} else {
-				arcologyEffects(180, 230, 25);
-			}
-		} else {
-			r.push(`Thanks to the advance riot control weaponry developed by your experts, the rebels were mostly subdued or killed with`);
-			r.push(`<span class="yellow">little to no collateral damage to the arcology</span> and its inhabitants.`);
-			r.push(`A few businesses were looted, but the damage was very limited.`);
-			r.push(setRepairTime("arc", 2, 1000));
-			if (V.week <= 30) {
-				arcologyEffects(20, 45, 2);
-			} else if (V.week <= 60) {
-				arcologyEffects(30, 55, 4);
-			} else if (V.week <= 90) {
-				arcologyEffects(40, 65, 6);
-			} else if (V.week <= 120) {
-				arcologyEffects(50, 75, 8);
-			} else {
-				arcologyEffects(60, 85, 10);
-			}
-		}
-	}
-	V.lowerClass = Math.max(V.lowerClass, 0);
-	V.NPCSlaves = Math.max(V.NPCSlaves, 0);
-	App.Events.addParagraph(node, r);
-	r = [];
-
-	// Garrisons
-	if (!V.SecExp.war.reactorDefense) {
-		if (random(1, 100) <= (75 - ((V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.reactor : 0) * 25))) {
-			r.push(`Unfortunately during the fighting a group of slaves infiltrated the reactor complex and sabotaged it, causing massive power fluctuations and blackouts.`);
-			r.push(`<span class="red">time and money to repair the damage.</span>`);
-			r.push(setRepairTime("reactor", (V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.reactor : 0)));
-		} else {
-			r.push(`While the reactor was left defenseless without a garrison, there was no attempt at sabotage. Let's hope we'll always be this lucky.`);
-		}
-	} else {
-		r.push(`The garrison assigned to the reactor protected it from the multiple sabotage attempts carried out by the rebels.`);
-	}
-	App.Events.addNode(node, r, "div");
-	r = [];
-
-	if (!V.SecExp.war.waterwayDefense) {
-		if (random(1, 100) <= (75 - ((V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.waterway : 0) * 25))) {
-			r.push(`Unfortunately during the fighting a group of slaves infiltrated the water management complex and sabotaged it, causing huge water leaks throughout the arcology and severely limiting the water supply.`);
-			r.push(`<span class="red">time and money to repair the damage.</span>`);
-			r.push(setRepairTime("waterway", (V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.waterway : 0)));
-		} else {
-			r.push(`While the water management complex was left defenseless without a garrison, there was no attempt at sabotage. Let's hope we'll always be this lucky.`);
-		}
-	} else {
-		r.push(`The garrison assigned to the water management complex protected it from the sabotage attempt of the rebels.`);
-	}
-	App.Events.addNode(node, r, "div");
-	r = [];
-
-	if (!V.SecExp.war.assistantDefense) {
-		if (random(1, 100) <= (75 - ((V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.assistant : 0) * 25))) {
-			r.push(`Unfortunately during the fighting a group of slaves infiltrated the facility housing ${V.assistant.name}'s mainframe and sabotaged it. Without its AI, the arcology will be next to impossible to manage.`);
-			r.push(`<span class="red">time and money to repair the damage.</span>`);
-			r.push(setRepairTime("assistant", (V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.assistant : 0)));
-		} else {
-			r.push(`While the ${V.assistant.name}'s mainframe was left defenseless without a garrison, there was no attempt at sabotage. Let's hope we'll always be this lucky.`);
-		}
-	} else {
-		r.push(`The garrison assigned to the facility housing ${V.assistant.name}'s mainframe prevented any sabotage attempt.`);
-	}
-	App.Events.addNode(node, r, "div");
-	r = [];
-
-	if (V.SecExp.war.penthouseDefense && V.BodyguardID !== 0) {
-		r.push(`The garrison assigned to the penthouse together with your loyal Bodyguard stopped all assaults against your penthouse with ease.`);
-	} else {
-		if (random(1, 100) <= 75) {
-			r.push(`During the fighting a group of slaves assaulted the penthouse.`);
-			if (S.Bodyguard) {
-				r.push(`Your Bodyguard, ${S.Bodyguard.slaveName}, stood strong against the furious attack.`);
-			} else if (V.SecExp.war.penthouseDefense) {
-				r.push(`The garrison stood strong against the furious attack.`);
-			} else {
-				r.push(`Isolated and alone, you stood strong against the furious attack.`);
-			}
-			["PC", "Concubine", "Bodyguard"].forEach(c => r.push(checkWoundStatus(c)));
-			r.push(`<span class="red">The damage to the structure will be</span> costly to repair.`);
-			r.push(IncreasePCSkills('engineering', 0.1));
-			cashX(-2000, "war");
-		} else {
-			if (!V.SecExp.war.penthouseDefense) {
-				r.push(`While the penthouse was left without a sizable garrison, there was no dangerous assault against it. Let's hope we'll always be this lucky.`);
-			} else {
-				r.push(`There was no sizable assault against the penthouse. Let's hope we'll always be this lucky.`);
-			}
-		}
-	}
-	return node;
-
-	function unitsRebellionReport() {
-		let rand;
-		let r = [];
-		let count = 0;
-		let averageLosses = 0;
-		let loss = 0;
-		const node = new DocumentFragment();
-		const lossesList = [];
-		const hasLosses = V.SecExp.war.losses > 0;
-
-		if (hasLosses || V.SecExp.war.losses === 0) {
-			if (hasLosses) { // Generates a list of randomized losses, from which each unit picks one at random
-				averageLosses = Math.trunc(V.SecExp.war.losses / App.SecExp.battle.deployedUnits());
-				for (let i = 0; i < App.SecExp.battle.deployedUnits(); i++) {
-					let assignedLosses = Math.trunc(Math.clamp(averageLosses + random(-5, 5), 0, 100));
-					if (assignedLosses > V.SecExp.war.losses) {
-						assignedLosses = V.SecExp.war.losses;
-						V.SecExp.war.losses = 0;
-					} else {
-						V.SecExp.war.losses -= assignedLosses;
-					}
-					lossesList.push(assignedLosses);
-				}
-				if (V.SecExp.war.losses > 0) {
-					lossesList[random(lossesList.length - 1)] += V.SecExp.war.losses;
-				}
-				lossesList.shuffle();
-
-				// Sanity check for losses
-				for (let l of lossesList) {
-					if (!Number.isInteger(l)) {
-						l = 0;
-					}
-					count += l;
-				}
-				if (count < V.SecExp.war.losses) {
-					rand = random(lossesList.length - 1);
-					lossesList[rand] += V.SecExp.war.losses - count;
-				} else if (count > V.SecExp.war.losses) {
-					const diff = count - V.SecExp.war.losses;
-					rand = random(lossesList.length - 1);
-					lossesList[rand] = Math.clamp(lossesList[rand]-diff, 0, 100);
-				}
-			}
-		} else {
-			throw(`Losses are ${V.SecExp.war.losses}.`);
-		}
-
-		if (V.SecExp.war.irregulars > 0) {
-			if (hasLosses) {
-				loss = lossesList.pluck();
-				if (loss > V.ACitizens * 0.95) { // This is unlikely to happen, but might as well be safe
-					loss = Math.trunc(V.ACitizens * 0.95);
-				}
-			}
-			App.UI.DOM.appendNewElement("div", node, `The volunteering citizens were quickly organized into an irregular militia unit and deployed in the arcology: ${casualtiesReport('irregulars', loss)}`);
-			if (hasLosses) {
-				if (loss > V.lowerClass * 0.95) { // I suspect only lower class ever get to fight/die, but being safe
-					V.lowerClass = Math.trunc(V.lowerClass * 0.05);
-					loss -= Math.trunc(V.lowerClass * 0.95);
-					if (loss > V.middleClass * 0.95) {
-						V.middleClass = Math.trunc(V.middleClass * 0.05);
-						loss -= Math.trunc(V.middleClass *0.95);
-						if (loss > V.upperClass * 0.95) {
-							V.upperClass = Math.trunc(V.upperClass * 0.05);
-							loss -= Math.trunc(V.upperClass * 0.95);
-							if (loss > V.topClass * 0.95) {
-								V.topClass = Math.trunc(V.topClass * 0.05);
-							} else {
-								V.topClass -= loss;
-							}
-						} else {
-							V.upperClass -= loss;
-						}
-					} else {
-						V.middleClass -= loss;
-					}
-				} else {
-					V.lowerClass -= loss;
-				}
-			}
-		}
-		if (V.SecExp.units.bots.active === 1) {
-			if (hasLosses) {
-				loss = lossesList.pluck();
-				loss = Math.clamp(loss, 0, V.SecExp.units.bots.troops);
-				V.SecExp.units.bots.troops -= loss;
-			}
-			App.UI.DOM.appendNewElement("div", node, `Security drones: ${casualtiesReport('bots', loss, V.SecExp.units.bots)} `);
-		}
-		if (V.SF.Toggle && V.SF.Active >= 1) {
-			if (hasLosses) {
-				loss = lossesList.pluck();
-				loss = Math.clamp(loss, 0, V.SF.ArmySize);
-				V.SF.ArmySize -= loss;
-			}
-			App.UI.DOM.appendNewElement("div", node, `${capFirstChar(V.SF.Lower)}, ${num(V.SF.ArmySize)} strong, is called to join the battle: ${casualtiesReport('SF', loss)}`);
-		}
-		for (const u of App.SecExp.unit.list().slice(1)) {
-			if (App.SecExp.battle.deployedUnits(u) >= 1) {
-				let med = 0;
-				for (const s of V.SecExp.units[u].squads.filter(t => App.SecExp.unit.isDeployed(t))) {
-					r = [];
-					s.battlesFought++;
-					if (hasLosses) {
-						loss = lossesList.pluck();
-						loss = Math.clamp(loss, 0, s.troops);
-					}
-					r.push(`${s.platoonName} participated in the battle. They remained loyal to you. ${casualtiesReport(u, loss, s)}`);
-					if (hasLosses) {
-						med = Math.round(Math.clamp(loss * s.medics * 0.25, 1, loss));
-						if (s.medics === 1 && loss > 0) {
-							r.push(`Some men were saved by their medics.`);
-						}
-						s.troops -= Math.trunc(Math.clamp(loss - med, 0, s.maxTroops));
-						V.SecExp.units[u].dead += Math.trunc(loss - med);
-					}
-					if (s.training < 100 && random(1, 100) > 60) {
-						r.push(`Experience has increased.`);
-						s.training += random(5, 15);
-					}
-					App.Events.addNode(node, r, "div");
-				}
-			}
-		}
-
-		for (const unit of App.SecExp.unit.list().slice(1)) {
-			App.UI.DOM.appendNewElement("p", node, rebellingUnitsFate(unit, averageLosses));
-		}
-		return node;
-	}
-};
-- 
GitLab


From f28916e721c65983e0b5106aab245a6dddcbc6dd Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Sun, 25 Jul 2021 20:39:50 +1200
Subject: [PATCH 03/19] Latest code 2021-07-25 0

---
 src/005-passages/eventsPassages.js |   2 +-
 src/005-passages/managePassages.js |   8 +
 src/Mods/SecExp/edicts.tw          | 214 ---------------
 src/Mods/SecExp/js/edicts.js       | 417 +++++++++++++++++++++++++++++
 4 files changed, 426 insertions(+), 215 deletions(-)
 create mode 100644 src/Mods/SecExp/js/edicts.js

diff --git a/src/005-passages/eventsPassages.js b/src/005-passages/eventsPassages.js
index 152b8015682..cebcb8971dd 100644
--- a/src/005-passages/eventsPassages.js
+++ b/src/005-passages/eventsPassages.js
@@ -8,7 +8,7 @@ new App.DomPassage("Nonrandom Event",
 
 new App.DomPassage("conflictReport",
 	() => {
-		return App.Events.conflictHandler();
+		return App.Events.conflictReport();
 	}
 );
 new App.DomPassage("conflictHandler",
diff --git a/src/005-passages/managePassages.js b/src/005-passages/managePassages.js
index 597b82e7118..2da118a3327 100644
--- a/src/005-passages/managePassages.js
+++ b/src/005-passages/managePassages.js
@@ -105,3 +105,11 @@ new App.DomPassage("Coursing Association",
 		return App.UI.coursingAssociation();
 	}
 );
+
+new App.DomPassage("edicts",
+	() => {
+		V.nextButton = "Back";
+		V.nextLink = "Main";
+		return App.SecExp.edicts();
+	}, ["jump-to-safe", "jump-from-safe"]
+);
diff --git a/src/Mods/SecExp/edicts.tw b/src/Mods/SecExp/edicts.tw
index 41fcdf1a6da..fc3fc6272e3 100644
--- a/src/Mods/SecExp/edicts.tw
+++ b/src/Mods/SecExp/edicts.tw
@@ -1,221 +1,7 @@
-:: edicts [nobr jump-to-safe jump-from-safe]
-
-<<set $nextButton = "Back", $nextLink = "Main">>
-
-//Passing any edict will cost <<print cashFormat(5000)>> and some authority. More edicts will become available as the arcology develops.//
-<<run App.UI.tabBar.handlePreSelectedTab($tabChoice.edicts)>>
-<br>
-<button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'Society')" id="tab Society">Society</button>
-<<if $SecExp.battles.victories + $SecExp.battles.losses > 0 || $SecExp.rebellions.victories + $SecExp.rebellions.losses > 0 || $mercenaries > 0>>
-	<button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'Military')" id="tab Military">Military</button>
-<</if>>
-<<set $SecExp.core.authority = Math.clamp($SecExp.core.authority, 0, 20000)>>
-
 <div id="Society" class="tab-content">
 	<div class="content">
-	<<if $SecExp.edicts.alternativeRents == 1>>
-		<br>''Alternative rent payment:'' you are allowing citizens to pay for their rents in menial slaves rather than cash.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.alternativeRents = 0]]</span>
-	<<else>>
-		<br>''Alternative rent payment:'' allow citizens to pay for their rents in menial slaves rather than cash, if so they wish.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.alternativeRents = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will decrease rents, but will supply a small amount of menial slaves each week.//
-	<</if>>
-
-	<<if $SecExp.edicts.enslavementRights == 1>>
-		<br>''Enslavement rights:'' you are the only authority able to declare a person enslaved or not.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.enslavementRights = 0]]</span>
-	<<else>>
-		<br>''Enslavement rights:'' the arcology owner will be the only authority able to declare a person enslaved or not.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.enslavementRights = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will provide cash each week. The higher the flux of citizens to slaves the higher the income. Will cost a small amount of authority each week.//
-	<</if>>
-
-	<<if $SecExp.buildings.secHub>>
-		<<set _secUpgrades = $SecExp.buildings.secHub.upgrades>>
-		<<if $SecExp.edicts.sellData === 1>>
-			<br>''Private Data marketization:'' you are selling private citizens' data to the best bidder.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.sellData = 0]]</span>
-		<<elseif $SecExp.edicts.sellData === 0 && Object.values(_secUpgrades.security).reduce((a, b) => a + b) > 0 || Object.values(_secUpgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(_secUpgrades.intel).reduce((a, b) => a + b) > 0>>
-			<br>''Private Data marketization:'' allow the selling of private citizens' data.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.sellData = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will generate income dependent on the amount of upgrades installed in the security HQ, but will cost a small amount of authority each week.//
-		<</if>>
-	<</if>>
-	<<if $SecExp.buildings.propHub>>
-		<<if $SecExp.edicts.propCampaignBoost == 1>>
-			<br>''Obligatory educational material:'' you are forcing residents to read curated educational material about the arcology.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.propCampaignBoost = 0]]</span>
-		<<else>>
-			<br>''Obligatory educational material:'' force residents to read curated educational material about the arcology.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.propCampaignBoost = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase the effectiveness of propaganda campaigns, but will incur upkeep costs.//
-		<</if>>
-	<</if>>
-	<<if $SecExp.buildings.transportHub>>
-		<<if $SecExp.edicts.tradeLegalAid == 1>>
-			<br>''Legal aid for new businesses:'' New businesses can rely on your help for legal expenses and issues.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.tradeLegalAid = 0]]</span>
-		<<else>>
-			<br>''Legal aid for new businesses:'' Support new businesses in the arcology by helping them cover legal costs and issues.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.tradeLegalAid = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase trade, but will incur upkeep costs.//
-		<</if>>
-		<<if $SecExp.edicts.taxTrade == 1>>
-			<br>''Trade tariffs:'' all goods transitioning in your arcology have to pay a transition fee.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.taxTrade = 0]]</span>
-		<<else>>
-			<br>''Trade tariffs:'' all goods transitioning in your arcology will have to pay a transition fee.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.taxTrade = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will provide income based on trade level, but will negatively affect trade.//
-		<</if>>
-	<</if>>
-
-	<<if $arcologies[0].FSPaternalist != "unset">>
-		<<if $SecExp.edicts.slaveWatch == 1>>
-			<br>''@@.lime;Slave mistreatment watch:@@'' slaves are able access a special security service in case of mistreatment.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.slaveWatch = 0]]</span>
-		<<else>>
-			<br>''@@.lime;Slave mistreatment watch:@@'' slaves will be able access a special security service in case of mistreatment.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.slaveWatch = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will help advance paternalism, but will incur upkeep costs.//
-		<</if>>
-	<</if>>
-
-	<<if $arcologies[0].FSChattelReligionist >= 40>>
-		<<if $SecExp.edicts.subsidyChurch == 1>>
-			<br>''@@.lime;Religious activities subsidy:@@'' you are providing economic support to religious activities following the official dogma.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.subsidyChurch = 0]]</span>
-		<<else>>
-			<br>''@@.lime;Religious activities subsidy:@@'' will provide economic support to religious activities following the official dogma.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.subsidyChurch = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will provide authority each week, but will incur upkeep costs.//
-		<</if>>
-	<</if>>
-
-	<br><br>__Immigration:__
-	<<if $SecExp.edicts.limitImmigration == 1>>
-		<br>''Immigration limits:'' you put strict limits to the amount of people the arcology can accept each week.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.limitImmigration = 0]]</span>
-	<<else>>
-		<br>''Immigration limits:'' institute limits to the amount of people the arcology will accept each week.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.openBorders = 0, $SecExp.edicts.limitImmigration = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will lower the amount of people immigrating into the arcology and enhance security.//
-	<</if>>
-
-	<<if $SecExp.edicts.openBorders == 1>>
-		<br>''Open borders:'' you have lowered considerably the requirements to become citizens.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.openBorders = 0]]</span>
-	<<else>>
-		<br>''Open borders:'' considerably lower requirements to become citizens.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.openBorders = 1, $SecExp.edicts.limitImmigration = 0, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase immigration to the arcology, but will increase crime.//
-	<</if>>
-
-	<br><br>__Weapons:__
-	<<if $SecExp.edicts.weaponsLaw == 0>>
-		<br>''Forbid weapons inside the arcology:'' residents are forbidden to buy, sell and keep weaponry while within the arcology.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.weaponsLaw = 3]]</span>
-	<<elseif $SecExp.edicts.weaponsLaw == 2>>
-		<br>''Heavy weaponry forbidden:'' residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-heavy, non-explosive.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.weaponsLaw = 3]]</span>
-	<<elseif $SecExp.edicts.weaponsLaw == 1>>
-		<br>''Heavily restricted weaponry:'' residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-automatic, non-high caliber.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.weaponsLaw = 3]]</span>
-	<<else>>
-		<br>''All weapons allowed:'' residents are allowed to buy, sell and keep all kind of weapons in the arcology.
-	<</if>>
-
-	<<if $SecExp.edicts.weaponsLaw == 3>>
-		<br>''Heavy weaponry forbidden:'' set the range of weapons allowed within the arcology to non-heavy, non-explosive.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.weaponsLaw = 2, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed.//
-	<<elseif $SecExp.edicts.weaponsLaw == 2>>
-		<br>''All weapons allowed:'' allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.weaponsLaw = 3, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed.//
-		<br>''Heavily restricted weaponry:'' set the range of weapons allowed within the arcology to non-automatic, non-high caliber.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.weaponsLaw = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will cost some authority each week, but rebellions will be poorly armed.//
-	<<elseif $SecExp.edicts.weaponsLaw == 1>>
-		<br>''Heavy weaponry forbidden:'' set the range of weapons allowed within the arcology to non-heavy, non-explosive.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.weaponsLaw = 2, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed.//
-		<br>''Forbid weapons inside the arcology:'' forbid residents to buy, sell and keep weaponry while within the arcology.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.weaponsLaw = 0, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will cost a moderate amount of authority each week, but rebellions will be very poorly armed.//
-	<<elseif $SecExp.edicts.weaponsLaw == 0>>
-		<br>''Heavily restricted weaponry:'' set the range of weapons allowed within the arcology to non-automatic, non-high caliber.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.weaponsLaw = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will cost some authority each week, but rebellions will be poorly armed.//
-	<</if>>
 
 	<<if $FSAnnounced>>
-		<br><br>__Future Societies:__
 		<<if $SecExp.edicts.defense.legionTradition === 1>>
 			<br>''@@.lime;Legionaries traditions:@@'' you are funding specialized training for your recruits following the Roman tradition of professional armies.
 			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.legionTradition = 0]]</span>
diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
new file mode 100644
index 00000000000..70eca1d3da3
--- /dev/null
+++ b/src/Mods/SecExp/js/edicts.js
@@ -0,0 +1,417 @@
+App.SecExp.edicts = function() {
+	function Society() {
+		const data = new Map([
+			["alternativeRents", {
+				title: "Alternative rent payment:",
+				repeal: [
+					{
+						text: "You are allowing citizens to pay for their rents in menial slaves rather than cash.",
+						conditional: V.SecExp.edicts.alternativeRents === 1,
+						value: V.SecExp.edicts.alternativeRents = 0
+					}
+				],
+				implement: [
+					{
+						text: "Allow citizens to pay for their rents in menial slaves rather than cash, if so they wish.",
+						conditional: V.SecExp.edicts.alternativeRents === 0,
+						value: V.SecExp.edicts.alternativeRents = 1,
+						note: "Will decrease rents, but will supply a small amount of menial slaves each week."
+					}
+				]
+			}],
+			["enslavementRights", {
+				title: "Enslavement rights:",
+				repeal: [
+					{
+						text: "you are the only authority able to declare a person enslaved or not.",
+						conditional: V.SecExp.edicts.enslavementRights === 1,
+						value: V.SecExp.edicts.enslavementRights = 0,
+				],
+				implement: [
+					text: "the arcology owner will be the only authority able to declare a person enslaved or not.",
+					conditional: V.SecExp.edicts.enslavementRights === 0,
+					value: V.SecExp.edicts.enslavementRights = 1,
+					note: "Will provide cash each week at the cost of a small authority hit. The higher the flux of citizens to slaves the higher the income."
+				]
+			}],
+			["sellData", {
+				title: "Private Data marketization:",
+				repeal: [
+					{
+						text: "you are selling private citizens' data to the best bidder.",
+						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 1,
+						value: V.SecExp.edicts.sellData = 0,
+					}
+				],
+				implement: [
+					text: "allow the selling of private citizens' data.",
+					conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 0 && Object.values(V.SecExp.buildings.secHub.upgrades.security).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.intel).reduce((a, b) => a + b) > 0,
+					value: V.SecExp.edicts.sellData = 1,
+					note: "Will generate income dependent on the amount of upgrades installed in the security HQ, but cost a small amount of authority each week."
+				]
+			}],
+			["propCampaignBoost", {
+				title: "Propaganda Campaign Boost:",
+				repeal: [
+					{
+						text: "you are forcing residents to read curated educational material about the arcology.",
+						conditional: V.SecExp.buildings.propHub && V.SecExp.edicts.propCampaignBoost === 1,
+						value: V.SecExp.edicts.propCampaignBoost = 0
+					}
+				],
+				implement: [
+					{
+						text: "force residents to read curated educational material about the arcology.",
+						conditional: V.SecExp.buildings.propHub && V.SecExp.edicts.propCampaignBoost === 0,
+						value: V.SecExp.edicts.propCampaignBoost = 1,
+						note: "Will increase the effectiveness of propaganda campaigns, but will incur upkeep costs."
+					}
+				]
+			}],
+			["tradeLegalAid:", {
+				title: "Legal aid for new businesses",
+				repeal: [
+					{
+						text: "New businesses can rely on your help for legal expenses and issues.",
+						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 1,
+						setter: V.SecExp.edicts.tradeLegalAid = 0
+					}
+				],
+				implement: [
+					{
+						text: "Support new businesses in the arcology by helping them cover legal costs and issues.",
+						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 0,
+						setter: V.SecExp.edicts.tradeLegalAid = 1,
+						note: "Will increase trade, but will incur upkeep costs."
+					}
+				]
+			}],
+			["taxTrade", {
+				title: "Trade tariffs:",
+				repeal: [
+					{
+						text: "all goods transitioning in your arcology have to pay a transition fee.",
+						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.taxTrade === 1,
+						setter: V.SecExp.edicts.taxTrade = 0
+					}
+				],
+				implement: [
+					{
+						text: "all goods transitioning in your arcology will have to pay a transition fee.",
+						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.taxTrade === 0,
+						setter: V.SecExp.edicts.taxTrade = 1,
+						note: "Will provide income based on trade level, but will negatively affect trade."
+					}
+				]
+			}],
+			["slaveWatch", {
+				title: "<span class='lime'>Slave mistreatment watch:</span>",
+				repeal: [
+					{
+						text: "slaves are able access a special security service in case of mistreatment.",
+						conditional: V.arcologies[0].FSPaternalist !== "unset" && V.SecExp.edicts.slaveWatch === 1,
+						setter: V.SecExp.edicts.slaveWatch = 0
+					}
+				],
+				implement: [
+					{
+						text: "slaves will be able access a special security service in case of mistreatment.",
+						conditional: V.arcologies[0].FSPaternalist !== "unset" && V.SecExp.edicts.slaveWatch === 0,
+						setter: V.SecExp.edicts.slaveWatch = 1,
+						note: "Will help advance paternalism, but will incur upkeep costs."
+					}
+				]
+			}],
+			["subsidyChurch", {
+				title: "<span class='lime'>Religious activities subsidy:</span>",
+				repeal: [
+					{
+						text: "you are providing economic support to religious activities following the official dogma.",
+						conditional: V.arcologies[0].FSChattelReligionist >= 40 && V.SecExp.edicts.subsidyChurch === 1,
+						setter: V.SecExp.edicts.subsidyChurch = 0
+					}
+				],
+				implement: [
+					{
+						text: "will provide economic support to religious activities following the official dogma.",
+						conditional: V.arcologies[0].FSChattelReligionist >= 40 && V.SecExp.edicts.subsidyChurch === 0,
+						setter: V.SecExp.edicts.subsidyChurch = 1,
+						note: "Will provide authority each week, but will incur upkeep costs."
+					}
+				]
+			}],
+			["limitImmigration", {
+				title: "Immigration limits:",
+				repeal: [
+					{
+						text: "you put strict limits to the amount of people the arcology can accept each week.",
+						conditional: V.SecExp.edicts.limitImmigration === 1,
+						setter: V.SecExp.edicts.limitImmigration = 0; 
+					}
+				],
+				implement: [
+					{
+						text: "institute limits to the amount of people the arcology will accept each week.",
+						conditional: V.SecExp.edicts.limitImmigration === 0,
+						setter: V.SecExp.edicts.openBorders = 0; V.SecExp.edicts.limitImmigration = 1,
+						note: "Will lower the amount of people immigrating into the arcology and enhance security."
+					}
+				]
+			}],
+			["openBorders", {
+				title: "Open borders",
+				repeal: [
+					{
+						text: "you have lowered considerably the requirements to become citizens.",
+						conditional: V.SecExp.edicts.openBorders === 1,
+						setter: V.SecExp.edicts.openBorders = 0
+					}
+				],
+				implement: [
+					{
+						text: "considerably lower requirements to become citizens.",
+						conditional: V.SecExp.edicts.openBorders === 0,
+						setter: V.SecExp.edicts.openBorders = 1; V.SecExp.edicts.limitImmigration = 0,
+						note: "Will increase immigration to the arcology, but will increase crime."
+					}
+				]
+			}],
+			/*
+			["weaponsLaw", {
+				title: if (V.SecExp.edicts.weaponsLaw === 0) {
+					"Forbid weapons inside the arcology:"
+				} else if (V.SecExp.edicts.weaponsLaw === 1) {
+					"Heavily restricted weaponry:"
+				} else if (V.SecExp.edicts.weaponsLaw === 2) {
+					"Heavy weaponry forbidden:"
+				} else if (V.SecExp.edicts.weaponsLaw === 3) {
+					"All weapons allowed:"
+				}
+				,
+				repeal: [
+					{
+						text: "residents are forbidden to buy, sell and keep weaponry while within the arcology.",
+						conditional: V.SecExp.edicts.weaponsLaw === 0,
+						setter: V.SecExp.edicts.weaponsLaw = 3
+					},
+					{
+						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-automatic, non-high caliber.",
+						conditional: V.SecExp.edicts.weaponsLaw === 1,
+						setter: V.SecExp.edicts.weaponsLaw = 3
+					},
+					{
+						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-heavy, non-explosive."
+						conditional: V.SecExp.edicts.weaponsLaw === 2,
+						setter: V.SecExp.edicts.weaponsLaw = 3
+					}
+				],
+				implement: [
+					{
+						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						conditional: V.SecExp.edicts.weaponsLaw === 3,
+						setter: V.SecExp.edicts.weaponsLaw = 2,
+						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
+					},
+					{
+						text: "allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
+						conditional: V.SecExp.edicts.weaponsLaw === 2,
+						setter: V.SecExp.edicts.weaponsLaw = 3,
+						note: "Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed."
+					},
+					{
+						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						conditional: V.SecExp.edicts.weaponsLaw === 2,
+						setter: V.SecExp.edicts.weaponsLaw = 1,
+						note: "Will cost some authority each week, but rebellions will be poorly armed."
+					},
+					{
+						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						conditional: V.SecExp.edicts.weaponsLaw === 1,
+						setter: V.SecExp.edicts.weaponsLaw = 2,
+						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
+					},
+					{
+						text: "forbid residents to buy, sell and keep weaponry while within the arcology.",
+						conditional: V.SecExp.edicts.weaponsLaw === 1,
+						setter: V.SecExp.edicts.weaponsLaw = 0,
+						note: "Will cost a moderate amount of authority each week, but rebellions will be very poorly armed."
+					},
+					{
+						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						conditional: V.SecExp.edicts.weaponsLaw === 0,
+						setter: V.SecExp.edicts.weaponsLaw = 1,
+						note: "Will cost some authority each week, but rebellions will be poorly armed."
+					}
+				]
+			}],
+			[, {
+				title: "",
+				repeal: [
+					{
+						text: "",
+						conditional: ,
+						setter:
+					}
+				],
+				implement: [
+					{
+						text: "",
+						conditional: ,
+						setter: ,
+						note:
+					}
+				]
+			}],
+			*/
+		]);
+
+		const c = new DocumentFragment();
+		for (const [name, detail] of data) {
+			let r;
+			if (["limitImmigration", "openBorders"].includes(name) && r !== "Immigration") {
+				App.UI.DOM.appendNewElement("h1", c, "Immigration:", "underline");
+				r = "Immigration";
+			} else if (name === "weaponsLaw" && r !== "Weapons") {
+				App.UI.DOM.appendNewElement("h1", c, "Weapons:", "underline");
+				r = "Weapons";
+			} else if (V.FSAnnounced && name === "Future Societies" && r !== "Future Societies") {
+				App.UI.DOM.appendNewElement("h1", c, "Future Societies:", "underline");
+				r = "Future Societies";
+			}
+			App.UI.DOM.appendNewElement("div", c);
+			App.UI.DOM.appendNewElement("span", c, `${detail.title} `, "bold");
+			for (let i = 0; i < detail.repeal.length; i++) {
+				if (detail.repeal[i].conditional) {
+					App.UI.DOM.appendNewElement("span", c, `${detail.repeal[i].text}`);
+				} else if (detail.implement[i].conditional) {
+					App.UI.DOM.appendNewElement("span", c, `${detail.implement[i].text}`);
+				}
+
+				if (V.SecExp.core.authority >= 1000) {
+					App.UI.DOM.appendNewElement("span", c,
+						App.UI.DOM.link(` ${detail.repeal[i].conditional ? "Repeal" : "Implement"}`
+							, () => {
+								detail.repeal[i].conditional ? detail.repeal[i].setter : detail.implement[i].setter;
+								if (detail.implement[i].conditional) {
+									cashX(-5000, "edicts");
+									V.SecExp.core.authority -= 1000;
+								}
+								App.UI.reload();
+							})
+						, (detail.repeal[i].conditional ? "yellow" : "green"));
+					if (detail.implement[i].conditional) {
+						App.UI.DOM.appendNewElement("div", c, `${detail.implement[i].note}`, ["note", "indent"]);
+					}
+				}
+			}
+		}
+		return c;
+	}
+	/*
+	function Military() {
+		const data = new Map([
+			[, {
+				title: "",
+				repeal: [
+					{
+						text: "",
+						conditional: ,
+						value:
+					}
+				],
+				implement: [
+					{
+						text: "",
+						conditional: ,
+						value: ,
+						note:
+					}
+				]
+			}],
+			[, {
+				title: "",
+				repeal: [
+					{
+						text: "",
+						conditional: ,
+						value:
+					}
+				],
+				implement: [
+					{
+						text: "",
+						conditional: ,
+						value: ,
+						note:
+					}
+				]
+			}],
+			[, {
+				title: "",
+				repeal: [
+					{
+						text: "",
+						conditional: ,
+						value:
+					}
+				],
+				implement: [
+					{
+						text: "",
+						conditional: ,
+						value: ,
+						note:
+					}
+				]
+			}],
+		]);
+
+		const c = new DocumentFragment();
+		for (const [name, detail] of data) {
+			App.UI.DOM.appendNewElement("div", c);
+			App.UI.DOM.appendNewElement("span", c, `${detail.title}: `, "bold");
+			for (let i = 0; i < detail.repeal.length; i++) {
+				if (detail.repeal[i].conditional) {
+					App.UI.DOM.appendNewElement("span", c, `${detail.repeal[i].text}`);
+				} else if (detail.implement[i].conditional) {
+					App.UI.DOM.appendNewElement("span", c, `${detail.implement[i].text}`);
+				}
+
+				if (V.SecExp.core.authority >= 1000) {
+					App.UI.DOM.appendNewElement("span", c,
+						App.UI.DOM.link(` ${detail.repeal[i].conditional ? "Repeal" : "Implement"}`
+							, () => {
+								V.SecExp.edicts[name] = (detail.repeal[i].conditional ? detail.repeal[i].value : detail.implement[i].value);
+								if (detail.implement[i].conditional) {
+									cashX(-5000, "edicts");
+									V.SecExp.core.authority -= 1000;
+								}
+								App.UI.reload();
+							})
+						, (detail.repeal[i].conditional ? "yellow" : "green"));
+					if (detail.implement[i].conditional) {
+						App.UI.DOM.appendNewElement("div", c, `${detail.implement[i].note}`, ["note", "indent"]);
+					}
+				}
+			}
+		}
+		return c;
+	}
+	*/
+
+	const node = new DocumentFragment();
+	App.UI.DOM.appendNewElement("div", node, `Passing any edict will cost ${cashFormat(5000)} and some authority. More will become available as the arcology develops.`, "note");
+	const tabBar = new App.UI.Tabs.TabBar("SlaveInteract");
+	tabBar.addTab("Society", "Society", Society());
+	/*
+	if (V.SecExp.battles.victories + V.SecExp.battles.losses > 0 || V.SecExp.rebellions.victories + V.SecExp.rebellions.losses > 0 || V.mercenaries > 0) {
+		tabBar.addTab("Military", "Military", Military());
+	}
+	*/
+	V.SecExp.core.authority = Math.clamp(V.SecExp.core.authority, 0, 20000);
+	if (V.SecExp.core.authority < 1000) {
+		App.UI.DOM.appendNewElement("div", node, "Not enough Authority.", ["red", "note"]);
+	}
+	node.append(tabBar.render());
+	return node;
+};
-- 
GitLab


From e48f9dc1e418980fc08adc655df721968da5c421 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Mon, 26 Jul 2021 14:53:28 +1200
Subject: [PATCH 04/19] Latest code 2021-07-26 0

---
 src/Mods/SecExp/edicts.tw    | 15 ---------------
 src/Mods/SecExp/js/edicts.js | 21 +++++++++++++++++++--
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/Mods/SecExp/edicts.tw b/src/Mods/SecExp/edicts.tw
index fc3fc6272e3..b0006f642fc 100644
--- a/src/Mods/SecExp/edicts.tw
+++ b/src/Mods/SecExp/edicts.tw
@@ -2,10 +2,6 @@
 	<div class="content">
 
 	<<if $FSAnnounced>>
-		<<if $SecExp.edicts.defense.legionTradition === 1>>
-			<br>''@@.lime;Legionaries traditions:@@'' you are funding specialized training for your recruits following the Roman tradition of professional armies.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.legionTradition = 0]]</span>
-		<</if>>
 		<<if $SecExp.edicts.defense.imperialTradition === 1>>
 			<br>''@@.lime;Neo-Imperial traditions:@@'' you are funding specialized training for your recruits to inculcate them into a professional Imperial army, led by highly trained and hand-picked $mercenariesTitle.
 			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.imperialTradition = 0]]</span>
@@ -15,17 +11,6 @@
 			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.pharaonTradition = 0]]</span>
 		<</if>>
 		<<if $SecExp.edicts.defense.militia >= 1>>
-			<<if $arcologies[0].FSRomanRevivalist >= 40>>
-				<<if $SecExp.edicts.defense.legionTradition === 0>>
-					<br>''@@.lime;Legionaries traditions:@@'' Fund specialized training for your recruits to turn them into the professional of Roman tradition.
-					<<if $SecExp.core.authority >= 1000>>
-						<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.legionTradition = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-					<<else>>
-						<br>//Not enough Authority.//
-					<</if>>
-					<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase defense, morale and hp of militia units, but will incur upkeep costs.//
-				<</if>>
-			<</if>>
 			<<if $arcologies[0].FSEgyptianRevivalist >= 40>>
 				<<if $SecExp.edicts.defense.pharaonTradition === 0>>
 					<br>''@@.lime;Pharaonic traditions:@@'' Fund specialized training for your recruits to turn them into an army worthy of a pharaoh.
diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index 70eca1d3da3..3d503b09598 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -176,7 +176,7 @@ App.SecExp.edicts = function() {
 					}
 				]
 			}],
-			/*
+
 			["weaponsLaw", {
 				title: if (V.SecExp.edicts.weaponsLaw === 0) {
 					"Forbid weapons inside the arcology:"
@@ -244,6 +244,24 @@ App.SecExp.edicts = function() {
 					}
 				]
 			}],
+			["pharaonTradition", {
+				title: "<span class='lime'>Legionaries traditions:</span>",
+				repeal: [
+					{
+						text: "you are funding specialized training for your recruits following the Roman tradition of professional armies.",
+						conditional: V.FSAnnounced && V.SecExp.edicts.defense.legionTradition === 1,
+						setter: V.SecExp.edicts.defense.legionTradition = 0
+					}
+				],
+				implement: [
+					{
+						text: "Fund specialized training for your recruits to turn them into the professional of Roman tradition.",
+						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSRomanRevivalist >= 40 && V.SecExp.edicts.defense.legionTradition === 0,
+						setter: V.SecExp.edicts.defense.legionTradition = 1,
+						note: "Will increase defense, morale and hp of militia units, but will incur upkeep costs."
+					}
+				]
+			}],
 			[, {
 				title: "",
 				repeal: [
@@ -262,7 +280,6 @@ App.SecExp.edicts = function() {
 					}
 				]
 			}],
-			*/
 		]);
 
 		const c = new DocumentFragment();
-- 
GitLab


From 7aa0c276d7b167f1038abde720de4aa75291bd40 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Thu, 5 Aug 2021 17:34:01 +1200
Subject: [PATCH 05/19] Latest code 2021-08-05 0

---
 src/Mods/SecExp/js/edicts.js | 91 ++++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 39 deletions(-)

diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index 3d503b09598..74014b42b8b 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -1,5 +1,17 @@
 App.SecExp.edicts = function() {
 	function Society() {
+		const weaponsLawTitle = function() {
+			if (V.SecExp.edicts.weaponsLaw === 0) {
+				return "Forbid weapons inside the arcology:";
+			} else if (V.SecExp.edicts.weaponsLaw === 1) {
+				return "Heavily restricted weaponry:";
+			} else if (V.SecExp.edicts.weaponsLaw === 2) {
+				return "Heavy weaponry forbidden:";
+			} else if (V.SecExp.edicts.weaponsLaw === 3) {
+				return "All weapons allowed:";
+			}
+		};
+		
 		const data = new Map([
 			["alternativeRents", {
 				title: "Alternative rent payment:",
@@ -26,12 +38,15 @@ App.SecExp.edicts = function() {
 						text: "you are the only authority able to declare a person enslaved or not.",
 						conditional: V.SecExp.edicts.enslavementRights === 1,
 						value: V.SecExp.edicts.enslavementRights = 0,
+					}
 				],
 				implement: [
-					text: "the arcology owner will be the only authority able to declare a person enslaved or not.",
-					conditional: V.SecExp.edicts.enslavementRights === 0,
-					value: V.SecExp.edicts.enslavementRights = 1,
-					note: "Will provide cash each week at the cost of a small authority hit. The higher the flux of citizens to slaves the higher the income."
+					{
+						text: "the arcology owner will be the only authority able to declare a person enslaved or not.",
+						conditional: V.SecExp.edicts.enslavementRights === 0,
+						value: V.SecExp.edicts.enslavementRights = 1,
+						note: "Will provide cash each week at the cost of a small authority hit. The higher the flux of citizens to slaves the higher the income."
+					}
 				]
 			}],
 			["sellData", {
@@ -44,10 +59,12 @@ App.SecExp.edicts = function() {
 					}
 				],
 				implement: [
-					text: "allow the selling of private citizens' data.",
-					conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 0 && Object.values(V.SecExp.buildings.secHub.upgrades.security).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.intel).reduce((a, b) => a + b) > 0,
-					value: V.SecExp.edicts.sellData = 1,
-					note: "Will generate income dependent on the amount of upgrades installed in the security HQ, but cost a small amount of authority each week."
+					{
+						text: "allow the selling of private citizens' data.",
+						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 0 && Object.values(V.SecExp.buildings.secHub.upgrades.security).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.intel).reduce((a, b) => a + b) > 0,
+						value: V.SecExp.edicts.sellData = 1,
+						note: "Will generate income dependent on the amount of upgrades installed in the security HQ, but cost a small amount of authority each week."
+					}
 				]
 			}],
 			["propCampaignBoost", {
@@ -146,14 +163,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "you put strict limits to the amount of people the arcology can accept each week.",
 						conditional: V.SecExp.edicts.limitImmigration === 1,
-						setter: V.SecExp.edicts.limitImmigration = 0; 
+						setter: V.SecExp.edicts.limitImmigration = 0
 					}
 				],
 				implement: [
 					{
 						text: "institute limits to the amount of people the arcology will accept each week.",
 						conditional: V.SecExp.edicts.limitImmigration === 0,
-						setter: V.SecExp.edicts.openBorders = 0; V.SecExp.edicts.limitImmigration = 1,
+						// setter: V.SecExp.edicts.openBorders = 0; V.SecExp.edicts.limitImmigration = 1,
 						note: "Will lower the amount of people immigrating into the arcology and enhance security."
 					}
 				]
@@ -171,23 +188,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "considerably lower requirements to become citizens.",
 						conditional: V.SecExp.edicts.openBorders === 0,
-						setter: V.SecExp.edicts.openBorders = 1; V.SecExp.edicts.limitImmigration = 0,
+						// setter: V.SecExp.edicts.openBorders = 1; V.SecExp.edicts.limitImmigration = 0,
 						note: "Will increase immigration to the arcology, but will increase crime."
 					}
 				]
 			}],
 
 			["weaponsLaw", {
-				title: if (V.SecExp.edicts.weaponsLaw === 0) {
-					"Forbid weapons inside the arcology:"
-				} else if (V.SecExp.edicts.weaponsLaw === 1) {
-					"Heavily restricted weaponry:"
-				} else if (V.SecExp.edicts.weaponsLaw === 2) {
-					"Heavy weaponry forbidden:"
-				} else if (V.SecExp.edicts.weaponsLaw === 3) {
-					"All weapons allowed:"
-				}
-				,
+				title: weaponsLawTitle(),
 				repeal: [
 					{
 						text: "residents are forbidden to buy, sell and keep weaponry while within the arcology.",
@@ -200,44 +208,44 @@ App.SecExp.edicts = function() {
 						setter: V.SecExp.edicts.weaponsLaw = 3
 					},
 					{
-						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-heavy, non-explosive."
+						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
 						setter: V.SecExp.edicts.weaponsLaw = 3
 					}
 				],
 				implement: [
 					{
-						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 3,
 						setter: V.SecExp.edicts.weaponsLaw = 2,
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
-						text: "allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
+						text: "Allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
 						setter: V.SecExp.edicts.weaponsLaw = 3,
 						note: "Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed."
 					},
 					{
-						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						text: "Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
 						setter: V.SecExp.edicts.weaponsLaw = 1,
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					},
 					{
-						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
 						setter: V.SecExp.edicts.weaponsLaw = 2,
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
-						text: "forbid residents to buy, sell and keep weaponry while within the arcology.",
+						text: "Forbid residents to buy, sell and keep weaponry while within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
 						setter: V.SecExp.edicts.weaponsLaw = 0,
 						note: "Will cost a moderate amount of authority each week, but rebellions will be very poorly armed."
 					},
 					{
-						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						text: "Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 0,
 						setter: V.SecExp.edicts.weaponsLaw = 1,
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
@@ -262,6 +270,7 @@ App.SecExp.edicts = function() {
 					}
 				]
 			}],
+			/*
 			[, {
 				title: "",
 				repeal: [
@@ -280,6 +289,7 @@ App.SecExp.edicts = function() {
 					}
 				]
 			}],
+			*/
 		]);
 
 		const c = new DocumentFragment();
@@ -301,21 +311,24 @@ App.SecExp.edicts = function() {
 				if (detail.repeal[i].conditional) {
 					App.UI.DOM.appendNewElement("span", c, `${detail.repeal[i].text}`);
 				} else if (detail.implement[i].conditional) {
-					App.UI.DOM.appendNewElement("span", c, `${detail.implement[i].text}`);
+					App.UI.DOM.appendNewElement((i === 0 ? "span" : "div"), c, `${detail.implement[i].text}`);
 				}
 
 				if (V.SecExp.core.authority >= 1000) {
 					App.UI.DOM.appendNewElement("span", c,
-						App.UI.DOM.link(` ${detail.repeal[i].conditional ? "Repeal" : "Implement"}`
-							, () => {
-								detail.repeal[i].conditional ? detail.repeal[i].setter : detail.implement[i].setter;
-								if (detail.implement[i].conditional) {
-									cashX(-5000, "edicts");
-									V.SecExp.core.authority -= 1000;
-								}
-								App.UI.reload();
-							})
-						, (detail.repeal[i].conditional ? "yellow" : "green"));
+						App.UI.DOM.link(` ${detail.repeal[i].conditional ? "Repeal" : "Implement"}`,
+						() => {
+							if (detail.implement[i].conditional) {
+								detail.implement[i].setter;
+								cashX(-5000, "edicts");
+								V.SecExp.core.authority -= 1000;
+							} else {
+								detail.repeal[i].setter;
+							}
+							App.UI.reload();
+						})
+						, (detail.repeal[i].conditional ? "yellow" : "green")
+					);
 					if (detail.implement[i].conditional) {
 						App.UI.DOM.appendNewElement("div", c, `${detail.implement[i].note}`, ["note", "indent"]);
 					}
-- 
GitLab


From 46c795a09dbe7b159e9c540be81bf24cc7ddb40b Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Fri, 6 Aug 2021 23:12:18 +1200
Subject: [PATCH 06/19] latest code 2020-08-06 0

---
 src/Mods/SecExp/js/edicts.js | 98 +++++++++++++++++++-----------------
 1 file changed, 51 insertions(+), 47 deletions(-)

diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index 74014b42b8b..9c1547f3cb1 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -19,14 +19,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "You are allowing citizens to pay for their rents in menial slaves rather than cash.",
 						conditional: V.SecExp.edicts.alternativeRents === 1,
-						value: V.SecExp.edicts.alternativeRents = 0
+						setter: 0
 					}
 				],
 				implement: [
 					{
 						text: "Allow citizens to pay for their rents in menial slaves rather than cash, if so they wish.",
 						conditional: V.SecExp.edicts.alternativeRents === 0,
-						value: V.SecExp.edicts.alternativeRents = 1,
+						setter: 1,
 						note: "Will decrease rents, but will supply a small amount of menial slaves each week."
 					}
 				]
@@ -37,14 +37,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "you are the only authority able to declare a person enslaved or not.",
 						conditional: V.SecExp.edicts.enslavementRights === 1,
-						value: V.SecExp.edicts.enslavementRights = 0,
+						setter: 0,
 					}
 				],
 				implement: [
 					{
 						text: "the arcology owner will be the only authority able to declare a person enslaved or not.",
 						conditional: V.SecExp.edicts.enslavementRights === 0,
-						value: V.SecExp.edicts.enslavementRights = 1,
+						setter: 1,
 						note: "Will provide cash each week at the cost of a small authority hit. The higher the flux of citizens to slaves the higher the income."
 					}
 				]
@@ -55,14 +55,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "you are selling private citizens' data to the best bidder.",
 						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 1,
-						value: V.SecExp.edicts.sellData = 0,
+						setter: 0,
 					}
 				],
 				implement: [
 					{
 						text: "allow the selling of private citizens' data.",
 						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 0 && Object.values(V.SecExp.buildings.secHub.upgrades.security).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.intel).reduce((a, b) => a + b) > 0,
-						value: V.SecExp.edicts.sellData = 1,
+						setter: 1,
 						note: "Will generate income dependent on the amount of upgrades installed in the security HQ, but cost a small amount of authority each week."
 					}
 				]
@@ -73,14 +73,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "you are forcing residents to read curated educational material about the arcology.",
 						conditional: V.SecExp.buildings.propHub && V.SecExp.edicts.propCampaignBoost === 1,
-						value: V.SecExp.edicts.propCampaignBoost = 0
+						setter: 0
 					}
 				],
 				implement: [
 					{
 						text: "force residents to read curated educational material about the arcology.",
 						conditional: V.SecExp.buildings.propHub && V.SecExp.edicts.propCampaignBoost === 0,
-						value: V.SecExp.edicts.propCampaignBoost = 1,
+						setter: 1,
 						note: "Will increase the effectiveness of propaganda campaigns, but will incur upkeep costs."
 					}
 				]
@@ -91,14 +91,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "New businesses can rely on your help for legal expenses and issues.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 1,
-						setter: V.SecExp.edicts.tradeLegalAid = 0
+						setter: 0
 					}
 				],
 				implement: [
 					{
 						text: "Support new businesses in the arcology by helping them cover legal costs and issues.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 0,
-						setter: V.SecExp.edicts.tradeLegalAid = 1,
+						setter: 1,
 						note: "Will increase trade, but will incur upkeep costs."
 					}
 				]
@@ -109,14 +109,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "all goods transitioning in your arcology have to pay a transition fee.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.taxTrade === 1,
-						setter: V.SecExp.edicts.taxTrade = 0
+						setter: 0
 					}
 				],
 				implement: [
 					{
 						text: "all goods transitioning in your arcology will have to pay a transition fee.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.taxTrade === 0,
-						setter: V.SecExp.edicts.taxTrade = 1,
+						setter: 1,
 						note: "Will provide income based on trade level, but will negatively affect trade."
 					}
 				]
@@ -127,14 +127,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "slaves are able access a special security service in case of mistreatment.",
 						conditional: V.arcologies[0].FSPaternalist !== "unset" && V.SecExp.edicts.slaveWatch === 1,
-						setter: V.SecExp.edicts.slaveWatch = 0
+						setter: 0
 					}
 				],
 				implement: [
 					{
 						text: "slaves will be able access a special security service in case of mistreatment.",
 						conditional: V.arcologies[0].FSPaternalist !== "unset" && V.SecExp.edicts.slaveWatch === 0,
-						setter: V.SecExp.edicts.slaveWatch = 1,
+						setter: 1,
 						note: "Will help advance paternalism, but will incur upkeep costs."
 					}
 				]
@@ -145,14 +145,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "you are providing economic support to religious activities following the official dogma.",
 						conditional: V.arcologies[0].FSChattelReligionist >= 40 && V.SecExp.edicts.subsidyChurch === 1,
-						setter: V.SecExp.edicts.subsidyChurch = 0
+						setter: 0
 					}
 				],
 				implement: [
 					{
 						text: "will provide economic support to religious activities following the official dogma.",
 						conditional: V.arcologies[0].FSChattelReligionist >= 40 && V.SecExp.edicts.subsidyChurch === 0,
-						setter: V.SecExp.edicts.subsidyChurch = 1,
+						setter: 1,
 						note: "Will provide authority each week, but will incur upkeep costs."
 					}
 				]
@@ -163,7 +163,7 @@ App.SecExp.edicts = function() {
 					{
 						text: "you put strict limits to the amount of people the arcology can accept each week.",
 						conditional: V.SecExp.edicts.limitImmigration === 1,
-						setter: V.SecExp.edicts.limitImmigration = 0
+						setter: 0
 					}
 				],
 				implement: [
@@ -181,7 +181,7 @@ App.SecExp.edicts = function() {
 					{
 						text: "you have lowered considerably the requirements to become citizens.",
 						conditional: V.SecExp.edicts.openBorders === 1,
-						setter: V.SecExp.edicts.openBorders = 0
+						setter: 0
 					}
 				],
 				implement: [
@@ -199,55 +199,55 @@ App.SecExp.edicts = function() {
 				repeal: [
 					{
 						text: "residents are forbidden to buy, sell and keep weaponry while within the arcology.",
-						conditional: V.SecExp.edicts.weaponsLaw === 0,
+						conditional: 0,
 						setter: V.SecExp.edicts.weaponsLaw = 3
 					},
 					{
 						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						setter: V.SecExp.edicts.weaponsLaw = 3
+						setter: 3
 					},
 					{
 						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						setter: V.SecExp.edicts.weaponsLaw = 3
+						setter: 3
 					}
 				],
 				implement: [
 					{
 						text: "Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 3,
-						setter: V.SecExp.edicts.weaponsLaw = 2,
+						setter: 2,
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
 						text: "Allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						setter: V.SecExp.edicts.weaponsLaw = 3,
+						setter: 3,
 						note: "Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed."
 					},
 					{
 						text: "Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						setter: V.SecExp.edicts.weaponsLaw = 1,
+						setter: 1,
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					},
 					{
 						text: "Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						setter: V.SecExp.edicts.weaponsLaw = 2,
+						setter: 2,
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
 						text: "Forbid residents to buy, sell and keep weaponry while within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						setter: V.SecExp.edicts.weaponsLaw = 0,
+						setter: 0,
 						note: "Will cost a moderate amount of authority each week, but rebellions will be very poorly armed."
 					},
 					{
 						text: "Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 0,
-						setter: V.SecExp.edicts.weaponsLaw = 1,
+						setter: 1,
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					}
 				]
@@ -258,14 +258,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "you are funding specialized training for your recruits following the Roman tradition of professional armies.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.legionTradition === 1,
-						setter: V.SecExp.edicts.defense.legionTradition = 0
+						setter: 0
 					}
 				],
 				implement: [
 					{
 						text: "Fund specialized training for your recruits to turn them into the professional of Roman tradition.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSRomanRevivalist >= 40 && V.SecExp.edicts.defense.legionTradition === 0,
-						setter: V.SecExp.edicts.defense.legionTradition = 1,
+						setter: 1,
 						note: "Will increase defense, morale and hp of militia units, but will incur upkeep costs."
 					}
 				]
@@ -293,17 +293,17 @@ App.SecExp.edicts = function() {
 		]);
 
 		const c = new DocumentFragment();
+		const r = [];;
 		for (const [name, detail] of data) {
-			let r;
-			if (["limitImmigration", "openBorders"].includes(name) && r !== "Immigration") {
+			if (["limitImmigration", "openBorders"].includes(name) && !r.includes("Immigration")) {
 				App.UI.DOM.appendNewElement("h1", c, "Immigration:", "underline");
-				r = "Immigration";
-			} else if (name === "weaponsLaw" && r !== "Weapons") {
+				r.push("Immigration");
+			} else if (name === "weaponsLaw" && !r.includes("Weapons")) {
 				App.UI.DOM.appendNewElement("h1", c, "Weapons:", "underline");
-				r = "Weapons";
-			} else if (V.FSAnnounced && name === "Future Societies" && r !== "Future Societies") {
+				r.push("Weapons");
+			} else if (V.FSAnnounced && name === "Future Societies" && !r.includes("Future Societies")) {
 				App.UI.DOM.appendNewElement("h1", c, "Future Societies:", "underline");
-				r = "Future Societies";
+				r.push("Future Societies");
 			}
 			App.UI.DOM.appendNewElement("div", c);
 			App.UI.DOM.appendNewElement("span", c, `${detail.title} `, "bold");
@@ -313,21 +313,25 @@ App.SecExp.edicts = function() {
 				} else if (detail.implement[i].conditional) {
 					App.UI.DOM.appendNewElement((i === 0 ? "span" : "div"), c, `${detail.implement[i].text}`);
 				}
+				
+				if (name === "propCampaignBoost") {
+					console.log(detail);
+				}
 
 				if (V.SecExp.core.authority >= 1000) {
 					App.UI.DOM.appendNewElement("span", c,
-						App.UI.DOM.link(` ${detail.repeal[i].conditional ? "Repeal" : "Implement"}`,
+						App.UI.DOM.link(` ${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
 						() => {
 							if (detail.implement[i].conditional) {
-								detail.implement[i].setter;
+								V.SecExp.edicts[name] = detail.implement[i].setter;
 								cashX(-5000, "edicts");
 								V.SecExp.core.authority -= 1000;
-							} else {
-								detail.repeal[i].setter;
+							} else if (detail.repeal[i].conditional) {
+								V.SecExp.edicts[name] = detail.repeal[i].setter;
 							}
 							App.UI.reload();
 						})
-						, (detail.repeal[i].conditional ? "yellow" : "green")
+						, (detail.implement[i].conditional ? "green" : "yellow")
 					);
 					if (detail.implement[i].conditional) {
 						App.UI.DOM.appendNewElement("div", c, `${detail.implement[i].note}`, ["note", "indent"]);
@@ -346,14 +350,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "",
 						conditional: ,
-						value:
+						setter:
 					}
 				],
 				implement: [
 					{
 						text: "",
 						conditional: ,
-						value: ,
+						setter: ,
 						note:
 					}
 				]
@@ -364,14 +368,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "",
 						conditional: ,
-						value:
+						setter:
 					}
 				],
 				implement: [
 					{
 						text: "",
 						conditional: ,
-						value: ,
+						setter: ,
 						note:
 					}
 				]
@@ -382,14 +386,14 @@ App.SecExp.edicts = function() {
 					{
 						text: "",
 						conditional: ,
-						value:
+						setter:
 					}
 				],
 				implement: [
 					{
 						text: "",
 						conditional: ,
-						value: ,
+						setter: ,
 						note:
 					}
 				]
-- 
GitLab


From f5a98a73da79674d8d079cd1a09db3967be02ec1 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Sat, 7 Aug 2021 22:05:07 +1200
Subject: [PATCH 07/19] latest code 2020-08-07 1

---
 src/Mods/SecExp/edicts.tw    |  435 -------------
 src/Mods/SecExp/js/edicts.js | 1135 ++++++++++++++++++++++++++++++----
 2 files changed, 1015 insertions(+), 555 deletions(-)
 delete mode 100644 src/Mods/SecExp/edicts.tw

diff --git a/src/Mods/SecExp/edicts.tw b/src/Mods/SecExp/edicts.tw
deleted file mode 100644
index b0006f642fc..00000000000
--- a/src/Mods/SecExp/edicts.tw
+++ /dev/null
@@ -1,435 +0,0 @@
-<div id="Society" class="tab-content">
-	<div class="content">
-
-	<<if $FSAnnounced>>
-		<<if $SecExp.edicts.defense.imperialTradition === 1>>
-			<br>''@@.lime;Neo-Imperial traditions:@@'' you are funding specialized training for your recruits to inculcate them into a professional Imperial army, led by highly trained and hand-picked $mercenariesTitle.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.imperialTradition = 0]]</span>
-		<</if>>
-		<<if $SecExp.edicts.defense.pharaonTradition === 1>>
-			<br>''@@.lime;Pharaonic traditions:@@'' you are funding specialized training for your recruits to turn them into an army worthy of a pharaon.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.pharaonTradition = 0]]</span>
-		<</if>>
-		<<if $SecExp.edicts.defense.militia >= 1>>
-			<<if $arcologies[0].FSEgyptianRevivalist >= 40>>
-				<<if $SecExp.edicts.defense.pharaonTradition === 0>>
-					<br>''@@.lime;Pharaonic traditions:@@'' Fund specialized training for your recruits to turn them into an army worthy of a pharaoh.
-					<<if $SecExp.core.authority >= 1000>>
-						<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.pharaonTradition = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-					<<else>>
-						<br>//Not enough Authority.//
-					<</if>>
-					<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase attack, defense and morale of militia units, but will incur upkeep costs.//
-				<</if>>
-			<</if>>
-			<<if $arcologies[0].FSNeoImperialist >= 40>>
-				<<if $SecExp.edicts.defense.imperialTradition === 0>>
-					<br>''@@.lime;Neo-Imperial traditions:@@'' Fund specialized training for your recruits to turn them into a professional Imperial army, led by your handpicked Imperial Knights.
-					<<if $SecExp.core.authority >= 1000>>
-						<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.imperialTradition = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-					<<else>>
-						<br>//Not enough Authority.//
-					<</if>>
-					<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will moderately increase defense, hp, and morale of your militia units and increase attack, defense and morale of your mercenaries, but will incur upkeep costs.//
-				<</if>>
-			<</if>>
-		<</if>>
-
-		<<if $SecExp.edicts.defense.eagleWarriors === 1>>
-			<br>''@@.lime;Eagle warriors traditions:@@'' you are funding specialized training for your mercenaries following the Aztec tradition of elite warriors.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.eagleWarriors = 0]]</span>
-		<</if>>
-
-		<<if $SecExp.edicts.defense.ronin === 1>>
-			<br>''@@.lime;Ronin traditions:@@'' you are funding specialized training for your mercenaries following the Japanese tradition of elite errant samurai.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.ronin = 0]]</span>
-		<</if>>
-		<<if $mercenaries > 0>>
-			<<if $arcologies[0].FSAztecRevivalist >= 40>>
-				<<if $SecExp.edicts.defense.eagleWarriors === 0>>
-					<br>''@@.lime;Eagle warriors traditions:@@'' Fund specialized training for your mercenaries to turn them into the elite units of Aztec tradition.
-					<<if $SecExp.core.authority >= 1000>>
-						<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.eagleWarriors = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-					<<else>>
-						<br>//Not enough Authority.//
-					<</if>>
-					<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will give a high increase in attack and morale, but will lower defense of mercenary units and will incur upkeep costs.//
-				<</if>>
-			<</if>>
-			<<if $arcologies[0].FSEdoRevivalist >= 40>>
-				<<if $SecExp.edicts.defense.ronin === 0>>
-					<br>''@@.lime;Ronin traditions:@@'' Fund specialized training for your mercenaries to turn them into the errant samurai of Japanese tradition.
-					<<if $SecExp.core.authority >= 1000>>
-						<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.ronin = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-					<<else>>
-						<br>//Not enough Authority.//
-					<</if>>
-					<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase attack, defense and morale of mercenary units, but will incur upkeep costs.//
-				<</if>>
-			<</if>>
-		<</if>>
-
-		<<if $SecExp.edicts.defense.mamluks === 1>>
-			<br>''@@.lime;Mamluks traditions:@@'' you are funding specialized training for your slaves following the Arabian tradition of mamluks slave soldiers.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.mamluks = 0]]</span>
-		<</if>>
-
-		<<if $SecExp.edicts.defense.sunTzu === 1>>
-			<br>''@@.lime;Sun Tzu Teachings:@@'' you are funding specialized training for your units and officers to follow the teachings of the "Art of War".
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.sunTzu = 0]]</span>
-		<</if>>
-		<<if $arcologies[0].FSArabianRevivalist >= 40>>
-			<<if $SecExp.edicts.defense.mamluks === 0>>
-				<br>''@@.lime;Mamluks traditions:@@'' Fund specialized training for your slaves to turn them into the mamluks slave soldiers of Arabian tradition.
-				<<if $SecExp.core.authority >= 1000>>
-					<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.mamluks = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-				<<else>>
-					<br>//Not enough Authority.//
-				<</if>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase attack, morale and hp of slave units, but will incur upkeep costs.//
-			<</if>>
-		<</if>>
-		<<if $arcologies[0].FSChineseRevivalist >= 40>>
-			<<if $SecExp.edicts.defense.sunTzu === 0>>
-				<br>''@@.lime;Sun Tzu Teachings:@@'' Fund specialized training for your units and officers to conform your army to the teachings of the "Art of War".
-				<<if $SecExp.core.authority >= 1000>>
-					<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.sunTzu = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-				<<else>>
-					<br>//Not enough Authority.//
-				<</if>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will slightly increase attack, defense and morale of all units, but will incur upkeep costs.//
-			<</if>>
-		<</if>>
-	<</if>>
-	</div>
-</div>
-
-<div id="Military" class="tab-content">
-	<div class="content">
-	<<if $SecExp.edicts.defense.soldierWages === 0>>
-		<br>''Low wages for soldiers:'' wages for soldiers are set to a low level compared to market standards.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.soldierWages = 1]]</span>
-	<<elseif $SecExp.edicts.defense.soldierWages === 1>>
-		<br>''Average wages for soldiers:'' wages for soldiers are set to the market standards.
-	<<else>>
-		<br>''High wages for soldiers:'' wages for soldiers are set to a high level compared to market standards.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.soldierWages = 1]]</span>
-	<</if>>
-
-	<<if $SecExp.edicts.defense.soldierWages === 0>>
-		<br>''Average wages for soldiers:'' will set the wages paid to the soldiers of the arcology to an average amount.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.soldierWages += 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will raise all units upkeep and push loyalty to average levels.//
-	<<elseif $SecExp.edicts.defense.soldierWages === 1>>
-		<br>''Low wages for soldiers:'' will set the wages paid to the soldiers of the arcology to a low amount.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.soldierWages -= 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will lower all units upkeep and push loyalty to low levels.//
-		<br>''High wages for soldiers:'' will set the wages paid to the soldiers of the arcology to a high amount.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.soldierWages += 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will raise all units upkeep and push loyalty to high levels.//
-	<<else>>
-		<br>''Average wages for soldiers:'' will set the wages paid to the soldiers of the arcology to an average amount.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.soldierWages -= 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will lower all units upkeep and push loyalty to average levels.//
-	<</if>>
-
-	<<if $SecExp.edicts.defense.slavesOfficers === 1>>
-		<br>''Slave Officers:'' your trusted slaves are allowed to lead the defense forces of the arcology.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.slavesOfficers = 0]]</span>
-	<<else>>
-		<br>''Slave Officers:'' allow your trusted slaves to lead the defense forces of the arcology.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.slavesOfficers = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will allow your bodyguard and Head Girl to lead troops into battle, but will cost a small amount of authority each week.//
-	<</if>>
-
-	<<if $mercenaries > 0>>
-		<<if $SecExp.edicts.defense.discountMercenaries === 1>>
-			<br>''Mercenary subsidy:'' mercenaries willing to immigrate in your arcology will be offered a discount on rent.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.discountMercenaries = 0]]</span>
-		<<else>>
-			<br>''Mercenary subsidy:'' mercenaries willing to immigrate in your arcology will be offered a discount on rent.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.discountMercenaries = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will slightly lower rent, but will increase the amount of available mercenaries.//
-		<</if>>
-	<</if>>
-
-	<<if $SecExp.edicts.defense.militia === 0>>
-		<br>''Found the militia:'' lay the groundwork for the formation of the arcology's citizens' army.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.militia = 2, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will allow for the recruitment and training of citizens.//
-	<<else>>
-		<<if $SecExp.edicts.defense.militia === 1>>
-			<br>''Volunteers' militia:'' only volunteers will be accepted in the militia.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.militia = 2, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will replenish militia manpower slowly and will cap at <<= num(App.SecExp.militiaCap(2)*100)>>% of the total citizens population.//
-		<</if>>
-
-		<<if $SecExp.edicts.defense.militia === 3>>
-			<br>''Conscription:'' every citizen is required to train in the militia and serve the arcology for a limited amount of time.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.militia = 2]]</span>
-		<<else>>
-			<br>''Conscription:'' every citizen is required to train in the militia and serve the arcology if the need arises.
-			<<if $SecExp.core.authority >= 4000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.militia = 3, cashX(-5000, "edicts"), $SecExp.core.authority -= 4000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will replenish militia manpower moderately fast and will cap at <<= num(App.SecExp.militiaCap(3)*100)>>% of the total citizens population, but has a high authority cost//
-		<</if>>
-		<<if $SecExp.edicts.defense.militia === 4>>
-			<br>''Obligatory military service:'' every citizen is required to register and serve under the militia.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.militia = 2]]</span>
-		<<else>>
-			<br>''Obligatory military service:'' every citizen is required to register and serve under the militia.
-			<<if $SecExp.core.authority >= 6000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.militia = 4, cashX(-5000, "edicts"), $SecExp.core.authority -= 6000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will quickly replenish militia manpower and will cap at <<= num(App.SecExp.militiaCap(4)*100)>>% of the total citizens population, but has a very high authority cost//
-		<</if>>
-		<<if $SecExp.edicts.defense.militia === 5>>
-			<br>''Militarized Society:'' every adult citizen is required to train and actively participate in the military of the arcology.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.militia = 2]]</span>
-		<<else>>
-			<br>''Militarized Society:'' every adult citizen is required to train and participate in the defense of the arcology.
-			<<if $SecExp.core.authority >= 8000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.militia = 5, cashX(-5000, "edicts"), $SecExp.core.authority -= 8000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will very quickly replenish militia manpower and will cap at <<= num(App.SecExp.militiaCap(5)*100)>>% of the total citizens population, but has an extremely high authority cost//
-		<</if>>
-
-
-		<<if $SecExp.edicts.defense.militaryExemption === 1>>
-				<br>''Military exemption:'' you allow citizens to avoid military duty by paying a weekly fee.
-				<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.militaryExemption = 0]]</span>
-		<</if>>
-		<<if $SecExp.edicts.defense.militia >= 3>>
-			<<if $SecExp.edicts.defense.militaryExemption === 0>>
-				<br>''Military exemption:'' allow citizens to avoid military duty by paying a weekly fee.
-				<<if $SecExp.core.authority >= 1000>>
-					<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.militaryExemption = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-				<<else>>
-					<br>//Not enough Authority.//
-				<</if>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will slow down the replenishment of manpower, but will supply cash each week. More profitable with stricter recruitment laws.//
-			<</if>>
-		<</if>>
-
-
-		<<if $SecExp.edicts.defense.lowerRequirements == 1>>
-			<br>''@@.lime;Revised minimum requirements:@@'' you allow citizens outside the normally accepted range to join the militia.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.lowerRequirements = 0]]</span>
-		<</if>>
-		<<if $arcologies[0].FSHedonisticDecadence >= 40>>
-			<<if $SecExp.edicts.defense.lowerRequirements == 0>>
-				<br>''@@.lime;Revised minimum requirements:@@'' will allow citizens outside the normally accepted range to join the militia.
-				<<if $SecExp.core.authority >= 1000>>
-					<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.lowerRequirements = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-				<<else>>
-					<br>//Not enough Authority.//
-				<</if>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will slightly lower defense and hp of militia units, but will increase the manpower replenishment rate.//
-			<</if>>
-		<</if>>
-
-		<<if $SecExp.edicts.defense.noSubhumansInArmy == 1>>
-			<br>''@@.lime;No subhumans in the militia:@@'' it is forbidden for subhumans to join the militia.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.noSubhumansInArmy = 0]]</span>
-		<</if>>
-		<<if $arcologies[0].FSSubjugationist >= 40>>
-			<<if $SecExp.edicts.defense.noSubhumansInArmy == 0>>
-				<br>''@@.lime;No subhumans in the militia:@@'' prevent subhumans from joining the militia.
-				<<if $SecExp.core.authority >= 1000>>
-					<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.noSubhumansInArmy = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-				<<else>>
-					<br>//Not enough Authority.//
-				<</if>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will help advance racial Subjugation, but will slow down slightly manpower replenishment.//
-			<</if>>
-		<</if>>
-
-		<<if $SecExp.edicts.defense.pregExemption == 1>>
-			<br>''@@.lime;Military exemption for pregnancies:@@'' pregnant citizens are allowed, and encouraged, to avoid military service.
-			<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.pregExemption = 0]]</span>
-		<</if>>
-		<<if $arcologies[0].FSRepopulationFocus >= 40 && $SecExp.edicts.defense.militia >= 3>>
-			<<if $SecExp.edicts.defense.pregExemption == 0>>
-				<br>''@@.lime;Military exemption for pregnancies:@@'' pregnant citizens will be allowed, and encouraged, to avoid military service.
-				<<if $SecExp.core.authority >= 1000>>
-					<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.pregExemption = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-				<<else>>
-					<br>//Not enough Authority.//
-				<</if>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will help advance repopulation focus, but will slow down slightly manpower replenishment.//
-			<</if>>
-		<</if>>
-	<</if>>
-
-	<<if $SecExp.edicts.defense.privilege.militiaSoldier === 1>>
-		<br>''Special militia privileges:'' citizens joining the militia are exempt from rent payment.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.privilege.militiaSoldier = 0]]</span>
-	<</if>>
-	<<if $SecExp.edicts.defense.privilege.militiaSoldier === 0 && $SecExp.edicts.defense.militia >= 1>>
-		<br>''Special militia privileges'' will allow citizens joining the militia to avoid paying rent.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.privilege.militiaSoldier = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase the loyalty of militia units, but will decrease rents.//
-	<</if>>
-
-	<<if $SecExp.edicts.defense.privilege.slaveSoldier === 1>>
-		<br>''Special slaves privileges:'' Slaves into the army are allowed to have material possessions.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.privilege.slaveSoldier = 0]]</span>
-	<</if>>
-	<<if $SecExp.edicts.defense.privilege.slaveSoldier === 0>>
-		<br>''Special slaves privileges'' will allow slaves drafted into the army to be able to have material possessions.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.privilege.slaveSoldier = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase the loyalty of slave units, but will cost authority each week.//
-	<</if>>
-
-	<<if $SecExp.edicts.defense.privilege.mercSoldier === 1>>
-		<br>''Special mercenary privileges:'' Mercenaries under contract can claim part of the loot gained from battles.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.privilege.mercSoldier = 0]]</span>
-	<</if>>
-	<<if $SecExp.edicts.defense.privilege.mercSoldier === 0 && $mercenaries > 0>>
-		<br>''Special mercenary privileges'' will allow mercenaries under contract to claim part of the loot gained from battles.
-		<<if $SecExp.core.authority >= 1000>>
-			<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.privilege.mercSoldier = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-		<<else>>
-			<br>//Not enough Authority.//
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will increase the loyalty of mercenary units, but will reduce cash and menial slaves gained from battles.//
-	<</if>>
-
-	<<if $SecExp.edicts.defense.martialSchool === 1>>
-		<br>''@@.lime;Slave martial schools:@@'' specialized schools are training slaves in martial arts and bodyguarding.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.martialSchool = 0]]</span>
-	<</if>>
-	<<if $arcologies[0].FSPhysicalIdealist >= 40>>
-		<<if $SecExp.edicts.defense.martialSchool === 0>>
-			<br>''@@.lime;Slave martial schools:@@'' specialized schools will be set up to train slaves in martial arts and bodyguarding.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.martialSchool = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will slightly increase morale of slave units, but will incur upkeep costs.//
-		<</if>>
-	<</if>>
-
-	<<if $SecExp.edicts.defense.eliteOfficers === 1>>
-		<br>''@@.lime;Elite officers:@@'' officers are exclusively recruited from the elite of society.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.eliteOfficers = 0]]</span>
-	<</if>>
-	<<if $arcologies[0].FSRestart >= 40>>
-		<<if $SecExp.edicts.defense.eliteOfficers === 0>>
-			<br>''@@.lime;Elite officers:@@'' officers will be exclusively recruited from the elite of society.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.eliteOfficers = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will help advance eugenics and provide a small morale boost to militia units, but will give a small morale malus to slave units.//
-		<</if>>
-	<</if>>
-
-	<<if $SecExp.edicts.defense.liveTargets === 1>>
-		<br>''@@.lime;Live targets drills:@@'' disobedient slaves are used as live targets at shooting ranges.
-		<span class ='yellow'>[[Repeal|edicts][$SecExp.edicts.defense.liveTargets = 0]]</span>
-	<</if>>
-	<<if $arcologies[0].FSDegradationist >= 40>>
-		<<if $SecExp.edicts.defense.liveTargets === 0>>
-			<br>''@@.lime;Live targets drills:@@'' disobedient slaves will be used as live targets at shooting ranges.
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.defense.liveTargets = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will help advance degradationism and provide a small amount of exp to units, but will make the slave population slowly decline.//
-		<</if>>
-	<</if>>
-
-	<<if $SF.Toggle && $SF.Active >= 1>>
-		<br><br>__Special Force:__
-		<<set _capSF = capFirstChar($SF.Lower || "the special force")>>
-		<<if $SecExp.edicts.SFSupportLevel > 0>>
-			<<if $SecExp.edicts.SFSupportLevel === 1>>
-				<br>''Equipment provision:'' _capSF is providing the security HQ with advanced equipment, boosting its efficiency.
-			<<elseif $SecExp.edicts.SFSupportLevel === 2>>
-				<br>''Personnel training:'' _capSF is currently providing advanced equipment and training to security HQ personnel.
-			<<elseif $SecExp.edicts.SFSupportLevel === 3>>
-				<br>''Troops detachment:'' _capSF has currently transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.
-			<<elseif $SecExp.edicts.SFSupportLevel === 4>>
-				<br>''Full support:'' _capSF is currently providing its full support to the security department, while transferring troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.
-			<<elseif $SecExp.edicts.SFSupportLevel === 5>>
-				<br>''Network assistance:'' _capSF is currently assisting with a local install of its custom network full support and has transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.
-			<</if>>
-			<span class='yellow'>[[Repeal|edicts][$SecExp.edicts.SFSupportLevel--]]</span>
-		<</if>>
-		<<if $SecExp.edicts.SFSupportLevel < 5>>
-			<<if $SecExp.edicts.SFSupportLevel === 0 && App.SecExp.Check.reqMenials() > 5>>
-				<br>''Equipment provision:'' _capSF will provide the security HQ with advanced equipment.
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will lower the amount of personnel necessary to man the security HQ by 5, but will incur upkeep costs.//
-			<<elseif $SecExp.edicts.SFSupportLevel === 1 && $SF.Squad.Firebase >= 4 && App.SecExp.Check.reqMenials() > 5>>
-				<br>''Personnel training:'' _capSF will provide the security HQ personnel with advanced training.
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs.//
-			<<elseif $SecExp.edicts.SFSupportLevel === 2 && $SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5>>
-				<br>''Troops detachment:'' _capSF will provide troops to the security department.
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs.//
-			<<elseif $SecExp.edicts.SFSupportLevel === 3 && $SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5>>
-				<br>''Full Support:'' _capSF will give the security department its full support.
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs.//
-			<<elseif $SecExp.edicts.SFSupportLevel === 4 && $SF.Squad.Firebase === 10 && App.SecExp.Check.reqMenials() > 5>>
-				<br>''Network assistance:'' _capSF will assist the security department with installing a local version of their custom network.
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;//Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs.//
-			<</if>>
-			<<if $SecExp.core.authority >= 1000>>
-				<span class='green'>[[Implement|edicts][$SecExp.edicts.SFSupportLevel++, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]</span>
-			<<else>>
-				<br>//Not enough Authority.//
-			<</if>>
-		<</if>>
-	<</if>>
-	</div>
-</div>
diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index ba57edef1f8..798de9b798d 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -11,281 +11,615 @@ App.SecExp.edicts = function() {
 				return "All weapons allowed:";
 			}
 		};
-		
+
 		const data = new Map([
 			["alternativeRents", {
-				title: "Alternative rent payment:",
+				title: {
+					text: "Alternative rent payment:",
+				},
 				repeal: [
 					{
 						text: "You are allowing citizens to pay for their rents in menial slaves rather than cash.",
 						conditional: V.SecExp.edicts.alternativeRents === 1,
-						setter: 0
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "Allow citizens to pay for their rents in menial slaves rather than cash, if so they wish.",
 						conditional: V.SecExp.edicts.alternativeRents === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will decrease rents, but will supply a small amount of menial slaves each week."
 					}
 				]
 			}],
 			["enslavementRights", {
-				title: "Enslavement rights:",
+				title: {
+					text: "Enslavement rights:",
+				},
 				repeal: [
 					{
 						text: "you are the only authority able to declare a person enslaved or not.",
 						conditional: V.SecExp.edicts.enslavementRights === 1,
-						setter: 0,
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "the arcology owner will be the only authority able to declare a person enslaved or not.",
 						conditional: V.SecExp.edicts.enslavementRights === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will provide cash each week at the cost of a small authority hit. The higher the flux of citizens to slaves the higher the income."
 					}
 				]
 			}],
 			["sellData", {
-				title: "Private Data marketization:",
+				title: {
+					text: "Private Data marketization:",
+				},
 				repeal: [
 					{
 						text: "you are selling private citizens' data to the best bidder.",
 						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 1,
-						setter: 0,
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "allow the selling of private citizens' data.",
 						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 0 && Object.values(V.SecExp.buildings.secHub.upgrades.security).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.intel).reduce((a, b) => a + b) > 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will generate income dependent on the amount of upgrades installed in the security HQ, but cost a small amount of authority each week."
 					}
 				]
 			}],
 			["propCampaignBoost", {
-				title: "Propaganda Campaign Boost:",
+				title: {
+					text: "Propaganda Campaign Boost:",
+				},
 				repeal: [
 					{
 						text: "you are forcing residents to read curated educational material about the arcology.",
 						conditional: V.SecExp.buildings.propHub && V.SecExp.edicts.propCampaignBoost === 1,
-						setter: 0
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "force residents to read curated educational material about the arcology.",
 						conditional: V.SecExp.buildings.propHub && V.SecExp.edicts.propCampaignBoost === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will increase the effectiveness of propaganda campaigns, but will incur upkeep costs."
 					}
 				]
 			}],
 			["tradeLegalAid:", {
-				title: "Legal aid for new businesses",
+				title: {
+					text: "Legal aid for new businesses",
+				},
 				repeal: [
 					{
 						text: "New businesses can rely on your help for legal expenses and issues.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 1,
-						setter: 0
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "Support new businesses in the arcology by helping them cover legal costs and issues.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will increase trade, but will incur upkeep costs."
 					}
 				]
 			}],
 			["taxTrade", {
-				title: "Trade tariffs:",
+				title: {
+					text: "Trade tariffs:",
+				},
 				repeal: [
 					{
 						text: "all goods transitioning in your arcology have to pay a transition fee.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.taxTrade === 1,
-						setter: 0
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "all goods transitioning in your arcology will have to pay a transition fee.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.taxTrade === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will provide income based on trade level, but will negatively affect trade."
 					}
 				]
 			}],
 			["slaveWatch", {
-				title: "<span class='lime'>Slave mistreatment watch:</span>",
+				title: {
+					text: "Slave mistreatment watch:",
+					tag: ["bold", "lime"]
+				},
 				repeal: [
 					{
 						text: "slaves are able access a special security service in case of mistreatment.",
 						conditional: V.arcologies[0].FSPaternalist !== "unset" && V.SecExp.edicts.slaveWatch === 1,
-						setter: 0
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "slaves will be able access a special security service in case of mistreatment.",
 						conditional: V.arcologies[0].FSPaternalist !== "unset" && V.SecExp.edicts.slaveWatch === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will help advance paternalism, but will incur upkeep costs."
 					}
 				]
 			}],
 			["subsidyChurch", {
-				title: "<span class='lime'>Religious activities subsidy:</span>",
+				title: {
+					text: "Religious activities subsidy:",
+					tag: ["bold", "lime"]
+				},
 				repeal: [
 					{
 						text: "you are providing economic support to religious activities following the official dogma.",
 						conditional: V.arcologies[0].FSChattelReligionist >= 40 && V.SecExp.edicts.subsidyChurch === 1,
-						setter: 0
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "will provide economic support to religious activities following the official dogma.",
 						conditional: V.arcologies[0].FSChattelReligionist >= 40 && V.SecExp.edicts.subsidyChurch === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will provide authority each week, but will incur upkeep costs."
 					}
 				]
 			}],
 			["limitImmigration", {
-				title: "Immigration limits:",
+				title: {
+					text: "Immigration limits:",
+				},
 				repeal: [
 					{
 						text: "you put strict limits to the amount of people the arcology can accept each week.",
 						conditional: V.SecExp.edicts.limitImmigration === 1,
-						setter: 0
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "institute limits to the amount of people the arcology will accept each week.",
 						conditional: V.SecExp.edicts.limitImmigration === 0,
-						// setter: V.SecExp.edicts.openBorders = 0; V.SecExp.edicts.limitImmigration = 1,
+						value: [
+							{
+								var: "openBorders",
+								value: 0
+							},
+							{
+								var: "limitImmigration",
+								value: 1
+							}
+						],
 						note: "Will lower the amount of people immigrating into the arcology and enhance security."
 					}
 				]
 			}],
 			["openBorders", {
-				title: "Open borders",
+				title: {
+					text: "Open borders",
+				},
 				repeal: [
 					{
 						text: "you have lowered considerably the requirements to become citizens.",
 						conditional: V.SecExp.edicts.openBorders === 1,
-						setter: 0
+						value: [
+							{
+								value: 0
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "considerably lower requirements to become citizens.",
 						conditional: V.SecExp.edicts.openBorders === 0,
-						// setter: V.SecExp.edicts.openBorders = 1; V.SecExp.edicts.limitImmigration = 0,
+						value: [
+							{
+								var: "openBorders",
+								value: 1
+							},
+							{
+								var: "limitImmigration",
+								value: 0
+							},
+						],
 						note: "Will increase immigration to the arcology, but will increase crime."
 					}
 				]
 			}],
 
 			["weaponsLaw", {
-				title: weaponsLawTitle(),
+				title: {
+					text: weaponsLawTitle(),
+				},
 				repeal: [
 					{
 						text: "residents are forbidden to buy, sell and keep weaponry while within the arcology.",
-						conditional: 0,
-						setter: V.SecExp.edicts.weaponsLaw = 3
+						conditional: V.SecExp.edicts.weaponsLaw === 0,
+						value: [
+							{
+								value: 3
+							}
+						]
 					},
 					{
 						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						setter: 3
+						value: [
+							{
+								value: 3
+							}
+						]
 					},
 					{
 						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						setter: 3
+						value: [
+							{
+								value: 3
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 3,
-						setter: 2,
+						value: [
+							{
+								value: 2
+							}
+						],
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
 						text: "Allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						setter: 3,
+						value: [
+							{
+								value: 3
+							}
+						],
 						note: "Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed."
 					},
 					{
 						text: "Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					},
 					{
 						text: "Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						setter: 2,
+						value: [
+							{
+								value: 2
+							}
+						],
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
 						text: "Forbid residents to buy, sell and keep weaponry while within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						setter: 0,
+						value: [
+							{
+								value: 0
+							}
+						],
 						note: "Will cost a moderate amount of authority each week, but rebellions will be very poorly armed."
 					},
 					{
 						text: "Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1
+							}
+						],
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					}
 				]
 			}],
 			["pharaonTradition", {
-				title: "<span class='lime'>Legionaries traditions:</span>",
+				title: {
+					text: "Legionaries traditions:",
+					tag: ["bold", "lime"]
+				},
 				repeal: [
 					{
 						text: "you are funding specialized training for your recruits following the Roman tradition of professional armies.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.legionTradition === 1,
-						setter: 0
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "Fund specialized training for your recruits to turn them into the professional of Roman tradition.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSRomanRevivalist >= 40 && V.SecExp.edicts.defense.legionTradition === 0,
-						setter: 1,
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							}
+						],
 						note: "Will increase defense, morale and hp of militia units, but will incur upkeep costs."
 					}
 				]
 			}],
+			["Neo-Imperial traditions", {
+				title: {
+					text: "Neo-Imperial traditions:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: `you are funding specialized training for your recruits to inculcate them into a professional Imperial army, led by highly trained and hand-picked ${V.mercenariesTitle}.`,
+						conditional: V.FSAnnounced && V.SecExp.edicts.defense.imperialTradition === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "Fund specialized training for your recruits to turn them into a professional Imperial army, led by your handpicked Imperial Knights.",
+						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && arcologies[0].FSNeoImperialist >= 40 && V.SecExp.edicts.defense.imperialTradition === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will moderately increase defense, hp, and morale of your militia units and increase attack, defense and morale of your mercenaries, but will incur upkeep costs."
+					}
+				]
+			}],
+			["pharaonTradition", {
+				title: {
+					text: "Pharaonic traditions:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "you are funding specialized training for your recruits to turn them into an army worthy of a pharaon.",
+						conditional: V.SecExp.edicts.defense.pharaonTradition === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "Fund specialized training for your recruits to turn them into an army worthy of a pharaoh.",
+						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && arcologies[0].FSEgyptianRevivalist >= 40 && V.SecExp.edicts.defense.pharaonTradition === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will increase attack, defense and morale of militia units, but will incur upkeep costs."
+					}
+				]
+			}],
+			["eagleWarriors", {
+				title: {
+					text: "Eagle warriors traditions:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "you are funding specialized training for your mercenaries following the Aztec tradition of elite warriors.",
+						conditional: V.SecExp.edicts.defense.eagleWarriors === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "Fund specialized training for your mercenaries to turn them into the elite units of Aztec tradition.",
+						conditional: V.FSAnnounced && V.mercenaries > 0 && arcologies[0].FSAztecRevivalist >= 40 && V.SecExp.edicts.defense.eagleWarriors === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will give a high increase in attack and morale, but will lower defense of mercenary units and will incur upkeep costs."
+					}
+				]
+			}],
+			["ronin", {
+				title: {
+					text: "Ronin traditions:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "you are funding specialized training for your mercenaries following the Japanese tradition of elite errant samurai.",
+						conditional: V.SecExp.edicts.defense.ronin === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "Fund specialized training for your mercenaries to turn them into the errant samurai of Japanese tradition.",
+						conditional: V.FSAnnounced && V.mercenaries > 0 && arcologies[0].FSEdoRevivalist >= 40 && V.SecExp.edicts.defense.ronin === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will increase attack, defense and morale of mercenary units, but will incur upkeep costs."
+					}
+				]
+			}],
+			["mamluks", {
+				title: {
+					text: "Mamluks traditions:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "you are funding specialized training for your slaves following the Arabian tradition of mamluks slave soldiers.",
+						conditional: V.SecExp.edicts.defense.mamluks === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "Fund specialized training for your slaves to turn them into the mamluks slave soldiers of Arabian tradition.",
+						conditional: V.FSAnnounced && V.arcologies[0].FSArabianRevivalist >= 40 && V.SecExp.edicts.defense.mamluks === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will increase attack, morale and hp of slave units, but will incur upkeep costs."
+					}
+				]
+			}],
+			["sunTzu", {
+				title: {
+					text: "Sun Tzu Teachings:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: `you are funding specialized training for your units and officers to follow the teachings of the "Art of War".`,
+						conditional: V.SecExp.edicts.defense.sunTzu === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: `Fund specialized training for your units and officers to conform your army to the teachings of the "Art of War".`,
+						conditional: V.FSAnnounced && V.arcologies[0].FSChineseRevivalist >= 40 && V.SecExp.edicts.defense.sunTzu === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will slightly increase attack, defense and morale of all units, but will incur upkeep costs."
+					}
+				]
+			}],
 			/*
 			[, {
-				title: "",
+				title: {
+					text: ""
+					tag: ["bold", "lime"]
+				},
 				repeal: [
 					{
 						text: "",
 						conditional: ,
-						setter:
+						value: {
+							value: 0,
+							isDefense: true
+						}
 					}
 				],
 				implement: [
 					{
 						text: "",
 						conditional: ,
-						setter: ,
-						note:
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: ""
 					}
 				]
 			}],
@@ -306,33 +640,38 @@ App.SecExp.edicts = function() {
 				r.push("Future Societies");
 			}
 			App.UI.DOM.appendNewElement("div", c);
-			App.UI.DOM.appendNewElement("span", c, `${detail.title} `, "bold");
+			const t = new DocumentFragment();
+			if (detail.implement[i].conditional || detail.repeal[i].conditional) {
+				App.UI.DOM.appendNewElement("span", t, `${detail.title.text} `, detail.title.tag || "bold");
+			}
 			for (let i = 0; i < detail.repeal.length; i++) {
-				if (detail.repeal[i].conditional) {
-					App.UI.DOM.appendNewElement("span", c, `${detail.repeal[i].text}`);
-				} else if (detail.implement[i].conditional) {
-					App.UI.DOM.appendNewElement((i === 0 ? "span" : "div"), c, `${detail.implement[i].text}`);
-				}
-				
-				if (name === "propCampaignBoost") {
-					console.log(detail);
-				}
-
-				if (V.SecExp.core.authority >= 1000) {
-					App.UI.DOM.appendNewElement("span", c,
-						App.UI.DOM.link(` ${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
-						() => {
-							if (detail.implement[i].conditional) {
-								V.SecExp.edicts[name] = detail.implement[i].setter;
-								cashX(-5000, "edicts");
-								V.SecExp.core.authority -= 1000;
-							} else if (detail.repeal[i].conditional) {
-								V.SecExp.edicts[name] = detail.repeal[i].setter;
-							}
-							App.UI.reload();
-						})
+				const current = detail.implement[i].conditional ? detail.implement[i] : detail.repeal[i];
+				t.append(`${current.text} `);
+				if (V.SecExp.core.authority >= 1000 && (detail.repeal[i].conditional || detail.implement[i].conditional)) {
+					t.append(App.UI.DOM.makeElement("span",
+						App.UI.DOM.link(`${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
+							() => {
+								if (detail.implement[i].conditional) {
+									cashX(-5000, "edicts");
+									V.SecExp.core.authority -= 1000;
+								}
+								for (const set of current.value) {
+									if (set.isDefense) {
+										V.SecExp.edicts.defense[name] = set.value;
+									} else {
+										V.SecExp.edicts[set. var || name] = set.value;
+									}
+								}
+								App.UI.reload();
+							},
+						)
 						, (detail.implement[i].conditional ? "green" : "yellow")
-					);
+					));
+					if (detail.implement[i].conditional && i > 0) {
+						App.UI.DOM.appendNewElement("div", c, t);
+					} else {
+						App.UI.DOM.appendNewElement("span", c, t);
+					}
 					if (detail.implement[i].conditional) {
 						App.UI.DOM.appendNewElement("div", c, `${detail.implement[i].note}`, ["note", "indent"]);
 					}
@@ -341,88 +680,646 @@ App.SecExp.edicts = function() {
 		}
 		return c;
 	}
-	/*
 	function Military() {
+		const militiaTitle = function() {
+			if (V.SecExp.edicts.defense.militia === 0) {
+				return "Found the militia:";
+			} else if (V.SecExp.edicts.defense.militia === 1) {
+				return "Volunteers' militia:";
+			} else if (V.SecExp.edicts.defense.militia === 2) {
+				return "Heavy weaponry forbidden:";
+			} else if (V.SecExp.edicts.defense.militia === 3) {
+				return "Conscription:";
+			} else if (V.SecExp.edicts.defense.militia === 4) {
+				return "Obligatory military service:";
+			} else if (V.SecExp.edicts.defense.militia === 5) {
+				return "Militarized Society:";
+			}
+		};
+		const sfTitle = function() {
+			if (V.SecExp.edicts.SFSupportLevel === 1 || V.SecExp.edicts.SFSupportLevel === 0) {
+				return "Equipment provision:";
+			} else if (V.SecExp.edicts.SFSupportLevel === 2) {
+				return "Personnel training:";
+			} else if (V.SecExp.edicts.SFSupportLevel === 3) {
+				return "Troops detachment:";
+			} else if (V.SecExp.edicts.SFSupportLevel === 4) {
+				return "Full Support:";
+			} else if (V.SecExp.edicts.SFSupportLevel === 5) {
+				return "Network assistance:";
+			}
+		};
+		const capSF = capFirstChar(V.SF.Lower || "the special force");
 		const data = new Map([
-			[, {
-				title: "",
+			["soldierWages", {
+				title: {
+					text: "Wages for soldiers:"
+				},
 				repeal: [
 					{
-						text: "",
-						conditional: ,
-						setter:
+						text: "Are set to a low level compared to market standards. Raise?",
+						conditional: V.SecExp.edicts.defense.soldierWages === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						}
+					},
+					{
+						text: "Are set to the market standards. Lower?",
+						conditional: V.SecExp.edicts.defense.soldierWages === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					},
+					{
+						text: "Are set to the market standards. Raise?",
+						conditional: V.SecExp.edicts.defense.soldierWages === 1,
+						value: {
+							value: 2,
+							isDefense: true
+						}
+					},
+					{
+						text: "Are set to a high level compared to market standards. Lower",
+						conditional: V.SecExp.edicts.defense.soldierWages === 2,
+						value: {
+							value: 1,
+							isDefense: true
+						}
 					}
 				],
 				implement: [
 					{
-						text: "",
-						conditional: ,
-						setter: ,
-						note:
+						text: "will set the wages paid to the soldiers of the arcology to an average amount.",
+						conditional: V.SecExp.edicts.defense.soldierWages === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will raise all units upkeep and push loyalty to average levels."
+					},
+					{
+						text: "will set the wages paid to the soldiers of the arcology to a low amount.",
+						conditional: V.SecExp.edicts.defense.soldierWages === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						},
+						note: "Will lower all units upkeep and push loyalty to low levels."
+					},
+					{
+						text: "will set the wages paid to the soldiers of the arcology to a high amount.",
+						conditional: V.SecExp.edicts.defense.soldierWages === 1,
+						value: {
+							value: 2,
+							isDefense: true
+						},
+						note: "Will raise all units upkeep and push loyalty to high levels."
+					},
+					{
+						text: "will set the wages paid to the soldiers of the arcology to an average amount.",
+						conditional: V.SecExp.edicts.defense.soldierWages === 2,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will lower all units upkeep and push loyalty to average levels."
 					}
 				]
 			}],
-			[, {
-				title: "",
+			["slavesOfficers", {
+				title: {
+					text: "Slave Officers:"
+				},
 				repeal: [
 					{
-						text: "",
-						conditional: ,
-						setter:
+						text: "your trusted slaves are allowed to lead the defense forces of the arcology.",
+						conditional: V.SecExp.edicts.defense.slavesOfficers === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
 					}
 				],
 				implement: [
 					{
-						text: "",
-						conditional: ,
-						setter: ,
-						note:
+						text: "allow your trusted slaves to lead the defense forces of the arcology.",
+						conditional: V.SecExp.edicts.defense.slavesOfficers === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will allow your bodyguard and Head Girl to lead troops into battle, but will cost a small amount of authority each week."
 					}
 				]
 			}],
-			[, {
-				title: "",
+			["discountMercenaries", {
+				title: {
+					text: "Mercenary subsidy:"
+				},
 				repeal: [
 					{
-						text: "",
-						conditional: ,
-						setter:
+						text: "mercenaries willing to immigrate in your arcology will be offered a discount on rent.",
+						conditional: V.SecExp.edicts.defense.discountMercenaries === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
 					}
 				],
 				implement: [
 					{
-						text: "",
-						conditional: ,
-						setter: ,
-						note:
+						text: "mercenaries willing to immigrate in your arcology will be offered a discount on rent.",
+						conditional: V.mercenaries > 0 && V.SecExp.edicts.defense.discountMercenaries === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will slightly lower rent, but will increase the amount of available mercenaries."
 					}
 				]
 			}],
+			["militia", {
+				title: {
+					text: militiaTitle()
+				},
+				repeal: [
+					{
+						text: "every citizen is required to train in the militia and serve the arcology for a limited amount of time.",
+						conditional: V.SecExp.edicts.defense.militia === 3,
+						value: {
+							value: 2,
+							isDefense: true
+						}
+					},
+					{
+						text: "every citizen is required to register and serve under the militia.",
+						conditional: V.SecExp.edicts.defense.militia === 4,
+						value: {
+							value: 2,
+							isDefense: true
+						}
+					},
+					{
+						text: "every adult citizen is required to train and actively participate in the military of the arcology.",
+						conditional: V.SecExp.edicts.defense.militia === 5,
+						value: {
+							value: 2,
+							isDefense: true
+						}
+					},
+				],
+				implement: [
+					{
+						text: "lay the groundwork for the formation of the arcology's citizens' army.",
+						conditional: V.SecExp.edicts.defense.militia === 0,
+						value: {
+							value: 2,
+							isDefense: true
+						},
+						note: "Will allow for the recruitment and training of citizens."
+					},
+					{
+						text: "Volunteers' militia:",
+						conditional: V.SecExp.edicts.defense.militia > 2,
+						value: {
+							value: 2,
+							isDefense: true
+						},
+						note: `Will replenish militia manpower slowly and will cap at ${num(App.SecExp.militiaCap(2)*100)}% of the total citizens population.`
+					},
+					{
+						text: "every citizen is required to train in the militia and serve the arcology if the need arises.",
+						conditional: V.SecExp.edicts.defense.militia < 3,
+						value: {
+							value: 3,
+							isDefense: true
+						},
+						note: `Will replenish militia manpower moderately fast and will cap at ${num(App.SecExp.militiaCap(3)*100)}% of the total citizens population, but has a high authority cost.`
+					},
+					{
+						text: "every citizen is required to register and serve under the militia.",
+						conditional: V.SecExp.edicts.defense.militia < 4,
+						value: {
+							value: 4,
+							isDefense: true
+						},
+						note: `Will quickly replenish militia manpower and will cap at ${num(App.SecExp.militiaCap(4)*100)}% of the total citizens population, but has a very high authority cost.`
+					},
+					{
+						text: "every adult citizen is required to train and participate in the defense of the arcology.",
+						conditional: V.SecExp.edicts.defense.militia < 5,
+						value: {
+							value: 5,
+							isDefense: true
+						},
+						note: `Will very quickly replenish militia manpower and will cap at ${num(App.SecExp.militiaCap(5)*100)}% of the total citizens population, but has an extremely high authority cost`
+					},
+				]
+			}],
+			["militaryExemption", {
+				title: {
+					text: "Military exemption:"
+				},
+				repeal: [
+					{
+						text: "you allow citizens to avoid military duty by paying a weekly fee.",
+						conditional: V.SecExp.edicts.defense.militaryExemption === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "allow citizens to avoid military duty by paying a weekly fee.",
+						conditional: V.SecExp.edicts.defense.militia >= 3 && V.SecExp.edicts.defense.militaryExemption === 1,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will slow down the replenishment of manpower, but will supply cash each week. More profitable with stricter recruitment laws."
+					}
+				]
+			}],
+			["lowerRequirements", {
+				title: {
+					text: "Revised minimum requirements:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "you allow citizens outside the normally accepted range to join the militia.",
+						conditional: V.SecExp.edicts.defense.lowerRequirements === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "will allow citizens outside the normally accepted range to join the militia.",
+						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSHedonisticDecadence >= 40 && V.SecExp.edicts.defense.lowerRequirements === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will slightly lower defense and hp of militia units, but will increase the manpower replenishment rate."
+					}
+				]
+			}],
+			["noSubhumansInArmy", {
+				title: {
+					text: "No subhumans in the militia:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "it is forbidden for subhumans to join the militia.",
+						conditional: V.SecExp.edicts.defense.noSubhumansInArmy === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "prevent subhumans from joining the militia.",
+						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSSubjugationist >= 40 && V.SecExp.edicts.defense.noSubhumansInArmy === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will help advance racial Subjugation, but will slow down slightly manpower replenishment."
+					}
+				]
+			}],
+			["pregExemption", {
+				title: {
+					text: "Military exemption for pregnancies:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "pregnant citizens are allowed, and encouraged, to avoid military service.",
+						conditional: V.SecExp.edicts.defense.pregExemption === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "pregnant citizens will be allowed, and encouraged, to avoid military service.",
+						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSRepopulationFocus >= 40 && $SecExp.edicts.defense.militia >= 3 && V.SecExp.edicts.defense.pregExemption === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will help advance repopulation focus, but will slow down slightly manpower replenishment."
+					}
+				]
+			}],
+			["militiaSoldier", {
+				title: {
+					text: "Special militia privileges:"
+				},
+				repeal: [
+					{
+						text: "citizens joining the militia are exempt from rent payment.",
+						conditional: V.SecExp.edicts.defense.privilege.militiaSoldier === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "will allow citizens joining the militia to avoid paying rent.",
+						conditional: V.SecExp.edicts.defense.militia >= 1 && V.SecExp.edicts.defense.privilege.militiaSoldier === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will increase the loyalty of militia units, but will decrease rents."
+					}
+				]
+			}],
+			["slaveSoldier", {
+				title: {
+					text: "Special slaves privileges:"
+				},
+				repeal: [
+					{
+						text: "Slaves into the army are allowed to have material possessions.",
+						conditional: V.SecExp.edicts.defense.privilege.slaveSoldier === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "will allow slaves drafted into the army to be able to have material possessions.",
+						conditional: V.SecExp.edicts.defense.privilege.slaveSoldier === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will increase the loyalty of slave units, but will cost authority each week."
+					}
+				]
+			}],
+			["mercSoldier", {
+				title: {
+					text: "Special mercenary privileges:"
+				},
+				repeal: [
+					{
+						text: "Mercenaries under contract can claim part of the loot gained from battles.",
+						conditional: V.SecExp.edicts.defense.privilege.mercSoldier === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "will allow mercenaries under contract to claim part of the loot gained from battles.",
+						conditional: V.mercenaries > 0 && V.SecExp.edicts.defense.privilege.mercSoldier === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will increase the loyalty of mercenary units, but will reduce cash and menial slaves gained from battles."
+					}
+				]
+			}],
+			["martialSchool", {
+				title: {
+					text: "Slave martial schools:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "specialized schools are training slaves in martial arts and bodyguarding.",
+						conditional: V.SecExp.edicts.defense.martialSchool === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "specialized schools will be set up to train slaves in martial arts and bodyguarding.",
+						conditional: V.arcologies[0].FSPhysicalIdealist >= 40 && V.SecExp.edicts.defense.martialSchool === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will slightly increase morale of slave units, but will incur upkeep costs."
+					}
+				]
+			}],
+			["eliteOfficers", {
+				title: {
+					text: "Elite officers:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "officers are exclusively recruited from the elite of society.",
+						conditional: V.SecExp.edicts.defense.eliteOfficers === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "officers will be exclusively recruited from the elite of society.",
+						conditional: V.arcologies[0].FSRestart >= 40 && V.SecExp.edicts.defense.eliteOfficers === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will help advance eugenics and provide a small morale boost to militia units, but will give a small morale malus to slave units."
+					}
+				]
+			}],
+			["liveTargets", {
+				title: {
+					text: "Live targets drills:",
+					tag: ["bold", "lime"]
+				},
+				repeal: [
+					{
+						text: "disobedient slaves are used as live targets at shooting ranges.",
+						conditional: V.SecExp.edicts.defense.liveTargets === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					}
+				],
+				implement: [
+					{
+						text: "disobedient slaves will be used as live targets at shooting ranges.",
+						conditional: V.arcologies[0].FSDegradationist >= 40 && V.SecExp.edicts.defense.liveTargets === 0,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will help advance degradationism and provide a small amount of exp to units, but will make the slave population slowly decline."
+					}
+				]
+			}],
+			["SFSupportLevel", {
+				title: {
+					text: sfTitle()
+				},
+				repeal: [
+					{
+						text: `${capSF} is providing the security HQ with advanced equipment, boosting its efficiency.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1,
+						value: {
+							value: 0,
+							isDefense: true
+						}
+					},
+					{
+						text: `${capSF} is currently providing advanced equipment and training to security HQ personnel.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2,
+						value: {
+							value: 1,
+							isDefense: true
+						}
+					},
+					{
+						text: `${capSF} has currently transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3,
+						value: {
+							value: 2,
+							isDefense: true
+						}
+					},
+					{
+						text: `${capSF} is currently providing its full support to the security department, while transferring troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4,
+						value: {
+							value: 3,
+							isDefense: true
+						}
+					},
+					{
+						text: `${capSF} is currently assisting with a local install of its custom network full support and has transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 5,
+						value: {
+							value: 4,
+							isDefense: true
+						}
+					},
+				],
+				implement: [
+					{
+						text: `${capSF} will provide the security HQ with advanced equipment.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 0 && App.SecExp.Check.reqMenials() > 5,
+						value: {
+							value: 1,
+							isDefense: true
+						},
+						note: "Will lower the amount of personnel necessary to man the security HQ by 5, but will incur upkeep costs."
+					},
+					{
+						text: `${capSF} will provide the security HQ personnel with advanced training.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1 && V.SF.Squad.Firebase >= 4 && App.SecExp.Check.reqMenials() > 5,
+						value: {
+							value: 2,
+							isDefense: true
+						},
+						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
+					},
+					{
+						text: `${capSF} will provide troops to the security department.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
+						value: {
+							value: 3,
+							isDefense: true
+						},
+						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
+					},
+					{
+						text: `${capSF} will give the security department its full support.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
+						value: {
+							value: 4,
+							isDefense: true
+						},
+						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
+					},
+					{
+						text: `${capSF} will assist the security department with installing a local version of their custom network.`,
+						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4 && V.SF.Squad.Firebase === 10 && App.SecExp.Check.reqMenials() > 5,
+						value: {
+							value: 5,
+							isDefense: true
+						},
+						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
+					},
+				]
+			}],
 		]);
 
 		const c = new DocumentFragment();
+		const r = [];
 		for (const [name, detail] of data) {
 			App.UI.DOM.appendNewElement("div", c);
-			App.UI.DOM.appendNewElement("span", c, `${detail.title}: `, "bold");
+			const t = new DocumentFragment();
+			if (V.SF.Toggle && $SF.Active >= 1 && name === "SFSupportLevel" && !r.includes("SFSupportLevel")) {
+				App.UI.DOM.appendNewElement("h1", c, "Special Force:", "underline");
+				r.push("SFSupportLevel");
+			}
+			if (detail.implement[i].conditional || detail.repeal[i].conditional) {
+				App.UI.DOM.appendNewElement("span", t, `${detail.title.text} `, detail.title.tag || "bold");
+			}
 			for (let i = 0; i < detail.repeal.length; i++) {
-				if (detail.repeal[i].conditional) {
-					App.UI.DOM.appendNewElement("span", c, `${detail.repeal[i].text}`);
-				} else if (detail.implement[i].conditional) {
-					App.UI.DOM.appendNewElement("span", c, `${detail.implement[i].text}`);
-				}
-
-				if (V.SecExp.core.authority >= 1000) {
-					App.UI.DOM.appendNewElement("span", c,
-						App.UI.DOM.link(` ${detail.repeal[i].conditional ? "Repeal" : "Implement"}`
-							, () => {
-								V.SecExp.edicts[name] = (detail.repeal[i].conditional ? detail.repeal[i].value : detail.implement[i].value);
+				const current = detail.implement[i].conditional ? detail.implement[i] : detail.repeal[i];
+				t.append(`${current.text} `);
+				if (V.SecExp.core.authority >= 1000 && (detail.repeal[i].conditional || detail.implement[i].conditional)) {
+					t.append(App.UI.DOM.makeElement("span",
+						App.UI.DOM.link(`${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
+							() => {
 								if (detail.implement[i].conditional) {
 									cashX(-5000, "edicts");
 									V.SecExp.core.authority -= 1000;
 								}
+								for (const set of current.value) {
+									if (set.isDefense) {
+										V.SecExp.edicts.defense[name] = set.value;
+									} else {
+										V.SecExp.edicts[name] = set.value;
+									}
+								}
 								App.UI.reload();
-							})
-						, (detail.repeal[i].conditional ? "yellow" : "green"));
+							},
+						)
+						, (detail.implement[i].conditional ? "green" : "yellow")
+					));
+					if (detail.implement[i].conditional && i > 0) {
+						App.UI.DOM.appendNewElement("div", c, t);
+					} else {
+						App.UI.DOM.appendNewElement("span", c, t);
+					}
 					if (detail.implement[i].conditional) {
 						App.UI.DOM.appendNewElement("div", c, `${detail.implement[i].note}`, ["note", "indent"]);
 					}
@@ -431,17 +1328,15 @@ App.SecExp.edicts = function() {
 		}
 		return c;
 	}
-	*/
 
+	const count = (x) => V.SecExp[x].victories + V.SecExp[x].losses;
 	const node = new DocumentFragment();
 	App.UI.DOM.appendNewElement("div", node, `Passing any edict will cost ${cashFormat(5000)} and some authority. More will become available as the arcology develops.`, "note");
 	const tabBar = new App.UI.Tabs.TabBar("SlaveInteract");
 	tabBar.addTab("Society", "Society", Society());
-	/*
-	if (V.SecExp.battles.victories + V.SecExp.battles.losses > 0 || V.SecExp.rebellions.victories + V.SecExp.rebellions.losses > 0 || V.mercenaries > 0) {
+	if (count("battles") > 0 || count("rebellions") > 0 || V.mercenaries > 0) {
 		tabBar.addTab("Military", "Military", Military());
 	}
-	*/
 	V.SecExp.core.authority = Math.clamp(V.SecExp.core.authority, 0, 20000);
 	if (V.SecExp.core.authority < 1000) {
 		App.UI.DOM.appendNewElement("div", node, "Not enough Authority.", ["red", "note"]);
-- 
GitLab


From df3abeabd84f156c34e7934c69a16e3e4dd08e49 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Sat, 7 Aug 2021 23:14:58 +1200
Subject: [PATCH 08/19] latest code 2020-08-07 2

---
 src/Mods/SecExp/js/edicts.js | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index 798de9b798d..ad9231f6b7c 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -451,7 +451,7 @@ App.SecExp.edicts = function() {
 				implement: [
 					{
 						text: "Fund specialized training for your recruits to turn them into a professional Imperial army, led by your handpicked Imperial Knights.",
-						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && arcologies[0].FSNeoImperialist >= 40 && V.SecExp.edicts.defense.imperialTradition === 0,
+						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSNeoImperialist >= 40 && V.SecExp.edicts.defense.imperialTradition === 0,
 						value: {
 							value: 1,
 							isDefense: true
@@ -478,7 +478,7 @@ App.SecExp.edicts = function() {
 				implement: [
 					{
 						text: "Fund specialized training for your recruits to turn them into an army worthy of a pharaoh.",
-						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && arcologies[0].FSEgyptianRevivalist >= 40 && V.SecExp.edicts.defense.pharaonTradition === 0,
+						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSEgyptianRevivalist >= 40 && V.SecExp.edicts.defense.pharaonTradition === 0,
 						value: {
 							value: 1,
 							isDefense: true
@@ -505,7 +505,7 @@ App.SecExp.edicts = function() {
 				implement: [
 					{
 						text: "Fund specialized training for your mercenaries to turn them into the elite units of Aztec tradition.",
-						conditional: V.FSAnnounced && V.mercenaries > 0 && arcologies[0].FSAztecRevivalist >= 40 && V.SecExp.edicts.defense.eagleWarriors === 0,
+						conditional: V.FSAnnounced && V.mercenaries > 0 && V.arcologies[0].FSAztecRevivalist >= 40 && V.SecExp.edicts.defense.eagleWarriors === 0,
 						value: {
 							value: 1,
 							isDefense: true
@@ -532,7 +532,7 @@ App.SecExp.edicts = function() {
 				implement: [
 					{
 						text: "Fund specialized training for your mercenaries to turn them into the errant samurai of Japanese tradition.",
-						conditional: V.FSAnnounced && V.mercenaries > 0 && arcologies[0].FSEdoRevivalist >= 40 && V.SecExp.edicts.defense.ronin === 0,
+						conditional: V.FSAnnounced && V.mercenaries > 0 && V.arcologies[0].FSEdoRevivalist >= 40 && V.SecExp.edicts.defense.ronin === 0,
 						value: {
 							value: 1,
 							isDefense: true
@@ -641,7 +641,7 @@ App.SecExp.edicts = function() {
 			}
 			App.UI.DOM.appendNewElement("div", c);
 			const t = new DocumentFragment();
-			if (detail.implement[i].conditional || detail.repeal[i].conditional) {
+			if (detail.implement.filter(s => s.conditional) || detail.repeal.filter(s => s.conditional)) {
 				App.UI.DOM.appendNewElement("span", t, `${detail.title.text} `, detail.title.tag || "bold");
 			}
 			for (let i = 0; i < detail.repeal.length; i++) {
@@ -659,7 +659,7 @@ App.SecExp.edicts = function() {
 									if (set.isDefense) {
 										V.SecExp.edicts.defense[name] = set.value;
 									} else {
-										V.SecExp.edicts[set. var || name] = set.value;
+										V.SecExp.edicts[set.var || name] = set.value;
 									}
 								}
 								App.UI.reload();
@@ -1191,7 +1191,7 @@ App.SecExp.edicts = function() {
 				repeal: [
 					{
 						text: `${capSF} is providing the security HQ with advanced equipment, boosting its efficiency.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1,
 						value: {
 							value: 0,
 							isDefense: true
@@ -1199,7 +1199,7 @@ App.SecExp.edicts = function() {
 					},
 					{
 						text: `${capSF} is currently providing advanced equipment and training to security HQ personnel.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2,
 						value: {
 							value: 1,
 							isDefense: true
@@ -1207,7 +1207,7 @@ App.SecExp.edicts = function() {
 					},
 					{
 						text: `${capSF} has currently transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3,
 						value: {
 							value: 2,
 							isDefense: true
@@ -1215,7 +1215,7 @@ App.SecExp.edicts = function() {
 					},
 					{
 						text: `${capSF} is currently providing its full support to the security department, while transferring troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4,
 						value: {
 							value: 3,
 							isDefense: true
@@ -1223,7 +1223,7 @@ App.SecExp.edicts = function() {
 					},
 					{
 						text: `${capSF} is currently assisting with a local install of its custom network full support and has transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 5,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 5,
 						value: {
 							value: 4,
 							isDefense: true
@@ -1233,7 +1233,7 @@ App.SecExp.edicts = function() {
 				implement: [
 					{
 						text: `${capSF} will provide the security HQ with advanced equipment.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 0 && App.SecExp.Check.reqMenials() > 5,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 0 && App.SecExp.Check.reqMenials() > 5,
 						value: {
 							value: 1,
 							isDefense: true
@@ -1242,7 +1242,7 @@ App.SecExp.edicts = function() {
 					},
 					{
 						text: `${capSF} will provide the security HQ personnel with advanced training.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1 && V.SF.Squad.Firebase >= 4 && App.SecExp.Check.reqMenials() > 5,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1 && V.SF.Squad.Firebase >= 4 && App.SecExp.Check.reqMenials() > 5,
 						value: {
 							value: 2,
 							isDefense: true
@@ -1251,7 +1251,7 @@ App.SecExp.edicts = function() {
 					},
 					{
 						text: `${capSF} will provide troops to the security department.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
 						value: {
 							value: 3,
 							isDefense: true
@@ -1260,7 +1260,7 @@ App.SecExp.edicts = function() {
 					},
 					{
 						text: `${capSF} will give the security department its full support.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
 						value: {
 							value: 4,
 							isDefense: true
@@ -1269,7 +1269,7 @@ App.SecExp.edicts = function() {
 					},
 					{
 						text: `${capSF} will assist the security department with installing a local version of their custom network.`,
-						conditional: V.SF.Toggle && $SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4 && V.SF.Squad.Firebase === 10 && App.SecExp.Check.reqMenials() > 5,
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4 && V.SF.Squad.Firebase === 10 && App.SecExp.Check.reqMenials() > 5,
 						value: {
 							value: 5,
 							isDefense: true
@@ -1285,11 +1285,11 @@ App.SecExp.edicts = function() {
 		for (const [name, detail] of data) {
 			App.UI.DOM.appendNewElement("div", c);
 			const t = new DocumentFragment();
-			if (V.SF.Toggle && $SF.Active >= 1 && name === "SFSupportLevel" && !r.includes("SFSupportLevel")) {
+			if (V.SF.Toggle && V.SF.Active >= 1 && name === "SFSupportLevel" && !r.includes("SFSupportLevel")) {
 				App.UI.DOM.appendNewElement("h1", c, "Special Force:", "underline");
 				r.push("SFSupportLevel");
 			}
-			if (detail.implement[i].conditional || detail.repeal[i].conditional) {
+			if (detail.implement.filter(s => s.conditional) || detail.repeal.filter(s => s.conditional)) {
 				App.UI.DOM.appendNewElement("span", t, `${detail.title.text} `, detail.title.tag || "bold");
 			}
 			for (let i = 0; i < detail.repeal.length; i++) {
-- 
GitLab


From 823c5002c83b13b8d8525184f8bea6e32a7a146c Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Sun, 8 Aug 2021 11:43:55 +1200
Subject: [PATCH 09/19] latest code 2020-08-08 0

---
 src/Mods/SecExp/js/edicts.js | 682 +++++++++++++++++++----------------
 1 file changed, 373 insertions(+), 309 deletions(-)

diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index ad9231f6b7c..d2606cc87d2 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -1,4 +1,42 @@
 App.SecExp.edicts = function() {
+	function genMenu(detail) {
+		const t = new DocumentFragment();
+		if (detail.implement.find(s => s.conditional) || detail.repeal.find(s => s.conditional)) {
+			App.UI.DOM.appendNewElement("span", t, `${detail.title.text} `, detail.title.tag || "bold");
+			for (let i = 0; i < detail.repeal.length; i++) {
+				const current = detail.implement[i].conditional ? detail.implement[i] : detail.repeal[i];
+				t.append(`${capFirstChar(current.text)} `);
+				if (V.SecExp.core.authority >= 1000 && (detail.repeal[i].conditional || detail.implement[i].conditional)) {
+				// if (V.SecExp.core.authority >= 1000) {
+					t.append(App.UI.DOM.makeElement("span",
+						App.UI.DOM.link(`${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
+							() => {
+								if (detail.implement[i].conditional) {
+									cashX(-5000, "edicts");
+									V.SecExp.core.authority -= 1000;
+								}
+								for (const set of current.value) {
+									if (set.isDefense) {
+										V.SecExp.edicts.defense[name] = set.value;
+									} else {
+										V.SecExp.edicts[set.var || name] = set.value;
+									}
+								}
+								App.UI.reload();
+							},
+						)
+						, (detail.implement[i].conditional ? "green" : "yellow")
+					));
+					App.UI.DOM.appendNewElement("div", t);
+					if (detail.implement[i].conditional) {
+						App.UI.DOM.appendNewElement("div", t, `${detail.implement[i].note}`, ["note", "indent"]);
+					}
+				}
+			}
+		}
+		return t;
+	}
+
 	function Society() {
 		const weaponsLawTitle = function() {
 			if (V.SecExp.edicts.weaponsLaw === 0) {
@@ -19,7 +57,7 @@ App.SecExp.edicts = function() {
 				},
 				repeal: [
 					{
-						text: "You are allowing citizens to pay for their rents in menial slaves rather than cash.",
+						text: "you are allowing citizens to pay for their rents in menial slaves rather than cash.",
 						conditional: V.SecExp.edicts.alternativeRents === 1,
 						value: [
 							{
@@ -30,7 +68,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Allow citizens to pay for their rents in menial slaves rather than cash, if so they wish.",
+						text: "allow citizens to pay for their rents in menial slaves rather than cash, if so they wish.",
 						conditional: V.SecExp.edicts.alternativeRents === 0,
 						value: [
 							{
@@ -127,11 +165,11 @@ App.SecExp.edicts = function() {
 			}],
 			["tradeLegalAid:", {
 				title: {
-					text: "Legal aid for new businesses",
+					text: "Legal aid for new businesses:",
 				},
 				repeal: [
 					{
-						text: "New businesses can rely on your help for legal expenses and issues.",
+						text: "new businesses can rely on your help for legal expenses and issues.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 1,
 						value: [
 							{
@@ -142,7 +180,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Support new businesses in the arcology by helping them cover legal costs and issues.",
+						text: "support new businesses in the arcology by helping them cover legal costs and issues.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 0,
 						value: [
 							{
@@ -274,7 +312,7 @@ App.SecExp.edicts = function() {
 			}],
 			["openBorders", {
 				title: {
-					text: "Open borders",
+					text: "Open borders:",
 				},
 				repeal: [
 					{
@@ -321,7 +359,7 @@ App.SecExp.edicts = function() {
 						]
 					},
 					{
-						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-automatic, non-high caliber.",
+						text: "residents are allowed to buy, sell and keep non-automatic, non-high caliber weapons within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
 						value: [
 							{
@@ -330,7 +368,7 @@ App.SecExp.edicts = function() {
 						]
 					},
 					{
-						text: "residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-heavy, non-explosive.",
+						text: "residents are allowed to buy, sell and keep non-heavy, non-explosive weapons within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
 						value: [
 							{
@@ -341,7 +379,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 3,
 						value: [
 							{
@@ -351,7 +389,7 @@ App.SecExp.edicts = function() {
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
-						text: "Allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
+						text: "allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
 						value: [
 							{
@@ -361,7 +399,7 @@ App.SecExp.edicts = function() {
 						note: "Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed."
 					},
 					{
-						text: "Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
 						value: [
 							{
@@ -371,7 +409,7 @@ App.SecExp.edicts = function() {
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					},
 					{
-						text: "Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
 						value: [
 							{
@@ -381,7 +419,7 @@ App.SecExp.edicts = function() {
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
-						text: "Forbid residents to buy, sell and keep weaponry while within the arcology.",
+						text: "forbid residents to buy, sell and keep weaponry while within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
 						value: [
 							{
@@ -391,7 +429,7 @@ App.SecExp.edicts = function() {
 						note: "Will cost a moderate amount of authority each week, but rebellions will be very poorly armed."
 					},
 					{
-						text: "Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 0,
 						value: [
 							{
@@ -421,7 +459,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Fund specialized training for your recruits to turn them into the professional of Roman tradition.",
+						text: "fund specialized training for your recruits to turn them into the professional of Roman tradition.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSRomanRevivalist >= 40 && V.SecExp.edicts.defense.legionTradition === 0,
 						value: [
 							{
@@ -450,7 +488,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Fund specialized training for your recruits to turn them into a professional Imperial army, led by your handpicked Imperial Knights.",
+						text: "fund specialized training for your recruits to turn them into a professional Imperial army, led by your handpicked Imperial Knights.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSNeoImperialist >= 40 && V.SecExp.edicts.defense.imperialTradition === 0,
 						value: {
 							value: 1,
@@ -477,7 +515,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Fund specialized training for your recruits to turn them into an army worthy of a pharaoh.",
+						text: "fund specialized training for your recruits to turn them into an army worthy of a pharaoh.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSEgyptianRevivalist >= 40 && V.SecExp.edicts.defense.pharaonTradition === 0,
 						value: {
 							value: 1,
@@ -504,7 +542,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Fund specialized training for your mercenaries to turn them into the elite units of Aztec tradition.",
+						text: "fund specialized training for your mercenaries to turn them into the elite units of Aztec tradition.",
 						conditional: V.FSAnnounced && V.mercenaries > 0 && V.arcologies[0].FSAztecRevivalist >= 40 && V.SecExp.edicts.defense.eagleWarriors === 0,
 						value: {
 							value: 1,
@@ -531,7 +569,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Fund specialized training for your mercenaries to turn them into the errant samurai of Japanese tradition.",
+						text: "fund specialized training for your mercenaries to turn them into the errant samurai of Japanese tradition.",
 						conditional: V.FSAnnounced && V.mercenaries > 0 && V.arcologies[0].FSEdoRevivalist >= 40 && V.SecExp.edicts.defense.ronin === 0,
 						value: {
 							value: 1,
@@ -558,7 +596,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: "Fund specialized training for your slaves to turn them into the mamluks slave soldiers of Arabian tradition.",
+						text: "fund specialized training for your slaves to turn them into the mamluks slave soldiers of Arabian tradition.",
 						conditional: V.FSAnnounced && V.arcologies[0].FSArabianRevivalist >= 40 && V.SecExp.edicts.defense.mamluks === 0,
 						value: {
 							value: 1,
@@ -585,7 +623,7 @@ App.SecExp.edicts = function() {
 				],
 				implement: [
 					{
-						text: `Fund specialized training for your units and officers to conform your army to the teachings of the "Art of War".`,
+						text: `fund specialized training for your units and officers to conform your army to the teachings of the "Art of War".`,
 						conditional: V.FSAnnounced && V.arcologies[0].FSChineseRevivalist >= 40 && V.SecExp.edicts.defense.sunTzu === 0,
 						value: {
 							value: 1,
@@ -639,44 +677,7 @@ App.SecExp.edicts = function() {
 				App.UI.DOM.appendNewElement("h1", c, "Future Societies:", "underline");
 				r.push("Future Societies");
 			}
-			App.UI.DOM.appendNewElement("div", c);
-			const t = new DocumentFragment();
-			if (detail.implement.filter(s => s.conditional) || detail.repeal.filter(s => s.conditional)) {
-				App.UI.DOM.appendNewElement("span", t, `${detail.title.text} `, detail.title.tag || "bold");
-			}
-			for (let i = 0; i < detail.repeal.length; i++) {
-				const current = detail.implement[i].conditional ? detail.implement[i] : detail.repeal[i];
-				t.append(`${current.text} `);
-				if (V.SecExp.core.authority >= 1000 && (detail.repeal[i].conditional || detail.implement[i].conditional)) {
-					t.append(App.UI.DOM.makeElement("span",
-						App.UI.DOM.link(`${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
-							() => {
-								if (detail.implement[i].conditional) {
-									cashX(-5000, "edicts");
-									V.SecExp.core.authority -= 1000;
-								}
-								for (const set of current.value) {
-									if (set.isDefense) {
-										V.SecExp.edicts.defense[name] = set.value;
-									} else {
-										V.SecExp.edicts[set.var || name] = set.value;
-									}
-								}
-								App.UI.reload();
-							},
-						)
-						, (detail.implement[i].conditional ? "green" : "yellow")
-					));
-					if (detail.implement[i].conditional && i > 0) {
-						App.UI.DOM.appendNewElement("div", c, t);
-					} else {
-						App.UI.DOM.appendNewElement("span", c, t);
-					}
-					if (detail.implement[i].conditional) {
-						App.UI.DOM.appendNewElement("div", c, `${detail.implement[i].note}`, ["note", "indent"]);
-					}
-				}
-			}
+			App.UI.DOM.appendNewElement("p", c, genMenu(detail));
 		}
 		return c;
 	}
@@ -717,73 +718,89 @@ App.SecExp.edicts = function() {
 				},
 				repeal: [
 					{
-						text: "Are set to a low level compared to market standards. Raise?",
+						text: "are lower then market standards. Raise?",
 						conditional: V.SecExp.edicts.defense.soldierWages === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							}
+						]
 					},
 					{
-						text: "Are set to the market standards. Lower?",
+						text: "are set to the market standards. Lower?",
 						conditional: V.SecExp.edicts.defense.soldierWages === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					},
 					{
-						text: "Are set to the market standards. Raise?",
+						text: "are set to the market standards. Raise?",
 						conditional: V.SecExp.edicts.defense.soldierWages === 1,
-						value: {
-							value: 2,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							}
+						]
 					},
 					{
-						text: "Are set to a high level compared to market standards. Lower",
+						text: "are set to a high level compared to market standards. Lower",
 						conditional: V.SecExp.edicts.defense.soldierWages === 2,
-						value: {
-							value: 1,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "will set the wages paid to the soldiers of the arcology to an average amount.",
 						conditional: V.SecExp.edicts.defense.soldierWages === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will raise all units upkeep and push loyalty to average levels."
 					},
 					{
 						text: "will set the wages paid to the soldiers of the arcology to a low amount.",
 						conditional: V.SecExp.edicts.defense.soldierWages === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							},
+						],
 						note: "Will lower all units upkeep and push loyalty to low levels."
 					},
 					{
 						text: "will set the wages paid to the soldiers of the arcology to a high amount.",
 						conditional: V.SecExp.edicts.defense.soldierWages === 1,
-						value: {
-							value: 2,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							},
+						],
 						note: "Will raise all units upkeep and push loyalty to high levels."
 					},
 					{
 						text: "will set the wages paid to the soldiers of the arcology to an average amount.",
 						conditional: V.SecExp.edicts.defense.soldierWages === 2,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will lower all units upkeep and push loyalty to average levels."
 					}
 				]
@@ -796,20 +813,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "your trusted slaves are allowed to lead the defense forces of the arcology.",
 						conditional: V.SecExp.edicts.defense.slavesOfficers === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "allow your trusted slaves to lead the defense forces of the arcology.",
 						conditional: V.SecExp.edicts.defense.slavesOfficers === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will allow your bodyguard and Head Girl to lead troops into battle, but will cost a small amount of authority each week."
 					}
 				]
@@ -822,20 +843,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "mercenaries willing to immigrate in your arcology will be offered a discount on rent.",
 						conditional: V.SecExp.edicts.defense.discountMercenaries === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "mercenaries willing to immigrate in your arcology will be offered a discount on rent.",
 						conditional: V.mercenaries > 0 && V.SecExp.edicts.defense.discountMercenaries === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will slightly lower rent, but will increase the amount of available mercenaries."
 					}
 				]
@@ -848,72 +873,88 @@ App.SecExp.edicts = function() {
 					{
 						text: "every citizen is required to train in the militia and serve the arcology for a limited amount of time.",
 						conditional: V.SecExp.edicts.defense.militia === 3,
-						value: {
-							value: 2,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							}
+						]
 					},
 					{
 						text: "every citizen is required to register and serve under the militia.",
 						conditional: V.SecExp.edicts.defense.militia === 4,
-						value: {
-							value: 2,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							}
+						]
 					},
 					{
 						text: "every adult citizen is required to train and actively participate in the military of the arcology.",
 						conditional: V.SecExp.edicts.defense.militia === 5,
-						value: {
-							value: 2,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							}
+						]
 					},
 				],
 				implement: [
 					{
 						text: "lay the groundwork for the formation of the arcology's citizens' army.",
 						conditional: V.SecExp.edicts.defense.militia === 0,
-						value: {
-							value: 2,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							},
+						],
 						note: "Will allow for the recruitment and training of citizens."
 					},
 					{
-						text: "Volunteers' militia:",
+						text: "only volunteers will be accepted in the militia.",
 						conditional: V.SecExp.edicts.defense.militia > 2,
-						value: {
-							value: 2,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							},
+						],
 						note: `Will replenish militia manpower slowly and will cap at ${num(App.SecExp.militiaCap(2)*100)}% of the total citizens population.`
 					},
 					{
 						text: "every citizen is required to train in the militia and serve the arcology if the need arises.",
 						conditional: V.SecExp.edicts.defense.militia < 3,
-						value: {
-							value: 3,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 3,
+								isDefense: true
+							},
+						],
 						note: `Will replenish militia manpower moderately fast and will cap at ${num(App.SecExp.militiaCap(3)*100)}% of the total citizens population, but has a high authority cost.`
 					},
 					{
 						text: "every citizen is required to register and serve under the militia.",
 						conditional: V.SecExp.edicts.defense.militia < 4,
-						value: {
-							value: 4,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 4,
+								isDefense: true
+							},
+						],
 						note: `Will quickly replenish militia manpower and will cap at ${num(App.SecExp.militiaCap(4)*100)}% of the total citizens population, but has a very high authority cost.`
 					},
 					{
 						text: "every adult citizen is required to train and participate in the defense of the arcology.",
 						conditional: V.SecExp.edicts.defense.militia < 5,
-						value: {
-							value: 5,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 5,
+								isDefense: true
+							},
+						],
 						note: `Will very quickly replenish militia manpower and will cap at ${num(App.SecExp.militiaCap(5)*100)}% of the total citizens population, but has an extremely high authority cost`
 					},
 				]
@@ -926,25 +967,29 @@ App.SecExp.edicts = function() {
 					{
 						text: "you allow citizens to avoid military duty by paying a weekly fee.",
 						conditional: V.SecExp.edicts.defense.militaryExemption === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "allow citizens to avoid military duty by paying a weekly fee.",
 						conditional: V.SecExp.edicts.defense.militia >= 3 && V.SecExp.edicts.defense.militaryExemption === 1,
-						value: {
-							value: 1,
-							isDefense: true
-						},
-						note: "Will slow down the replenishment of manpower, but will supply cash each week. More profitable with stricter recruitment laws."
-					}
-				]
-			}],
-			["lowerRequirements", {
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
+						note: "Will slow down the replenishment of manpower, but will supply cash each week. More profitable with stricter recruitment laws."
+					}
+				]
+			}],
+			["lowerRequirements", {
 				title: {
 					text: "Revised minimum requirements:",
 					tag: ["bold", "lime"]
@@ -953,20 +998,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "you allow citizens outside the normally accepted range to join the militia.",
 						conditional: V.SecExp.edicts.defense.lowerRequirements === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "will allow citizens outside the normally accepted range to join the militia.",
 						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSHedonisticDecadence >= 40 && V.SecExp.edicts.defense.lowerRequirements === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will slightly lower defense and hp of militia units, but will increase the manpower replenishment rate."
 					}
 				]
@@ -980,20 +1029,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "it is forbidden for subhumans to join the militia.",
 						conditional: V.SecExp.edicts.defense.noSubhumansInArmy === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "prevent subhumans from joining the militia.",
 						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSSubjugationist >= 40 && V.SecExp.edicts.defense.noSubhumansInArmy === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will help advance racial Subjugation, but will slow down slightly manpower replenishment."
 					}
 				]
@@ -1007,20 +1060,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "pregnant citizens are allowed, and encouraged, to avoid military service.",
 						conditional: V.SecExp.edicts.defense.pregExemption === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "pregnant citizens will be allowed, and encouraged, to avoid military service.",
 						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSRepopulationFocus >= 40 && $SecExp.edicts.defense.militia >= 3 && V.SecExp.edicts.defense.pregExemption === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will help advance repopulation focus, but will slow down slightly manpower replenishment."
 					}
 				]
@@ -1033,20 +1090,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "citizens joining the militia are exempt from rent payment.",
 						conditional: V.SecExp.edicts.defense.privilege.militiaSoldier === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "will allow citizens joining the militia to avoid paying rent.",
 						conditional: V.SecExp.edicts.defense.militia >= 1 && V.SecExp.edicts.defense.privilege.militiaSoldier === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will increase the loyalty of militia units, but will decrease rents."
 					}
 				]
@@ -1057,22 +1118,26 @@ App.SecExp.edicts = function() {
 				},
 				repeal: [
 					{
-						text: "Slaves into the army are allowed to have material possessions.",
+						text: "slaves into the army are allowed to have material possessions.",
 						conditional: V.SecExp.edicts.defense.privilege.slaveSoldier === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "will allow slaves drafted into the army to be able to have material possessions.",
 						conditional: V.SecExp.edicts.defense.privilege.slaveSoldier === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will increase the loyalty of slave units, but will cost authority each week."
 					}
 				]
@@ -1083,22 +1148,26 @@ App.SecExp.edicts = function() {
 				},
 				repeal: [
 					{
-						text: "Mercenaries under contract can claim part of the loot gained from battles.",
+						text: "mercenaries under contract can claim part of the loot gained from battles.",
 						conditional: V.SecExp.edicts.defense.privilege.mercSoldier === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "will allow mercenaries under contract to claim part of the loot gained from battles.",
 						conditional: V.mercenaries > 0 && V.SecExp.edicts.defense.privilege.mercSoldier === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will increase the loyalty of mercenary units, but will reduce cash and menial slaves gained from battles."
 					}
 				]
@@ -1112,20 +1181,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "specialized schools are training slaves in martial arts and bodyguarding.",
 						conditional: V.SecExp.edicts.defense.martialSchool === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "specialized schools will be set up to train slaves in martial arts and bodyguarding.",
 						conditional: V.arcologies[0].FSPhysicalIdealist >= 40 && V.SecExp.edicts.defense.martialSchool === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will slightly increase morale of slave units, but will incur upkeep costs."
 					}
 				]
@@ -1139,20 +1212,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "officers are exclusively recruited from the elite of society.",
 						conditional: V.SecExp.edicts.defense.eliteOfficers === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "officers will be exclusively recruited from the elite of society.",
 						conditional: V.arcologies[0].FSRestart >= 40 && V.SecExp.edicts.defense.eliteOfficers === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will help advance eugenics and provide a small morale boost to militia units, but will give a small morale malus to slave units."
 					}
 				]
@@ -1166,20 +1243,24 @@ App.SecExp.edicts = function() {
 					{
 						text: "disobedient slaves are used as live targets at shooting ranges.",
 						conditional: V.SecExp.edicts.defense.liveTargets === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					}
 				],
 				implement: [
 					{
 						text: "disobedient slaves will be used as live targets at shooting ranges.",
 						conditional: V.arcologies[0].FSDegradationist >= 40 && V.SecExp.edicts.defense.liveTargets === 0,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will help advance degradationism and provide a small amount of exp to units, but will make the slave population slowly decline."
 					}
 				]
@@ -1192,88 +1273,108 @@ App.SecExp.edicts = function() {
 					{
 						text: `${capSF} is providing the security HQ with advanced equipment, boosting its efficiency.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 0,
+								isDefense: true
+							}
+						]
 					},
 					{
 						text: `${capSF} is currently providing advanced equipment and training to security HQ personnel.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2,
-						value: {
-							value: 1,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							}
+						]
 					},
 					{
 						text: `${capSF} has currently transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3,
-						value: {
-							value: 2,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							}
+						]
 					},
 					{
 						text: `${capSF} is currently providing its full support to the security department, while transferring troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4,
-						value: {
-							value: 3,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 3,
+								isDefense: true
+							}
+						]
 					},
 					{
 						text: `${capSF} is currently assisting with a local install of its custom network full support and has transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 5,
-						value: {
-							value: 4,
-							isDefense: true
-						}
+						value: [
+							{
+								value: 4,
+								isDefense: true
+							}
+						]
 					},
 				],
 				implement: [
 					{
 						text: `${capSF} will provide the security HQ with advanced equipment.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 0 && App.SecExp.Check.reqMenials() > 5,
-						value: {
-							value: 1,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 1,
+								isDefense: true
+							},
+						],
 						note: "Will lower the amount of personnel necessary to man the security HQ by 5, but will incur upkeep costs."
 					},
 					{
 						text: `${capSF} will provide the security HQ personnel with advanced training.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1 && V.SF.Squad.Firebase >= 4 && App.SecExp.Check.reqMenials() > 5,
-						value: {
-							value: 2,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 2,
+								isDefense: true
+							},
+						],
 						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
 					},
 					{
 						text: `${capSF} will provide troops to the security department.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
-						value: {
-							value: 3,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 3,
+								isDefense: true
+							},
+						],
 						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
 					},
 					{
 						text: `${capSF} will give the security department its full support.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
-						value: {
-							value: 4,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 4,
+								isDefense: true
+							},
+						],
 						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
 					},
 					{
 						text: `${capSF} will assist the security department with installing a local version of their custom network.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4 && V.SF.Squad.Firebase === 10 && App.SecExp.Check.reqMenials() > 5,
-						value: {
-							value: 5,
-							isDefense: true
-						},
+						value: [
+							{
+								value: 5,
+								isDefense: true
+							},
+						],
 						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
 					},
 				]
@@ -1283,48 +1384,11 @@ App.SecExp.edicts = function() {
 		const c = new DocumentFragment();
 		const r = [];
 		for (const [name, detail] of data) {
-			App.UI.DOM.appendNewElement("div", c);
-			const t = new DocumentFragment();
 			if (V.SF.Toggle && V.SF.Active >= 1 && name === "SFSupportLevel" && !r.includes("SFSupportLevel")) {
 				App.UI.DOM.appendNewElement("h1", c, "Special Force:", "underline");
 				r.push("SFSupportLevel");
 			}
-			if (detail.implement.filter(s => s.conditional) || detail.repeal.filter(s => s.conditional)) {
-				App.UI.DOM.appendNewElement("span", t, `${detail.title.text} `, detail.title.tag || "bold");
-			}
-			for (let i = 0; i < detail.repeal.length; i++) {
-				const current = detail.implement[i].conditional ? detail.implement[i] : detail.repeal[i];
-				t.append(`${current.text} `);
-				if (V.SecExp.core.authority >= 1000 && (detail.repeal[i].conditional || detail.implement[i].conditional)) {
-					t.append(App.UI.DOM.makeElement("span",
-						App.UI.DOM.link(`${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
-							() => {
-								if (detail.implement[i].conditional) {
-									cashX(-5000, "edicts");
-									V.SecExp.core.authority -= 1000;
-								}
-								for (const set of current.value) {
-									if (set.isDefense) {
-										V.SecExp.edicts.defense[name] = set.value;
-									} else {
-										V.SecExp.edicts[name] = set.value;
-									}
-								}
-								App.UI.reload();
-							},
-						)
-						, (detail.implement[i].conditional ? "green" : "yellow")
-					));
-					if (detail.implement[i].conditional && i > 0) {
-						App.UI.DOM.appendNewElement("div", c, t);
-					} else {
-						App.UI.DOM.appendNewElement("span", c, t);
-					}
-					if (detail.implement[i].conditional) {
-						App.UI.DOM.appendNewElement("div", c, `${detail.implement[i].note}`, ["note", "indent"]);
-					}
-				}
-			}
+			App.UI.DOM.appendNewElement("p", c, genMenu(detail));
 		}
 		return c;
 	}
-- 
GitLab


From dc6b4ddc846cb5e4bdf1e92f560a8b847ad426b8 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Sun, 8 Aug 2021 12:46:50 +1200
Subject: [PATCH 10/19] latest code 2020-08-08 1

---
 src/Mods/SecExp/events/conflictReport.js | 35 ++++++++++++++----------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
index a647869b7c7..c5063d293a0 100644
--- a/src/Mods/SecExp/events/conflictReport.js
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -64,7 +64,7 @@ App.Events.conflictReport = function() {
 	* @param {string} [type]
 	* @returns {Node}
 	*/
-	function loopThroughUnits(units, type) {
+	function loopThroughUnits(units, type, lossesList) {
 		for (const unit of units) {
 			if (App.SecExp.unit.isDeployed(unit)) {
 				let r = [];
@@ -74,9 +74,13 @@ App.Events.conflictReport = function() {
 				}
 
 				if (inRebellion) {
-					r.push(`${type !== "bots" ? `${unit.platoonName}` : "Security drones"}: ${casualtiesReport(type, loss, unit)}`);
+					if (type === "bots") {
+						r.push(`Security drones: ${casualtiesReport(type, loss, unit)}`);
+					} else {
+						r.push(`${unit.platoonName} participated in the battle. They remained loyal to you. ${casualtiesReport(type, loss, unit)}`);
+					}
 				} else {
-					r.push(`${s.platoonName} participated in the battle. They remained loyal to you. ${casualtiesReport(u, loss, s)}`);
+					r.push(`${type !== "bots" ? `${unit.platoonName}` : "Security drones"}: ${casualtiesReport(type, loss, unit)}`);
 				}
 				if (type !== "bots") {
 					unit.battlesFought++;
@@ -568,7 +572,7 @@ App.Events.conflictReport = function() {
 
 		// Effects
 		if (result === 3 || result === 2) {
-			node.append(` Thanks to your victory, your `, App.UI.DOM.makeElement("span", `reputation`, "green"), ` and `, App.UI.DOM.makeElement("span", `authority`, "darkviolet"), `${result === 2 ? 'slightly' : ''} increased.`);
+			r.push(` Thanks to your victory, your `, App.UI.DOM.makeElement("span", `reputation`, "green"), ` and `, App.UI.DOM.makeElement("span", `authority`, "darkviolet"), `${result === 2 ? 'slightly' : ''} increased.`);
 			if (inRebellion) {
 				if (slaveRebellion) {
 					App.UI.DOM.appendNewElement("div", node, `Many of the rebelling slaves were recaptured and punished.`);
@@ -585,7 +589,7 @@ App.Events.conflictReport = function() {
 				V.SecExp.core.authority += (result === 3 ? random(800, 1000) : random(600, 800));
 			} else {
 				if (result === 3) {
-					App.UI.DOM.appendNewElement("span", node, " You were also able to capture");
+					r.push("You were also able to capture");
 					if (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses <= 50) {
 						r.push(`a small amount of attackers,`);
 						captives = (V.SecExp.war.attacker.troops - V.SecExp.war.attacker.losses) * 0.1 * random(1, 3);
@@ -604,7 +608,7 @@ App.Events.conflictReport = function() {
 					}
 					r.push(`and some of their equipment,`);
 				} else {
-					App.UI.DOM.appendNewElement("span", node, " Our men were not able to capture any combatants, however some equipment was seized during the enemy's hasty retreat,");
+					App.UI.DOM.appendNewElement("div", node, " Our men were not able to capture any combatants, however some equipment was seized during the enemy's hasty retreat,");
 				}
 				if (V.SecExp.war.attacker.type === "raiders") {
 					repX((result === 3 ? 4000 : 1000) * majorBattleMod, "war");
@@ -662,10 +666,12 @@ App.Events.conflictReport = function() {
 					V.lowerClass -= random(10) * majorBattleMod;
 					App.SecExp.slavesDamaged(random(20) * majorBattleMod);
 				}
+				App.Events.addParagraph(node, r);
+				r = [];
 			}
 		} else if (result === -3 || result === -2) {
+			r.push(` Thanks to your defeat, your `, App.UI.DOM.makeElement("span", `reputation`, "red"), ` and `, App.UI.DOM.makeElement("span", `authority`, "red"), ` decreased.`);
 			if (inRebellion) {
-				node.append(` Thanks to your defeat, your `, App.UI.DOM.makeElement("span", `reputation`, "red"), ` and `, App.UI.DOM.makeElement("span", `authority`, "red"), ` decreased.`);
 				if (slaveRebellion) {
 					App.UI.DOM.appendNewElement("div", node, `After the battle most of the rebelling slaves managed to escape, while others remained in the arcology for days looting and hunting their former masters. The arcology will bear the scars of this day for a long time.`);
 					V.lowerClass -= (result === -3 ? random(50, 100) : random(40, 80));
@@ -679,8 +685,7 @@ App.Events.conflictReport = function() {
 				V.SecExp.core.authority -= (result === -3 ? random(800, 1000) : random(600, 800));
 			} else {
 				if (result === -3) {
-					node.append(` Thanks to your defeat, your `, App.UI.DOM.makeElement("span", `reputation`, "red"), ` and `, App.UI.DOM.makeElement("span", `authority`, "red"), ` decreased. `);
-					App.UI.DOM.appendNewElement("span", node, " Obviously your troops were not able to capture anyone or anything.");
+					App.UI.DOM.appendNewElement("div", node, " Obviously your troops were not able to capture anyone or anything.");
 
 					r = [];
 					r.push(`In the raiding following the battle <span class="red">the arcology sustained heavy damage,</span> which will cost quite the amount of cash to fix. Reports of <span class="red">citizens or slaves killed or missing</span> flood your office for a few days following the defeat.`);
@@ -689,13 +694,15 @@ App.Events.conflictReport = function() {
 						V.arcologies[0].prosperity -= 5 * majorBattleMod;
 					}
 				} else {
-					App.UI.DOM.appendNewElement("span", node, `It was a close defeat, but nonetheless your <span class="red">reputation</span> and <span class="red">authority</span> slightly decreased.`);
-					App.UI.DOM.appendNewElement("span", node, " Your troops were not able to capture anyone or anything.");
+					r.push(`It was a close defeat, but nonetheless your <span class="red">reputation</span> and <span class="red">authority</span> slightly decreased.`);
+					r.push("Your troops were not able to capture anyone or anything.");
 					r = [];
 					r.push(`The enemy did not have the strength to raid the arcology for long, still <span class="red">the arcology sustained some damage,</span> which will cost a moderate amount of cash to fix. Some citizens and slaves found themselves on the wrong end of a gun and met their demise.`);
 					r.push(`Some business sustained heavy damage, slightly impacting the arcology's prosperity.`);
 				}
 				r.push(`${IncreasePCSkills('engineering', 0.1)}`);
+				App.Events.addParagraph(node, r);
+				r = [];
 				if (V.SecExp.war.attacker.type === "raiders") {
 					repX(forceNeg((result === -3 ? 400 : 40) * majorBattleMod), "war");
 					V.SecExp.core.authority -= (result === -3 ? 400 : 40) * majorBattleMod;
@@ -1176,6 +1183,7 @@ App.Events.conflictReport = function() {
 			}
 			r.push(`the efficiency of your army.`);
 			App.Events.addParagraph(node, r);
+			r = [];
 		}
 
 		let rand;
@@ -1266,9 +1274,9 @@ App.Events.conflictReport = function() {
 		for (const unitClass of App.SecExp.unit.list()) {
 			if (App.SecExp.battle.deployedUnits(unitClass) >= 1) {
 				if (unitClass !== 'bots') {
-					loopThroughUnits(V.SecExp.units[unitClass].squads, unitClass);
+					loopThroughUnits(V.SecExp.units[unitClass].squads, unitClass, lossesList);
 				} else {
-					loopThroughUnits([V.SecExp.units.bots], unitClass);
+					loopThroughUnits([V.SecExp.units.bots], unitClass, lossesList);
 				}
 			}
 		}
@@ -1283,7 +1291,6 @@ App.Events.conflictReport = function() {
 				(V.SF.Squad.Firebase >= 7 || V.SF.Squad.GunS >= 1 || V.SF.Squad.Satellite >= 5 || V.SF.Squad.GiantRobot >= 6 || V.SF.Squad.MissileSilo >= 1)
 			) {
 				// SF upgrades effects
-				App.Events.addParagraph(node, r);
 				r = [];
 				if (V.SF.Squad.Firebase >= 7) {
 					r.push(`The artillery pieces installed around ${V.SF.Lower}'s firebase provided vital fire support to the troops in the field.`);
-- 
GitLab


From 40515bda979c3cbeabe5d62a73ef96c5fa1945f5 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Sun, 8 Aug 2021 13:09:57 +1200
Subject: [PATCH 11/19] latest code 2020-08-08 2

---
 src/Mods/SecExp/events/conflictReport.js | 105 +++++++++++------------
 1 file changed, 50 insertions(+), 55 deletions(-)

diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
index c5063d293a0..2164cb13225 100644
--- a/src/Mods/SecExp/events/conflictReport.js
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -59,51 +59,6 @@ App.Events.conflictReport = function() {
 		return r.join(" ");
 	};
 
-   /**
-	* @param {Array} [units]
-	* @param {string} [type]
-	* @returns {Node}
-	*/
-	function loopThroughUnits(units, type, lossesList) {
-		for (const unit of units) {
-			if (App.SecExp.unit.isDeployed(unit)) {
-				let r = [];
-				if (hasLosses) {
-					loss = lossesList.pluck();
-					loss = Math.clamp(loss, 0, unit.troops);
-				}
-
-				if (inRebellion) {
-					if (type === "bots") {
-						r.push(`Security drones: ${casualtiesReport(type, loss, unit)}`);
-					} else {
-						r.push(`${unit.platoonName} participated in the battle. They remained loyal to you. ${casualtiesReport(type, loss, unit)}`);
-					}
-				} else {
-					r.push(`${type !== "bots" ? `${unit.platoonName}` : "Security drones"}: ${casualtiesReport(type, loss, unit)}`);
-				}
-				if (type !== "bots") {
-					unit.battlesFought++;
-					if (loss > 0) {
-						const med = Math.round(Math.clamp(loss * unit.medics * 0.25, 1, loss));
-						if (unit.medics === 1) {
-							r.push(`Some men were saved by their medics.`);
-						}
-						unit.troops -= Math.trunc(Math.clamp(loss - med, 0, unit.maxTroops));
-						V.SecExp.units[type].dead += Math.trunc(loss - med);
-					}
-					if (unit.training < 100 && random(1, 100) > 60) {
-						r.push(`Experience has increased.`);
-						unit.training += random(5, 15) + (majorBattle ? 1 : 0) * random(5, 15);
-					}
-				} else if (type === "bots" && loss > 0) {
-					unit.troops -= loss;
-				}
-				App.Events.addNode(node, r, "div");
-			}
-		}
-	}
-
 	// Rebellions
 	/**
 	 * @param {string} [target]
@@ -812,6 +767,8 @@ App.Events.conflictReport = function() {
 					arcologyEffects(60, 85, 10);
 				}
 			}
+			App.Events.addParagraph(node, r);
+			r = [];
 
 			if (!V.SecExp.war.reactorDefense) {
 				if (random(1, 100) <= (75 - ((V.SecExp.buildings.riotCenter ? V.SecExp.buildings.riotCenter.fort.reactor : 0) * 25))) {
@@ -824,7 +781,7 @@ App.Events.conflictReport = function() {
 			} else {
 				r.push(`The garrison assigned to the reactor protected it from the multiple sabotage attempts carried out by the rebels.`);
 			}
-			App.Events.addNode(node, r, "div");
+			App.UI.DOM.appendNewElement("div", node, r.join(" "));
 			r = [];
 
 			if (!V.SecExp.war.waterwayDefense) {
@@ -838,7 +795,7 @@ App.Events.conflictReport = function() {
 			} else {
 				r.push(`The garrison assigned to the water management complex protected it from the sabotage attempt of the rebels.`);
 			}
-			App.Events.addNode(node, r, "div");
+			App.UI.DOM.appendNewElement("div", node, r.join(" "));
 			r = [];
 
 			if (!V.SecExp.war.assistantDefense) {
@@ -852,7 +809,7 @@ App.Events.conflictReport = function() {
 			} else {
 				r.push(`The garrison assigned to the facility housing ${V.assistant.name}'s mainframe prevented any sabotage attempt.`);
 			}
-			App.Events.addNode(node, r, "div");
+			App.UI.DOM.appendNewElement("div", node, r.join(" "));
 			r = [];
 
 			if (V.SecExp.war.penthouseDefense && V.BodyguardID !== 0) {
@@ -879,11 +836,11 @@ App.Events.conflictReport = function() {
 					}
 				}
 			}
+			App.UI.DOM.appendNewElement("div", node, r.join(" "));
+			r = [];
 		}
 		V.lowerClass = Math.max(V.lowerClass, 0);
 		V.NPCSlaves = Math.max(V.NPCSlaves, 0);
-		App.Events.addParagraph(node, r);
-		r = [];
 
 		if (inBattle) { // tactics
 			App.Events.addParagraph(node, App.SecExp.commanderEffectiveness("report"));
@@ -1271,12 +1228,50 @@ App.Events.conflictReport = function() {
 			}
 			App.UI.DOM.appendNewElement("div", node, `${capFirstChar(V.SF.Lower)}, ${num(V.SF.ArmySize)} strong, is called to arms: ${casualtiesReport('SF', loss)}`);
 		}
-		for (const unitClass of App.SecExp.unit.list()) {
-			if (App.SecExp.battle.deployedUnits(unitClass) >= 1) {
-				if (unitClass !== 'bots') {
-					loopThroughUnits(V.SecExp.units[unitClass].squads, unitClass, lossesList);
+		for (const type of App.SecExp.unit.list()) {
+			if (App.SecExp.battle.deployedUnits(type) >= 1) {
+				let units;
+				if (type !== 'bots') {
+					units = V.SecExp.units[type].squads;
 				} else {
-					loopThroughUnits([V.SecExp.units.bots], unitClass, lossesList);
+					units = [V.SecExp.units.bots];
+				}
+				for (const unit of units) {
+					if (App.SecExp.unit.isDeployed(unit)) {
+						let r = [];
+						if (hasLosses) {
+							loss = lossesList.pluck();
+							loss = Math.clamp(loss, 0, unit.troops);
+						}
+
+						if (inRebellion) {
+							if (type === "bots") {
+								r.push(`Security drones: ${casualtiesReport(type, loss, unit)}`);
+							} else {
+								r.push(`${unit.platoonName} participated in the battle. They remained loyal to you. ${casualtiesReport(type, loss, unit)}`);
+							}
+						} else {
+							r.push(`${type !== "bots" ? `${unit.platoonName}` : "Security drones"}: ${casualtiesReport(type, loss, unit)}`);
+						}
+						if (type !== "bots") {
+							unit.battlesFought++;
+							if (loss > 0) {
+								const med = Math.round(Math.clamp(loss * unit.medics * 0.25, 1, loss));
+								if (unit.medics === 1) {
+									r.push(`Some men were saved by their medics.`);
+								}
+								unit.troops -= Math.trunc(Math.clamp(loss - med, 0, unit.maxTroops));
+								V.SecExp.units[type].dead += Math.trunc(loss - med);
+							}
+							if (unit.training < 100 && random(1, 100) > 60) {
+								r.push(`Experience has increased.`);
+								unit.training += random(5, 15) + (majorBattle ? 1 : 0) * random(5, 15);
+							}
+						} else if (type === "bots" && loss > 0) {
+							unit.troops -= loss;
+						}
+						App.Events.addNode(node, r, "div");
+					}
 				}
 			}
 		}
-- 
GitLab


From f0378e64661beedf432fe085e4b25f8922a62249 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Sun, 8 Aug 2021 18:03:47 +1200
Subject: [PATCH 12/19] latest code 2020-08-08 3

---
 src/Mods/SecExp/js/edicts.js | 1232 +++++++++++-----------------------
 1 file changed, 391 insertions(+), 841 deletions(-)

diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index d2606cc87d2..d92ea02ffdc 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -1,35 +1,38 @@
 App.SecExp.edicts = function() {
-	function genMenu(detail) {
+	function genMenu(name, detail) {
 		const t = new DocumentFragment();
-		if (detail.implement.find(s => s.conditional) || detail.repeal.find(s => s.conditional)) {
-			App.UI.DOM.appendNewElement("span", t, `${detail.title.text} `, detail.title.tag || "bold");
-			for (let i = 0; i < detail.repeal.length; i++) {
-				const current = detail.implement[i].conditional ? detail.implement[i] : detail.repeal[i];
-				t.append(`${capFirstChar(current.text)} `);
-				if (V.SecExp.core.authority >= 1000 && (detail.repeal[i].conditional || detail.implement[i].conditional)) {
-				// if (V.SecExp.core.authority >= 1000) {
-					t.append(App.UI.DOM.makeElement("span",
-						App.UI.DOM.link(`${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
-							() => {
-								if (detail.implement[i].conditional) {
-									cashX(-5000, "edicts");
-									V.SecExp.core.authority -= 1000;
-								}
-								for (const set of current.value) {
-									if (set.isDefense) {
-										V.SecExp.edicts.defense[name] = set.value;
-									} else {
-										V.SecExp.edicts[set.var || name] = set.value;
+		if (detail.implement.find(s => s.conditional) || detail.repeal && detail.repeal.find(s => s.conditional)) {
+			App.UI.DOM.appendNewElement("span", t, `${name}: `, detail.tag || "bold");
+			for (let i = 0; i < detail.implement.length; i++) {
+				let current;
+				if (detail.implement[i].conditional) {
+					current = detail.implement[i];
+				} else if (detail.repeal) {
+					current = detail.repeal[i];
+				}
+				if (current) {
+					if (current.text) {
+						t.append(`${capFirstChar(current.text)} `);
+					}
+					// if (V.SecExp.core.authority >= 1000 && (detail.repeal[i].conditional || detail.implement[i].conditional)) {
+					if (V.SecExp.core.authority >= 1000 && current.set) {
+						t.append(App.UI.DOM.makeElement("span",
+							App.UI.DOM.link(`${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
+								() => {
+									if (detail.implement[i].conditional) {
+										cashX(-5000, "edicts");
+										V.SecExp.core.authority -= 1000;
 									}
-								}
-								App.UI.reload();
-							},
-						)
-						, (detail.implement[i].conditional ? "green" : "yellow")
-					));
-					App.UI.DOM.appendNewElement("div", t);
-					if (detail.implement[i].conditional) {
-						App.UI.DOM.appendNewElement("div", t, `${detail.implement[i].note}`, ["note", "indent"]);
+									current.set();
+									App.UI.reload();
+								},
+							)
+							, (detail.implement[i].conditional ? "green" : "yellow")
+						));
+						App.UI.DOM.appendNewElement("div", t);
+						if (detail.implement[i].conditional && detail.implement[i].note) {
+							App.UI.DOM.appendNewElement("div", t, `${detail.implement[i].note}`, ["note", "indent"]);
+						}
 					}
 				}
 			}
@@ -38,1343 +41,890 @@ App.SecExp.edicts = function() {
 	}
 
 	function Society() {
-		const weaponsLawTitle = function() {
-			if (V.SecExp.edicts.weaponsLaw === 0) {
-				return "Forbid weapons inside the arcology:";
-			} else if (V.SecExp.edicts.weaponsLaw === 1) {
-				return "Heavily restricted weaponry:";
-			} else if (V.SecExp.edicts.weaponsLaw === 2) {
-				return "Heavy weaponry forbidden:";
-			} else if (V.SecExp.edicts.weaponsLaw === 3) {
-				return "All weapons allowed:";
-			}
-		};
-
 		const data = new Map([
-			["alternativeRents", {
-				title: {
-					text: "Alternative rent payment:",
-				},
+			["Alternative rent payment", {
 				repeal: [
 					{
 						text: "you are allowing citizens to pay for their rents in menial slaves rather than cash.",
 						conditional: V.SecExp.edicts.alternativeRents === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.alternativeRents = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "allow citizens to pay for their rents in menial slaves rather than cash, if so they wish.",
 						conditional: V.SecExp.edicts.alternativeRents === 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.alternativeRents = 1;
+						},
 						note: "Will decrease rents, but will supply a small amount of menial slaves each week."
 					}
 				]
 			}],
-			["enslavementRights", {
-				title: {
-					text: "Enslavement rights:",
-				},
+			["Enslavement rights", {
 				repeal: [
 					{
 						text: "you are the only authority able to declare a person enslaved or not.",
 						conditional: V.SecExp.edicts.enslavementRights === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.enslavementRights = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "the arcology owner will be the only authority able to declare a person enslaved or not.",
 						conditional: V.SecExp.edicts.enslavementRights === 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.enslavementRights = 1;
+						},
 						note: "Will provide cash each week at the cost of a small authority hit. The higher the flux of citizens to slaves the higher the income."
 					}
 				]
 			}],
-			["sellData", {
-				title: {
-					text: "Private Data marketization:",
-				},
+			["Private Data marketization", {
 				repeal: [
 					{
 						text: "you are selling private citizens' data to the best bidder.",
 						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.sellData = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "allow the selling of private citizens' data.",
 						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 0 && Object.values(V.SecExp.buildings.secHub.upgrades.security).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.intel).reduce((a, b) => a + b) > 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.sellData = 1;
+						},
 						note: "Will generate income dependent on the amount of upgrades installed in the security HQ, but cost a small amount of authority each week."
 					}
 				]
 			}],
-			["propCampaignBoost", {
-				title: {
-					text: "Propaganda Campaign Boost:",
-				},
+			["Propaganda Campaign Boost", {
 				repeal: [
 					{
 						text: "you are forcing residents to read curated educational material about the arcology.",
 						conditional: V.SecExp.buildings.propHub && V.SecExp.edicts.propCampaignBoost === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.propCampaignBoost = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "force residents to read curated educational material about the arcology.",
 						conditional: V.SecExp.buildings.propHub && V.SecExp.edicts.propCampaignBoost === 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.propCampaignBoost = 1;
+						},
 						note: "Will increase the effectiveness of propaganda campaigns, but will incur upkeep costs."
 					}
 				]
 			}],
-			["tradeLegalAid:", {
-				title: {
-					text: "Legal aid for new businesses:",
-				},
+			["Legal aid for new businesses:", {
 				repeal: [
 					{
 						text: "new businesses can rely on your help for legal expenses and issues.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.tradeLegalAid = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "support new businesses in the arcology by helping them cover legal costs and issues.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.tradeLegalAid === 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.tradeLegalAid = 1;
+						},
 						note: "Will increase trade, but will incur upkeep costs."
 					}
 				]
 			}],
-			["taxTrade", {
-				title: {
-					text: "Trade tariffs:",
-				},
+			["Trade tariffs", {
 				repeal: [
 					{
 						text: "all goods transitioning in your arcology have to pay a transition fee.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.taxTrade === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.taxTrade = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "all goods transitioning in your arcology will have to pay a transition fee.",
 						conditional: V.SecExp.buildings.transportHub && V.SecExp.edicts.taxTrade === 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.taxTrade = 1;
+						},
 						note: "Will provide income based on trade level, but will negatively affect trade."
 					}
 				]
 			}],
-			["slaveWatch", {
-				title: {
-					text: "Slave mistreatment watch:",
-					tag: ["bold", "lime"]
-				},
+			["Slave mistreatment watch", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "slaves are able access a special security service in case of mistreatment.",
 						conditional: V.arcologies[0].FSPaternalist !== "unset" && V.SecExp.edicts.slaveWatch === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.slaveWatch = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "slaves will be able access a special security service in case of mistreatment.",
 						conditional: V.arcologies[0].FSPaternalist !== "unset" && V.SecExp.edicts.slaveWatch === 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.slaveWatch = 1;
+						},
 						note: "Will help advance paternalism, but will incur upkeep costs."
 					}
 				]
 			}],
-			["subsidyChurch", {
-				title: {
-					text: "Religious activities subsidy:",
-					tag: ["bold", "lime"]
-				},
+			["Religious activities subsidy", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "you are providing economic support to religious activities following the official dogma.",
 						conditional: V.arcologies[0].FSChattelReligionist >= 40 && V.SecExp.edicts.subsidyChurch === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.subsidyChurch = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "will provide economic support to religious activities following the official dogma.",
 						conditional: V.arcologies[0].FSChattelReligionist >= 40 && V.SecExp.edicts.subsidyChurch === 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.subsidyChurch = 1;
+						},
 						note: "Will provide authority each week, but will incur upkeep costs."
 					}
 				]
 			}],
-			["limitImmigration", {
-				title: {
-					text: "Immigration limits:",
-				},
+			["Immigration limits", {
 				repeal: [
 					{
 						text: "you put strict limits to the amount of people the arcology can accept each week.",
 						conditional: V.SecExp.edicts.limitImmigration === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.limitImmigration = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "institute limits to the amount of people the arcology will accept each week.",
 						conditional: V.SecExp.edicts.limitImmigration === 0,
-						value: [
-							{
-								var: "openBorders",
-								value: 0
-							},
-							{
-								var: "limitImmigration",
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.openBorders = 0;
+							V.SecExp.edicts.limitImmigration = 1;
+						},
 						note: "Will lower the amount of people immigrating into the arcology and enhance security."
 					}
 				]
 			}],
-			["openBorders", {
-				title: {
-					text: "Open borders:",
-				},
+			["Open borders", {
 				repeal: [
 					{
 						text: "you have lowered considerably the requirements to become citizens.",
 						conditional: V.SecExp.edicts.openBorders === 1,
-						value: [
-							{
-								value: 0
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.openBorders = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "considerably lower requirements to become citizens.",
 						conditional: V.SecExp.edicts.openBorders === 0,
-						value: [
-							{
-								var: "openBorders",
-								value: 1
-							},
-							{
-								var: "limitImmigration",
-								value: 0
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.openBorders = 1;
+							V.SecExp.edicts.limitImmigration = 0;
+						},
 						note: "Will increase immigration to the arcology, but will increase crime."
 					}
 				]
 			}],
 
-			["weaponsLaw", {
-				title: {
-					text: weaponsLawTitle(),
-				},
-				repeal: [
-					{
-						text: "residents are forbidden to buy, sell and keep weaponry while within the arcology.",
-						conditional: V.SecExp.edicts.weaponsLaw === 0,
-						value: [
-							{
-								value: 3
-							}
-						]
-					},
-					{
-						text: "residents are allowed to buy, sell and keep non-automatic, non-high caliber weapons within the arcology.",
-						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						value: [
-							{
-								value: 3
-							}
-						]
-					},
-					{
-						text: "residents are allowed to buy, sell and keep non-heavy, non-explosive weapons within the arcology.",
-						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						value: [
-							{
-								value: 3
-							}
-						]
-					}
-				],
+			["Weapons Law", {
 				implement: [
 					{
-						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "there are no restrictions on wapons. Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 3,
-						value: [
-							{
-								value: 2
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.weaponsLaw = 2;
+						},
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
-						text: "allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
+						text: "non-heavy, non-explosive weapons are legal. Allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						value: [
-							{
-								value: 3
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.weaponsLaw = 3;
+						},
 						note: "Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed."
 					},
 					{
-						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						text: "non-heavy, non-explosive weapons are legal. Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.weaponsLaw = 1;
+						},
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					},
 					{
-						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "non-automatic, non-high caliber weapons are legal. Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						value: [
-							{
-								value: 2
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.weaponsLaw = 2;
+						},
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
-						text: "forbid residents to buy, sell and keep weaponry while within the arcology.",
+						text: "non-automatic, non-high caliber weapons are legal. Forbid residents to buy, sell and keep weaponry while within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
-						value: [
-							{
-								value: 0
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.weaponsLaw = 0;
+						},
 						note: "Will cost a moderate amount of authority each week, but rebellions will be very poorly armed."
 					},
 					{
-						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						text: "residents are unable to buy, sell and keep weapons. Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 0,
-						value: [
-							{
-								value: 1
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.weaponsLaw = 1;
+						},
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					}
 				]
 			}],
-			["pharaonTradition", {
-				title: {
-					text: "Legionaries traditions:",
-					tag: ["bold", "lime"]
-				},
+			["Legionaries traditions", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "you are funding specialized training for your recruits following the Roman tradition of professional armies.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.legionTradition === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.legionTradition = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "fund specialized training for your recruits to turn them into the professional of Roman tradition.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSRomanRevivalist >= 40 && V.SecExp.edicts.defense.legionTradition === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							}
-						],
+						set: function() {
+							V.SecExp.edicts.defense.legionTradition = 1;
+						},
 						note: "Will increase defense, morale and hp of militia units, but will incur upkeep costs."
 					}
 				]
 			}],
 			["Neo-Imperial traditions", {
-				title: {
-					text: "Neo-Imperial traditions:",
-					tag: ["bold", "lime"]
-				},
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: `you are funding specialized training for your recruits to inculcate them into a professional Imperial army, led by highly trained and hand-picked ${V.mercenariesTitle}.`,
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.imperialTradition === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						set: function() {
+							V.SecExp.edicts.defense.imperialTradition = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "fund specialized training for your recruits to turn them into a professional Imperial army, led by your handpicked Imperial Knights.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSNeoImperialist >= 40 && V.SecExp.edicts.defense.imperialTradition === 0,
-						value: {
-							value: 1,
-							isDefense: true
+						set: function() {
+							V.SecExp.edicts.defense.imperialTradition = 1;
 						},
 						note: "Will moderately increase defense, hp, and morale of your militia units and increase attack, defense and morale of your mercenaries, but will incur upkeep costs."
 					}
 				]
 			}],
-			["pharaonTradition", {
-				title: {
-					text: "Pharaonic traditions:",
-					tag: ["bold", "lime"]
-				},
+			["Pharaonic traditions", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "you are funding specialized training for your recruits to turn them into an army worthy of a pharaon.",
 						conditional: V.SecExp.edicts.defense.pharaonTradition === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						set: function() {
+							V.SecExp.edicts.defense.pharaonTradition = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "fund specialized training for your recruits to turn them into an army worthy of a pharaoh.",
 						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSEgyptianRevivalist >= 40 && V.SecExp.edicts.defense.pharaonTradition === 0,
-						value: {
-							value: 1,
-							isDefense: true
+						set: function() {
+							V.SecExp.edicts.defense.pharaonTradition = 1;
 						},
 						note: "Will increase attack, defense and morale of militia units, but will incur upkeep costs."
 					}
 				]
 			}],
-			["eagleWarriors", {
-				title: {
-					text: "Eagle warriors traditions:",
-					tag: ["bold", "lime"]
-				},
+			["Eagle warriors traditions", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "you are funding specialized training for your mercenaries following the Aztec tradition of elite warriors.",
 						conditional: V.SecExp.edicts.defense.eagleWarriors === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						set: function() {
+							V.SecExp.edicts.defense.eagleWarriors = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "fund specialized training for your mercenaries to turn them into the elite units of Aztec tradition.",
 						conditional: V.FSAnnounced && V.mercenaries > 0 && V.arcologies[0].FSAztecRevivalist >= 40 && V.SecExp.edicts.defense.eagleWarriors === 0,
-						value: {
-							value: 1,
-							isDefense: true
+						set: function() {
+							V.SecExp.edicts.defense.eagleWarriors = 1;
 						},
 						note: "Will give a high increase in attack and morale, but will lower defense of mercenary units and will incur upkeep costs."
 					}
 				]
 			}],
-			["ronin", {
-				title: {
-					text: "Ronin traditions:",
-					tag: ["bold", "lime"]
-				},
+			["Ronin traditions", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "you are funding specialized training for your mercenaries following the Japanese tradition of elite errant samurai.",
 						conditional: V.SecExp.edicts.defense.ronin === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						set: function() {
+							V.SecExp.edicts.defense.ronin = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "fund specialized training for your mercenaries to turn them into the errant samurai of Japanese tradition.",
 						conditional: V.FSAnnounced && V.mercenaries > 0 && V.arcologies[0].FSEdoRevivalist >= 40 && V.SecExp.edicts.defense.ronin === 0,
-						value: {
-							value: 1,
-							isDefense: true
+						set: function() {
+							V.SecExp.edicts.defense.ronin = 1;
 						},
 						note: "Will increase attack, defense and morale of mercenary units, but will incur upkeep costs."
 					}
 				]
 			}],
-			["mamluks", {
-				title: {
-					text: "Mamluks traditions:",
-					tag: ["bold", "lime"]
-				},
+			["Mamluks traditions", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "you are funding specialized training for your slaves following the Arabian tradition of mamluks slave soldiers.",
 						conditional: V.SecExp.edicts.defense.mamluks === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						set: function() {
+							V.SecExp.edicts.defense.mamluks = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "fund specialized training for your slaves to turn them into the mamluks slave soldiers of Arabian tradition.",
 						conditional: V.FSAnnounced && V.arcologies[0].FSArabianRevivalist >= 40 && V.SecExp.edicts.defense.mamluks === 0,
-						value: {
-							value: 1,
-							isDefense: true
+						set: function() {
+							V.SecExp.edicts.defense.mamluks = 1;
 						},
 						note: "Will increase attack, morale and hp of slave units, but will incur upkeep costs."
 					}
 				]
 			}],
-			["sunTzu", {
-				title: {
-					text: "Sun Tzu Teachings:",
-					tag: ["bold", "lime"]
-				},
+			["Sun Tzu Teachings", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: `you are funding specialized training for your units and officers to follow the teachings of the "Art of War".`,
 						conditional: V.SecExp.edicts.defense.sunTzu === 1,
-						value: {
-							value: 0,
-							isDefense: true
-						}
+						set: function() {
+							V.SecExp.edicts.defense.sunTzu = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: `fund specialized training for your units and officers to conform your army to the teachings of the "Art of War".`,
 						conditional: V.FSAnnounced && V.arcologies[0].FSChineseRevivalist >= 40 && V.SecExp.edicts.defense.sunTzu === 0,
-						value: {
-							value: 1,
-							isDefense: true
+						set: function() {
+							V.SecExp.edicts.defense.sunTzu = 1;
 						},
 						note: "Will slightly increase attack, defense and morale of all units, but will incur upkeep costs."
 					}
 				]
 			}],
-			/*
-			[, {
-				title: {
-					text: ""
-					tag: ["bold", "lime"]
-				},
-				repeal: [
-					{
-						text: "",
-						conditional: ,
-						value: {
-							value: 0,
-							isDefense: true
-						}
-					}
-				],
-				implement: [
-					{
-						text: "",
-						conditional: ,
-						value: {
-							value: 1,
-							isDefense: true
-						},
-						note: ""
-					}
-				]
-			}],
-			*/
 		]);
 
 		const c = new DocumentFragment();
 		const r = [];
 		for (const [name, detail] of data) {
-			if (["limitImmigration", "openBorders"].includes(name) && !r.includes("Immigration")) {
+			if (["Immigration limits", "Open Borders"].includes(name) && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Immigration:", "underline");
-				r.push("Immigration");
-			} else if (name === "weaponsLaw" && !r.includes("Weapons")) {
+				r.push(name);
+			} else if (name === "Weapons Law" && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Weapons:", "underline");
-				r.push("Weapons");
-			} else if (V.FSAnnounced && name === "Future Societies" && !r.includes("Future Societies")) {
+				r.push(name);
+			} else if (V.FSAnnounced && name.contains("traditions", "Teachings") && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Future Societies:", "underline");
-				r.push("Future Societies");
+				r.push(name);
 			}
-			App.UI.DOM.appendNewElement("p", c, genMenu(detail));
+			App.UI.DOM.appendNewElement("p", c, genMenu(name, detail));
 		}
 		return c;
 	}
 	function Military() {
-		const militiaTitle = function() {
-			if (V.SecExp.edicts.defense.militia === 0) {
-				return "Found the militia:";
-			} else if (V.SecExp.edicts.defense.militia === 1) {
-				return "Volunteers' militia:";
-			} else if (V.SecExp.edicts.defense.militia === 2) {
-				return "Heavy weaponry forbidden:";
-			} else if (V.SecExp.edicts.defense.militia === 3) {
-				return "Conscription:";
-			} else if (V.SecExp.edicts.defense.militia === 4) {
-				return "Obligatory military service:";
-			} else if (V.SecExp.edicts.defense.militia === 5) {
-				return "Militarized Society:";
+		const soliderWages = function() {
+			switch(V.SecExp.edicts.defense.soldierWages) {
+				case 0: return "below market rates";
+				case 1: return "at market rates";
+				case 2: return "above market rates";
 			}
 		};
-		const sfTitle = function() {
-			if (V.SecExp.edicts.SFSupportLevel === 1 || V.SecExp.edicts.SFSupportLevel === 0) {
-				return "Equipment provision:";
-			} else if (V.SecExp.edicts.SFSupportLevel === 2) {
-				return "Personnel training:";
-			} else if (V.SecExp.edicts.SFSupportLevel === 3) {
-				return "Troops detachment:";
-			} else if (V.SecExp.edicts.SFSupportLevel === 4) {
-				return "Full Support:";
-			} else if (V.SecExp.edicts.SFSupportLevel === 5) {
-				return "Network assistance:";
+		const militiaStatus = function() {
+			switch(V.SecExp.edicts.defense.militia) {
+				case 0: return "Not Founded";
+				case 1: return "Disbanded";
+				case 2: return "Volunteers only";
+				case 3: return "Conscription";
+				case 4: return "Obligatory military service";
+				case 5: return "Militarized Society";
 			}
 		};
+		const sfSupport = function() {
+			const x = [];
+			if (V.SecExp.edicts.SFSupportLevel === 0) {
+				x.push("no support");
+			} else {
+				if (V.SecExp.edicts.SFSupportLevel >= 1) {
+					x.push("provided the security HQ with advanced equipment");
+				}
+				if (V.SecExp.edicts.SFSupportLevel >= 2) {
+					x.push("advanced training for security HQ personnel");
+				}
+				if (V.SecExp.edicts.SFSupportLevel >= 3) {
+					x.push("assigned troops to the security department");
+				}
+				if (V.SecExp.edicts.SFSupportLevel >= 4) {
+					x.push("its full support");
+				}
+				if (V.SecExp.edicts.SFSupportLevel === 5) {
+					x.push("assited with installing up a local version of their custom network");
+				}
+			}
+			return toSentence(x);
+		};
 		const capSF = capFirstChar(V.SF.Lower || "the special force");
 		const data = new Map([
-			["soldierWages", {
-				title: {
-					text: "Wages for soldiers:"
-				},
-				repeal: [
-					{
-						text: "are lower then market standards. Raise?",
-						conditional: V.SecExp.edicts.defense.soldierWages === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							}
-						]
-					},
-					{
-						text: "are set to the market standards. Lower?",
-						conditional: V.SecExp.edicts.defense.soldierWages === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
-					},
-					{
-						text: "are set to the market standards. Raise?",
-						conditional: V.SecExp.edicts.defense.soldierWages === 1,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							}
-						]
-					},
-					{
-						text: "are set to a high level compared to market standards. Lower",
-						conditional: V.SecExp.edicts.defense.soldierWages === 2,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							}
-						]
-					}
-				],
+			[`Wages for soldiers are ${soliderWages()}`, {
 				implement: [
 					{
-						text: "will set the wages paid to the soldiers of the arcology to an average amount.",
+						text: "the wages paid to arcology soldiers will be at market rates.",
 						conditional: V.SecExp.edicts.defense.soldierWages === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.soldierWages = 1;
+						},
 						note: "Will raise all units upkeep and push loyalty to average levels."
 					},
 					{
-						text: "will set the wages paid to the soldiers of the arcology to a low amount.",
+						text: "the wages paid to arcology soldiers will be below market rates.",
 						conditional: V.SecExp.edicts.defense.soldierWages === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.soldierWages = 0;
+						},
 						note: "Will lower all units upkeep and push loyalty to low levels."
 					},
 					{
-						text: "will set the wages paid to the soldiers of the arcology to a high amount.",
+						text: "the wages paid to arcology soldiers will be above market rates.",
 						conditional: V.SecExp.edicts.defense.soldierWages === 1,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.soldierWages = 2;
+						},
 						note: "Will raise all units upkeep and push loyalty to high levels."
 					},
 					{
-						text: "will set the wages paid to the soldiers of the arcology to an average amount.",
+						text: "the wages paid to arcology soldiers will be at market rates.",
 						conditional: V.SecExp.edicts.defense.soldierWages === 2,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.soldierWages = 1;
+						},
 						note: "Will lower all units upkeep and push loyalty to average levels."
 					}
 				]
 			}],
-			["slavesOfficers", {
-				title: {
-					text: "Slave Officers:"
-				},
+			["Slave Officers", {
 				repeal: [
 					{
 						text: "your trusted slaves are allowed to lead the defense forces of the arcology.",
 						conditional: V.SecExp.edicts.defense.slavesOfficers === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.slavesOfficers = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "allow your trusted slaves to lead the defense forces of the arcology.",
 						conditional: V.SecExp.edicts.defense.slavesOfficers === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.slavesOfficers = 1;
+						},
 						note: "Will allow your bodyguard and Head Girl to lead troops into battle, but will cost a small amount of authority each week."
 					}
 				]
 			}],
-			["discountMercenaries", {
-				title: {
-					text: "Mercenary subsidy:"
-				},
+			["Mercenary subsidy", {
 				repeal: [
 					{
 						text: "mercenaries willing to immigrate in your arcology will be offered a discount on rent.",
 						conditional: V.SecExp.edicts.defense.discountMercenaries === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.discountMercenaries = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "mercenaries willing to immigrate in your arcology will be offered a discount on rent.",
 						conditional: V.mercenaries > 0 && V.SecExp.edicts.defense.discountMercenaries === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.discountMercenaries = 1;
+						},
 						note: "Will slightly lower rent, but will increase the amount of available mercenaries."
 					}
 				]
 			}],
-			["militia", {
-				title: {
-					text: militiaTitle()
-				},
-				repeal: [
+			[`Militia Status (${militiaStatus()})`, {
+				implement: [
 					{
-						text: "every citizen is required to train in the militia and serve the arcology for a limited amount of time.",
-						conditional: V.SecExp.edicts.defense.militia === 3,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							}
-						]
+						text: `lay the groundwork for the formation of the arcology's citizens' army.`,
+						conditional: V.SecExp.edicts.defense.militia === 0,
+						set: function() {
+							V.SecExp.edicts.defense.militia = 2;
+						},
+						note: "Will allow for the recruitment and training of citizens."
 					},
 					{
-						text: "every citizen is required to register and serve under the militia.",
-						conditional: V.SecExp.edicts.defense.militia === 4,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							}
-						]
+						text: `disband the militia.`,
+						conditional: V.SecExp.edicts.defense.militia > 1,
+						set: function() {
+							V.SecExp.edicts.defense.militia = 1;
+						}
 					},
 					{
-						text: "every adult citizen is required to train and actively participate in the military of the arcology.",
-						conditional: V.SecExp.edicts.defense.militia === 5,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							}
-						]
-					},
-				],
-				implement: [
-					{
-						text: "lay the groundwork for the formation of the arcology's citizens' army.",
-						conditional: V.SecExp.edicts.defense.militia === 0,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							},
-						],
-						note: "Will allow for the recruitment and training of citizens."
+						text: `Re-enstate the militia as volunteers only.`,
+						conditional: V.SecExp.edicts.defense.militia === 1,
+						set: function() {
+							V.SecExp.edicts.defense.militia = 2;
+						},
 					},
 					{
-						text: "only volunteers will be accepted in the militia.",
+						text: `only volunteers will be accepted in the militia.`,
 						conditional: V.SecExp.edicts.defense.militia > 2,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.militia = 2;
+						},
 						note: `Will replenish militia manpower slowly and will cap at ${num(App.SecExp.militiaCap(2)*100)}% of the total citizens population.`
 					},
 					{
-						text: "every citizen is required to train in the militia and serve the arcology if the need arises.",
-						conditional: V.SecExp.edicts.defense.militia < 3,
-						value: [
-							{
-								value: 3,
-								isDefense: true
-							},
-						],
+						text: `ensure every citizen is required to train in the militia and serve the arcology if the need arises.`,
+						conditional: V.SecExp.edicts.defense.militia === 2,
+						set: function() {
+							V.SecExp.edicts.defense.militia = 3;
+						},
 						note: `Will replenish militia manpower moderately fast and will cap at ${num(App.SecExp.militiaCap(3)*100)}% of the total citizens population, but has a high authority cost.`
 					},
 					{
-						text: "every citizen is required to register and serve under the militia.",
-						conditional: V.SecExp.edicts.defense.militia < 4,
-						value: [
-							{
-								value: 4,
-								isDefense: true
-							},
-						],
+						text: `ensure every citizen is required to register and serve under the militia.`,
+						conditional: V.SecExp.edicts.defense.militia === 3,
+						set: function() {
+							V.SecExp.edicts.defense.militia = 4;
+						},
 						note: `Will quickly replenish militia manpower and will cap at ${num(App.SecExp.militiaCap(4)*100)}% of the total citizens population, but has a very high authority cost.`
 					},
 					{
-						text: "every adult citizen is required to train and participate in the defense of the arcology.",
-						conditional: V.SecExp.edicts.defense.militia < 5,
-						value: [
-							{
-								value: 5,
-								isDefense: true
-							},
-						],
+						text: `ensure that very adult citizen is required to train and participate in the defense of the arcology.`,
+						conditional: V.SecExp.edicts.defense.militia === 4,
+						set: function() {
+							V.SecExp.edicts.defense.militia = 5;
+						},
 						note: `Will very quickly replenish militia manpower and will cap at ${num(App.SecExp.militiaCap(5)*100)}% of the total citizens population, but has an extremely high authority cost`
 					},
 				]
 			}],
-			["militaryExemption", {
-				title: {
-					text: "Military exemption:"
-				},
+			["Military exemption", {
 				repeal: [
 					{
 						text: "you allow citizens to avoid military duty by paying a weekly fee.",
 						conditional: V.SecExp.edicts.defense.militaryExemption === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.militaryExemption = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "allow citizens to avoid military duty by paying a weekly fee.",
 						conditional: V.SecExp.edicts.defense.militia >= 3 && V.SecExp.edicts.defense.militaryExemption === 1,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.militaryExemption = 1;
+						},
 						note: "Will slow down the replenishment of manpower, but will supply cash each week. More profitable with stricter recruitment laws."
 					}
 				]
 			}],
-			["lowerRequirements", {
-				title: {
-					text: "Revised minimum requirements:",
-					tag: ["bold", "lime"]
-				},
+			["Revised minimum requirements", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "you allow citizens outside the normally accepted range to join the militia.",
 						conditional: V.SecExp.edicts.defense.lowerRequirements === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.lowerRequirements = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "will allow citizens outside the normally accepted range to join the militia.",
 						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSHedonisticDecadence >= 40 && V.SecExp.edicts.defense.lowerRequirements === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.lowerRequirements = 1;
+						},
 						note: "Will slightly lower defense and hp of militia units, but will increase the manpower replenishment rate."
 					}
 				]
 			}],
-			["noSubhumansInArmy", {
-				title: {
-					text: "No subhumans in the militia:",
-					tag: ["bold", "lime"]
-				},
+			["No subhumans in the militia", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "it is forbidden for subhumans to join the militia.",
 						conditional: V.SecExp.edicts.defense.noSubhumansInArmy === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.noSubhumansInArmy = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "prevent subhumans from joining the militia.",
 						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSSubjugationist >= 40 && V.SecExp.edicts.defense.noSubhumansInArmy === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.noSubhumansInArmy = 1;
+						},
 						note: "Will help advance racial Subjugation, but will slow down slightly manpower replenishment."
 					}
 				]
 			}],
-			["pregExemption", {
-				title: {
-					text: "Military exemption for pregnancies:",
-					tag: ["bold", "lime"]
-				},
+			["Military exemption for pregnancies", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "pregnant citizens are allowed, and encouraged, to avoid military service.",
 						conditional: V.SecExp.edicts.defense.pregExemption === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.pregExemption = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "pregnant citizens will be allowed, and encouraged, to avoid military service.",
 						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSRepopulationFocus >= 40 && $SecExp.edicts.defense.militia >= 3 && V.SecExp.edicts.defense.pregExemption === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.pregExemption = 1;
+						},
 						note: "Will help advance repopulation focus, but will slow down slightly manpower replenishment."
 					}
 				]
 			}],
-			["militiaSoldier", {
-				title: {
-					text: "Special militia privileges:"
-				},
+			["Special militia privileges", {
 				repeal: [
 					{
 						text: "citizens joining the militia are exempt from rent payment.",
 						conditional: V.SecExp.edicts.defense.privilege.militiaSoldier === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.privilege.militiaSoldier = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "will allow citizens joining the militia to avoid paying rent.",
 						conditional: V.SecExp.edicts.defense.militia >= 1 && V.SecExp.edicts.defense.privilege.militiaSoldier === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.privilege.militiaSoldier = 1;
+						},
 						note: "Will increase the loyalty of militia units, but will decrease rents."
 					}
 				]
 			}],
-			["slaveSoldier", {
-				title: {
-					text: "Special slaves privileges:"
-				},
+			["Special slaves privileges", {
 				repeal: [
 					{
 						text: "slaves into the army are allowed to have material possessions.",
 						conditional: V.SecExp.edicts.defense.privilege.slaveSoldier === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.privilege.slaveSoldier = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "will allow slaves drafted into the army to be able to have material possessions.",
 						conditional: V.SecExp.edicts.defense.privilege.slaveSoldier === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.privilege.slaveSoldier = 1;
+						},
 						note: "Will increase the loyalty of slave units, but will cost authority each week."
 					}
 				]
 			}],
-			["mercSoldier", {
-				title: {
-					text: "Special mercenary privileges:"
-				},
+			["Special mercenary privileges", {
 				repeal: [
 					{
 						text: "mercenaries under contract can claim part of the loot gained from battles.",
 						conditional: V.SecExp.edicts.defense.privilege.mercSoldier === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.privilege.mercSoldier = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "will allow mercenaries under contract to claim part of the loot gained from battles.",
 						conditional: V.mercenaries > 0 && V.SecExp.edicts.defense.privilege.mercSoldier === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.privilege.mercSoldier = 1;
+						},
 						note: "Will increase the loyalty of mercenary units, but will reduce cash and menial slaves gained from battles."
 					}
 				]
 			}],
-			["martialSchool", {
-				title: {
-					text: "Slave martial schools:",
-					tag: ["bold", "lime"]
-				},
+			["Slave martial schools", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "specialized schools are training slaves in martial arts and bodyguarding.",
 						conditional: V.SecExp.edicts.defense.martialSchool === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.martialSchool = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "specialized schools will be set up to train slaves in martial arts and bodyguarding.",
 						conditional: V.arcologies[0].FSPhysicalIdealist >= 40 && V.SecExp.edicts.defense.martialSchool === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.martialSchool = 1;
+						},
 						note: "Will slightly increase morale of slave units, but will incur upkeep costs."
 					}
 				]
 			}],
-			["eliteOfficers", {
-				title: {
-					text: "Elite officers:",
-					tag: ["bold", "lime"]
-				},
+			["Elite officers", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "officers are exclusively recruited from the elite of society.",
 						conditional: V.SecExp.edicts.defense.eliteOfficers === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.eliteOfficers = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "officers will be exclusively recruited from the elite of society.",
 						conditional: V.arcologies[0].FSRestart >= 40 && V.SecExp.edicts.defense.eliteOfficers === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.eliteOfficers = 1;
+						},
 						note: "Will help advance eugenics and provide a small morale boost to militia units, but will give a small morale malus to slave units."
 					}
 				]
 			}],
-			["liveTargets", {
-				title: {
-					text: "Live targets drills:",
-					tag: ["bold", "lime"]
-				},
+			["Live targets drills", {
+				tag: ["bold", "lime"],
 				repeal: [
 					{
 						text: "disobedient slaves are used as live targets at shooting ranges.",
 						conditional: V.SecExp.edicts.defense.liveTargets === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
+						set: function() {
+							V.SecExp.edicts.defense.liveTargets = 0;
+						},
 					}
 				],
 				implement: [
 					{
 						text: "disobedient slaves will be used as live targets at shooting ranges.",
 						conditional: V.arcologies[0].FSDegradationist >= 40 && V.SecExp.edicts.defense.liveTargets === 0,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.defense.liveTargets = 1;
+						},
 						note: "Will help advance degradationism and provide a small amount of exp to units, but will make the slave population slowly decline."
 					}
 				]
 			}],
-			["SFSupportLevel", {
-				title: {
-					text: sfTitle()
-				},
+			[`SF Assistance; ${sfSupport()}`, {
 				repeal: [
 					{
-						text: `${capSF} is providing the security HQ with advanced equipment, boosting its efficiency.`,
-						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1,
-						value: [
-							{
-								value: 0,
-								isDefense: true
-							}
-						]
-					},
-					{
-						text: `${capSF} is currently providing advanced equipment and training to security HQ personnel.`,
-						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							}
-						]
-					},
-					{
-						text: `${capSF} has currently transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
-						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							}
-						]
-					},
-					{
-						text: `${capSF} is currently providing its full support to the security department, while transferring troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
-						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4,
-						value: [
-							{
-								value: 3,
-								isDefense: true
-							}
-						]
-					},
-					{
-						text: `${capSF} is currently assisting with a local install of its custom network full support and has transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.`,
-						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 5,
-						value: [
-							{
-								value: 4,
-								isDefense: true
-							}
-						]
-					},
+						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel > 0,
+						set: function() {
+							V.SecExp.edicts.SFSupportLevel--;
+						},
+					}
 				],
 				implement: [
 					{
 						text: `${capSF} will provide the security HQ with advanced equipment.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 0 && App.SecExp.Check.reqMenials() > 5,
-						value: [
-							{
-								value: 1,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.SFSupportLevel = 1;
+						},
 						note: "Will lower the amount of personnel necessary to man the security HQ by 5, but will incur upkeep costs."
 					},
 					{
 						text: `${capSF} will provide the security HQ personnel with advanced training.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 1 && V.SF.Squad.Firebase >= 4 && App.SecExp.Check.reqMenials() > 5,
-						value: [
-							{
-								value: 2,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.SFSupportLevel = 2;
+						},
 						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
 					},
 					{
 						text: `${capSF} will provide troops to the security department.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 2 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
-						value: [
-							{
-								value: 3,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.SFSupportLevel = 3;
+						},
 						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
 					},
 					{
 						text: `${capSF} will give the security department its full support.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 3 && V.SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5,
-						value: [
-							{
-								value: 4,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.SFSupportLevel = 4;
+						},
 						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
 					},
 					{
 						text: `${capSF} will assist the security department with installing a local version of their custom network.`,
 						conditional: V.SF.Toggle && V.SF.Active >= 1 && V.SecExp.edicts.SFSupportLevel === 4 && V.SF.Squad.Firebase === 10 && App.SecExp.Check.reqMenials() > 5,
-						value: [
-							{
-								value: 5,
-								isDefense: true
-							},
-						],
+						set: function() {
+							V.SecExp.edicts.SFSupportLevel = 5;
+						},
 						note: "Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs."
 					},
 				]
@@ -1384,11 +934,11 @@ App.SecExp.edicts = function() {
 		const c = new DocumentFragment();
 		const r = [];
 		for (const [name, detail] of data) {
-			if (V.SF.Toggle && V.SF.Active >= 1 && name === "SFSupportLevel" && !r.includes("SFSupportLevel")) {
+			if (V.SF.Toggle && V.SF.Active >= 1 && name === "SF Assistance" && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Special Force:", "underline");
-				r.push("SFSupportLevel");
+				r.push(name);
 			}
-			App.UI.DOM.appendNewElement("p", c, genMenu(detail));
+			App.UI.DOM.appendNewElement("p", c, genMenu(name, detail));
 		}
 		return c;
 	}
-- 
GitLab


From 4363c2cc53cdd2d385972b9cebcea1e1735de714 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Sun, 8 Aug 2021 18:28:54 +1200
Subject: [PATCH 13/19] latest code 2020-08-08 4

---
 src/Mods/SecExp/js/edicts.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index d92ea02ffdc..27d276c53ed 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -345,7 +345,7 @@ App.SecExp.edicts = function() {
 				implement: [
 					{
 						text: "fund specialized training for your recruits to turn them into a professional Imperial army, led by your handpicked Imperial Knights.",
-						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSNeoImperialist >= 40 && V.SecExp.edicts.defense.imperialTradition === 0,
+						conditional: V.FSAnnounced && V.SecExp.edicts.defense.militia >= 1 && V.arcologies[0].FSNeoImperialist >= 40 && !V.SecExp.edicts.defense.imperialTradition,
 						set: function() {
 							V.SecExp.edicts.defense.imperialTradition = 1;
 						},
@@ -467,6 +467,7 @@ App.SecExp.edicts = function() {
 
 		const c = new DocumentFragment();
 		const r = [];
+		let showFS = 0;
 		for (const [name, detail] of data) {
 			if (["Immigration limits", "Open Borders"].includes(name) && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Immigration:", "underline");
@@ -474,9 +475,9 @@ App.SecExp.edicts = function() {
 			} else if (name === "Weapons Law" && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Weapons:", "underline");
 				r.push(name);
-			} else if (V.FSAnnounced && name.contains("traditions", "Teachings") && !r.includes(name)) {
+			} else if (V.FSAnnounced && name.contains("traditions", "Teachings") && !showFS) {
 				App.UI.DOM.appendNewElement("h1", c, "Future Societies:", "underline");
-				r.push(name);
+				showFS = 1;
 			}
 			App.UI.DOM.appendNewElement("p", c, genMenu(name, detail));
 		}
-- 
GitLab


From 746f417c0d94e600349e2ea63ca61e01bd62143a Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Mon, 9 Aug 2021 11:14:05 +1200
Subject: [PATCH 14/19] Implement suggestions

---
 src/Mods/SecExp/events/conflictReport.js |  4 ++--
 src/Mods/SecExp/js/edicts.js             | 11 +++++------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
index 2164cb13225..fc5df555594 100644
--- a/src/Mods/SecExp/events/conflictReport.js
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -75,7 +75,7 @@ App.Events.conflictReport = function() {
 	 * @param {number} [lowerClass]
 	 * @param {number} [slaves]
 	 * @param {number} [prosperity]
-	 * @returns {Void}
+	 * @returns {void}
 	 */
 	const arcologyEffects = function(lowerClass, slaves, prosperity) {
 		V.lowerClass -= random(lowerClass);
@@ -1265,7 +1265,7 @@ App.Events.conflictReport = function() {
 							}
 							if (unit.training < 100 && random(1, 100) > 60) {
 								r.push(`Experience has increased.`);
-								unit.training += random(5, 15) + (majorBattle ? 1 : 0) * random(5, 15);
+								unit.training += random(5, 15) + (isMajorBattle ? 1 : 0) * random(5, 15);
 							}
 						} else if (type === "bots" && loss > 0) {
 							unit.troops -= loss;
diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index 27d276c53ed..f5134604bec 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -14,7 +14,6 @@ App.SecExp.edicts = function() {
 					if (current.text) {
 						t.append(`${capFirstChar(current.text)} `);
 					}
-					// if (V.SecExp.core.authority >= 1000 && (detail.repeal[i].conditional || detail.implement[i].conditional)) {
 					if (V.SecExp.core.authority >= 1000 && current.set) {
 						t.append(App.UI.DOM.makeElement("span",
 							App.UI.DOM.link(`${detail.implement[i].conditional ? "Implement" : "Repeal"}`,
@@ -260,7 +259,7 @@ App.SecExp.edicts = function() {
 			["Weapons Law", {
 				implement: [
 					{
-						text: "there are no restrictions on wapons. Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "there are no restrictions on weapons. Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 3,
 						set: function() {
 							V.SecExp.edicts.weaponsLaw = 2;
@@ -475,7 +474,7 @@ App.SecExp.edicts = function() {
 			} else if (name === "Weapons Law" && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Weapons:", "underline");
 				r.push(name);
-			} else if (V.FSAnnounced && name.contains("traditions", "Teachings") && !showFS) {
+			} else if (V.FSAnnounced && name.includes("traditions", "Teachings") && !showFS) {
 				App.UI.DOM.appendNewElement("h1", c, "Future Societies:", "underline");
 				showFS = 1;
 			}
@@ -519,7 +518,7 @@ App.SecExp.edicts = function() {
 					x.push("its full support");
 				}
 				if (V.SecExp.edicts.SFSupportLevel === 5) {
-					x.push("assited with installing up a local version of their custom network");
+					x.push("assisted with installing a local version of their custom network");
 				}
 			}
 			return toSentence(x);
@@ -622,7 +621,7 @@ App.SecExp.edicts = function() {
 						}
 					},
 					{
-						text: `Re-enstate the militia as volunteers only.`,
+						text: `Reinstate the militia as volunteers only.`,
 						conditional: V.SecExp.edicts.defense.militia === 1,
 						set: function() {
 							V.SecExp.edicts.defense.militia = 2;
@@ -741,7 +740,7 @@ App.SecExp.edicts = function() {
 				implement: [
 					{
 						text: "pregnant citizens will be allowed, and encouraged, to avoid military service.",
-						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSRepopulationFocus >= 40 && $SecExp.edicts.defense.militia >= 3 && V.SecExp.edicts.defense.pregExemption === 0,
+						conditional: V.SecExp.edicts.defense.militia >= 3 && V.arcologies[0].FSRepopulationFocus >= 40 && V.SecExp.edicts.defense.militia >= 3 && V.SecExp.edicts.defense.pregExemption === 0,
 						set: function() {
 							V.SecExp.edicts.defense.pregExemption = 1;
 						},
-- 
GitLab


From 34eab32fd75b15baa7844589304be6d87366e407 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Mon, 9 Aug 2021 15:16:53 +1200
Subject: [PATCH 15/19] Implement suggestion and minor re-orginisation

---
 src/005-passages/eventsPassages.js       |   3 +
 src/Mods/SecExp/events/conflictReport.js | 273 +++++++++++------------
 src/Mods/SecExp/js/edicts.js             |   4 +-
 3 files changed, 130 insertions(+), 150 deletions(-)

diff --git a/src/005-passages/eventsPassages.js b/src/005-passages/eventsPassages.js
index cebcb8971dd..70acfbf7389 100644
--- a/src/005-passages/eventsPassages.js
+++ b/src/005-passages/eventsPassages.js
@@ -8,6 +8,9 @@ new App.DomPassage("Nonrandom Event",
 
 new App.DomPassage("conflictReport",
 	() => {
+		V.nextButton = "Continue";
+		V.nextLink = "Scheduled Event";
+		V.encyclopedia = "Battles";
 		return App.Events.conflictReport();
 	}
 );
diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
index fc5df555594..6055040da9e 100644
--- a/src/Mods/SecExp/events/conflictReport.js
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -1,34 +1,11 @@
 App.Events.conflictReport = function() {
-	V.nextButton = "Continue";
-	V.nextLink = "Scheduled Event";
-	V.encyclopedia = "Battles";
-
-	// Battles
-	let loot = 0;
-	let loss = 0;
-	let captives;
-	const end = (V.SecExp.battles.victoryStreak >= 2 || V.SecExp.battles.lossStreak >= 2) ? `,` : `.`;
-
-	let lostSlaves;
-	let r = [];
-	const allKilled = V.SecExp.war.attacker.losses === V.SecExp.war.attacker.troops;
-	const result = V.SecExp.war.result;
-
-	const inBattle = V.SecExp.war.type.includes("Attack");
-	const isMajorBattle = inBattle && V.SecExp.war.type.includes("Major");
-	const majorBattleMod = !isMajorBattle ? 1 : 2;
-	const inRebellion = V.SecExp.war.type.includes("Rebellion");
-	const slaveRebellion = V.SecExp.war.type.includes("Slave");
-	const type = inBattle ? "battles" : "rebellions";
-	const hasLosses = V.SecExp.war.losses > 0;
-
 	/**
 	 * @param {string} [type]
 	 * @param {number} [loss]
 	 * @param {Object} [squad=null]
 	 * @returns {string}
 	 */
-	const casualtiesReport = function(type, loss, squad=null) {
+	 const casualtiesReport = function(type, loss, squad=null) {
 		const isSpecial = squad && App.SecExp.unit.list().slice(1).includes(type);
 		let r = [];
 		if (loss <= 0) {
@@ -58,8 +35,130 @@ App.Events.conflictReport = function() {
 		}
 		return r.join(" ");
 	};
+	let r = [];
+	const allKilled = V.SecExp.war.attacker.losses === V.SecExp.war.attacker.troops;
+	const result = V.SecExp.war.result;
+	const hasLosses = V.SecExp.war.losses > 0;
+
+	const inBattle = V.SecExp.war.type.includes("Attack");
+	const isMajorBattle = inBattle && V.SecExp.war.type.includes("Major");
+	const majorBattleMod = !isMajorBattle ? 1 : 2;
+
+	const inRebellion = V.SecExp.war.type.includes("Rebellion");
+	const slaveRebellion = V.SecExp.war.type.includes("Slave");
+	const type = inBattle ? "battles" : "rebellions";
+
+	// Battles
+	let loot = 0;
+	let captives;
+	const end = (V.SecExp.battles.victoryStreak >= 2 || V.SecExp.battles.lossStreak >= 2) ? `,` : `.`;
+	/**
+	 * Does the target become wounded?
+	 * @param {string} [target]
+	 * @returns {string}
+	 */
+	 const checkWoundStatus = function(target) {
+		let conditions;
+		let slave;
+		let woundChance = 0;
+		const r = [];
+		if (target === "PC") {
+			if (V.PC.career === "mercenary" || V.PC.career === "gang") {
+				woundChance -= 5;
+			} else if (V.PC.skill.warfare >= 75) {
+				woundChance -= 3;
+			}
+			if (V.personalArms >= 1) {
+				woundChance -= 5;
+			}
+			if (V.PC.balls >= 20) {
+				woundChance += random(5, 10);
+			} else if (V.PC.balls >= 9) {
+				woundChance += random(1, 5);
+			}
+			conditions = [
+				V.PC.physicalAge >= 60,
+				V.PC.belly > 5000,
+				V.PC.boobs >= 1000,
+				V.PC.butt >= 4,
+				V.PC.preg >= 30
+			];
+			for (const cond of conditions) {
+				if (cond) {
+					woundChance += random(1, 5);
+				}
+			}
+			woundChance *= random(1, 2);
+		} else {
+			if (target === "Concubine") {
+				slave = S.Concubine;
+			} else if (target === "Bodyguard") {
+				slave = S.Bodyguard;
+			}
+
+			if (!slave) {
+				return ``;
+			}
+
+			if (slave.skill.combat === 1) {
+				woundChance -= 2;
+			}
+			woundChance -= 0.25 * (getLimbCount(slave, 105));
+			if (slave.health.condition >= 50) {
+				woundChance -= 1;
+			}
+			conditions = [
+				slave.weight > 130,
+				slave.muscles < -30,
+				getBestVision(slave) === 0,
+				slave.heels === 1,
+				slave.boobs >= 1400,
+				slave.butt >= 6,
+				slave.belly >= 10000,
+				slave.dick >= 8,
+				slave.balls >= 8,
+				slave.intelligence + slave.intelligenceImplant < -95
+			];
+			for (const cond of conditions) {
+				if (cond) {
+					woundChance++;
+				}
+			}
+			woundChance *= random(2, 4);
+		}
+
+		if (random(1, 100) <= woundChance) {
+			if (target === "PC") {
+				healthDamage(V.PC, 60);
+				r.push(`A lucky shot managed to find its way to you, leaving a painful, but thankfully not lethal, wound.`);
+			} else {
+				const woundType = App.SecExp.inflictBattleWound(slave);
+				const {his, him} = getPronouns(slave);
+				if (target === "Concubine") {
+					r.push(`Your Concubine was unfortunately caught in the crossfire.`);
+				} else {
+					r.push(`During one of the assaults your Bodyguard was hit.`);
+				}
+				if (woundType === "voice") {
+					r.push(`A splinter pierced ${his} throat, severing ${his} vocal cords.`);
+				} else if (woundType === "eyes") {
+					r.push(`A splinter hit ${his} face, severely damaging ${his} eyes.`);
+				} else if (woundType === "legs") {
+					r.push(`An explosion near ${him} caused the loss of both of ${his} legs.`);
+				} else if (woundType === "arm") {
+					r.push(`An explosion near ${him} caused the loss of one of ${his} arms.`);
+				} else if (woundType === "flesh") {
+					r.push(`A stray shot severely wounded ${him}.`);
+				}
+			}
+		} else if (target === "PC") {
+			r.push(`Fortunately you managed to avoid injury.`);
+		}
+		return r.join(" ");
+	};
 
 	// Rebellions
+	let lostSlaves;
 	/**
 	 * @param {string} [target]
 	 * @param {number} [value]
@@ -114,7 +213,7 @@ App.Events.conflictReport = function() {
 		App.UI.DOM.appendNewElement("div", node);
 		for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
 			if (V.SecExp.war.rebellingID.contains(u.ID)) {
-				rebels.names.push(`${u.platoonName}`);
+				rebels.names.push(${u.platoonName});
 				rebels.ID.push(u.ID);
 				manpower += Math.clamp(u.troops - random(averageLosses), 0, u.troops);
 			}
@@ -157,128 +256,6 @@ App.Events.conflictReport = function() {
 		return node;
 	};
 
-	// Battles
-	/**
-	 * Does the target become wounded?
-	 * @param {string} [target]
-	 * @returns {string}
-	 */
-	const checkWoundStatus = function(target) {
-		let slave;
-		let woundChance = 0;
-		const r = [];
-		if (target === "PC") {
-			if (V.PC.career === "mercenary" || V.PC.career === "gang") {
-				woundChance -= 5;
-			} else if (V.PC.skill.warfare >= 75) {
-				woundChance -= 3;
-			}
-			if (V.personalArms >= 1) {
-				woundChance -= 5;
-			}
-			if (V.PC.physicalAge >= 60) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.belly > 5000) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.boobs >= 1000) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.butt >= 4) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.preg >= 30) {
-				woundChance += random(1, 5);
-			}
-			if (V.PC.balls >= 20) {
-				woundChance += random(5, 10);
-			}
-			if (V.PC.balls >= 9) {
-				woundChance += random(1, 5);
-			}
-			woundChance *= random(1, 2);
-		} else {
-			if (target === "Concubine") {
-				slave = S.Concubine;
-			} else if (target === "Bodyguard") {
-				slave = S.Bodyguard;
-			}
-
-			if (!slave) {
-				return ``;
-			}
-
-			if (slave.skill.combat === 1) {
-				woundChance -= 2;
-			}
-			woundChance -= 0.25 * (getLimbCount(slave, 105));
-			if (slave.health.condition >= 50) {
-				woundChance -= 1;
-			}
-			if (slave.weight > 130) {
-				woundChance += 1;
-			}
-			if (slave.muscles < -30) {
-				woundChance += 1;
-			}
-			if (getBestVision(slave) === 0) {
-				woundChance += 1;
-			}
-			if (slave.heels === 1) {
-				woundChance += 1;
-			}
-			if (slave.boobs >= 1400) {
-				woundChance += 1;
-			}
-			if (slave.butt >= 6) {
-				woundChance += 1;
-			}
-			if (slave.belly >= 10000) {
-				woundChance += 1;
-			}
-			if (slave.dick >= 8) {
-				woundChance += 1;
-			}
-			if (slave.balls >= 8) {
-				woundChance += 1;
-			}
-			if (slave.intelligence + slave.intelligenceImplant < -95) {
-				woundChance += 1;
-			}
-			woundChance *= random(2, 4);
-		}
-
-		if (random(1, 100) <= woundChance) {
-			if (target === "PC") {
-				healthDamage(V.PC, 60);
-				r.push(`A lucky shot managed to find its way to you, leaving a painful, but thankfully not lethal, wound.`);
-			} else {
-				const woundType = App.SecExp.inflictBattleWound(slave);
-				const {his, him} = getPronouns(slave);
-				if (target === "Concubine") {
-					r.push(`Your Concubine was unfortunately caught in the crossfire.`);
-				} else {
-					r.push(`During one of the assaults your Bodyguard was hit.`);
-				}
-				if (woundType === "voice") {
-					r.push(`A splinter pierced ${his} throat, severing ${his} vocal cords.`);
-				} else if (woundType === "eyes") {
-					r.push(`A splinter hit ${his} face, severely damaging ${his} eyes.`);
-				} else if (woundType === "legs") {
-					r.push(`An explosion near ${him} caused the loss of both of ${his} legs.`);
-				} else if (woundType === "arm") {
-					r.push(`An explosion near ${him} caused the loss of one of ${his} arms.`);
-				} else if (woundType === "flesh") {
-					r.push(`A stray shot severely wounded ${him}.`);
-				}
-			}
-		} else if (target === "PC") {
-			r.push(`Fortunately you managed to avoid injury.`);
-		}
-		return r.join(" ");
-	};
-
 	V.SecExp.war.attacker.losses = Math.trunc(V.SecExp.war.attacker.losses);
 	if (V.SecExp.war.attacker.losses > V.SecExp.war.attacker.troops) {
 		V.SecExp.war.attacker.losses = V.SecExp.war.attacker.troops;
@@ -319,7 +296,7 @@ App.Events.conflictReport = function() {
 	r.push(`Today, ${asDateString(V.week, random(0, 7))}, our arcology was`);
 	if (inBattle) {
 		r.push(`attacked by`);
-			if (V.SecExp.war.attacker.type === "raiders") {
+		if (V.SecExp.war.attacker.type === "raiders") {
 			r.push(`a band of wild raiders,`);
 		} else if (V.SecExp.war.attacker.type === "free city") {
 			r.push(`a contingent of mercenaries hired by a competing free city,`);
diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index f5134604bec..65bba69bf59 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -96,7 +96,7 @@ App.SecExp.edicts = function() {
 				implement: [
 					{
 						text: "allow the selling of private citizens' data.",
-						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 0 && Object.values(V.SecExp.buildings.secHub.upgrades.security).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.intel).reduce((a, b) => a + b) > 0,
+						conditional: V.SecExp.buildings.secHub && V.SecExp.edicts.sellData === 0 && (Object.values(V.SecExp.buildings.secHub.upgrades.security).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.crime).reduce((a, b) => a + b) > 0 || Object.values(V.SecExp.buildings.secHub.upgrades.intel).reduce((a, b) => a + b) > 0),
 						set: function() {
 							V.SecExp.edicts.sellData = 1;
 						},
@@ -474,7 +474,7 @@ App.SecExp.edicts = function() {
 			} else if (name === "Weapons Law" && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Weapons:", "underline");
 				r.push(name);
-			} else if (V.FSAnnounced && name.includes("traditions", "Teachings") && !showFS) {
+			} else if (V.FSAnnounced && (name.includes("traditions") || name.includes("Teachings")) && !showFS) {
 				App.UI.DOM.appendNewElement("h1", c, "Future Societies:", "underline");
 				showFS = 1;
 			}
-- 
GitLab


From ad05b0c78a5773aac8096c8fd61b73e55ada3175 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Mon, 9 Aug 2021 15:57:34 +1200
Subject: [PATCH 16/19] Implement suggestions

---
 src/Mods/SecExp/events/conflictReport.js | 2 +-
 src/Mods/SecExp/js/edicts.js             | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
index 6055040da9e..e511de77b20 100644
--- a/src/Mods/SecExp/events/conflictReport.js
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -213,7 +213,7 @@ App.Events.conflictReport = function() {
 		App.UI.DOM.appendNewElement("div", node);
 		for (const u of V.SecExp.units[unit].squads.filter(s => s.active === 1)) {
 			if (V.SecExp.war.rebellingID.contains(u.ID)) {
-				rebels.names.push(${u.platoonName});
+				rebels.names.push(u.platoonName);
 				rebels.ID.push(u.ID);
 				manpower += Math.clamp(u.troops - random(averageLosses), 0, u.troops);
 			}
diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index 65bba69bf59..d0439de53a0 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -12,7 +12,11 @@ App.SecExp.edicts = function() {
 				}
 				if (current) {
 					if (current.text) {
-						t.append(`${capFirstChar(current.text)} `);
+						if (detail.implement.filter(s => s.conditional) > 0) {
+							App.UI.DOM.appendNewElement("span", t, `${capFirstChar(current.text)}`);
+						} else {
+							t.append(`${capFirstChar(current.text)} `);
+						}
 					}
 					if (V.SecExp.core.authority >= 1000 && current.set) {
 						t.append(App.UI.DOM.makeElement("span",
@@ -474,7 +478,7 @@ App.SecExp.edicts = function() {
 			} else if (name === "Weapons Law" && !r.includes(name)) {
 				App.UI.DOM.appendNewElement("h1", c, "Weapons:", "underline");
 				r.push(name);
-			} else if (V.FSAnnounced && (name.includes("traditions") || name.includes("Teachings")) && !showFS) {
+			} else if (V.FSAnnounced && ["traditions", "Teachings"].includes(name) && !showFS) {
 				App.UI.DOM.appendNewElement("h1", c, "Future Societies:", "underline");
 				showFS = 1;
 			}
-- 
GitLab


From 414f1b7727c058115f2306df20f889958367d2fc Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Mon, 9 Aug 2021 17:00:49 +1200
Subject: [PATCH 17/19] Minor tweaks

---
 src/Mods/SecExp/events/conflictReport.js | 16 ++++---------
 src/Mods/SecExp/js/edicts.js             | 29 +++++++++++++++---------
 2 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
index e511de77b20..a699b0b610f 100644
--- a/src/Mods/SecExp/events/conflictReport.js
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -83,12 +83,6 @@ App.Events.conflictReport = function() {
 				V.PC.butt >= 4,
 				V.PC.preg >= 30
 			];
-			for (const cond of conditions) {
-				if (cond) {
-					woundChance += random(1, 5);
-				}
-			}
-			woundChance *= random(1, 2);
 		} else {
 			if (target === "Concubine") {
 				slave = S.Concubine;
@@ -119,13 +113,11 @@ App.Events.conflictReport = function() {
 				slave.balls >= 8,
 				slave.intelligence + slave.intelligenceImplant < -95
 			];
-			for (const cond of conditions) {
-				if (cond) {
-					woundChance++;
-				}
-			}
-			woundChance *= random(2, 4);
 		}
+		for (const cond of conditions.filter(s => s)) {
+			woundChance += (target === "PC" ? random(1, 5) : 1);
+		}
+		woundChance *= (target === "PC" ? random(1, 2) : random(2, 4));
 
 		if (random(1, 100) <= woundChance) {
 			if (target === "PC") {
diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index d0439de53a0..ccfe99a947c 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -12,11 +12,10 @@ App.SecExp.edicts = function() {
 				}
 				if (current) {
 					if (current.text) {
-						if (detail.implement.filter(s => s.conditional) > 0) {
-							App.UI.DOM.appendNewElement("span", t, `${capFirstChar(current.text)}`);
-						} else {
-							t.append(`${capFirstChar(current.text)} `);
+						if (detail.implement.filter(s => s.conditional).length > 1) {
+							App.UI.DOM.appendNewElement("div", t);
 						}
+						t.append(`${capFirstChar(current.text)} `);
 					}
 					if (V.SecExp.core.authority >= 1000 && current.set) {
 						t.append(App.UI.DOM.makeElement("span",
@@ -44,6 +43,14 @@ App.SecExp.edicts = function() {
 	}
 
 	function Society() {
+		const weaponsStatus = function() {
+			switch(V.SecExp.edicts.weaponsLaw ) {
+				case 3: return "There are no restrictions on weapons";
+				case 2: return "Non-heavy, non-explosive weapons are legal";
+				case 1: return "Non-automatic, non-high caliber weapons are legal";
+				case 0: return "Residents are unable to buy, sell and keep weapons ";
+			}
+		};
 		const data = new Map([
 			["Alternative rent payment", {
 				repeal: [
@@ -260,10 +267,10 @@ App.SecExp.edicts = function() {
 				]
 			}],
 
-			["Weapons Law", {
+			[`Weapons Law; ${weaponsStatus()}`, {
 				implement: [
 					{
-						text: "there are no restrictions on weapons. Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 3,
 						set: function() {
 							V.SecExp.edicts.weaponsLaw = 2;
@@ -271,7 +278,7 @@ App.SecExp.edicts = function() {
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
-						text: "non-heavy, non-explosive weapons are legal. Allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
+						text: "allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
 						set: function() {
 							V.SecExp.edicts.weaponsLaw = 3;
@@ -279,7 +286,7 @@ App.SecExp.edicts = function() {
 						note: "Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed."
 					},
 					{
-						text: "non-heavy, non-explosive weapons are legal. Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 2,
 						set: function() {
 							V.SecExp.edicts.weaponsLaw = 1;
@@ -287,7 +294,7 @@ App.SecExp.edicts = function() {
 						note: "Will cost some authority each week, but rebellions will be poorly armed."
 					},
 					{
-						text: "non-automatic, non-high caliber weapons are legal. Set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
+						text: "set the range of weapons allowed within the arcology to non-heavy, non-explosive.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
 						set: function() {
 							V.SecExp.edicts.weaponsLaw = 2;
@@ -295,7 +302,7 @@ App.SecExp.edicts = function() {
 						note: "Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed."
 					},
 					{
-						text: "non-automatic, non-high caliber weapons are legal. Forbid residents to buy, sell and keep weaponry while within the arcology.",
+						text: "forbid residents to buy, sell and keep weaponry while within the arcology.",
 						conditional: V.SecExp.edicts.weaponsLaw === 1,
 						set: function() {
 							V.SecExp.edicts.weaponsLaw = 0;
@@ -303,7 +310,7 @@ App.SecExp.edicts = function() {
 						note: "Will cost a moderate amount of authority each week, but rebellions will be very poorly armed."
 					},
 					{
-						text: "residents are unable to buy, sell and keep weapons. Set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
+						text: "set the range of weapons allowed within the arcology to non-automatic, non-high caliber.",
 						conditional: V.SecExp.edicts.weaponsLaw === 0,
 						set: function() {
 							V.SecExp.edicts.weaponsLaw = 1;
-- 
GitLab


From 4d3667b81dccb0a92ec49a48a57541de112c6e98 Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Mon, 9 Aug 2021 17:13:18 +1200
Subject: [PATCH 18/19] Minor cleanup

---
 src/Mods/SecExp/js/edicts.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Mods/SecExp/js/edicts.js b/src/Mods/SecExp/js/edicts.js
index ccfe99a947c..8bfeee066df 100644
--- a/src/Mods/SecExp/js/edicts.js
+++ b/src/Mods/SecExp/js/edicts.js
@@ -48,7 +48,7 @@ App.SecExp.edicts = function() {
 				case 3: return "There are no restrictions on weapons";
 				case 2: return "Non-heavy, non-explosive weapons are legal";
 				case 1: return "Non-automatic, non-high caliber weapons are legal";
-				case 0: return "Residents are unable to buy, sell and keep weapons ";
+				case 0: return "Residents are unable to buy, sell and keep weapons";
 			}
 		};
 		const data = new Map([
-- 
GitLab


From 2f6ff5c00dfa40304b29be592f44a93f23a5adfb Mon Sep 17 00:00:00 2001
From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io>
Date: Tue, 10 Aug 2021 19:34:00 +1200
Subject: [PATCH 19/19] Implement suggestions

---
 src/Mods/SecExp/events/conflictReport.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Mods/SecExp/events/conflictReport.js b/src/Mods/SecExp/events/conflictReport.js
index a699b0b610f..70f4f6547db 100644
--- a/src/Mods/SecExp/events/conflictReport.js
+++ b/src/Mods/SecExp/events/conflictReport.js
@@ -114,8 +114,10 @@ App.Events.conflictReport = function() {
 				slave.intelligence + slave.intelligenceImplant < -95
 			];
 		}
-		for (const cond of conditions.filter(s => s)) {
-			woundChance += (target === "PC" ? random(1, 5) : 1);
+		for (const cond of conditions) {
+			if (cond) {
+				woundChance += (target === "PC" ? random(1, 5) : 1);
+			}
 		}
 		woundChance *= (target === "PC" ? random(1, 2) : random(2, 4));
 
@@ -1152,7 +1154,7 @@ App.Events.conflictReport = function() {
 				}
 			}
 		} else {
-			throw(`Losses are ${V.SecExp.war.losses}.`);
+			throw Error(`Losses are ${V.SecExp.war.losses}.`);
 		}
 
 		if (inRebellion && V.SecExp.war.irregulars > 0) {
-- 
GitLab