:: SecExpBackwardCompatibility [nobr]

<<set $nextButton = "Continue", $nextLink = "Main", $returnTo = "Main">>

/* base stats */
<<if ndef $authority>>
<<set $authority = 0>>
<</if>>
<<if ndef $security>>
<<set $security = 30>>
<</if>>
<<if ndef $secRestPoint>>
<<set $secRestPoint = 40>>
<</if>>
<<if ndef $crime>>
<<set $crime = 30>>
<</if>>
<<if ndef $crimeCap>>
<<set $crimeCap = 100>>
<</if>>
<<if ndef $readiness>>
<<set $readiness = 1>>
<</if>>
<<if ndef $recon>>
<<set $recon = 0>>
<</if>>
<<if ndef $maxUnits>>
<<set $maxUnits = 6>>
<</if>>
<<if ndef $activeUnits>>
<<set $activeUnits = 0>>
<</if>>
<<if ndef $attackType>>
<<set $attackType = "none">>
<</if>>
<<if ndef $attackThisWeek>>
<<set $attackThisWeek = 0>>
<</if>>
<<if ndef $lastAttackWeeks>>
<<set $lastAttackWeeks = 0>>
<</if>>
<<if ndef $hasFoughtOnce>>
<<set $hasFoughtOnce = 0>>
<</if>>
<<if ndef $hasFoughtMajorBattleOnce>>
<<set $hasFoughtMajorBattleOnce = 0>>
<</if>>
<<if ndef $majorBattle>>
<<set $majorBattle = 0>>
<</if>>
<<if ndef $PCvictoryStreak>>
<<set $PCvictoryStreak = 0>>
<</if>>
<<if ndef $PClossStreak>>
<<set $PClossStreak = 0>>
<</if>>
<<if ndef $oldFlux>>
<<set $oldFlux = 0>>
<</if>>
<<if ndef $wasToggledBefore>>
<<set $wasToggledBefore = 0>>
<</if>>
<<if ndef $showBattleStatistics>>
<<set $showBattleStatistics = 0>>
<</if>>
<<if ndef $forceBattle>>
<<set $forceBattle = 0>>
<</if>>
<<if ndef $forceMajorBattle>>
<<set $forceMajorBattle = 0>>
<</if>>
<<if ndef $foughtThisWeek>>
<<set $foughtThisWeek = 0>>
<</if>>
<<if ndef $battlesEnabled>>
<<set $battlesEnabled = 1>>
<</if>>
<<if ndef $majorBattlesEnabled>>
<<set $majorBattlesEnabled = 1>>
<</if>>
<<if ndef $majorBattleGameOver>>
<<set $majorBattleGameOver = 1>>
<</if>>
<<if ndef $rebellionsEnabled>>
<<set $rebellionsEnabled = 0>>
<</if>>
<<if ndef $forceRebellion>>
<<set $forceRebellion = 0>>
<</if>>
<<if ndef $rebellionGameOver>>
<<set $rebellionGameOver = 1>>
<</if>>

/* edicts */
<<if ndef $edictsUpkeep>>
<<set $edictsUpkeep = 0>>
<</if>>
<<if ndef $edictsAuthUpkeep>>
<<set $edictsAuthUpkeep = 0>>
<</if>>
<<if ndef $alternativeRents>>
<<set $alternativeRents = 0>>
<</if>>
<<if ndef $enslavementRights>>
<<set $enslavementRights = 0>>
<</if>>
<<if ndef $securityExemption>>
<<set $securityExemption = 0>>
<</if>>
<<if ndef $sellData>>
<<set $sellData = 0>>
<</if>>
<<if ndef $propCampaignBoost>>
<<set $propCampaignBoost = 0>>
<</if>>
<<if ndef $slaveWatch>>
<<set $slaveWatch = 0>>
<</if>>
<<if ndef $subsidyChurch>>
<<set $subsidyChurch = 0>>
<</if>>
<<if ndef $limitImmigration>>
<<set $limitImmigration = 0>>
<</if>>
<<if ndef $openBorders>>
<<set $openBorders = 0>>
<</if>>
<<if ndef $limitSubhumans>>
<<set $limitSubhumans = 0>>
<</if>>
<<if ndef $slavesOfficers>>
<<set $slavesOfficers = 0>>
<</if>>
<<if ndef $martialSchool>>
<<set $martialSchool = 0>>
<</if>>
<<if ndef $discountMercenaries>>
<<set $discountMercenaries = 0>>
<</if>>
<<if ndef $militiaFounded>>
<<set $militiaFounded = 0>>
<</if>>
<<if ndef $recruitVolunteers>>
<<set $recruitVolunteers = 0>>
<</if>>
<<if ndef $militaryService>>
<<set $militaryService = 0>>
<</if>>
<<if ndef $militarizedSociety>>
<<set $militarizedSociety = 0>>
<</if>>
<<if ndef $militaryExemption>>
<<set $militaryExemption = 0>>
<</if>>
<<if ndef $lowerRquirements>>
<<set $lowerRquirements = 0>>
<</if>>
<<if ndef $noSubhumansInArmy>>
<<set $noSubhumansInArmy = 0>>
<</if>>
<<if ndef $pregExemption>>
<<set $pregExemption = 0>>
<</if>>
<<if ndef $eliteOfficers>>
<<set $eliteOfficers = 0>>
<</if>>
<<if ndef $liveTargets>>
<<set $liveTargets = 0>>
<</if>>
<<if ndef $legionTradition>>
<<set $legionTradition = 0>>
<</if>>
<<if ndef $eagleWarriors>>
<<set $eagleWarriors = 0>>
<</if>>
<<if ndef $ronin>>
<<set $ronin = 0>>
<</if>>
<<if ndef $sunTzu>>
<<set $sunTzu = 0>>
<</if>>
<<if ndef $weaponsLaw || $wasToggledBefore == 1>>
<<set $weaponsLaw = 3>>
<</if>>

/* buildings */
<<if ndef $secHQ>>
<<set $secHQ = 0>>
<</if>>
<<if ndef $secBarracks>>
<<set $secBarracks = 0>>
<</if>>
<<if ndef $secBarracksUpgrades>>
<<set $secBarracksUpgrades ={
	size: 0,
	luxury: 0,
	training: 0}>> 
<</if>>
<<if ndef $secHelots>>
<<set $secHelots = 0>>
<</if>>
<<if ndef $reqHelots>>
<<set $reqHelots = 20>>
<</if>>
<<if ndef $secUpgrades >>
<<set $secUpgrades = {
	nanoCams: 0,
	cyberBots: 0,
	eyeScan: 0,
	cryptoAnalyzer: 0,
	coldstorage: 0}>>
<</if>>	
<<if ndef $crimeUpgrades>>
<<set $crimeUpgrades = {
	autoTrial: 0,
	autoArchive: 0,
	worldProfiler: 0,
	advForensic: 0}>>
<</if>>
<<if ndef $intelUpgrades>>
	<<set $intelUpgrades = {
	sensors: 0,
	radar: 0,
	signalIntercept: 0}>>
<</if>>
<<if ndef $readinessUpgrades>>
<<set $readinessUpgrades = {
	earlyWarn: 0,
	rapidPlatforms: 0,
	pathways: 0,
	rapidVehicles: 0}>>
<</if>>
<<if ndef $propHub>>
	<<set $propHub = 0>>
<</if>>
<<if ndef $propCampaign>>
<<set $propCampaign = 0>>
<</if>>
<<if ndef $propFocus>>
<<set $propFocus = "none">>
<</if>>
<<if ndef $miniTruth>>
<<set $miniTruth = 0>>
<</if>>
<<if ndef $fakeNews>>
<<set $fakeNews = 0>>
<</if>>
<<if ndef $controlLeaks>>
<<set $controlLeaks = 0>>
<</if>>
<<if ndef $secretService>>
<<set $secretService = 0>>
<</if>>
<<if ndef $blackOps>>
<<set $blackOps = 0>>
<</if>>
<<if ndef $marketInfiltration>>
<<set $marketInfiltration = 0>>
<</if>>
<<if ndef $propHubUpkeep>>
<<set $propHubUpkeep = $facilityCost * 5>>
<</if>>
<<if ndef $secHQUpkeep>>
<<set $secHQUpkeep = $facilityCost * 5>>
<</if>>
<<if ndef $secBarracksUpkeep>>
<<set $secBarracksUpkeep = $facilityCost * 5>>
<</if>>
<<if ndef $upgradeUpkeep>>
<<set $upgradeUpkeep = 50>>
<</if>>
<<if ndef $riotCenter>>
<<set $riotCenter = 0>>
<</if>>
<<if ndef $riotUpgrades>>
<<set $riotUpgrades = {
	freeMedia: 0,
	rapidUnit: 0,
	rapidUnitSpeed: 0}>>
<</if>>
<<if ndef $fort>>
<<set $fort = {
	reactor: 0,
	waterway: 0,
	assistant:0}>>
<</if>>
<<if ndef $sentUnitCooldown>>
<<set $sentUnitCooldown = 0>>
<</if>>
<<if ndef $advancedRiotEquip>>
<<set $advancedRiotEquip = 0>>
<</if>>
<<if ndef $brainImplant>>
<<set $brainImplant = -1>>
<</if>>
<<if ndef $brainImplantProject>>
<<set $brainImplantProject = 0>>
<</if>>

/* events */
<<if ndef $smilingManProgress>>
<<set $smilingManProgress = 0>>
<</if>>
<<if ndef $investedFunds>>
<<set $investedFunds = 0>>
<</if>>
<<if ndef $relationshipLM>>
<<set $relationshipLM = 0>>
<</if>>
<<if ndef $captureRoute>>
<<set $captureRoute = 0>>
<</if>>
<<if ndef $collaborationRoute>>
<<set $collaborationRoute = 0>>
<</if>>
<<if ndef $hostileRoute>>
<<set $hostileRoute = 0>>
<</if>>
<<if ndef $smilingManWeek>>
<<set $smilingManWeek = 0>>
<</if>>
<<if ndef $globalCrisisWeeks>>
<<set $globalCrisisWeeks = 0>>
<</if>>
<<if ndef $smilingManFate>>
<<set $smilingManFate = 4>>
<</if>>

/* rebellions */
<<if ndef $tension>>
<<set $tension = 0>>
<</if>>
<<if ndef $slaveProgress>>
<<set $slaveProgress = 0>>
<</if>>
<<if ndef $citizenProgress>>
<<set $citizenProgress = 0>>
<</if>>
<<if ndef $slaveRebellionEventFires>>
<<set $slaveRebellionEventFires = 0>>
<</if>>
<<if ndef $citizenRebellionEventFires>>
<<set $citizenRebellionEventFires = 0>>
<</if>>
<<if ndef $slaveRebellion>>
<<set $slaveRebellion = 0>>
<</if>>
<<if ndef $citizenRebellion>>
<<set $citizenRebellion = 0>>
<</if>>
<<if ndef $rebellingUnits>>
<<set $rebellingUnits = []>>
<</if>>
<<if ndef $notInvolved>>
<<set $notInvolved = 0>>
<</if>>
<<if ndef $engageRule>>
<<set $engageRule = 0>>
<</if>>
<<if ndef $irregulars>>
<<set $irregulars = 0>>
<</if>>
<<if ndef $rebellingMilitia>>
<<set $rebellingMilitia = 0>>
<</if>>
<<if ndef $rebellingSlaves>>
<<set $rebellingSlaves = 0>>
<</if>>
<<if ndef $rebellingMercs>>
<<set $rebellingMercs = 0>>
<</if>>
<<if ndef $repairTime>>
<<set $repairTime = 3>>
<</if>>
<<if ndef $arcRepairTime>>
<<set $arcRepairTime = 0>>
<</if>>
<<if ndef $rebelDefeatAftermath>>
<<set $rebelDefeatAftermath = 0>>
<</if>>
<<if ndef $garrison>>
<<set $garrison = {
	penthouse: 0,
	reactor: 0,
	assistant: 0,
	waterway: 0,
	reactorTime: 0,
	assistantTime: 0,
	waterwayTime: 0 }>>
<</if>>
	
/* armed forces stats */
<<if ndef $targetUnit>>
<<set $targetUnit = 0>>
<</if>>
<<if ndef $targetIndex>>
<<set $targetIndex = 0>>
<</if>>
<<if ndef $secBotsCost>>
<<set $secBotsCost = 500>>
<</if>>
<<if ndef $secBotsUpgradeCost>>
<<set $secBotsUpgradeCost = 250>>
<</if>>
<<if ndef $equipUpgradeCost>>
<<set $equipUpgradeCost = 250>>
<</if>>
<<if ndef $maxTroops>>
<<set $maxTroops = 30>>
<</if>>
<<if ndef $militiaFounded>>
<<set $militiaFounded = 0>>
<</if>>
<<if ndef $militiaRecruitment>>
<<set $militiaRecruitment = 0>>
<</if>>
<<if ndef $militiaTotalManpower>>
<<set $militiaTotalManpower = 0>>
<</if>>
<<if ndef $militiaFreeManpower>>
<<set $militiaFreeManpower = 0>>
<</if>>
<<if ndef $militiaEmployedManpower>>
<<set $militiaEmployedManpower = 0>>
<</if>>
<<if ndef $militiaTotalCasualties>>
<<set $militiaTotalCasualties = 0>>
<</if>>
<<if ndef $slavesOfficers>>
<<set $slavesOfficers = 0>>
<</if>>
<<if ndef $slavesEmployedManpower>>
<<set $slavesEmployedManpower = 0>>
<</if>>
<<if ndef $slavesTotalCasualties>>
<<set $slavesTotalCasualties = 0>>
<</if>>
<<if ndef $slavesMaxTroops>>
<<set $slavesMaxTroops = 30>>
<</if>>
<<if ndef $mercTotalManpower>>
<<set $mercTotalManpower = 0>>
<</if>>
<<if ndef $mercFreeManpower>>
<<set $mercFreeManpower = 0>>
<</if>>
<<if ndef mercEmployedManpower>>
<<set $mercEmployedManpower = 0>>
<</if>>
<<if ndef $mercTotalCasualties>>
<<set $mercTotalCasualties = 0>>
<</if>>
<<if ndef $militiaLoyalty>>
<<set $militiaLoyalty = 0>>
<</if>>
<<if ndef $slaveArmyLoyalty>>
<<set $slaveArmyLoyalty = 0>>
<</if>>
<<if ndef $mercLoyalty>>
<<set $mercLoyalty = 0>>
<</if>>
<<if ndef $soldierUpkeep>>
<<set $soldierUpkeep = 10>>
<</if>>
<<if ndef $createdSlavesUnits>>
<<set $createdSlavesUnits = 0>>
<</if>>
<<if ndef $createdMilitiaUnits>>
<<set $createdMilitiaUnits = 0>>
<</if>>
<<if ndef $createdMercUnits>>
<<set $createdMercUnits = 0>>
<</if>>


/* battle relevant vars */
<<if ndef $totalKills>>
<<set $totalKills = 0>>
<</if>>
<<if ndef $battlesCount>>
<<set $battlesCount = 0>>
<</if>>
<<if ndef $majorBattlesCount>>
<<set $majorBattlesCount = 0>>
<</if>>
<<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 $deployingBots>>
	<<set $deployingBots = 0>>
<</if>>
<<if ndef $deployingMilitia>>
	<<set $deployingMilitia = 0>>
<</if>>
<<if ndef $deployingSlaves>>
	<<set $deployingSlaves = 0>>
<</if>>
<<if ndef $deployingMercs>>
	<<set $deployingMercs = 0>>
<</if>>
<<if ndef $battleTerrain>>
	<<set $battleTerrain = "none">>
<</if>>
<<if ndef $maxTurns>>
	<<set $maxTurns = 10>>
<</if>>
<<if ndef $battleResult>>
	<<set $battleResult = 4>>				/* sets $battleResult value outside accepted range (-3,3) to avoid evaluation problems */
<</if>>
<<if ndef $losses>>
	<<set $losses = 0>>
<</if>>
<<if ndef $enemyLosses>>
	<<set $enemyLosses = 0>>
<</if>>
<<if ndef $battleTurns>>
	<<set $battleTurns = 0>>
<</if>>
<<if ndef $bribeCost>>
	<<set $bribeCost = 0>>
<</if>>
<<if ndef $tacticsSuccessful>>
	<<set $tacticsSuccessful = 0>>
<</if>>
<<if ndef $leaderWounded>>
	<<set $leaderWounded = 0>>				/* 0=no wound, 1=mute, 2=blind, 3=amputee, 4=health */
<</if>>
<<if ndef $gainedCombat>>
	<<set $gainedCombat = 0>>
<</if>>
<<if ndef $gainedWarfare>>
<<set $gainedWarfare = 0>>
<</if>>
<<if ndef $PCWounded>>
<<set $PCWounded = 0>>
<</if>>
<<if ndef $PCWoundCooldown>>
<<set $PCWoundCooldown = 0>>
<</if>>
<<if ndef $expectedEquip>>
<<set $expectedEquip = 0>>
<</if>>
<<if ndef $estimatedMen>>
<<set $estimatedMen = 0>>
<</if>>
<<if ndef $SFIntervention>>
<<set $SFIntervention = 0>>
<</if>>
<<if ndef $carriableSoldiers>>
<<set $carriableSoldiers = 0>>
<</if>>

/* statistics */
<<if $baseBribePerAttacker != 5>>
<<set $baseBribePerAttacker = 5>>
<</if>>
<<if $equipMod != 15>>
<<set $equipMod = 0.15>>
<</if>>
<<if $secBotsBaseAttack != 7>>
<<set $secBotsBaseAttack = 7>>
<</if>>
<<if $secBotsBaseDefense != 3>>
<<set $secBotsBaseDefense = 3>>
<</if>>
<<if $secBotsMorale != 200>>
<<set $secBotsMorale = 200>>
<</if>>
<<if $secBotsBaseHp != 3>>
<<set $secBotsBaseHp = 3>>
<</if>>
<<if $militiaBaseAttack != 7>>
<<set $militiaBaseAttack = 7>>
<</if>>
<<if $militiaBaseDefense != 5>>
<<set $militiaBaseDefense = 5>>
<</if>>
<<if $militiaBaseMorale != 140>>
<<set $militiaBaseMorale = 140>>
<</if>>
<<if $militiaBaseHp != 3>>
<<set $militiaBaseHp = 3>>
<</if>>
<<if $slaveBaseAttack != 9>>
<<set $slaveBaseAttack = 9>>
<</if>>
<<if $slaveBaseDefense != 3>>
<<set $slaveBaseDefense = 3>>
<</if>>
<<if $slaveBaseMorale != 110>>
<<set $slaveBaseMorale = 110>>
<</if>>
<<if $slaveBaseHp != 3>>
<<set $slaveBaseHp = 3>>
<</if>>
<<if $mercBaseAttack != 8>>
<<set $mercBaseAttack = 8>>
<</if>>
<<if $mercBaseDefense != 4>>
<<set $mercBaseDefense = 4>>
<</if>>
<<if $mercBaseMorale != 125>>
<<set $mercBaseMorale = 125>>
<</if>>
<<if $mercBaseHp != 4>>
<<set $mercBaseHp = 4>>
<</if>>
<<if $SFBaseAttack != 8>>
<<set $SFBaseAttack = 8>>
<</if>>
<<if $SFBaseDefense != 4>>
<<set $SFBaseDefense = 4>>
<</if>>
<<if $SFBaseMorale != 140>>
<<set $SFBaseMorale = 140>>
<</if>>
<<if $SFBaseHp != 4>>
<<set $SFBaseHp = 4>>
<</if>>

<<if $raBaseAttack != 7>>
<<set $raBaseAttack = 7>>
<</if>>
<<if $raBaseDefense != 2>>
<<set $raBaseDefense = 2>>
<</if>>
<<if $raBaseMorale != 100>>
<<set $raBaseMorale = 100>>
<</if>>
<<if $raBaseHp != 2>>
<<set $raBaseHp = 2>>
<</if>>
<<if $fcBaseAttack != 6>>
<<set $fcBaseAttack = 6>>
<</if>>
<<if $fcBaseDefense != 4>>
<<set $fcBaseDefense = 4>>
<</if>>
<<if $fcBaseMorale != 130>>
<<set $fcBaseMorale = 130>>
<</if>>
<<if $fcBaseHp != 3>>
<<set $fcBaseHp = 3>>
<</if>>
<<if $owBaseAttack != 8>>
<<set $owBaseAttack = 8>>
<</if>>
<<if $owBaseDefense != 4>>
<<set $owBaseDefense = 4>>
<</if>>
<<if $owBaseMorale != 110>>
<<set $owBaseMorale = 110>>
<</if>>
<<if $owBaseHp != 2>>
<<set $owBaseHp = 2>>
<</if>>
<<if $ffBaseAttack != 9>>
<<set $ffBaseAttack = 9>>
<</if>>
<<if $ffBaseDefense != 2>>
<<set $ffBaseDefense = 2>>
<</if>>
<<if $ffBaseMorale != 160>>
<<set $ffBaseMorale = 160>>
<</if>>
<<if $ffBaseHp != 2>>
<<set $ffBaseHp = 2>>
<</if>>

/* units */
<<if ndef $secBots>>
	<<if $arcologyUpgrade.drones == 0>>
		<<set $secBots = {
		active: 0,
		isDeployed: 0,
		troops: 0,
		maxTroops: 0,
		equip: 0} >>
	<<elseif $arcologyUpgrade.drones == 1>>
		<<set $secBots = {
		active: 1,
		isDeployed: 0,
		troops: 50,
		maxTroops: 50,
		equip: 0} >>
	<</if>>
<<elseif def $secBots>>
	<<if $arcologyUpgrade.drones == 0>>
		<<set $secBots = {
		active: 0,
		isDeployed: 0,
		troops: 0,
		maxTroops: 0,
		equip: 0} >>
	<<elseif $arcologyUpgrade.drones == 1>>
		<<set $secBots = {
		active: 1,
		isDeployed: 0,
		troops: 50,
		maxTroops: 50,
		equip: 0} >>
	<</if>>
<</if>>

<<if ndef $militiaUnits>>
	<<set $militiaUnits = []>>
<</if>>
<<if ndef $slaveUnits>>
	<<set $slaveUnits = []>>
<</if>>
<<if ndef $mercUnits>>
	<<set $mercUnits = []>>
<</if>>

/* SFanon additions */
<<if ndef $SFSupportLevel>>
	<<set $SFSupportLevel = 0>> 
<</if>>
<<if ndef $SFSupportUpkeep>>
<<set $SFSupportUpkeep = 0>>
<</if>>
<<if ndef $secUpgrades.coldstorage>>
	<<set $secUpgrades.coldstorage = 0>>
<</if>>

/* recalculation widgets */
<<fixBrokenUnits>>
<<fixBrokenStats>>
<<recalcSecRestPoint>>
<<recalcCrimeCap>>
<<recalcReqHelots>>
<<recalcManpower>>
<<recalcEdictsUpkeep>>

<<set $wasToggledBefore = 1>>

<br>Missing Security Expansion variables set. All done!