code:
:: attackReport [nobr]

<<set $nextButton = "Continue", $nextLink = "Scheduled Event", $showEncyclopedia = 1, $encyclopedia = "Battles">>

/*init*/
<<set _oldRep = $rep>>
<<set _oldAuth = $authority>>
<<set $enemyLosses = Math.trunc($enemyLosses)>>
<<if $enemyLosses > $attackTroops>>
	<<set $enemyLosses = $attackTroops>>
<</if>>
<<set $totalKills += $enemyLosses>>
<<set $losses = Math.trunc($losses)>>
<<set _loot = 0>>

/* result */
<<if $majorBattle == 0>>
	<<set $battlesCount++>>
	<<set _majorBattleMod = 1>>
	<<if $battleResult == 3>>
		Victory!
		<<set $PClossStreak = 0>>
		<<set $PCvictoryStreak += 1>>
		<<set $PCvictories++>>
	<<elseif $battleResult == -3>>
		Defeat!
		<<set $PClossStreak += 1>>
		<<set $PCvictoryStreak = 0>>
		<<set $PClosses++>>
	<<elseif $battleResult == 2>>
		Partial victory!
		<<set $PCvictories++>>
	<<elseif $battleResult == -2>>
		Partial defeat!
		<<set $PClosses++>>
	<<elseif $battleResult == -1>>
		We surrendered
		<<set $PClosses++>>
	<<elseif $battleResult == 0>>
		Failed bribery!
		<<set $PClosses++>>
	<<elseif $battleResult == 1>>
		Successful bribery!
		<<set $PCvictories++>>
	<</if>>
<<else>>
	<<set _majorBattleMod = 2>>
	<<set $battlesCount++>>
	<<set $majorBattlesCount++>>
	<<if $battleResult == 3>>
		Major victory!
		<<set $PClossStreak = 0>>
		<<set $PCvictoryStreak += 1>>
		<<set $PCvictories++>>
	<<elseif $battleResult == -3>>
		Major Defeat!
		<<set $PClossStreak += 1>>
		<<set $PCvictoryStreak = 0>>
		<<set $PClosses++>>
	<<elseif $battleResult == 2>>
		Partial victory!
		<<set $PCvictories++>>
	<<elseif $battleResult == -2>>
		Partial defeat!
		<<set $PClosses++>>
	<<elseif $battleResult == -1>>
		We surrendered
		<<set $PClosses++>>
	<<elseif $battleResult == 0>>
		Failed bribery!
		<<set $PClosses++>>
	<<elseif $battleResult == 1>>
		Successful bribery!
		<<set $PCvictories++>>
	<</if>>
<</if>>
<<set _day = $day + random(0,7)>>
<<set _month = $month>>
<<set _year = $year>>
<<switch _month>>
<<case "January">>
<<if _day > 31>>
	<<set _day -= 31, _month = "February">>
<</if>>
<<case "February">>
<<if _day > 28>>
	<<set _day -= 28, _month = "March">>
<</if>>
<<case "March">>
<<if _day > 31>>
	<<set _day -= 31, _month = "April">>
<</if>>
<<case "April">>
<<if _day > 30>>
	<<set _day -= 30, _month = "May">>
<</if>>
<<case "May">>
<<if _day > 31>>
	<<set _day -= 31, _month = "June">>
<</if>>
<<case "June">>
<<if _day > 30>>
	<<set _day -= 30, _month = "July">>
<</if>>
<<case "July">>
<<if _day > 31>>
	<<set _day -= 31, _month = "August">>
<</if>>
<<case "August">>
<<if _day > 31>>
	<<set _day -= 31, _month = "September">>
<</if>>
<<case "September">>
<<if _day > 30>>
	<<set _day -= 30, _month = "October">>
<</if>>
<<case "October">>
<<if _day > 31>>
	<<set _day -= 31, _month = "November">>
<</if>>
<<case "November">>
<<if _day > 30>>
	<<set _day -= 30, _month = "December">>
<</if>>
<<default>>
<<if _day > 31>>
	<<set _day -= 31, _month = "January", _year += 1>>
<</if>>
<</switch>>

<<if $attackType == "raiders">>
	Today, the _day of _month _year, our arcology was attacked by a band of wild raiders, $attackTroops men strong.
	<<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>>
		Our defense forces, $troopCount strong, clashed with them
		<<if $battleTerrain == "urban">>
			in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>,
			<<elseif $battleTerrain == "rural">>
			in the rural land surrounding the free city,
		<<elseif $battleTerrain == "hills">>
			on the hills around the free city,
		<<elseif $battleTerrain == "coast">>
			along the coast just outside the free city,
			<<elseif $battleTerrain == "outskirts">>
			just against the walls of the arcology,
		<<elseif $battleTerrain == "mountains">>
			in the mountains overlooking the arcology,
		<<elseif $battleTerrain == "wasteland">>
			in the wastelands outside the free city territory,
		<</if>>
		<<if $enemyLosses != $attackTroops>>
			inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves.
		<<else>>
			completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties. <<elseif $losses > 0>> a casualty. <<else>> zero casualties.<</if>>
		<</if>>
	<</if>>
	<<if $battleResult == 3>>
		<<if $battleTurns <= 5>>
			The fight was quick and one sided, our men easily stopped the disorganized horde futile attempt at raiding your arcology
		<<elseif $battleTurns <= 7>>
			The fight was hard, but in the end our men stopped the disorganized horde attempt at raiding your arcology
		<<else>>
			The fight was long and hard, but our men managed to stop the horde raiding party
		<</if>>
		<<if $PCvictoryStreak >= 2>>
			, adding another victory to the growing list of our military's successes.
		<<elseif $PClossStreak >= 2>>
			, finally putting an end to a series of unfortunate defeats.
		<<else>>
			.
		<</if>>
	<<elseif $battleResult == -3>>
		<<if $battleTurns <= 5>>
			The fight was quick and one sided, our men were easily crushed by the barbaric horde of raiders
		<<elseif $battleTurns <= 7>>
			The fight was hard and in the end the bandits proved too much to handle for our men
		<<else>>
			The fight was long and hard, but despite their bravery the horde proved too much for our men
		<</if>>
			<<if $PCvictoryStreak >= 2>>
				, so interrupting a long series of military successes.
		<<elseif $PClossStreak >= 2>>
				, confirming the long list of recent failures our armed forces collected.
		<<else>>
			.
		<</if>>
	<<elseif $battleResult == 2>>
		The fight was long and hard, but in the end our men managed to repel the raiders, though not without difficulty.
	<<elseif $battleResult == -2>>
		The fight was long and hard. Our men in the end had to yield to the horde raiders, which was fortunately unable to capitalized on their victory.
	<<elseif $battleResult == -1>>
		You gave your troops the order to surrender, obediently they stand down.
	<<elseif $battleResult == 0>>
		You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.
	<<elseif $battleResult == 1>>
		You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.
	<</if>>
<<elseif $attackType == "free city">>
	Today, the _day of _month _year, our arcology was attacked by a contingent of mercenaries hired by a competing free city, $attackTroops men strong.
	<<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>>
		Our defense forces, $troopCount strong, clashed with them
		<<if $battleTerrain == "urban">>
			in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>,
		<<elseif $battleTerrain == "rural">>
			in the rural land surrounding the free city,
		<<elseif $battleTerrain == "hills">>
			on the hills around the free city,
		<<elseif $battleTerrain == "coast">>
			along the coast just outside the free city,
		<<elseif $battleTerrain == "outskirts">>
			just against the walls of the arcology,
		<<elseif $battleTerrain == "mountains">>
			in the mountains overlooking the arcology,
		<<elseif $battleTerrain == "wasteland">>
			in the wastelands outside the free city territory,
		<</if>>
		<<if $enemyLosses != $attackTroops>>
			inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves.
		<<else>>
			completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty .<<else>> zero casualties.<</if>>
		<</if>>
	<</if>>
	<<if $battleResult == 3>>
		<<if $battleTurns <= 5>>
			The fight was quick and one sided, our men easily stopped the mercenaries dead in their tracks
		<<elseif $battleTurns <= 7>>
			The fight was hard, but in the end our men stopped the slavers attempt at weakening your arcology
		<<else>>
			The fight was long and hard, but our men managed to stop the free city mercenaries
		<</if>>
		<<if $PCvictoryStreak >= 2>>
			, adding another victory to the growing list of our military's successes.
		<<elseif $PClossStreak >= 2>>
			, finally putting an end to a series of unfortunate defeats.
		<<else>>
			.
		<</if>>
	<<elseif $battleResult == -3>>
		<<if $battleTurns <= 5>>
				The fight was quick and one sided, our men were easily crushed by the consumed mercenary veterans sent against us
		<<elseif $battleTurns <= 7>>
			The fight was hard and in the end the slavers proved too much to handle for our men
		<<else>>
			The fight was long and hard, but despite their bravery the mercenary slavers proved too much for our men
		<</if>>
		<<if $PCvictoryStreak >= 2>>
			, so interrupting a long series of military successes.
		<<elseif $PClossStreak >= 2>>
			, confirming the long list of recent failures our armed forces collected.
		<<else>>
			.
		<</if>>
	<<elseif $battleResult == 2>>
		The fight was long and hard, but in the end our men managed to repel the mercenaries, though not without difficulty.
	<<elseif $battleResult == -2>>
		The fight was long and hard. Our men in the end had to yield to the slavers, which were fortunately unable to capitalized on their victory.
	<<elseif $battleResult == -1>>
		You gave your troops the order to surrender, obediently they stand down.
	<<elseif $battleResult == 0>>
		You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.
	<<elseif $battleResult == 1>>
		You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.
	<</if>>
<<elseif $attackType == "freedom fighters">>
	Today, the _day of _month _year, our arcology was attacked by a group of freedom fighters bent on the destruction of the institution of slavery, $attackTroops men strong.
	<<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>>
		Our defense forces, $troopCount strong, clashed with them
		<<if $battleTerrain == "urban">>
			in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>,
		<<elseif $battleTerrain == "rural">>
			in the rural land surrounding the free city,
		<<elseif $battleTerrain == "hills">>
			on the hills around the free city,
		<<elseif $battleTerrain == "coast">>
			along the coast just outside the free city,
		<<elseif $battleTerrain == "outskirts">>
			just against the walls of the arcology,
		<<elseif $battleTerrain == "mountains">>
			in the mountains overlooking the arcology,
		<<elseif $battleTerrain == "wasteland">>
			in the wastelands outside the free city territory,
		<</if>>
		<<if $enemyLosses != $attackTroops>>
			inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves.
		<<else>>
			completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty. <<else>> zero casualties.<</if>>
		<</if>>
	<</if>>
	<<if $battleResult == 3>>
		<<if $battleTurns <= 5>>
			The fight was quick and one sided, our men easily stopped the freedom fighters dead in their tracks
		<<elseif $battleTurns <= 7>>
			The fight was hard, but in the end our men stopped the fighters attack
		<<else>>
			The fight was long and hard, but our men managed to stop the freedom fighters
		<</if>>
		<<if $PCvictoryStreak >= 2>>
			, adding another victory to the growing list of our military's successes.
		<<elseif $PClossStreak >= 2>>
			, finally putting an end to a series of unfortunate defeats.
		<<else>>
			.
		<</if>>
	<<elseif $battleResult == -3>>
		<<if $battleTurns <= 5>>
			The fight was quick and one sided, our men were easily crushed by the fanatical fury of the freedom fighters
		<<elseif $battleTurns <= 7>>
			The fight was hard and in the end the freedom fighters proved too much to handle for our men
		<<else>>
			The fight was long and hard, but despite their bravery the freedom fighters fury proved too much for our men
		<</if>>
		<<if $PCvictoryStreak >= 2>>
			, so interrupting a long series of military successes.
		<<elseif $PClossStreak >= 2>>
			, confirming the long list of recent failures our armed forces collected.
		<<else>>
			.
		<</if>>
	<<elseif $battleResult == 2>>
			The fight was long and hard, but in the end our men managed to repel the freedom fighters, though not without difficulty.
	<<elseif $battleResult == -2>>
		The fight was long and hard. Our men in the end had to yield to the freedom fighters, which were fortunately unable to capitalized on their victory.
	<<elseif $battleResult == -1>>
		You gave your troops the order to surrender, obediently they stand down.
	<<elseif $battleResult == 0>>
		You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.
	<<elseif $battleResult == 1>>
		You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.
	<</if>>
<<elseif $attackType == "old world">>
	Today, the _day of _month _year, our arcology was attacked by an old world nation boasting a misplaced sense of superiority, $attackTroops men strong.
	<<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>>
		Our defense forces, $troopCount strong, clashed with them
		<<if $battleTerrain == "urban">>
			in the streets of <<if $terrain == "urban">>the old world city surrounding the arcology<<else>>of the free city<</if>>,
		<<elseif $battleTerrain == "rural">>
			in the rural land surrounding the free city,
		<<elseif $battleTerrain == "hills">>
			on the hills around the free city,
		<<elseif $battleTerrain == "coast">>
			along the coast just outside the free city,
		<<elseif $battleTerrain == "outskirts">>
			just against the walls of the arcology,
		<<elseif $battleTerrain == "mountains">>
			in the mountains overlooking the arcology,
		<<elseif $battleTerrain == "wasteland">>
			in the wastelands outside the free city territory,
		<</if>>
		<<if $enemyLosses != $attackTroops>>
			inflicting <<print $enemyLosses>> casualties, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty <<else>> zero <</if>> themselves.
		<<else>>
			completely annihilating their troops, while sustaining <<if $losses > 1>> <<print commaNum(Math.trunc($losses))>> casualties <<elseif $losses > 0>> a casualty. <<else>> zero casualties.<</if>>
		<</if>>
	<</if>>
	<<if $battleResult == 3>>
		<<if $battleTurns <= 5>>
			The fight was quick and one sided, our men easily stopped the old world soldiers dead in their tracks
		<<elseif $battleTurns <= 7>>
			The fight was hard, but in the end our men stopped the soldiers of the old world
		<<else>>
			The fight was long and hard, but our men managed to stop the old world soldiers
		<</if>>
		<<if $PCvictoryStreak >= 2>>
			, adding another victory to the growing list of our military's successes.
		<<elseif $PClossStreak >= 2>>
			, finally putting an end to a series of unfortunate defeats.
		<<else>>
			.
		<</if>>
	<<elseif $battleResult == -3>>
		<<if $battleTurns <= 5>>
			The fight was quick and one sided, our men were easily crushed by the discipline of the old world armies
		<<elseif $battleTurns <= 7>>
			The fight was hard and in the end the old world proved too much to handle for our men
		<<else>>
			The fight was long and hard, but despite their bravery the determination of the old world troops proved too much for our men
		<</if>>
		<<if $PCvictoryStreak >= 2>>
			, so interrupting a long series of military successes.
		<<elseif $PClossStreak >= 2>>
			, confirming the long list of recent failures our armed forces collected.
		<<else>>
			.
		<</if>>
	<<elseif $battleResult == 2>>
		The fight was long and hard, but in the end our men managed to repel the old world soldiers, though not without difficulty.
	<<elseif $battleResult == -2>>
		The fight was long and hard. Our men in the end had to yield to the old world soldiers, which were fortunately unable to capitalized on their victory.
	<<elseif $battleResult == -1>>
		You gave your troops the order to surrender, obediently they stand down.
	<<elseif $battleResult == 0>>
		You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.
	<<elseif $battleResult == 1>>
		You decided in favor of a financial approach rather than open hostilities. Your troops remain inside the arcology's walls.
	<</if>>
<</if>>

/* calculates effects on the city */
<<if $battleResult == 3>>
	Thanks to your victory, your @@.green;reputation@@ and @@.darkviolet;authority@@ increased. You were also able to capture
	<<if $attackType == "raiders">>
		<<set $rep += 800 * _majorBattleMod>>
		<<set $authority += 800 * _majorBattleMod>>
	<<elseif $attackType == "free city">>
		<<set $rep += 1200 * _majorBattleMod>>
		<<set $authority += 1200 * _majorBattleMod>>
	<<elseif $attackType == "freedom fighters">>
		<<set $rep += 1500 * _majorBattleMod>>
		<<set $authority += 1500 * _majorBattleMod>>
	<<elseif $attackType == "old world">>
		<<set $rep += 1200 * _majorBattleMod>>
		<<set $authority += 1200 * _majorBattleMod>>
	<</if>>
	<<if $attackTroops - $enemyLosses <= 50>>
		a small amount of attackers,
		<<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>>
	<<elseif $attackTroops - $enemyLosses <= 100>>
		an healthy group of attackers,
		<<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>>
	<<elseif $attackTroops - $enemyLosses <= 150>>
		a big group of attackers,
		<<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>>
	<<elseif $attackTroops - $enemyLosses <= 200>>
		a huge group of attackers,
		<<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>>
	<<elseif $attackTroops - $enemyLosses > 200>>
		a great amount of attackers,
		<<set _captives = ($attackTroops - $enemyLosses) * 0.1 * random(1,3)>>
	<</if>>
	and some of their equipment, which once sold produced
	<<if $attackEquip == 0>>
		@@.yellowgreen;a small amount of cash.@@
		<<set _loot += 1000 * _majorBattleMod>>
	<<elseif $attackEquip == 1>>
		@@.yellowgreen;a moderate amount of cash.@@
		<<set _loot += 5000 * _majorBattleMod>>
	<<elseif $attackEquip == 2>>
		@@.yellowgreen;a good amount of cash.@@
		<<set _loot += 10000 * _majorBattleMod>>
	<<elseif $attackEquip == 3>>
		@@.yellowgreen;a great amount of cash.@@
		<<set _loot += 15000 * _majorBattleMod>>
	<<elseif $attackEquip == 4>>
		@@.yellowgreen;wealth worthy of the mightiest warlord.@@
		<<set _loot += 20000 * _majorBattleMod>>
	<</if>>
	<<if $mercSoldierPrivilege == 1 && $deployingMercs == 1>>
		Part of the loot is distributed to your mercenaries.
		<<set _captives = Math.trunc(_captives * 0.6)>>
		<<set _loot = Math.trunc(_loot * 0.6)>>
	<</if>>
	<<set $cash += _loot>>

	Damage to the infrastructure was @@.yellow;virtually non-existent@@, 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.
	<<set $cash -= 1000 * _majorBattleMod, $PC.engineering += .1>>
	<<if $PCvictoryStreak >= 3>>
		It seems your victories over the constant threats directed your way is having  @@.green;a positive effect on the prosperity of the arcology@@, due to the security your leadership affords.
		<<set $arcologies[0].prosperity += 5 * _majorBattleMod>>
	<</if>>
<<elseif $battleResult == -3>>
	Due to your defeat, your @@.red;reputation@@ and @@.red;authority@@ decreased. Obviously your troops were not able to capture anyone or anything.
	<<if $attackType == "raiders">>
		<<set $rep -= 400 * _majorBattleMod>>
		<<set $authority -= 400 * _majorBattleMod>>
	<<elseif $attackType == "free city">>
		<<set $rep -= 600 * _majorBattleMod>>
		<<set $authority -= 600 * _majorBattleMod>>
	<<elseif $attackType == "freedom fighters">>
		<<set $rep -= 750 * _majorBattleMod>>
		<<set $authority -= 750 * _majorBattleMod>>
	<<elseif $attackType == "old world">>
		<<set $rep -= 600 * _majorBattleMod>>
		<<set $authority -= 600 * _majorBattleMod>>
	<</if>>

	In the raiding following the battle @@.red;the arcology sustained heavy damage@@, which will cost quite the amount of cash to fix. Reports of @@.red;citizens or slaves killed or missing@@ flood your office for a few days following the defeat.
	<<set $cash -= 5000 * _majorBattleMod, $PC.engineering += .1>>
	<<if $week <= 30>>
		<<set $ACitizens -= random(100) * _majorBattleMod>>
		<<set $ASlaves -= random(150) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(5) * _majorBattleMod>>
	<<elseif $week <= 60>>
		<<set $ACitizens -= random(120) * _majorBattleMod>>
		<<set $ASlaves -= random(170) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(10) * _majorBattleMod>>
	<<elseif $week <= 90>>
		<<set $ACitizens -= random(140) * _majorBattleMod>>
		<<set $ASlaves -= random(190) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(15) * _majorBattleMod>>
	<<elseif $week <= 120>>
		<<set $ACitizens -= random(160) * _majorBattleMod>>
		<<set $ASlaves -= random(210) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(20) * _majorBattleMod>>
	<<else>>
		<<set $ACitizens -= random(180) * _majorBattleMod>>
		<<set $ASlaves -= random(230) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(25) * _majorBattleMod>>
	<</if>>
	<<if $PClossStreak >= 3>>
		This only confirms the fears of many, @@.red;your arcology is not safe@@ and it is clear their business will be better somewhere else.
		<<set $arcologies[0].prosperity -= 5 * _majorBattleMod>>
	<</if>>
<<elseif $battleResult == 2>>
	Thanks to your victory, your @@.green;reputation@@ and @@.darkviolet;authority@@ slightly increased. Our men were not able to capture any attacker, however some equipment was seized during the enemy hasty retreat,
	<<if $attackType == "raiders">>
		<<set $rep += 200 * _majorBattleMod>>
		<<set $authority += 200 * _majorBattleMod>>
	<<elseif $attackType == "free city">>
		<<set $rep += 300 * _majorBattleMod>>
		<<set $authority += 300 * _majorBattleMod>>
	<<elseif $attackType == "freedom fighters">>
		<<set $rep += 450 * _majorBattleMod>>
		<<set $authority += 450 * _majorBattleMod>>
	<<elseif $attackType == "old world">>
		<<set $rep += 300 * _majorBattleMod>>
		<<set $authority += 300 * _majorBattleMod>>
	<</if>>
	which once sold produced
	<<if $attackEquip == 0>>
		@@.yellowgreen;a bit of cash.@@
		<<set _loot += 500 * _majorBattleMod>>
	<<elseif $attackEquip == 1>>
		@@.yellowgreen;a small amount of cash.@@
		<<set _loot += 2500 * _majorBattleMod>>
	<<elseif $attackEquip == 2>>
		@@.yellowgreen;a moderate amount of cash.@@
		<<set _loot += 5000 * _majorBattleMod>>
	<<elseif $attackEquip == 3>>
		@@.yellowgreen;a good amount of cash.@@
		<<set _loot += 7500 * _majorBattleMod>>
	<<elseif $attackEquip == 4>>
		@@.yellowgreen;a great amount of cash.@@
		<<set _loot += 10000 * _majorBattleMod>>
	<</if>>
	<<if $mercSoldierPrivilege == 1 && $deployingMercs == 1>>
		Part of the loot is distributed to your mercenaries.
		<<set _loot = Math.trunc(_loot * 0.6)>>
	<</if>>
	<<set $cash += _loot>>

	Damage to the city was @@.red;limited@@, 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.
	<<set $cash -= 2000 * _majorBattleMod, $PC.engineering += .1>>
	<<set $ACitizens -= random(10) * _majorBattleMod>>
	<<set $ASlaves -= random(20) * _majorBattleMod>>
<<elseif $battleResult == -2>>
	It was a close defeat, but nonetheless your @@.red;reputation@@ and @@.red;authority@@ slightly decreased. Your troops were not able to capture anyone or anything.
	<<if $attackType == "raiders">>
		<<set $rep -= 40 * _majorBattleMod>>
		<<set $authority -= 40 * _majorBattleMod>>
	<<elseif $attackType == "free city">>
		<<set $rep -= 60 * _majorBattleMod>>
		<<set $authority -= 60 * _majorBattleMod>>
	<<elseif $attackType == "freedom fighters">>
		<<set $rep -= 75 * _majorBattleMod>>
		<<set $authority -= 75 * _majorBattleMod>>
	<<elseif $attackType == "old world">>
		<<set $rep -= 60 * _majorBattleMod>>
		<<set $authority -= 60 * _majorBattleMod>>
	<</if>>

	The enemy did not have the strength to raid the arcology for long, still @@.red;the arcology sustained some damage@@, 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.
	Some business sustained heavy damage, slightly impacting the arcology's prosperity.
	<<set $cash -= 3000 * _majorBattleMod, $PC.engineering += .1>>
	<<if $week <= 30>>
		<<set $ACitizens -= random(50) * _majorBattleMod>>
		<<set $ASlaves -= random(75) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(2) * _majorBattleMod>>
	<<elseif $week <= 60>>
		<<set $ACitizens -= random(60) * _majorBattleMod>>
		<<set $ASlaves -= random(65) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(5) * _majorBattleMod>>
	<<elseif $week <= 90>>
		<<set $ACitizens -= random(70) * _majorBattleMod>>
		<<set $ASlaves -= random(95) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(7) * _majorBattleMod>>
	<<elseif $week <= 120>>
		<<set $ACitizens -= random(80) * _majorBattleMod>>
		<<set $ASlaves -= random(105) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(10) * _majorBattleMod>>
	<<else>>
		<<set $ACitizens -= random(90) * _majorBattleMod>>
		<<set $ASlaves -= random(115) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(12) * _majorBattleMod>>
	<</if>>
<<elseif $battleResult == -1>>
	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 @@.red;reputation@@ and @@.red;authority@@ are significantly impacted.
	<<if $attackType == "raiders">>
		<<set $rep -= 600 * _majorBattleMod>>
		<<set $authority -= 600 * _majorBattleMod>>
	<<elseif $attackType == "free city">>
		<<set $rep -= 800 * _majorBattleMod>>
		<<set $authority -= 800 * _majorBattleMod>>
	<<elseif $attackType == "freedom fighters">>
		<<set $rep -= 1000 * _majorBattleMod>>
		<<set $authority -= 1000 * _majorBattleMod>>
	<<elseif $attackType == "old world">>
		<<set $rep -= 800 * _majorBattleMod>>
		<<set $authority -= 800 * _majorBattleMod>>
	<</if>>

	The surrender allows the arcology to survive @@.red;mostly intact@@, however reports of @@.red;mass looting and killing of citizens@@ flood your office for a few days.
	<<set $cash -= 1000 * _majorBattleMod, $PC.engineering += .1>>
	<<if $week <= 30>>
		<<set $ACitizens -= random(80) * _majorBattleMod>>
		<<set $ASlaves -= random(120) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(5) * _majorBattleMod>>
	<<elseif $week <= 60>>
		<<set $ACitizens -= random(100) * _majorBattleMod>>
		<<set $ASlaves -= random(140) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(10) * _majorBattleMod>>
	<<elseif $week <= 90>>
		<<set $ACitizens -= random(120) * _majorBattleMod>>
		<<set $ASlaves -= random(160) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(15) * _majorBattleMod>>
	<<elseif $week <= 120>>
		<<set $ACitizens -= random(140) * _majorBattleMod>>
		<<set $ASlaves -= random(180) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(20) * _majorBattleMod>>
	<<else>>
		<<set $ACitizens -= random(160) * _majorBattleMod>>
		<<set $ASlaves -= random(190) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(25) * _majorBattleMod>>
	<</if>>
<<elseif $battleResult == 0>>
	Unfortunately your adversary did not accept your money. <<if $attackType == "freedom fighters">> Their ideological crusade would not allow such thing<<else>>They saw your attempt as nothing more than admission of weakness<</if>>. 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 $attackType == "raiders">>
		<<set $rep -= 400 * _majorBattleMod>>
		<<set $authority -= 400 * _majorBattleMod>>
	<<elseif $attackType == "free city">>
		<<set $rep -= 600 * _majorBattleMod>>
		<<set $authority -= 600 * _majorBattleMod>>
	<<elseif $attackType == "freedom fighters">>
		<<set $rep -= 750 * _majorBattleMod>>
		<<set $authority -= 750 * _majorBattleMod>>
	<<elseif $attackType == "old world">>
		<<set $rep -= 600 * _majorBattleMod>>
		<<set $authority -= 600 * _majorBattleMod>>
	<</if>>

	Fortunately the arcology survives @@.yellow;mostly intact@@, however reports of @@.red;mass looting and killing of citizens@@ flood your office for a few days.
	<<set $cash -= 1000, $PC.engineering += .1>>
	<<if $week <= 30>>
		<<set $ACitizens -= random(80) * _majorBattleMod>>
		<<set $ASlaves -= random(120) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(5) * _majorBattleMod>>
	<<elseif $week <= 60>>
		<<set $ACitizens -= random(100) * _majorBattleMod>>
		<<set $ASlaves -= random(140) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(10) * _majorBattleMod>>
	<<elseif $week <= 90>>
		<<set $ACitizens -= random(120) * _majorBattleMod>>
		<<set $ASlaves -= random(160) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(15) * _majorBattleMod>>
	<<elseif $week <= 120>>
		<<set $ACitizens -= random(140) * _majorBattleMod>>
		<<set $ASlaves -= random(180) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(20) * _majorBattleMod>>
	<<else>>
		<<set $ACitizens -= random(160) * _majorBattleMod>>
		<<set $ASlaves -= random(190) * _majorBattleMod>>
		<<set $arcologies[0].prosperity -= random(25) * _majorBattleMod>>
	<</if>>

<<elseif $battleResult == 1>>
	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 events are the perfect demonstration of such strength.
	Your @@.green;reputation slightly increases@@.
	<<if $attackType == "raiders">>
		<<set $rep += 100 * _majorBattleMod>>
	<<elseif $attackType == "free city">>
		<<set $rep += 150 * _majorBattleMod>>
	<<elseif $attackType == "freedom fighters">>
		<<set $rep += 200 * _majorBattleMod>>
	<<elseif $attackType == "old world">>
		<<set $rep += 150 * _majorBattleMod>>
	<</if>>
	<<set $cash -= $bribeCost>>
<</if>>
<<if !isInt($ACitizens)>>
	<<if isNaN($ACitizens)>>

@@.red;Error: ACitizens is NaN, please report this issue@@
	<<else>>
		<<set $ACitizens = Math.clamp(Math.trunc($ACitizens),100,$ACitizenLimit)>>
	<</if>>
<</if>>
<<if !isInt($ASlaves)>>
	<<if isNaN($ASlaves)>>

@@.red;Error: ASlaves is NaN, please report this issue@@
	<<else>>
		<<set $ASlaves = Math.clamp(Math.trunc($ASlaves),1000,$ASlaveLimit)>>
	<</if>>
<</if>>

<<if $battleResult != 1 && $battleResult != 0 && $battleResult != -1>>

	/* leaders */
	<<if $leadingTroops == "PC">>
		You decided to personally lead the defense of your arcology.
		<<if $deployingMilitia == 1>>
			<<if _oldRep <= 2500>>
				<<if _oldRep > 1000>>
					You're not particularly popular between the inhabitants of your arcology, so your presence does little to reassure the volunteers.
				<<else>>
					As your low reputation proves, your volunteers do not particularly enjoy your company. As far as they are concerned your presence is more of an hindrance than an advantage.
				<</if>>
				<<if $PC.career == "celebrity">>
					Still, your past celebrity does carry some weight, and many look forward to fight alongside a famous name.
				<<elseif $PC.career == "capitalist">>
					Still, your past life as a famous venture capitalist does carry some weight, and many trust in your cunning to save them in the incoming battle.
				<<elseif $PC.career == "gang">>
					The situation is not made easier by your past. Many still remember you as the gang leader who used to be on the other side of their guns.
				<<elseif $PC.career == "escort">>
					The situation is not made easier by your past. Many still remember your past career as an escort and doubt you'll be of any use during the fighting.
				<<elseif $PC.career == "mercenary">>
					Still, your past mercenary work does carry some weight, and many look forward to fight alongside a battle hardened name.
				<</if>>
			<<elseif _oldRep >= 5000>>
				<<if _oldRep < 15000>>
					Your citizens are honored that their arcology owner is willing to put <<if $PC.title == 0>>her<<else>>his<</if>> life in danger.
				<<else>>
					Many among the volunteers are awed by your presence; never would they have thought they would fight shoulder to shoulder with their famous arcology owner.
				<</if>>
				<<if $PC.career == "celebrity">>
					They consider it a priceless opportunity to fight together with someone with such a renowned past as yours. Your celebrity past still carries weight.
				<<elseif $PC.career == "capitalist">>
					They consider it a priceless opportunity to fight together with one of the great capitalist sharks of their time. Such a fine mind on their side can only bring victory!
				<<elseif $PC.career == "gang">>
					Your past, however, does not help you. Many still remember you as the gang leader who used to be on the other side of their guns.
				<<elseif $PC.career == "escort">>
					Your past, however, does not help you. Many still remember your past career as an escort and doubt you'll be of any use during the fighting.
				<<elseif $PC.career == "mercenary">>
					Your past mercenary work does carries some weight, and many look forward to fight alongside a battle hardened name.
				<</if>>
			<</if>>
		<</if>>
		<<if $deployingSlaves == 1>>
			<<if _oldAuth <= 2500>>
				<<if _oldAuth > 1000>>
					Your slave soldiers do not feel bound to you as much as they should, as your authority is far from absolute.
				<<else>>
					Your slave soldiers are often openly rebellious. Only the threat of execution holds them in line.
				<</if>>
				<<if $PC.career == "escort">>
					Fortunately many feel some level of kinship with you, thanks to your past as an escort.
				<<elseif $PC.career == "servant">>
					Fortunately many feel some level of kinship with you, thanks to your past as a servant.
				<<elseif $PC.career == "slaver">>
					Things are made worse by your past as a notorious slaver.
				<<elseif $PC.career == "mercenary">>
					Your past mercenary work carries some weight, and many look forward to fighting alongside a battle hardened name.
				<</if>>
			<<elseif _oldAuth >= 5000>>
				<<if _oldAuth < 15000>>
					Your slave soldiers show a surprising amount of discipline, thanks to your high authority.
				<<else>>
					Your slave soldiers show almost a fanatical level of martial discipline. Your absolute authority has a great effect on them.
				<</if>>
				<<if $PC.career == "escort">>
					Many have an instinctual feeling of kinship towards you because of your past as an escort.
				<<elseif $PC.career == "servant">>
					Many have an instinctual feeling of kinship towards you because of your past as a servant.
				<<elseif $PC.career == "slaver">>
					Still, some rebellious looks can be spotted once in a while. In their eyes your slaver past will always paint you in a dark light.
				<<elseif $PC.career == "mercenary">>
					Your past mercenary work carries some weight, and many look forward to fighting alongside a battle hardened name.
				<</if>>
			<</if>>
		<</if>>
		<<if $deployingMercs == 1>>
			<<if $mercLoyalty <= 25>>
				<<if $mercLoyalty <= 10>>
					Your mercenaries barely bother to pretend being loyal; their battle performance is obviously barely passable.
				<<else>>
					Your presence does little to spur your mercenaries into action; their loyalty is straining and their performance suffers.
				<</if>>
				<<if $PC.career == "mercenary">>
					Thankfully they hold in high regard someone who made their fortune as a mercenary themselves.
				<<elseif $PC.career == "wealth">>
					They do little to hide the contempt they have for someone who was born into wealth, rather than gaining it through blood, sweat, and tears.
				<<elseif $PC.career == "servant">>
					They do little to hide their disgust at being ordered around by an ex-servant.
				<<elseif $PC.career == "BlackHat">>
					They do little to hide their disgust at being ordered around by some unscrupulous code monkey.
				<</if>>
			<<elseif $mercLoyalty >= 50>>
				<<if $mercLoyalty < 75>>
					Your mercenaries are ready to fight their hardest for you, their loyalty a testament to your capability as a leader.
				<<else>>
					Your mercenaries fight with a martial fury worthy of religious fanatics. Their loyalty to you is absolute.
				<</if>>
				<<if $PC.career == "mercenary">>
					They're more than willing to follow someone who walked their same steps once as a gun for hire.
				<<elseif $PC.career == "wealth">>
					Unfortunately many still resent you being born into your wealth and power, rather than having earned it through blood, sweat, and tears.
				<<elseif $PC.career == "servant">>
					Unfortunately some still resent the fact they are ordered around by an ex-servant.
				<<elseif $PC.career == "BlackHat">>
					Unfortunately some still resent the fact they are ordered around by an unscrupulous hacker.
				<</if>>
			<</if>>
			<<if _oldRep >= 15000>>
				Your reputation is so high your name carries power by itself. Having you on the battlefield puts fear even in the hardiest of warriors.
			<</if>>
		<</if>>
		<<if $SFIntervention == 1>>
			<<if $PC.career == "mercenary" || $PC.career == "slaver" || $PC.career == "capitalist" || $PC.career == "gang" || $PC.warfare > 75>>
				The soldiers of the $securityForceName are ready and willing to follow you into battle, confident in your past experience.
			<<elseif $PC.career == "wealth" || $PC.career == "medicine" || $PC.career == "engineer">>
				The soldiers of the $securityForceName, as loyal as they are, are not enthusiastic to follow the orders of someone who has no experience leading men.
			<<elseif $PC.career == "servant">>
				The soldiers of the $securityForceName, as loyal as they are, are not enthusiastic to follow the orders of an ex-servant.
			<<elseif $PC.career == "escort">>
				The soldiers of the $securityForceName, as loyal as they are, are not enthusiastic to follow the orders of an ex-escort.
			<<elseif $PC.career == "BlackHat">>
				The soldiers of the $securityForceName, as loyal as they are, are not enthusiastic to follow the orders of a dubious incursion specialist.
			<</if>>
		<</if>>
		<<if $PC.warfare <= 25 && $PC.warfare > 10>>
			Your inexperience in military matters has a negative impact on your troops performance and the effectiveness of your battleplan.
		<<elseif $PC.warfare <= 10>>
			Your ignorance in military matters has a severe negative impact on your troops performance and the effectiveness of your battleplan.
		<<elseif $PC.warfare >= 50 && $PC.warfare >= 50>>
			Your experience in military matters has a positive impact on your troops performance and the effectiveness of your battleplan.
		<<elseif $PC.warfare >= 75>>
			Your great experience in military matters has a major positive impact on your troops performance and the effectiveness of your battleplan.
		<</if>>
		<<if $gainedWarfare == 1>>
			Battlefield experience increased your understanding of warfare, making you a better commander.
		<</if>>
		<<if $PCWounded == 1>>
			During the fighting @@.red;you were wounded@@. Your medics assure you it's nothing life threatening, but you'll be weakened for a few weeks.
			<<set $PCWoundCooldown = 3>>
		<</if>>
	<<elseif $leadingTroops == "assistant">>
		<<if $auto == 1>>$assistantName<<else>>You<</if>> let your personal assistant lead the troops.
		<<if $deployingMercs == 1 || $deployingMilitia == 1 || $deployingSlaves == 1>>
			<<if _oldRep < 10000 && _oldAuth < 10000>>
				No soldier trusts a computer to be their commander, no algorithm can substitute experience <<if $assistantPower == 0>>and as expected<<else>>, however <</if>>
			<<else>>
				No soldier trusts a computer to be their commander, but they trust you enough to not question your decision<<if $assistantPower == 0>>, however<<else>>, <</if>>
			<</if>>
		<</if>>
		<<if $assistantPower == 0>>
			your assistant gives a rather poor field performance, due to the limited computing power available to her.
		<<elseif $assistantPower == 1>>
			your assistant performs decently. While nothing to write home about your men are pleasantly surprised.
		<<elseif $assistantPower == 2>>
			your assistant performs admirably. Her vast computing power allows her to be everywhere on the battlefield, greatly enhancing the efficacy of your troops and the effectiveness of your battleplan.
		<</if>>
	<<elseif $leadingTroops == "bodyguard">>
		<<if $auto == 1>>$assistantName<<else>>You<</if>> decided it will be your bodyguard to lead the troops.
		<<if $deployingSlaves == 1>>
			<<if $Bodyguard.devotion < -20>>
				Her low devotion has a negative impact on the morale of your slave soldiers.
			<<elseif $Bodyguard.devotion > 51>>
				Her devotion to you has a positive impact on the morale of your slave soldiers, proud to be lead by one of their own.
			<</if>>
		<</if>>
		<<if _oldRep < 10000 && _oldAuth < 10000 || $Bodyguard.prestige < 1>>
			<<if $deployingMilitia == 1>>
				Your volunteers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander
				<<if $deployingMercs == 1 && $SFIntervention == 1>>
					and neither are your mercenaries or your soldiers.
				<<elseif $deployingMercs == 1>>
					and neither are your mercenaries.
				<<elseif $SFIntervention == 1>>
					and neither are your soldiers.
				<<else>>
					.
				<</if>>
			<<elseif $deployingMercs == 1 && $SFIntervention == 1>>
				Your mercenaries and soldiers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander.
			<<elseif $deployingMercs == 1>>
				Your mercenaries <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander.
			<<elseif $SFIntervention == 1>>
				Your soldiers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander.
			<</if>>
		<<elseif $Bodyguard.prestige >= 2>>
			<<if $deployingMilitia == 1>>
				Your volunteers
				<<if $deployingMercs == 1>>
					and your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<<else>>
					are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<</if>>
			<<elseif $deployingMercs == 1>>
				Your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
			<</if>>
			<<if $deployingMilitia == 1>>
				Your volunteers
				<<if $deployingMercs == 1 && $SFIntervention == 1>>
					, your mercenaries and your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<<elseif $deployingMercs == 1>>
					and your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<<elseif $SFIntervention == 1>>
					and your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<<else>>
					are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<</if>>
			<<elseif $deployingMercs == 1 && $SFIntervention == 1>>
				Your mercenaries and soldiers are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
			<<elseif $deployingMercs == 1>>
				Your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
			<<elseif $SFIntervention == 1>>
				Your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
			<</if>>
		<<else>>
			<<if $deployingMilitia == 1>>
				Your volunteers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander
				<<if $deployingMercs == 1 && $SFIntervention == 1>>
					and neither are your mercenaries and soldiers, but they trust you enough not to question your decision.
				<<elseif $deployingMercs == 1>>
					and neither are your mercenaries, but they trust you enough not to question your decision.
				<<elseif $SFIntervention == 1>>
					and neither are your soldiers, but they trust you enough not to question your decision.
				<<else>>
					, but they trust you enough not to question your decision.
				<</if>>
			<<elseif $deployingMercs == 1 && $SFIntervention == 1>>
				Your mercenaries and soldiers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision.
			<<elseif $deployingMercs == 1>>
				Your mercenaries <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision.
			<<elseif $SFIntervention == 1>>
				Your soldiers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision.
			<</if>>
		<</if>>
		<<if (setup.bodyguardCareers.includes($Bodyguard.career) || setup.HGCareers.includes($Bodyguard.career)) && $Bodyguard.intelligence == 3>>
			With her experience and her great intellect, she is able to exploits the smallest of tactical advantages, making your troops very effective.
		<<elseif $Bodyguard.intelligence == 3>>
			While she lacks experience, her great intellect allows her to seize and exploit any tactical advantage the battlefield offers her.
		<<elseif (setup.bodyguardCareers.includes($Bodyguard.career) || setup.HGCareers.includes($Bodyguard.career)) && $Bodyguard.intelligence == 2>>
			Having both the experience and the intelligence, she performs admirably as your commander. Her competence greatly increases the efficacy of your troops.
		<<elseif $Bodyguard.intelligence == 2>>
			Despite not having a lot of experience as a leader, her intelligence makes her a good commander, increasing the efficacy of your troops.
		<<elseif setup.bodyguardCareers.includes($Bodyguard.career) || setup.HGCareers.includes($Bodyguard.career) && $Bodyguard.intelligence >= 1>>
			Thanks to her experience, she is a decent commander, competently guiding your troops through the battle.
		<<elseif $Bodyguard.intelligence >= 1>>
			Lacking experience her performance as a commander is rather forgettable.
		<<elseif !(setup.bodyguardCareers.includes($Bodyguard.career) && setup.HGCareers.includes($Bodyguard.career)) || $Bodyguard.intelligence <= -2>>
			Despite the experience she accumulated during her past career, her very low intelligence is a great disadvantage for your troops.
		<<elseif $Bodyguard.intelligence <= -2>>
			Without experience and low intelligence, she performs horribly as a commander, greatly affecting your troops.
		<<elseif !(setup.bodyguardCareers.includes($Bodyguard.career) && setup.HGCareers.includes($Bodyguard.career)) || $Bodyguard.intelligence <= -1>>
			Despite the experience she accumulated during her past career, she lacks the intelligence to apply it quickly and effectively, making for a rather poor performance in the field.
		<<elseif $Bodyguard.intelligence <= -1>>
			She lacks the experience and the intelligence to be an effective commander, the performance of your troops suffers because of her poor leadership.
		<</if>>
		<<if $gainedCombat == 1>>
			During the battle, she had to fight for her life, giving her experience in modern combat. She is now proficient with modern firearms and hand to hand combat.
		<</if>>
		<<if $woundType != 0>>
			Unfortunately @@.red;she reported injuries@@.
			<<if $woundType == 1>>
				A stray bullet hit her neck. While she fortunately avoided fatal hemorrhages, her vocal cords were irreparably damaged.
			<<elseif $woundType == 2>>
				A few shrapnels found her eyes as final target, blinding her permanently.
			<<elseif $woundType == 3>>
				A grenade landed close to her, rendering her a quadruple amputee.
			<<elseif $woundType >= 4>>
				While grave wounds, it seems she will be able to fully recover, given enough time.
			<</if>>
			Your troops were greatly affected by the loss of their leader.
		<</if>>
		<<if $battleResult == 3 && $allowPrestigeFromBattles == 1>>
			<<set _found = 0>>
			<<for _i = 0; _i < $slaveVictories.length; _i++>>
				<<if $slaveVictories[_i].ID == $Bodyguard.ID>>
					<<set $slaveVictories[_i].victories++>>
					<<set _found = 1>>
					<<if $slaveVictories[_i].victories >= 10>>
						<<if $Bodyguard.prestige < 3>>
							<<set _j = $slaveIndices[$Bodyguard.ID]>>
							<<set $slaves[_j].prestige++>>
							<<if $slaves[_j].prestige == 1>>
								<<set $slaves[_j].prestigeDesc = "She is well known for being a great commander.">>
							<<elseif $slaves[_j].prestige == 2>>
								<<set $slaves[_j].prestigeDesc = "She is famous for being an incredible commander.">>
							<<elseif $slaves[_j].prestige == 3>>
								<<set $slaves[_j].prestigeDesc = "She is known as a legendary commander all over the world.">>
							<</if>>
							<<set $slaveVictories[_i].victories = 0>>
							<<set $slaveIncreasedPrestige = 1>>
						<</if>>
					<</if>>
					<<break>>
				<</if>>
			<</for>>
			<<if _found == 0>>
				<<set _newSlave = {ID: $Bodyguard.ID, victories: 0}>>
				<<set $slaveVictories.push(_newSlave)>>
			<</if>>
		<</if>>
		<<if $slaveIncreasedPrestige == 1>>
			She brought your army to victory so many times that her @@.green;prestige has increased@@.
		<</if>>
	<<elseif $leadingTroops == "headGirl">>
		<<if $auto == 1>>$assistantName<<else>>You<</if>> decided it will be your head girl to lead the troops.
		<<if $deployingSlaves == 1>>
			<<if $HeadGirl.devotion < -20>>
				Her low devotion has a negative impact on the morale of your slave soldiers.
			<<elseif $HeadGirl.devotion > 51>>
				Her devotion to you has a positive impact on the morale of your slave soldiers, proud to be lead by one of their own.
			<</if>>
		<</if>>
		<<if _oldRep < 10000 && _oldAuth < 10000 || $HeadGirl.prestige < 1>>
			<<if $deployingMilitia == 1>>
				Your volunteers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander
				<<if $deployingMercs == 1 && $SFIntervention == 1>>
					and neither are your mercenaries or your soldiers.
				<<elseif $deployingMercs == 1>>
					and neither are your mercenaries.
				<<elseif $SFIntervention == 1>>
					and neither are your soldiers.
				<<else>>
					.
				<</if>>
			<<elseif $deployingMercs == 1 && $SFIntervention == 1>>
				Your mercenaries and soldiers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander.
			<<elseif $deployingMercs == 1>>
				Your mercenaries <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander.
			<<elseif $SFIntervention == 1>>
				Your soldiers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander.
			<</if>>
		<<elseif $HeadGirl.prestige >= 2>>
			<<if $deployingMilitia == 1>>
				Your volunteers
				<<if $deployingMercs == 1>>
					and your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<<else>>
					are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<</if>>
			<<elseif $deployingMercs == 1>>
				Your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
			<</if>>
			<<if $deployingMilitia == 1>>
				Your volunteers
				<<if $deployingMercs == 1 && $SFIntervention == 1>>
					, your mercenaries and your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<<elseif $deployingMercs == 1>>
					and your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<<elseif $SFIntervention == 1>>
					and your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<<else>>
					are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
				<</if>>
			<<elseif $deployingMercs == 1 && $SFIntervention == 1>>
				Your mercenaries and soldiers are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
			<<elseif $deployingMercs == 1>>
				Your mercenaries are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
			<<elseif $SFIntervention == 1>>
				Your soldiers are delighted to have such a prestigious individual as their commander, almost forgetting she is a slave.
			<</if>>
		<<else>>
			<<if $deployingMilitia == 1>>
				Your volunteers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander
				<<if $deployingMercs == 1 && $SFIntervention == 1>>
					and neither are your mercenaries and soldiers, but they trust you enough not to question your decision.
				<<elseif $deployingMercs == 1>>
					and neither are your mercenaries, but they trust you enough not to question your decision.
				<<elseif $SFIntervention == 1>>
					and neither are your soldiers, but they trust you enough not to question your decision.
				<<else>>
					, but they trust you enough not to question your decision.
				<</if>>
			<<elseif $deployingMercs == 1 && $SFIntervention == 1>>
				Your mercenaries and soldiers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision.
			<<elseif $deployingMercs == 1>>
				Your mercenaries <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision.
			<<elseif $SFIntervention == 1>>
				Your soldiers <<if $deployingSlaves == 1>>however<</if>> are not enthusiastic to have a slave as a commander, but they trust you enough not to question your decision.
			<</if>>
		<</if>>
		<<if (setup.bodyguardCareers.includes($HeadGirl.career) || setup.HGCareers.includes($HeadGirl.career)) && $HeadGirl.intelligence == 3>>
			With her experience and her great intellect, she is able to exploits the smallest of tactical advantages, making your troops greatly effective.
		<<elseif $HeadGirl.intelligence == 3>>
			While she lacks experience, her great intellect allows her to seize and exploit any tactical advantage the battlefield offers her.
		<<elseif (setup.bodyguardCareers.includes($HeadGirl.career) || setup.HGCareers.includes($HeadGirl.career)) && $HeadGirl.intelligence == 2>>
			Having both the experience and the intelligence, she performs admirably as your commander. Her competence greatly increases the efficacy of your troops.
		<<elseif $HeadGirl.intelligence == 2>>
			Despite not having a lot of experience as a leader, her intelligence makes her a good commander, increasing the efficacy of your troops.
		<<elseif setup.bodyguardCareers.includes($HeadGirl.career) || setup.HGCareers.includes($HeadGirl.career) && $HeadGirl.intelligence >= 1>>
			Thanks to her experience, she is a decent commander, competently guiding your troops through the battle.
		<<elseif $HeadGirl.intelligence >= 1>>
			Lacking experience her performance as a commander is rather forgettable.
		<<elseif !(setup.bodyguardCareers.includes($HeadGirl.career) && setup.HGCareers.includes($HeadGirl.career)) || $HeadGirl.intelligence <= -2>>
			Despite the experience she accumulated during her past career, her very low intelligence is a great disadvantage for your troops.
		<<elseif $HeadGirl.intelligence <= -2>>
			Without experience and low intelligence, she performs horribly as a commander, greatly affecting your troops.
		<<elseif !(setup.bodyguardCareers.includes($HeadGirl.career) && setup.HGCareers.includes($HeadGirl.career)) || $HeadGirl.intelligence <= -1>>
			Despite the experience she accumulated during her past career, she lacks the intelligence to apply it quickly and effectively, making for a rather poor performance in the field.
		<<elseif $HeadGirl.intelligence <= -1>>
			She lacks the experience and the intelligence to be an effective commander, the performance of your troops suffers because of her poor leadership.
		<</if>>
		<<if $gainedCombat == 1>>
			During the battle, she had to fight for her life, giving her experience in modern combat. She is now proficient with modern firearms and hand to hand combat.
		<</if>>
		<<if $woundType != 0>>
			Unfortunately @@.red;she reported injuries@@.
			<<if $woundType == 1>>
				A stray bullet hit her neck. While she fortunately avoided fatal hemorrhages, her vocal cords were irreparably damaged.
			<<elseif $woundType == 2>>
				A few shrapnels found her eyes as final target, blinding her permanently.
			<<elseif $woundType == 3>>
				A grenade landed close to her, rendering her a quadruple amputee.
			<<elseif $woundType >= 4>>
				While grave wounds, it seems she will be able to fully recover, given enough time.
			<</if>>
			Your troops were greatly affected by the loss of their leader.
		<</if>>
		<<if $battleResult == 3 && $allowPrestigeFromBattles == 1>>
			<<set _found = 0>>
			<<for _i = 0; _i < $slaveVictories.length; _i++>>
				<<if $slaveVictories[_i].ID == $HeadGirl.ID>>
					<<set $slaveVictories[_i].victories++>>
					<<set _found = 1>>
					<<if $slaveVictories[_i].victories >= 10>>
						<<if $HeadGirl.prestige < 3>>
							<<set _j = $slaveIndices[$HeadGirl.ID]>>
							<<set $slaves[_j].prestige++>>
							<<if $slaves[_j].prestige == 1>>
								<<set $slaves[_j].prestigeDesc = "She is well known for being a great commander.">>
							<<elseif $slaves[_j].prestige == 2>>
								<<set $slaves[_j].prestigeDesc = "She is famous for being an incredible commander.">>
							<<elseif $slaves[_j].prestige == 3>>
								<<set $slaves[_j].prestigeDesc = "She is known as a legendary commander all over the world.">>
							<</if>>
							<<set $slaveVictories[_i].victories = 0>>
							<<set $slaveIncreasedPrestige = 1>>
						<</if>>
					<</if>>
					<<break>>
				<</if>>
			<</for>>
			<<if _found == 0>>
				<<set _newSlave = {ID: $HeadGirl.ID, victories: 0}>>
				<<set $slaveVictories.push(_newSlave)>>
			<</if>>
		<</if>>
		<<if $slaveIncreasedPrestige == 1>>
			She brought your army to victory so many times that her @@.green;prestige has increased@@.
		<</if>>
	<<elseif $leadingTroops == "citizen">>
		<<if $auto == 1>>$assistantName<<else>>You<</if>> decided to appoint one of your volunteers as the commander.
		<<if $arcologies[0].FSDegradationist == "unset" && $arcologies[0].FSPaternalist == "unset">>
			<<if $deployingMilitia == 1>>
				Your volunteers are honored and pleased that one of their own is leading the defense force of the city.
			<</if>>
			<<if $deployingSlaves == 1>>
				Your slaves<<if $deployingMilitia == 1>>, however,<</if>> are not thrilled by the news.
			<</if>>
		<<elseif $arcologies[0].FSPaternalist != "unset">>
			<<if $deployingMilitia == 1>>
				Your volunteers are honored and pleased that one of their own is leading the defense force of the city.
			<</if>>
			<<if $deployingSlaves == 1>>
				Thanks to your paternalistic society, your slave soldiers trust your chosen citizen to treat them as more than cannon fodder.
			<</if>>
		<<elseif $arcologies[0].FSDegradationist != "unset">>
			<<if $deployingMilitia == 1>>
				Your volunteers are honored and pleased that one of their own is leading the defense force of the city.
			<</if>>
			<<if $deployingSlaves == 1>>
				Because of your degradationist society,<<if $deployingMilitia == 1>> however,<</if>> your slave soldiers are deeply distrustful of the new leader.
			<</if>>
		<</if>>
		<<if $arcologies[0].FSRomanRevivalist != "unset" && $deployingMercs == 1>>
			Since you decided to revive old Rome, many of your citizens took on themselves to educate themselves in martial matters, because of this your mercenaries feel safe enough in the hands of one of your volunteers.
		<<elseif $deployingMercs == 1>>
			You mercenaries are not thrilled to be lead by a civilian without any formal martial training or education.
		<</if>>
		<<if $arcologies[0].FSRomanRevivalist != "unset" && $SFIntervention == 1>>
			Since you decided to revive old Rome, many of your citizens took on themselves to educate themselves in martial matters, because of this your soldiers feel safe enough in the hands of one of your volunteers.
		<<elseif $SFIntervention == 1>>
			You soldiers are not thrilled to be lead by a civilian without any formal martial training or education.
		<</if>>
		<<if $leaderWounded == 1>>
			During the battle a stray bullet managed to reach the leader. Your troops were greatly affected by the loss.
		<</if>>
	<<elseif $leadingTroops == "mercenary">>
		<<if $auto == 1>>$assistantName<<else>>You<</if>> decided to appoint one of your mercenary officers as the commander.
		<<if $deployingMercs == 1>>
			Your mercenaries of course approve of your decision.
		<</if>>
		<<if $SFIntervention == 1>>
			Your soldiers feel more confident going into battle with an experienced commander.
		<</if>>
		<<if $arcologies[0].FSRomanRevivalist != "unset" && $deployingMilitia == 1>>
			Since you decided to revive old Rome, your volunteers are more willing to trust one of your mercenaries as their leader.
		<<elseif $deployingMilitia == 1>>
			Your volunteers are not enthusiastic at the prospect of being commanded around by  a gun for hire.
		<</if>>
		<<if $arcologies[0].FSDegradationist != "unset" && $deployingSlaves == 1>>
			Because of your degradationist society, your slave soldiers are highly distrustful of the gun for hire you forced them to accept as leader.
		<</if>>
		<<if $leaderWounded == 1>>
			During the battle a stray bullet managed to reach the mercenary. Your troops were greatly affected by the loss of their leader.
		<</if>>
	<<elseif $leadingTroops == "colonel">>
		<<if $auto == 1>>$assistantName<<else>>You<</if>> decided to appoint The Colonel as the commander.
		<<if $deployingMercs == 1>>
			Your mercenaries approve of such decisions, as they feel more confident by having a good, experienced commander.
		<</if>>
		<<if $SFIntervention == 1>>
			The soldiers of $securityForceName obviously approved of your decision.
		<</if>>
		<<if $arcologies[0].FSRomanRevivalist != "unset" && $deployingMilitia == 1>>
			Since you decided to revive old Rome, your volunteers are more willing to trust one of your soldiers as their leader.
		<<elseif $deployingMilitia == 1>>
			Your volunteers are not enthusiastic at the prospect of being commanded around by an old style military officer.
		<</if>>
		<<if $arcologies[0].FSDegradationist != "unset" && $deployingSlaves == 1>>
			Because of your degradationist society, your slave soldiers are highly distrustful of the soldier you forced them to accept as leader.
		<</if>>
		<<if $leaderWounded == 1>>
			During the battle a stray bullet managed to reach The Colonel, wounding her slightly. Your troops were greatly affected by the loss of their leader.
		<</if>>
	<</if>>

	/* tactics */
	<<if $auto == 1>>$assistantName<<else>>You<</if>>
	<<if $chosenTactic == "Bait and Bleed">>
		chose to employ "bait and bleed" tactics or relying on quick attacks and harassment to tire and wound the enemy until their surrender.
	<<elseif $chosenTactic == "Guerrilla">>
		chose to employ "guerrilla" tactics or relying on stealth, terrain knowledge and subterfuge to undermine and ultimately destroy the enemy.
	<<elseif $chosenTactic == "Choke Points">>
		chose to employ "choke points" tactics or the extensive use of fortified or highly defensive positions to slow down and eventually stop the enemy.
	<<elseif $chosenTactic == "Interior Lines">>
		chose to employ "interior lines" tactics or exploiting the defender's shorter front to quickly disengage and concentrate troops when and where needed.
	<<elseif $chosenTactic == "Pincer Maneuver">>
			chose to employ "pincer maneuver" tactics or attempting to encircle the enemy by faking a collapsing center front.
	<<elseif $chosenTactic == "Defense In Depth">>
		chose to employ "defense in depth" tactics or relying on mobility to disengage and exploit overextended enemy troops by attacking their freshly exposed flanks.
	<<elseif $chosenTactic == "Blitzkrieg">>
		chose to employ "blitzkrieg" tactics or shattering the enemy's frontline with a violent, concentrated armored assault.
	<<elseif $chosenTactic == "Human Wave">>
		chose to employ "human wave" tactics or overwhelming the enemy's army with a massive infantry assault.
	<</if>>
	<<if $battleTerrain == "urban">>
		<<if $chosenTactic == "Bait and Bleed">>
			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.
		<<elseif $chosenTactic == "Guerrilla">>
			The urban terrain synergized well with guerrilla tactics, eroding your enemy's determination from the safety of the narrow streets and empty buildings.
		<<elseif $chosenTactic == "Choke Points">>
			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.
		<<elseif $chosenTactic == "Interior Lines">>
			While the urban environment offers many highly defensive position, it does restrict movement and with it the advantages of exploiting interior lines.
		<<elseif $chosenTactic == "Pincer Maneuver">>
			The urban terrain does not allow for wide maneuvers, the attempts of your forces to encircle the attackers are mostly unsuccessful.
		<<elseif $chosenTactic == "Defense In Depth">>
			While the urban environment offers many defensive positions, it limits mobility, limiting the advantages of using a defense in depth tactic.
		<<elseif $chosenTactic == "Blitzkrieg">>
			The urban terrain is difficult to traverse, making your troops attempt at a lightning strike unsuccessful.
		<<elseif $chosenTactic == "Human Wave">>
			The urban terrain offers great advantages to the defender, your men find themselves in great disadvantage while mass assaulting the enemy's position.
		<</if>>
	<<elseif $battleTerrain == "rural">>
		<<if $chosenTactic == "Bait and Bleed">>
			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.
		<<elseif $chosenTactic == "Guerrilla">>
			The open terrain of rural lands does not offer many hiding spots, making it harder for your men to perform guerrilla actions effectively.
		<<elseif $chosenTactic == "Choke Points">>
			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.
		<<elseif $chosenTactic == "Interior Lines">>
			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.
		<<elseif $chosenTactic == "Pincer Maneuver">>
			The open terrain affords your men great mobility, allowing them to easily position themselves for envelopment.
		<<elseif $chosenTactic == "Defense In Depth">>
			The open terrain affords your men great mobility, allowing them to exploit overextended assaults and concentrate where and when it matters.
		<<elseif $chosenTactic == "Blitzkrieg">>
			The open terrain affords your men great mobility, making it easier to accomplish concentrated lightning strikes.
		<<elseif $chosenTactic == "Human Wave">>
			The open terrain affords your men great mobility, making it easier to overwhelm the enemy with mass assaults.
		<</if>>
	<<elseif $battleTerrain == "hills">>
		<<if $chosenTactic == "Bait and Bleed">>
			While the hills offer some protection, they also make it harder to maneuver, bait and bleed tactics will not be 100% effective here.
		<<elseif $chosenTactic == "Guerrilla">>
			The hills offer protection to both your troops and your enemy's, making it harder for your men to accomplish guerrilla attacks effectively.
		<<elseif $chosenTactic == "Choke Points">>
			While not as defensible as mountains, hills offer numerous opportunities to funnel the enemy towards highly defensible choke points.
		<<elseif $chosenTactic == "Interior Lines">>
			The limited mobility on hills hampers the capability of your troops to exploit the defender's greater mobility afforded by interior lines.
		<<elseif $chosenTactic == "Pincer Maneuver">>
			Limited mobility due to the hills is a double edged sword, affording your men a decent shot at encirclement.
		<<elseif $chosenTactic == "Defense In Depth">>
			The limited mobility on hills hampers the capability of your troops to use elastic defense tactics.
		<<elseif $chosenTactic == "Blitzkrieg">>
			The limited mobility on hills hampers the capability of your troops to organize lightning strikes.
		<<elseif $chosenTactic == "Human Wave">>
			The defensibility of hills makes it harder to accomplish victory through mass assaults.
		<</if>>
	<<elseif $battleTerrain == "coast">>
		<<if $chosenTactic == "Bait and Bleed">>
			On the coast there's little space and protection to effectively employ bait and bleed tactics.
		<<elseif $chosenTactic == "Guerrilla">>
			On the coast there's little space and protection to effectively employ guerrilla tactics.
		<<elseif $chosenTactic == "Choke Points">>
			Amphibious attacks are difficult in the best of situations, the defender has a very easy time funneling the enemy towards their key defensive positions.
		<<elseif $chosenTactic == "Interior Lines">>
			While in an amphibious landing mobility is not the defender best weapon, exploiting interior lines still affords your troops some advantages.
		<<elseif $chosenTactic == "Pincer Maneuver">>
			Attempting to encircle a landing party is not the best course of action, but not the worst either.
		<<elseif $chosenTactic == "Defense In Depth">>
			In an amphibious assault it's very easy for the enemy to overextend, making defense in depth tactics quite effective.
		<<elseif $chosenTactic == "Blitzkrieg">>
			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
		<<elseif $chosenTactic == "Human Wave">>
			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.
		<</if>>
	<<elseif $battleTerrain == "outskirts">>
		<<if $chosenTactic == "Bait and Bleed">>
			Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops bait and bleed tactics would require.
		<<elseif $chosenTactic == "Guerrilla">>
			Fighting just beneath the walls of the arcology does not allow for the dynamic redeployment of troops guerrilla tactics would require.
		<<elseif $chosenTactic == "Choke Points">>
			The imposing structure of the arcology itself provides plenty of opportunities to create fortified choke points where to shatter the enemy assault.
		<<elseif $chosenTactic == "Interior Lines">>
			While the presence of the arcology near the battlefield is an advantage, it does limit maneuverability, lowering overall effectiveness of interior lines tactics.
		<<elseif $chosenTactic == "Pincer Maneuver">>
			While the presence of the arcology near the battlefield is an advantage, it does limit maneuverability, lowering the chances of making an effective encirclement.
		<<elseif $chosenTactic == "Defense In Depth">>
			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.
		<<elseif $chosenTactic == "Blitzkrieg">>
			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.
		<<elseif $chosenTactic == "Human Wave">>
			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.
		<</if>>
	<<elseif $battleTerrain == "mountains">>
		<<if $chosenTactic == "Bait and Bleed">>
			While the mountains offer great protection, they also limit maneuverability, bait and bleed tactics will not be quite as effective here.
		<<elseif $chosenTactic == "Guerrilla">>
			The mountains offer many excellent hiding spots and defensive positions, making guerrilla tactics very effective.
		<<elseif $chosenTactic == "Choke Points">>
			The mountains offer plenty of opportunity to build strong defensive positions where to shatter the enemy's assault.
		<<elseif $chosenTactic == "Interior Lines">>
			While the rough terrain complicates maneuvers, the defensive advantages offered by the mountains offsets its negative impact.
		<<elseif $chosenTactic == "Pincer Maneuver">>
			The rough terrain complicates maneuvers, your men have a really hard time pulling off an effective encirclement in this environment.
		<<elseif $chosenTactic == "Defense In Depth">>
			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.
		<<elseif $chosenTactic == "Blitzkrieg">>
			The rough terrain complicates maneuvers, your men have a really hard time pulling off an effective lightning strike in this environment.
		<<elseif $chosenTactic == "Human Wave">>
			The rough terrain complicates maneuvers, your men have a really hard time pulling off an effective mass assault in this environment.
		<</if>>
	<<elseif $battleTerrain == "wasteland">>
		<<if $chosenTactic == "Bait and Bleed">>
			While the wastelands are mostly open terrain, there are enough hiding spots to make bait and bleed tactics work well enough.
		<<elseif $chosenTactic == "Guerrilla">>
			While the wastelands are mostly open terrain, there are enough hiding spots to make guerrilla tactics work well enough.
		<<elseif $chosenTactic == "Choke Points">>
			The wastelands are mostly open terrain, your men have a difficult time setting up effective fortified positions.
		<<elseif $chosenTactic == "Interior Lines">>
			The wastelands, while rough, are mostly open terrain, where your men can exploit to the maximum the superior mobility of the defender.
		<<elseif $chosenTactic == "Pincer Maneuver">>
			The wastelands, while rough, are mostly open terrain, your men can set up an effective encirclement here.
		<<elseif $chosenTactic == "Defense In Depth">>
			The wastelands, while rough, are mostly open terrain, allowing your men to liberally maneuver to exploit overextended enemies.
		<<elseif $chosenTactic == "Blitzkrieg">>
			The wastelands, while rough, are mostly open terrain, where your men are able to mount effective lightning strikes.
		<<elseif $chosenTactic == "Human Wave">>
			The wastelands, while rough, are mostly open terrain, where your men are able to mount effective mass assaults.
		<</if>>
	<</if>>

	<<if $chosenTactic == "Bait and Bleed">>
		<<if $attackType == "raiders">>
			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.
		<<elseif $attackType == "free city">>
			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.
		<<elseif $attackType == "old world">>
			While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harassment tactics.
		<<elseif $attackType == "freedom fighters">>
			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.
		<</if>>
	<<elseif $chosenTactic == "Guerrilla">>
		<<if $attackType == "raiders">>
			Since the bands of raiders are used to be on high alert and on the move constantly, guerrilla tactics are not effective against them.
		<<elseif $attackType == "free city">>
			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.
		<<elseif $attackType == "old world">>
			While old world armies are tough nuts to crack, their predictability makes them the perfect target for hit and run and harassment tactics.
		<<elseif $attackType == "freedom fighters">>
			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.
		<</if>>
	<<elseif $chosenTactic == "Choke Points">>
		<<if $attackType == "raiders">>
			Raiders lack heavy weaponry or armour, so making use of fortified positions is an excellent way to dissipate the otherwise powerful momentum of their assault.
		<<elseif $attackType == "free city">>
			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.
		<<elseif $attackType == "old world">>
			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.
		<<elseif $attackType == "freedom fighters">>
			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.
		<</if>>
	<<elseif $chosenTactic == "Interior Lines">>
		<<if $attackType == "raiders">>
			The highly mobile horde of raiders will not give much room for your troops to maneuver, lowering their tactical superiority.
		<<elseif $attackType == "free city">>
			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.
		<<elseif $attackType == "old world">>
			Old world armies are not famous for the mobility, which makes them highly susceptible to any tactic that exploits maneuverability and speed.
		<<elseif $attackType == "freedom fighters">>
			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.
		<</if>>
	<<elseif $chosenTactic == "Pincer Maneuver">>
		<<if $attackType == "raiders">>
			While numerous, the undisciplined masses of raiders are easy prey for encirclements.
		<<elseif $attackType == "free city">>
			While decently mobile, the low number of free cities expedition forces make them good candidates for encirclements.
		<<elseif $attackType == "old world">>
			The discipline and numbers of old world armies make them quite difficult to encircle.
		<<elseif $attackType == "freedom fighters">>
			While not particularly mobile, freedom fighters are used to fight against overwhelming odds, diminishing the effectiveness of the encirclement.
		<</if>>
	<<elseif $chosenTactic == "Defense In Depth">>
		<<if $attackType == "raiders">>
			While their low discipline makes them prime candidates for an elastic defense type of strategy, their high numbers limit your troops maneuverability.
		<<elseif $attackType == "free city">>
			With their low numbers free cities mercenaries are quite susceptible to this type of tactic, despite their mobility.
		<<elseif $attackType == "old world">>
			With their low mobility old world armies are very susceptible to this type of strategy.
		<<elseif $attackType == "freedom fighters">>
			Low mobility and not particularly high numbers mean freedom fighters can be defeated by employing elastic defense tactics.
		<</if>>
	<<elseif $chosenTactic == "Blitzkrieg">>
		<<if $attackType == "raiders">>
			With their low discipline and lack of heavy equipment, lightning strikes are very effective against raider hordes.
		<<elseif $attackType == "free city">>
			Having good equipment and discipline on their side, free cities expeditions are capable of responding to even strong lightning strikes.
		<<elseif $attackType == "old world">>
			While disciplined, old world armies low mobility makes them highly susceptible to lightning strikes.
		<<elseif $attackType == "freedom fighters">>
			While not well equipped, freedom fighters have plenty of experience fighting small, mobile attacks, making them difficult to defeat with lightning strikes.
		<</if>>
	<<elseif $chosenTactic == "Human Wave">>
		<<if $attackType == "raiders">>
			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.
		<<elseif $attackType == "free city">>
			The good equipment and mobility of free cities mercenaries cannot save them from an organized mass assault.
		<<elseif $attackType == "old world">>
			Unfortunately the discipline and good equipment of old world armies allow them to respond well against a mass assault.
		<<elseif $attackType == "freedom fighters">>
			The relative low numbers and not great equipment typical of freedom fighters make them susceptible to being overwhelmed by an organized mass assault.
		<</if>>
	<</if>>
	<<if $tacticsSuccessful == 1>>
		In the end <<if $leadingTroops == "PC">>you were<<else>>your commander was<</if>> @@.green;able to successfully employ <<print $chosenTactic>> tactics@@, greatly enhancing the efficacy of your army.
	<<else>>
		In the end <<if $leadingTroops == "PC">>you were<<else>>your commander was<</if>> @@.red;not able to effectively employ <<print $chosenTactic>> tactics@@, greatly affecting the efficacy of your army.
	<</if>>

	<<include "unitsBattleReport">>

	<<if $securityForceArcologyUpgrades >= 7 || $securityForceFortressZeppelin >= 1 || $securityForceSatellitePower >= 11 || $securityForceGiantRobot >= 6 || $securityForceMissileSilo >= 1>>
		/* SF upgrades effects */

		<<if $securityForceArcologyUpgrades >= 7>>
			The artillery pieces installed around the $securityForceName barracks provided vital fire support to the troops in the field.
		<</if>>
		<<if $securityForceFortressZeppelin >= 1>>
			The fortress zeppelin gave our troops an undeniable advantage in recon capabilities, air superiority and fire support.
		<</if>>
		<<if $securityForceSatellitePower >= 11>>
			The $securityForceName Satellite devastating power was employed with great efficacy against the enemy.
		<</if>>
		<<if $securityForceGiantRobot >= 6>>
			The giant robot of the $securityForceName proved to be a great boon to our troops, shielding many from the worst the enemy had to offer.
		<</if>>
		<<if $securityForceMissileSilo >= 1>>
			The missile silo exterminated many enemy soldiers even before the battle would begin.
		<</if>>
	<</if>>

<</if>> /* closes check for surrender and bribery */

<<set _menialPrice = Math.trunc(($slaveCostFactor*1000)/100)*100>>
<<set _menialPrice = Math.clamp(_menialPrice, 500, 1500)>>

<<set _captives = Math.trunc(_captives)>>
<<if _captives > 0>>
	During the battle <<print _captives>> attackers were captured.
	/*
	<<if random(1,100) <= 25>>
		<<set _roll = random(1,100)>>
		<<if _roll <= 33>>
			Three of them have the potential to be sex slaves.
			<<set _candidates = 3>>

		<<elseif _roll <= 66>>
			Two of them have the potential to be sex slaves.
			<<set _candidates = 2>>
		<<else>>
			One of them have the potential to be sex slaves.
			<<set _candidates = 1>>
		<</if>>
	<</if>>
	*/

	<<link "sell them all immediately">>
		<<set $cash += _menialPrice * _captives>>
		<<replace "#captOptions">>Captives sold<</replace>>
	<</link>>
	|
	<<link "Keep them as menial slaves">>
		<<set $helots += _captives>>
		<<replace "#captOptions">>Captives added as menial slaves<</replace>>
	<</link>>

<</if>>

/* resets variables */
<<set $leaderWounded = 0>>
<<set $gainedWarfare = 0>>
<<set $slaveIncreasedPrestige = 0>>
<<set $woundType = 0>>
<<set $tacticsSuccessful = 0>>
<<set $attackType = "none">>
<<set $chosenTactic = "none">>
<<set $leadingTroops = "none">>
<<set $attackTroops = 0>>
<<set $attackEquip = 0>>
<<set $deployableUnits = 0>>
<<set $deployedUnits = 0>>
<<set $deployingBots = 0>>
<<set $deployingMilitia = 0>>
<<set $deployingSlaves = 0>>
<<set $deployingMercs = 0>>
<<set $battleTerrain = "none">>
<<set $attackThisWeek = 0>>
<<set $deployableUnits = 0>>
<<set $deployedUnits = 0>>
<<set $enemyLosses = 0>>
<<set $losses = 0>>
<<set $battleTurns = 0>>
<<set $majorBattle = 0>>
<<set $SFIntervention = 0>>
<<set $secBots.isDeployed = 0>>
<<for _i = 0; _i < $militiaUnits.length; _i++>>
	<<set $militiaUnits[_i].isDeployed = 0>>
<</for>>
<<for _i = 0; _i < $slaveUnits.length; _i++>>
	<<set $slaveUnits[_i].isDeployed = 0>>
<</for>>
<<for _i = 0; _i < $mercUnits.length; _i++>>
	<<set $mercUnits[_i].isDeployed = 0>>
<</for>>

repo_name: lemongrab/fc


code:
:: authorityReport [nobr]

<<if $useTabs == 0>>__Authority__<</if>>

<<if $authority > 19500>>
	Your authority is nearly absolute. The arcology is yours to command as it pleases you.
<<elseif $authority > 15000>>
	Your authority is extremely high. There's little you cannot do within the walls of your arcology.
<<elseif $authority > 10000>>
	Your authority is high. You command respect and fear in equal measure.
<<elseif $authority > 5000>>
	Your authority is moderate. You command some respect from your citizens.
<<else>>
	Your authority is low. You command no respect or fear from your citizens.
<</if>>

<<set _authGrowth = 0>>

<<if $PC.career == "wealth">>
	As part of the idle wealth, you were used to have obedience coming naturally to you. Now you find it harder to maintain authority over the arcology.
	<<set _authGrowth -= 10 * random(5,15)>>
<<elseif $PC.career == "slaver">>
	Your past as a slaver helps you assert your authority over the arcology.
	<<set _authGrowth += 10 * random(5,15)>>
<<elseif $PC.career == "escort">>
	Given your past career as an escort, you find it hard to assert your authority over the arcology and its inhabitants.
	<<set _authGrowth -= 10 * random(5,15)>>
<<elseif $PC.career == "servant">>
	Given your past career as a servant, you find it hard to assert your authority over the arcology and its inhabitants.
	<<set _authGrowth -= 10 * random(5,15)>>
<<elseif $PC.career == "BlackHat">>
	Given your past career as a, rather questionable, incursion specialist, you find it hard to assert your authority over the arcology and its inhabitants, despite what you may know about them.
	<<set _authGrowth -= 10 * random(5,15)>>
<<elseif $PC.career == "gang">>
	Given your past life as a gang leader, you find it easier to assert your authority over the arcology and its inhabitants.
	<<set _authGrowth += 10 * random(5,15)>>
<</if>>

<<if $rep >= 19500>>
	Your legend is so well known that your mere presence command respect and obedience, increasing your authority.
	<<set _authGrowth += 10 * random(10,20)>>
<<elseif $rep >= 15000>>
	Your reputation is so high that your mere presence command respect, increasing your authority.
	<<set _authGrowth += 10 * random(5,15)>>
<<elseif $rep >= 10000>>
	Your reputation is high enough that your presence command some respect, increasing your authority.
	<<set _authGrowth += 10 * random(2,8)>>
<</if>>

<<if $security >= 90>>
	Your arcology is incredibly secure and your citizens know quite well who to thank, greatly increasing your authority.
	<<set _authGrowth += 10 * random(10,20)>>
<<elseif $security >= 70>>
	Your arcology is really secure and your citizens know quite well who to thank, increasing your authority.
	<<set _authGrowth += 10 * random(5,15)>>
<<elseif $security >= 50>>
	Your arcology is quite secure and your citizens know who to thank, increasing your authority.
	<<set _authGrowth += 10 * random(2,8)>>
<</if>>

<<if $crime >= 90>>
	The all powerful criminal organizations controlling the arcology has a very easy time undermining your authority.
	<<set _authGrowth -= 10 * random(10,20)>>
<<elseif $crime >= 70>>
	Crime is king in the arcology, powerful criminals have a very easy time undermining your authority.
	<<set _authGrowth -= 10 * random(5,15)>>
<<elseif $crime >= 50>>
	Criminal organizations have a strong foothold in the arcology, their activities undermine your authority.
	<<set _authGrowth -= 10 * random(2,8)>>
<</if>>

<<if $averageDevotion >= 50 && $averageTrust >= 50>>
	The high devotion and trust of your slaves speak eloquently of your leadership capabilities, helping your authority grow.
	<<set _authGrowth += 5 * (($averageDevotion + $averageTrust) / 10)>>
<<elseif $averageDevotion >= 50>>
	The high devotion of your slaves speak eloquently of your leadership capabilities, helping your authority grow.
	<<set _authGrowth += 5 * ($averageDevotion / 10)>>
<<elseif $averageTrust >= 50>>
	The high trust of your slaves speak eloquently of your leadership capabilities, helping your authority grow.
	<<set _authGrowth += 5 * ($averageTrust / 10)>>
<</if>>

<<if $arcologies[0].ownership >= 90>>
	You own so much of the arcology that your authority quickly increases.
	<<set _authGrowth += 5 * Math.trunc($arcologies[0].ownership / 10)>>
<<elseif $arcologies[0].ownership >= 70>>
	You own a big part of the arcology, causing your authority to increase.
	<<set _authGrowth += 5 * Math.trunc($arcologies[0].ownership / 10)>>
<<elseif $arcologies[0].ownership >= 50>>
	You own the majority of the arcology, causing your authority to slowly increase.
	<<set _authGrowth += 5 * Math.trunc($arcologies[0].ownership / 10)>>
<<else>>
	Your low ownership of the arcology causes your authority to decrease.
	<<set _authGrowth -= 5 * Math.trunc($arcologies[0].ownership / 10)>>
<</if>>

<<if $activeUnits >= 9>>
	Your military is massive, commanding so many troops greatly increases your authority.
	<<set _authGrowth += 12 * $activeUnits>>
<<elseif $activeUnits >= 7>>
	Your military is huge, commanding such a number of soldiers increases your authority.
	<<set _authGrowth += 12 * $activeUnits>>
<<elseif $activeUnits >= 4>>
	Your military is at a decent size, commanding a small army increases your authority.
	<<set _authGrowth += 12 * $activeUnits>>
<</if>>

<<if $arcologies[0].FSChattelReligionist >= 90>>
	Religious organizations have a tight grip on the minds of your residents and their dogma greatly helps your authority grow.
	<<set _authGrowth += $arcologies[0].FSChattelReligionist>>
<<elseif $arcologies[0].FSChattelReligionist >= 50>>
	Religious organizations have a tight grip on the minds of your residents and their dogma helps your authority grow.
	<<set _authGrowth += $arcologies[0].FSChattelReligionist>>
<</if>>

<<if $arcologies[0].FSRestart >= 90>>
	The arcology's society is extremely stratified. The reliance on the societal elite by the lower classes greatly increases your reputation.
	<<set _authGrowth += $arcologies[0].FSRestart>>
<<elseif $arcologies[0].FSRestart >= 50>>
	The arcology's society is very stratified. The reliance on the societal elite by the lower classes increases your reputation.
	<<set _authGrowth += $arcologies[0].FSRestart>>
<</if>>

<<if $arcologies[0].FSPaternalist >= 90>>
	Your extremely paternalistic society has the unfortunate side effects of spreading dangerous ideals in the arcology, damaging your authority.
	<<set _authGrowth -= Math.clamp($arcologies[0].FSPaternalist, 0, 100)>>
<<elseif $arcologies[0].FSPaternalist >= 50>>
	Your paternalistic society has the unfortunate side effects of spreading dangerous ideals in the arcology, damaging your authority.
	<<set _authGrowth -= Math.clamp($arcologies[0].FSPaternalist, 0, 100)>>
<</if>>

<<if $arcologies[0].FSNull >= 90>>
	Cultural openness allows dangerous ideas to spread in your arcology, damaging your reputation.
	<<set _authGrowth -= $arcologies[0].FSNull>>
<<elseif $arcologies[0].FSNull >= 50>>
	Cultural openness allows dangerous ideas to spread in your arcology, damaging your reputation.
	<<set _authGrowth -= $arcologies[0].FSNull>>
<</if>>

<<if $miniTruth >= 1>>
	Your authenticity department works tirelessly to impose your authority in all the arcology.
	<<set _authGrowth += 15 * $miniTruth>>
<</if>>

<<if $secretService >= 1>>
	Your secret services constantly keep under surveillance any potential threat, intervening when necessary. Rumors of the secretive security service and mysterious disappearances make your authority increase.
	<<set _authGrowth += 15 * $secretService>>
<</if>>

<<if $edictsAuthUpkeep > 0>>
	Some of your authority is spent maintaining your edicts
	<<set _authGrowth -= $edictsAuthUpkeep>>
<</if>>

This week
<<if _authGrowth > 0>>
	@@.green;authority has increased@@.
<<elseif _authGrowth == 0>>
	@@.yellow;authority did not change@@.
<<else>>
	@@.red;authority has decreased@@.
<</if>>

<<set $authority += _authGrowth>>
<<set $authority = Math.trunc(Math.clamp($authority, 0, 20000))>>

<<if $rebellionsEnabled == 1>>
/* rebellions */

	<<include "rebellionGenerator">>
<</if>>