diff --git a/src/SecExp/SecExpBackwardCompatibility.tw b/src/SecExp/SecExpBackwardCompatibility.tw
new file mode 100644
index 0000000000000000000000000000000000000000..ff796e71fc8ee73ac5edac8f08f5c104feb353f9
--- /dev/null
+++ b/src/SecExp/SecExpBackwardCompatibility.tw
@@ -0,0 +1,60 @@
+:: SecExpBackwardCompatibility [nobr]
+
+/* base stats */
+<<if ndef $authority>>
+	<<set $authority = 1000>>
+<</if>>
+<<if ndef $authority>>
+	<<set $security = 50>>
+<</if>>
+<<if ndef $authority>>
+	<<set $readiness = 0>>
+<</if>>
+<<if ndef $authority>>
+	<<set $attackType = "none">>
+<</if>>
+<<if ndef $authority>>
+	<<set $attackThisWeek = 0>>
+<</if>>
+<<if ndef $authority>>
+	<<set $lastAttackWeeks = 0>>
+<</if>>
+
+/* upgrades */
+<<set $riskSim = 0>>
+<<set $riskSimExpectedAttack = "none">>
+<<set $perimeterDrones = 0>>
+
+/* battle relevant vars */
+<<if ndef $chosenTactic>>
+<<set $chosenTactic = "none">>
+<</if>>
+<<if ndef $leadingTroops>>
+<<set $leadingTroops = "none">>
+<</if>>
+<<if ndef $attackTroops>>
+<<set $attackTroops = 0>>
+<</if>>
+<<if ndef $attackEquip>>
+<<set $attackEquip = 0>>
+<</if>>
+<<if ndef $deployableUnits>>
+<<set $deployableUnits = 0>>
+<</if>>
+<<if ndef $deployedUnits>>
+<<set $deployedUnits = 0>>
+<</if>>
+<<if ndef $battleTerrain>>
+<<set $battleTerrain = "none">>
+<</if>>
+
+/* units */
+<<if ndef $militiaUnits>>
+	<<set $militiaUnits = []>>
+<</if>>
+<<if ndef $slaveUnits>>
+	<<set $slaveUnits = []>>
+<</if>>
+<<if ndef $mercUnits>>
+	<<set $mercUnits = []>>
+<</if>>
\ No newline at end of file
diff --git a/src/SecExp/attackGenerator.tw b/src/SecExp/attackGenerator.tw
index f1281e93c8455985fbe80f49ad4c74b5926b81ce..14fb539145cdf4573aa20d1f9c6685b07b5c8be9 100644
--- a/src/SecExp/attackGenerator.tw
+++ b/src/SecExp/attackGenerator.tw
@@ -1,362 +1,222 @@
 :: attackGenerator [nobr]
 
-/* attack progress */
-<<set _raider = 0>>
-<<if $week < 40>>
-	<<set _raider += 3>>
-<<elseif $week < 60>>
-	<<set _raider += 5>>
-<<elseif $week < 110>>
-	<<set _raider += 7>>
-<<elseif $week < 150>>
-	<<set _raider +=9>>
+/* _attackChance value is the chance out of 100 of an attack happening this week */
+<<if $lastAttackWeeks < 3>>
+	<<set _attackChance = 0>>
 <<else>>
-	<<set _raider +=15>>
-<</if>>
-<<if $arcologies[0].prosperity <= 50>>
-	<<set _raider += 3>>
-<<elseif $arcologies[0].prosperity <= 70>>
-	<<set _raider += 5>>
-<<elseif $arcologies[0].prosperity <= 90>>
-	<<set _raider += 7>>
-<<elseif $arcologies[0].prosperity <= 110>>
-	<<set _raider += 9>>
-<<elseif $arcologies[0].prosperity <= 130>>
-	<<set _raider += 15>>
-<<else>>
-	<<set _raider += 18>>
+	<<if $week < 30>>
+		<<set _attackChance = 5>>
+	<<elseif $week < 60>>
+		<<set _attackChance = 8>>
+	<<elseif $week < 90>>
+		<<set _attackChance = 12>>
+	<<elseif $week < 120>>
+		<<set _attackChance =16>>
+	<<else>>
+		<<set _attackChance =20>>
+	<</if>>
+	<<if $lastAttackWeeks >= 15>>
+		<<set _attackChance += 5>>
+	<</if>>
 <</if>>
+/* testing */
+<<set _attackChance = 100>>
 
-<<set _oldWorld = 0>>
-<<if $arcologies[0].prosperity <= 50>>
-	<<set _oldWorld += 2>>
-<<elseif $arcologies[0].prosperity <= 70>>
-	<<set _oldWorld += 4>>
-<<elseif $arcologies[0].prosperity <= 90>>
-	<<set _oldWorld += 6>>
-<<elseif $arcologies[0].prosperity <= 110>>
-	<<set _oldWorld += 8>>
-<<elseif $arcologies[0].prosperity <= 130>>
-	<<set _oldWorld += 12>>
+/* Rolls to see if attack happens this week */
+/* raiders are attracted by low security */
+/* the old world by "degenerate" future societies */
+/* free Cities by high prosperity */
+/* freedom fighters by high slave/citizen ratio */
+<<if random(1,100) <= _attackChance>>
+	<<set $attackThisWeek = 1>>
+	<<set $lastAttackWeeks = 0>>
+	/* _type is the chance out of 100 of an attack of that type happening */
+	<<set _raider = 25>>
+	<<set _oldWorld = 25>>
+	<<set _freeCity = 25>>
+	<<set _free = 25>>
+	/* old world */
+	<<if $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" ||
+	$arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset" ||
+	$arcologies[0].FSRepopulationFocus != "unset" || $arcologies[0].FSGenderRadicalist != "unset" || $arcologies[0].FSPastoralist != "unset" ||
+	$arcologies[0].FSChattelReligionist != "unset">>
+		<<set _oldWorld += 15>>
+		<<set _raider -= 5>>
+		<<set _freeCity -= 5>>
+		<<set _free -= 5>>
+	<<elseif ($arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" ||
+	$arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset") &&
+	($arcologies[0].FSRepopulationFocus != "unset" || $arcologies[0].FSGenderRadicalist != "unset" || $arcologies[0].FSPastoralist != "unset" ||
+	$arcologies[0].FSChattelReligionist != "unset")>>
+		<<set _oldWorld += 24>>
+		<<set _raider -= 8>>
+		<<set _freeCity -= 8>>
+		<<set _free -= 8>>
+	<</if>>
+	/* freedom fighter */
+	<<if $ASlaves > $ACitizens * 2>>
+		<<set _oldWorld -= 8>>
+		<<set _raider -= 8>>
+		<<set _freeCity -= 8>>
+		<<set _free += 24>>
+	<<elseif $ASlaves > $ACitizens * 1.2 || $arcologies[0].FSDegradationist != "unset">>
+		<<set _oldWorld -= 5>>
+		<<set _raider -= 5>>
+		<<set _freeCity -= 5>>
+		<<set _free += 15>>
+	<</if>>
+	/* free cities */
+	<<if $arcologies[0].prosperity >= 10 && $arcologies[0].prosperity < 20>>
+		<<set _oldWorld -= 5>>
+		<<set _raider -= 5>>
+		<<set _freeCity += 15>>
+		<<set _free -= 5>>
+	<<elseif $arcologies[0].prosperity >= 20>>
+		<<set _oldWorld -= 8>>
+		<<set _raider -= 8>>
+		<<set _freeCity += 24>>
+		<<set _free -= 8>>
+	<</if>>
+	/* raiders */
+	<<if $security <= 50>>
+		<<set _oldWorld -= 5>>
+		<<set _raider += 15>>
+		<<set _freeCity -= 5>>
+		<<set _free -= 5>>
+	<<elseif $security <= 25>>
+		<<set _oldWorld -= 8>>
+		<<set _raider += 24>>
+		<<set _freeCity -= 8>>
+		<<set _free -= 8>>
+	<</if>>
+	
+	/* makes the actual roll */
+	<<set _roll = random(1,100)>>
+	<<if _roll <= _raider>>
+		<<set $attackType = "raiders">>
+	<<elseif _roll <= _raider + _oldWorld>>
+		<<set $attackType = "old world">>
+	<<elseif _roll <= _raider + _oldWorld + _freeCity>>
+		<<set $attackType = "free city">>
+	<<elseif _roll <= _raider + _oldWorld + _freeCity + _free>>
+		<<set $attackType = "freedom fighters">>
+	<</if>>
 <<else>>
-	<<set _oldWorld += 16>>
-<</if>>
-<<if $arcologies[0].FSRepopulationFocus != "unset">>
-	<<set _oldWorld += 8>>
-<<elseif $arcologies[0].FSGenderRadicalist != "unset">>
-	<<set _oldWorld += 8>>
-<<elseif $arcologies[0].FSPastoralist != "unset">>
-	<<set _oldWorld += 8>>
-<<elseif $arcologies[0].FSChattelReligionist != "unset">>
-	<<set _oldWorld += 8>>
-<<elseif $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" ||
-	$arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset">>
-	<<set _oldWorld += 8>>
+	<<set $attackType = "none">>
+	<<set $lastAttackWeeks++>>
 <</if>>
+	
+/*  To be implemented  */
+/* rebellionChance value is the chance out of 100 of an attack happening this week */
+<<set _rebellionChance = 0>>
 
-<<set _freeCity = 0>>
-<<if $week < 40>>
-	<<set _freeCity += 2>>
-<<elseif $week < 60>>
-	<<set _freeCity += 4>>
-<<elseif $week < 110>>
-	<<set _freeCity += 6>>
-<<elseif $week < 150>>
-	<<set _freeCity +=8>>
-<<else>>
-	<<set _freeCity +=12>>
+/* Rolls to see if rebellion happens this week */
+<<if random(1,100) < _rebellionChance>>
+	<<set _slaveReb = 0>>
+	<<set _citReb = 0>>
+	<<set _mercReb = 0>>
 <</if>>
-<<if $arcologies[0].prosperity <= 50>>
-	<<set _freeCity += 2>>
-<<elseif $arcologies[0].prosperity <= 70>>
-	<<set _freeCity += 4>>
-<<elseif $arcologies[0].prosperity <= 90>>
-	<<set _freeCity += 6>>
-<<elseif $arcologies[0].prosperity <= 110>>
-	<<set _freeCity += 8>>
-<<elseif $arcologies[0].prosperity <= 130>>
-	<<set _freeCity += 12>>
-<<else>>
-	<<set _freeCity += 16>>
-<</if>>
-
-<<set _free = 0>>
-
-<<set _slaveRev = 0>>
-
-<<set _citRev = 0>>
-
-<<set _mercRev = 0>>
 
-<<set _arc = 0>>
-<<for>> /* cycle through the arcologies and calculate for each */
-
-/* Makes one proceed */
-<<set _randThrow =random(0,7)>>
-<<if _randThrow == 0>>
-	<<if $week < 60>>
-		<<set _raider = Math.clamp(0,10)>>
-	<<elseif $week < 120>>
-		<<set _raider = Math.clamp(0,15)>>
-	<<else>>
-		<<set _raider = Math.clamp(0,20)>>
-	<</if>>
-	<<set $raidersProgress += _raider>>
-<<elseif _randThrow == 1>>
-	<<if $week < 60>>
-		<<set _freeCity = Math.clamp(0,10)>>
-	<<elseif $week < 120>>
-		<<set _freeCity = Math.clamp(0,15)>>
-	<<else>>
-		<<set _freeCity = Math.clamp(0,20)>>
-	<</if>>
-	<<set $freeCityProgress += _freeCity>>
-<<elseif _randThrow == 2>>
-	<<if $week < 60>>
-		<<set _oldWorld = Math.clamp(0,10)>>
-	<<elseif $week < 120>>
-		<<set _oldWorld = Math.clamp(0,15)>>
-	<<else>>
-		<<set _oldWorld = Math.clamp(0,20)>>
-	<</if>>
-	<<set $oldWorldProgress += _oldWorld>>
-<<elseif _randThrow == 3>>
-	<<if $week < 60>>
-		<<set _free = Math.clamp(0,10)>>
-	<<elseif $week < 120>>
-		<<set _free = Math.clamp(0,15)>>
-	<<else>>
-		<<set _free = Math.clamp(0,20)>>
-	<</if>>
-	<<set $freedomProgress += _free>>
-<<elseif _randThrow == 4>>
-	<<if $week < 60>>
-		<<set _slaveRev = Math.clamp(0,10)>>
-	<<elseif $week < 120>>
-		<<set _slaveRev = Math.clamp(0,15)>>
-	<<else>>
-		<<set _slaveRev = Math.clamp(0,20)>>
-	<</if>>
-	<<set $slaveProgress += _slaveRev>>
-<<elseif _randThrow == 5>>
-	<<if $week < 60>>
-		<<set _mercRev = Math.clamp(0,10)>>
-	<<elseif $week < 120>>
-		<<set _mercRev = Math.clamp(0,15)>>
-	<<else>>
-		<<set _mercRev = Math.clamp(0,20)>>
-	<</if>>
-	<<set $mercProgress += _mercRev>>
-<<elseif _randThrow == 6>>
-	<<if $week < 60>>
-		<<set _arc = Math.clamp(0,10)>>
-	<<elseif $week < 120>>
-		<<set _arc = Math.clamp(0,15)>>
-	<<else>>
-		<<set _arc = Math.clamp(0,20)>>
-	<</if>>
-	<<set $arcologyProgress += _arc>>
-<<elseif _randThrow == 7>>
-	<<if $week < 60>>
-		<<set _citRev = Math.clamp(0,10)>>
-	<<elseif $week < 120>>
-		<<set _citRev = Math.clamp(0,15)>>
-	<<else>>
-		<<set _citRev = Math.clamp(0,20)>>
-	<</if>>
-	<<set $citizenProgress += _citRev>>
-<</if>>
 
 /* if an attack happens */
-<<if $raidersProgress == 100>>
-	<<set $attackThisWeek = 1>>
-	<<set $attackType = "raiders">>
-	<<if $terrain == "urban">>
-		<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
-	<<elseif $terrain == "rural">>
-		<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
-	<<elseif $terrain == "ravine">>
-		<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "marine">>
-		<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "oceanic">>
-		<<set $battleTerrain = "sea")>>
-	<</if>>
-	<<set $attackTroops = random(50,150)>>
-	<<if $week < 60>>
-		<<set $attackTroops *= random(1,2)>>
-	<<else>>
-		<<set $attackTroops *= random(2,3)>>
-	<</if>>
-	<<if $week < 60>>
-		<<set $attackEquip = random(0,2)>>
-	<<else>>
-		<<set $attackEquip = random(1,4)>>
-	<</if>>
-	<<set $raidersProgress = 0>>
-<<elseif $slaveProgress == 100>>
-	<<set $attackThisWeek = 1>>
-	<<set $attackType = "slave">>
-	<<if $terrain == "urban">>
-		<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
-	<<elseif $terrain == "rural">>
-		<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
-	<<elseif $terrain == "ravine">>
-		<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "marine">>
-		<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "oceanic">>
-		<<set $battleTerrain = "sea")>>
-	<</if>>
-	<<set $attackTroops = random($ASlaves * 0.05, $ASlaves * 0.1)>>
-	<<if $week < 60>>
-		<<set $attackTroops *= random(1,2)>>
-	<<elseif $week < 90>>
-		<<set $attackTroops *= random(2,3)>>
-	<<else>>
-		<<set $attackTroops *= random(3,4)>>
-	<</if>>
-	<<if $week < 60>>
-		<<set $attackEquip = random(0,1)>>
-	<<else>>
-		<<set $attackEquip = random(1,2)>>
-	<</if>>
-	<<set $slaveProgress = 0>>
-<<elseif $citizenProgress == 100>>
-	<<set $attackThisWeek = 1>>
-	<<set $attackType = "citizen">>
-	<<if $terrain == "urban">>
-		<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
-	<<elseif $terrain == "rural">>
-		<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
-	<<elseif $terrain == "ravine">>
-		<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "marine">>
-		<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "oceanic">>
-		<<set $battleTerrain = "sea")>>
-	<</if>>
-	<<set $attackTroops = random($ACitizens * 0.05, $ACitizens * 0.1)>>
-	<<if $week < 60>>
-		<<set $attackTroops *= random(1,2)>>
-	<<else>>
-		<<set $attackTroops *= random(2,3)>>
-	<</if>>
-	<<if $week < 60>>
-		<<set $attackEquip = random(0,1)>>
-	<<else>>
-		<<set $attackEquip = random(1,2)>>
-	<</if>>
-	<<set $citizenProgress = 0>>
-<<elseif $arcologyProgress == 100>>
-	<<set $attackThisWeek = 1>>
-	<<set $attackType = "arcology">>
-	<<if $terrain == "urban">>
-		<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
-	<<elseif $terrain == "rural">>
-		<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
-	<<elseif $terrain == "ravine">>
-		<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "marine">>
-		<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "oceanic">>
-		<<set $battleTerrain = "sea")>>
-	<</if>>
-	<<set $attackTroops = random(60,180)>>
-	<<if $week < 60>>
-		<<set $attackTroops *= random(1,2)>>
-	<<else>>
-		<<set $attackTroops *= random(2,3)>>
-	<</if>>
-	<<if $week < 60>>
-		<<set $attackEquip = random(0,1)>>
-	<<else>>
-		<<set $attackEquip = random(1,2)>>
-	<</if>>
-	<<if $attackingArcology.prosperity > 100>>
-		<<set $attackEquip++>>
-	<</if>>
-	<<set $arcologyProgress = 0>>
-<<elseif $freeCityProgress == 100>>
-	<<set $attackThisWeek = 1>>
-	<<set $attackType = "free city">>
-	<<if $terrain == "urban">>
-		<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
-	<<elseif $terrain == "rural">>
-		<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
-	<<elseif $terrain == "ravine">>
-		<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "marine">>
-		<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "oceanic">>
-		<<set $battleTerrain = "sea")>>
-	<</if>>
-	<<set $attackTroops = random(60,180)>>
-	<<if $week < 60>>
-		<<set $attackTroops *= random(1,2)>>
-	<<else>>
-		<<set $attackTroops *= random(2,3)>>
-	<</if>>
-	<<if $week < 60>>
-		<<set $attackEquip = random(0,1)>>
-	<<elseif $week < 90>>
-		<<set $attackEquip = random(1,3)>>
-	<<else>>
-		<<set $attackEquip = random(1,4)>>
-	<</if>>
-	<<set $freeCityProgress = 0>>
-<<elseif $oldWorldProgress == 100>>
-	<<set $attackThisWeek = 1>>
-	<<set $attackType = "old world">>
-	<<if $terrain == "urban">>
-		<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
-	<<elseif $terrain == "rural">>
-		<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
-	<<elseif $terrain == "ravine">>
-		<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "marine">>
-		<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "oceanic">>
-		<<set $battleTerrain = "sea")>>
-	<</if>>
-	<<set $attackTroops = random(100,200)>>
-	<<if $week < 60>>
-		<<set $attackTroops *= random(1,2)>>
-	<<else>>
-		<<set $attackTroops *= random(2,3)>>
-	<</if>>
-	<<if $week < 60>>
-		<<set $attackEquip = random(0,1)>>
-	<<elseif $week < 90>>
-		<<set $attackEquip = random(1,3)>>
-	<<else>>
-		<<set $attackEquip = random(1,4)>>
-	<</if>>
-	<<set $oldWorldProgress = 0>>
-<<elseif $freedomProgress == 100>>
-	<<set $attackThisWeek = 1>>
-	<<set $attackType = "freedom fighters">>
-	<<if $terrain == "urban">>
-		<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
-	<<elseif $terrain == "rural">>
-		<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
-	<<elseif $terrain == "ravine">>
-		<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "marine">>
-		<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
-	<<elseif $terrain == "oceanic">>
-		<<set $battleTerrain = "sea")>>
-	<</if>>
-	<<set $attackTroops = random(70,170)>>
-	<<if $week < 60>>
-		<<set $attackTroops *= random(1,2)>>
-	<<elseif>>
-		<<set $attackTroops *= random(2,3)>>
-	<</if>>
-	<<if $week < 60>>
-		<<set $attackEquip = random(0,1)>>
-	<<else>>
-		<<set $attackEquip = random(1,3)>>
+<<if $attackType != "none">>
+	<<if $attackType == "raiders">>
+		<<if $terrain == "urban">>
+			<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
+		<<elseif $terrain == "rural">>
+			<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
+		<<elseif $terrain == "ravine">>
+			<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
+		<<elseif $terrain == "marine">>
+			<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
+		<<elseif $terrain == "oceanic">>
+			<<set $battleTerrain = either("sea", "urban")>>
+		<</if>>
+		<<set $attackTroops = random(100,200)>>
+		<<if $week < 60>>
+			<<set $attackTroops *= random(1,2)>>
+		<<else>>
+			<<set $attackTroops *= random(2,4)>>
+		<</if>>
+		<<if $week < 60>>
+			<<set $attackEquip = random(0,2)>>
+		<<else>>
+			<<set $attackEquip = random(0,3)>>
+		<</if>>
+	<<elseif $attackType == "free city">>
+		<<if $terrain == "urban">>
+			<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
+		<<elseif $terrain == "rural">>
+			<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
+		<<elseif $terrain == "ravine">>
+			<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
+		<<elseif $terrain == "marine">>
+			<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
+		<<elseif $terrain == "oceanic">>
+			<<set $battleTerrain = either("sea", "urban")>>
+		<</if>>
+		<<set $attackTroops = random(80,180)>>
+		<<if $week < 60>>
+			<<set $attackTroops *= random(1,2)>>
+		<<else>>
+			<<set $attackTroops *= random(2,4)>>
+		<</if>>
+		<<if $week < 60>>
+			<<set $attackEquip = random(0,1)>>
+		<<elseif $week < 90>>
+			<<set $attackEquip = random(1,3)>>
+		<<else>>
+			<<set $attackEquip = random(2,4)>>
+		<</if>>
+	<<elseif $attackType == "old world">>
+		<<if $terrain == "urban">>
+			<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
+		<<elseif $terrain == "rural">>
+			<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
+		<<elseif $terrain == "ravine">>
+			<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
+		<<elseif $terrain == "marine">>
+			<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
+		<<elseif $terrain == "oceanic">>
+			<<set $battleTerrain = either("sea", "urban")>>
+		<</if>>
+		<<set $attackTroops = random(100,200)>>
+		<<if $week < 60>>
+			<<set $attackTroops *= random(1,2)>>
+		<<else>>
+			<<set $attackTroops *= random(2,4)>>
+		<</if>>
+		<<if $week < 60>>
+			<<set $attackEquip = random(0,1)>>
+		<<elseif $week < 90>>
+			<<set $attackEquip = random(1,3)>>
+		<<else>>
+			<<set $attackEquip = random(1,4)>>
+		<</if>>
+	<<elseif $attackType == "freedom fighters">>
+		<<if $terrain == "urban">>
+			<<set $battleTerrain = either("outskirts", "urban", "wasteland")>>
+		<<elseif $terrain == "rural">>
+			<<set $battleTerrain = either("hills", "outskirts", "rural", "wasteland")>>
+		<<elseif $terrain == "ravine">>
+			<<set $battleTerrain = either("mountains", "outskirts", "hills", "wasteland")>>
+		<<elseif $terrain == "marine">>
+			<<set $battleTerrain = either("coast", "outskirts", "hills", "wasteland")>>
+		<<elseif $terrain == "oceanic">>
+			<<set $battleTerrain = either("sea", "urban")>>
+		<</if>>
+		<<set $attackTroops = random(60,160)>>
+		<<if $week < 60>>
+			<<set $attackTroops *= random(1,2)>>
+		<<elseif>>
+			<<set $attackTroops *= random(2,4)>>
+		<</if>>
+		<<if $week < 60>>
+			<<set $attackEquip = random(0,1)>>
+		<<elseif $week < 90>>
+			<<set $attackEquip = random(1,3)>>
+		<<else>>
+			<<set $attackEquip = random(1,4)>>
+		<</if>>
 	<</if>>
-	<<set $freedomProgress = 0>>
 <</if>>
\ No newline at end of file
diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw
index 9099b7dd1e7fe16e50bf6df645f26977a79a4762..3b737e44ba87f56ba1a15c4f0e96a7ccffc43e37 100644
--- a/src/SecExp/attackHandler.tw
+++ b/src/SecExp/attackHandler.tw
@@ -2,7 +2,7 @@
 
 <strong>Attack Imminent</strong>
 <hr>
-The ominous message dominates the screens of your office. <<print $assistantName>> quickly gathers all information available to prepare your arcology for battle.
+The ominous message dominates the screens of your office, <<print $assistantName>> quickly gathers all information available to prepare your arcology for battle.
 <<if $attackType == "raiders">>
 	<<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>>
 		A disorganized horde of raiders is coming to your city. To such jackals your arcology surely looks like an appetizing morsel.
@@ -19,7 +19,7 @@ The ominous message dominates the screens of your office. <<print $assistantName
 	<<elseif $perimeterDrones == 1>>
 		Your drones easily spot the menacing column of consumed mercenaries and slavers. Another free city is ready to use their best tools to bring down a dangerous competitor.
 	<<else>>
-		Some of your citizens saw the disorganized horde of raiders coming towards the city and quickly reported it. Another free city is ready to use their best tools to bring down a dangerous competitor.
+		Some of your citizens saw the menacing column of consumed mercenaries and slavers and rushed to your office to bring the grim news. Another free city is ready to use their best tools to bring down a dangerous competitor.
 	<</if>>
 <<elseif $attackType == "freedom fighters">>
 	<<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>>
@@ -39,16 +39,6 @@ The ominous message dominates the screens of your office. <<print $assistantName
 	<<else>>
 		Some of your citizens saw the diciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target. 
 	<</if>>
-<<elseif $attackType == "arcology">>
-	<<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>>
-		A disorgarganized horde of armed citizens are assembling into a semblance of battleline just outside jour arcology. The differences between your arcology's culture and <<print $attackingArcology.name>> were simply to much to bear, your domain must be cleansed.
-		Fortunately you knew of their coming weeks in advance, the risk simulation system did its job admirably.
-	<<elseif $perimeterDrones == 1>>
-		Your drones easily spot the disorgarganized horde of armed citizens assembling just outside your our arcology. The differences between your arcology's culture and <<print $attackingArcology.name>> were simply to much to bear, your domain must be cleansed.
-
-	<<else>>
-		Some of your citizens, terrified by the disorgarganized horde of armed citizens assembling just outside your our arcology, were gathering near the entrance of your penthouse. The differences between your arcology's culture and <<print $attackingArcology.name>> were simply to much to bear, your domain must be cleansed.
-	<</if>>
 <<elseif $attackType == "mercenary">>
 	<<if $riskSim == 1 && $riskSimExpectedAttack == $attackType>>
 		Some sections of the lower levels were already no longer responding. In the end it happened, your own mercenaries took arms against their benefactor. 
@@ -131,11 +121,11 @@ You quickly lay down a plan of action:
 	<<else>>
 	<</if>>
 <</link>>
-<<set $leadingTroops = "assistant">>
-<br>&nbsp;&nbsp;&nbsp;&nbsp;//$assistantName will handle leaders, tactics and troop deployment to the best of her abilities.//
 
-<br><br>
+<br>&nbsp;&nbsp;&nbsp;&nbsp;//$assistantName will handle leaders, tactics and troop deployment to the best of her abilities. To be implemented//
 
+<br><br>
+<<set $leadingTroops = "assistant">>
 /* leader assignment */
 <span id="leader"><strong><<print $assistantName>></strong></span> will lead your troops.
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
diff --git a/src/SecExp/seaAttackHandler.tw b/src/SecExp/seaAttackHandler.tw
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..415da6ea6947ec8d915f11ac336b10386f5ca851 100644
--- a/src/SecExp/seaAttackHandler.tw
+++ b/src/SecExp/seaAttackHandler.tw
@@ -0,0 +1 @@
+:: seaAttackHandler [nobr]
\ No newline at end of file
diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw
index dddbf030ca1d84b681c8515396950a4fff6cf9e2..5c02e95d1464406ceecb4f52fb7715d261bcf780 100644
--- a/src/SecExp/secInit.tw
+++ b/src/SecExp/secInit.tw
@@ -5,16 +5,8 @@
 <<set $security = 50>>
 <<set $readiness = 0>>
 <<set $attackType = "none">>
-
-/* attacks progress stats */
-<<set $raidersProgress = 0>>
-<<set $slaveProgress = 0>>
-<<set $citizenProgress = 0>>
-<<set $mercProgress = 0>>
-<<set $arcologyProgress = 0>>
-<<set $freeCityProgress = 0>>
-<<set $oldWorldProgress = 0>>
-<<set $freedomProgress = 0>>
+<<set $attackThisWeek = 0>>
+<<set $lastAttackWeeks = 0>>
 
 /* armed forces stats */
 <<set $militiaCreated = 0>>
@@ -34,6 +26,8 @@
 <<set $perimeterDrones = 0>>
 
 /* battle relevant variables */
+<<set $chosenTactic = "none">>
+<<set $leadingTroops = "none">>
 <<set $attackTroops = 0>>
 <<set $attackEquip = 0>>
 <<set $deployableUnits = 0>>
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index 78c2977fea795f8122b4df361299f845f29ebb90..c9f24eb43ebb28b4b4bf33b07b2306280f363809 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -571,6 +571,9 @@
 	<<set $SSLevel = 0>>
 <</if>>
 
+/* Sec Exp */
+<<include "SecExpBackwardCompatibility">>
+
 <<if ndef $arcologies[0].FSAztecRevivalist>>
 	<<for _bci = 0; _bci < $arcologies.length; _bci++>>
 		<<set $arcologies[_bci].FSAztecRevivalist = "unset", $arcologies[_bci].FSAztecRevivalistDecoration = 0>>
diff --git a/src/uncategorized/rieEligibilityCheck.tw b/src/uncategorized/rieEligibilityCheck.tw
index 696deb559aa6f9cfee077f7ecd592f2dff719038..a9ab2ad44b295079351ce0e6c1023f7088b5889c 100644
--- a/src/uncategorized/rieEligibilityCheck.tw
+++ b/src/uncategorized/rieEligibilityCheck.tw
@@ -16,7 +16,7 @@
 <<if $hostageRescued == 1>>
 	<<goto "P hostage acquisition">>
 <<elseif $eligibleSlaves.length == 0>>
-	<<goto "Next Week">>
+	<<goto "next week">>
 <<else>>
 	<<goto "Random Individual Event">>
 <</if>>
diff --git a/src/uncategorized/scheduledEvent.tw b/src/uncategorized/scheduledEvent.tw
index fc8544edd9deacfdc071571e940e4f4250ec8362..30914bb4a0bcb733248de1a1d81c0494b87f1912 100644
--- a/src/uncategorized/scheduledEvent.tw
+++ b/src/uncategorized/scheduledEvent.tw
@@ -90,8 +90,12 @@
 	<<set $fcnn = ["FCNN service has been temporarily suspended. Please stand by."]>>
 <</if>>
 
+<<goto "attackGenerator">>
+
 <<if $rivalOwner == -1>>
 	<<goto "P rival initiation">>
+<<elseif $attackThisWeek == 1>>
+	<<goto attackHandler>>
 <<elseif $PC.labor == 1>>
 	<<goto "SE Player Birth">>
 <<elseif ($independenceDay == 1) && (Math.trunc(($week-23)/52) == ($week-23)/52)>>