Skip to content
Snippets Groups Projects
Forked from pregmodfan / fc-pregmod
14028 commits behind the upstream repository.
attackOptions.tw 21.24 KiB
:: attackOptions [nobr]

<<if ndef $SecExp.settings.unitDescriptions>>
	<<set $SecExp.settings.unitDescriptions = 0>>
<</if>>
<<set $nextButton = " ", $encyclopedia = "Battles">>

<<set _options = new App.UI.OptionsGroup()>>
<<run _options.addOption("Unit descriptions are", "unitDescriptions", $SecExp.settings)
.addValueList([["Abbreviated", 1], ["Summarized", 0]])>>
<<includeDOM _options.render()>>

<br>
<strong> <<if $majorBattle == 1>>Major<</if>> Attack Imminent</strong>
<hr>
<<if $majorBattle == 0>>
	<<if $SecExp.battles.victories + $SecExp.battles.losses > 0>>
		The ominous message dominates the screens of your office, and <<print $assistant.name>> quickly gathers all information available to prepare for battle.
		<<if $SecExp.war.attacker.type === "raiders">>
			<<if App.SecExp.battle.recon() >= 1>>
				A disorganized horde of raiders is coming to your city. To such jackals your arcology surely looks like an appetizing morsel.
				Fortunately you knew of their coming, thanks to your recon systems.
			<<else>>
				Some of your citizens saw the disorganized horde of raiders coming towards the city and quickly reported it. To such jackals your arcology surely looks like an appetizing morsel.
			<</if>>
			<br>Raiders are roaming gangs of bandits, preying on the vulnerable supply lines of Free Cities and old world nations. They are rarely equipped with decent armaments and even more rarely have any formal military training, but they make up for that with high mobility and numbers.
		<<elseif $SecExp.war.attacker.type === "free city">>
			<<if App.SecExp.battle.recon() >= 1>>
				A menacing column of slavers and hired mercenaries is coming to your city. Another free city is ready to use their best tools to hit a dangerous competitor where it hurts.
				Fortunately you knew of their coming, thanks to your recon systems.
			<<else>>
				Some of your citizens saw the menacing column of slavers and hired mercenaries and rushed to your office to bring the grim news. Another free city is ready to use their best tools to bring down a dangerous competitor.
			<</if>>
			<br>Free City expeditions are usually composed of mercenaries hired to take down sensible supplies or infrastructure in order to damage the enemies of their contractor. They have on average good equipment and training, together with decent mobility, making them a formidable force. Their biggest weakness however is their relatively low numbers.
		<<elseif $SecExp.war.attacker.type === "freedom fighters">>
			<<if App.SecExp.battle.recon() >= 1>>
				A dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire.
				Fortunately you knew of their coming, thanks to your recon systems.
			<<else>>
				Some of your citizens saw the dangerous looking army of guerrillas is gathering just outside the arcology. Fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire.
			<</if>>
			<br>Freedom Fighters are groups of individuals fighting to rid the planet of "evils" such as the Free Cities and their way of life. Lacking the strength to assault one directly they fight guerrilla style slowly starving to death their enemies. They are rarely well equipped, but with good training and mobility they are not a threat that can be taken lightly.
		<<elseif $SecExp.war.attacker.type === "old world">>
			<<if App.SecExp.battle.recon() >= 1>>
				A disciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target.
				Fortunately you knew of their coming, thanks to your recon systems.
			<<else>>
				Some of your citizens saw the disciplined yet dusty, scruffy old world army is approaching the confines of your arcology. There's nothing better than a good war to unite the electorate and your arcology is just the perfect target.
			<</if>>
			<br>Old world expeditions are usually sent to secure resources and trade routes for their nation or, more often, to provide their citizens with a bogeyman to be scared of. They are usually decently equipped and trained, which together with their generous numbers make them a tough nut to crack. However, they often lack in mobility.
		<</if>>
	<<else>>
		Your assistant interrupted your rest to bring the grim news. You quickly rush to your console, where you can see one of the convoys supplying your arcology has been attacked and looted. It seems a group of desperate looking bandits decided it was a good idea to steal from you.
		Due to their great wealth, Free Cities inevitably become tasty morsels for anyone able to field armed men. Considering the particular needs of arcologies their supply lines tend to be delicate lifelines, often preyed upon by those who stand to gain from the free city downfall.
	<</if>>
<<else>>
	<<if $SecExp.battles.major > 0>>
		The ominous message dominates the screens of your office, and <<print $assistant.name>> quickly gathers all information available to prepare for the major battle ahead.
	<<else>>
		Your assistant interrupted your rest to bring the grim news. You quickly rush to your console, where you can see the satellite images coming in of the force about to crash against your arcology. It's not the first time your armies fought for the survival of your empire, but this time it seems it will be a fight for life or death.
	<</if>>
	<<if $SecExp.war.attacker.type === "raiders">>
		<<if App.SecExp.battle.recon() >= 1>>
			A massive, disorganized horde of raiders is coming to your city. It seems a warlord of the wastelands amassed enough men to try and obtain a slice of territory of his own; if he's not defeated there won't be a tomorrow for the arcology.
			Fortunately you knew of their coming, thanks to your recon systems.
		<<else>>
			Some of your citizens saw the massive, disorganized horde of raiders coming towards the city and quickly reported it. It seems a warlord of the wastelands amassed enough men to try and obtain a slice of territory of his own; if he's not defeated there won't be a tomorrow for the arcology.
		<</if>>
		<br>Raiders are roaming gangs of bandits, preying on the vulnerable supply lines of Free Cities and old world nations. They are rarely equipped with decent armaments and even more rarely have any formal military training, but they make up for that with high mobility and numbers.
	<<elseif $SecExp.war.attacker.type === "free city">>
		<<if App.SecExp.battle.recon() >= 1>>
			A massive, menacing column of slavers and hired mercenaries is coming to your city. The quantity of money invested in this assault is staggering; it seems you made some very powerful enemies. If they're not defeated your story will end this day.
			Fortunately you knew of their coming, thanks to your recon systems.
		<<else>>
			Some of your citizens saw the massive, menacing column of slavers and hired mercenaries and rushed to your office to bring the grim news. The quantity of money invested in this assault is staggering; it seems you made some very powerful enemies. If they're not defeated your story will end this day.
		<</if>>
		<br>Free City expeditions are usually composed of mercenaries hired to take down sensible supplies or infrastructure in order to damage the enemies of their contractor. They have, on average, good equipment and training, together with decent mobility, making them a formidable force. Their biggest weakness, however, is their relatively low numbers.
	<<elseif $SecExp.war.attacker.type === "freedom fighters">>
		<<if App.SecExp.battle.recon() >= 1>>
			A massive, dangerous army of guerrillas is gathering just outside the arcology. A huge ocean of fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire once and for all. And this time they won't stop until your body is burnt to a crisp.
			Fortunately you knew of their coming, thanks to your recon systems.
		<<else>>
			Some of your citizens saw the massive, dangerous army of guerrillas is gathering just outside the arcology. A huge ocean of fanatics and idealists armed with dead men's words and hope, set on erasing your fledgling empire once and for all. And this time they won't stop until your body is burnt to a crisp.
		<</if>>
		<br>Freedom Fighters are groups of individuals fighting to rid the planet of "evils" such as the Free Cities and their way of life. Lacking the strength to assault one directly, they fight guerrilla style, slowly starving to death their enemies. They are rarely well equipped, but with good training and mobility they are not a threat that can be taken lightly.
	<<elseif $SecExp.war.attacker.type === "old world">>
		<<if App.SecExp.battle.recon() >= 1>>
			A massive, disciplined old world army is approaching the confines of your arcology. It seems one of the nations of the old world is determined to put your arcology to rest once and for all or die trying.
			Fortunately you knew of their coming, thanks to your recon systems.
		<<else>>
			Some of your citizens saw the massive, disciplined old world army is approaching the confines of your arcology. It seems one of the nations of the old world is determined to put your arcology to rest once and for all or die trying.
		<</if>>
		<br>Old world expeditions are usually sent to secure resources and trade routes for their nation or, more often, to provide their citizens with a bogeyman to be scared of. They are usually decently equipped and trained, which together with their generous numbers make them a tough nut to crack. However, they often lack in mobility.
	<</if>>
<</if>>
<br><br>__Recon__: (AO: $terrain)
<<set _estimatedMen = $SecExp.war.estimatedMen>>
<<set _expectedEquip = $SecExp.war.expectedEquip>>
<br>It seems your troops and your adversary will fight
<<if $SecExp.war.terrain === "rural">>
	in <strong>the rural land</strong> surrounding the free city.
<<elseif $SecExp.war.terrain === "urban">>
	in the old <strong>abandoned city</strong> surrounding the free city.
<<elseif $SecExp.war.terrain === "hills">>
	on <strong>the hills</strong> around the free city.
<<elseif $SecExp.war.terrain === "coast">>
	along <strong>the coast</strong> just outside the free city.
<<elseif $SecExp.war.terrain === "outskirts">>
	right against <strong>the walls of the arcology.</strong>
<<elseif $SecExp.war.terrain === "mountains">>
	in <strong>the mountains</strong> overlooking the arcology.
<<elseif $SecExp.war.terrain === "wasteland">>
	in <strong>the wastelands</strong> outside the free city territory.
<<elseif $SecExp.war.terrain == "international waters">>
	in <strong>the water surrounding</strong> the free city.
<<elseif ["an underwater cave", "a sunken ship", "an island"].includes($SecExp.war.terrain)>>
	in <strong>$SecExp.war.terrain</strong> near the free city.
<<elseif $SecExp.war.terrain === "error">>
	<br>@@.red;Error: failed to assign terrain.@@ SecExp.war.terrain reads: $SecExp.war.terrain.
<<else>>
	<br>@@.red;Error: failed to read terrain.@@ SecExp.war.terrain reads: $SecExp.war.terrain.
<</if>>
<<if App.SecExp.battle.recon() == 3>>
	Your recon capabilities are top notch. The information collected will be most likely correct or very close to be so:
<<elseif App.SecExp.battle.recon() == 2>>
	Your recon capabilities are decent. The information collected will be mostly close to the truth:
<<elseif App.SecExp.battle.recon() == 1>>
	Your recon capabilities are fairly low. The information collected will be quite inaccurate:
<<else>>
	Your recon capabilities are almost non-existent. The information collected will be wild guesses at best:
<</if>>
approximately <strong>_estimatedMen men</strong> are coming, they seem to be
<<if _expectedEquip <= 0>>
	<strong>poorly armed</strong>. Old rusty small arms are the norm with just a few barely working civilian vehicles.
<<elseif _expectedEquip == 1>>
	<strong>lightly armed</strong>, mostly with small arms and some repurposed civilian vehicles with scattered machine gun support. There's no sign of heavy vehicles, artillery or aircraft.
<<elseif _expectedEquip == 2>>
	<strong>decently armed</strong> with good quality small arms, machine guns and a few mortars. There appear to be some heavy military vehicles coming as well.
<<elseif _expectedEquip == 3>>
	<strong>well armed</strong> with high quality small arms, snipers, demolitions teams, heavy duty machine guns and mortars. Heavy military vehicles are numerous and a few artillery pieces are accompanying the detachment.
<<elseif _expectedEquip >= 4>>
	<strong>extremely well armed</strong> with excellent small arms and specialized teams with heavy duty infantry support weapons. Heavy presence of armored military vehicles, artillery pieces and even some attack helicopters.
<</if>>

<hr>__Battle Plan__:<br>
<<set _leaderFound = 1>>
<<if $SecExp.war.commander === "bodyguard" && $BodyguardID === 0 || $SecExp.war.commander === "headGirl" && $HeadGirlID === 0>>
	@@.warning;Chosen leader $SecExp.war.commander cannot be found, please select another.@@
	<<set _leaderFound = 0>>
<</if>>
<<switch $SecExp.war.commander>>
<<case "PC">>
	<<set _leader = "Personally">>
<<case "assistant">>
	<<set _leader = "$assistant.name will">>
<<case "bodyguard">>
	<<set _leader = "_S.Bodyguard.slaveName will">>
<<case "headGirl">>
	<<set _leader = "_S.HeadGirl.slaveName will">>
<<case "citizen">>
	<<set _leader = "The citizens' militia commander will">>
<<case "mercenary">>
	<<set _leader = "The mercenary commander will">>
<<case "colonel">>
	<<set _leader = capFirstChar($SF.Lower || "the special force") +"'s Colonel will">>
<</switch>>

/* leader assignment */
<strong>_leader</strong> lead your troops.
<br>&nbsp;&nbsp;&nbsp;&nbsp;
[[Personally join the battle|attackOptions][$SecExp.war.commander = "PC"]]
| <<link "Let $assistant.name lead your troops""attackOptions">> <<set $SecExp.war.commander = "assistant">> <</link>>
<<if $BodyguardID !== 0 && $SecExp.edicts.defense.slavesOfficers === 1>>
	| [[Let your bodyguard lead your troops|attackOptions][$SecExp.war.commander = "bodyguard"]]
<</if>>
<<if $HeadGirlID !== 0 && $SecExp.edicts.defense.slavesOfficers === 1>>
	| [[Let your Head Girl lead your troops|attackOptions][$SecExp.war.commander = "headGirl"]]
<</if>>
<<if $SecExp.edicts.defense.militia >= 1>>
	| [[Let the citizens' militia officers lead the troops|attackOptions][$SecExp.war.commander = "citizen"]]
<</if>>
<<if $mercenaries > 0>>
	| [[Let the mercenary officers lead the troops|attackOptions][$SecExp.war.commander = "mercenary"]]
<</if>>
<<if $SF.Toggle && $SF.Active >= 1 && $SF.MercCon.CanAttend === -2>>
	|[[Let The Colonel lead the troops|attackOptions][$SecExp.war.commander = "colonel"]]
<</if>>
<br>For this battle you choose to follow <strong>$SecExp.war.chosenTactic</strong> tactics.<br>
<button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'defensiveTactics')" id="tab defensive tactics">Defensive tactics</button>
<button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'offensiveTactics')" id="tab offensiveTactics">Offensive Tactics</button>

<div id="defensiveTactics" class="tab-content">
	<div class="content">
		[[Bait and Bleed|attackOptions][$SecExp.war.chosenTactic = "Bait and Bleed"]]
		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Combines bait and switch tactics with guerrilla style assaults, with the objective of slowly bleed the enemy.//
		<br>[[Guerrilla|attackOptions][$SecExp.war.chosenTactic = "Guerrilla"]]
		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Involves using terrain knowledge and small fast attacks to hinder and weaken the enemy.//
		<br>[[Choke Points|attackOptions][$SecExp.war.chosenTactic = "Choke Points"]]
		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Involves using terrain knowledge and strong fortifications in order to stop the enemy on its track.//
		<br>[[Interior Lines|attackOptions][$SecExp.war.chosenTactic = "Interior Lines"]]
		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Involves exploiting a defender's shorter logistics lines and redeployment times in order to keep the enemy pressured.//
		<br>[[Pincer Maneuver|attackOptions][$SecExp.war.chosenTactic = "Pincer Maneuver"]]
		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Involves letting the enemy push back the center in order to envelop their formation.//
		<br>[[Defense In Depth|attackOptions][$SecExp.war.chosenTactic = "Defense In Depth"]]
		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Involves letting the enemy gain terrain to gain tactical superiority by alternating between delaying actions and small counterattacks.//
	</div>
</div>

<div id="offensiveTactics" class="tab-content">
	<div class="content">
		[[Blitzkrieg|attackOptions][$SecExp.war.chosenTactic = "Blitzkrieg"]]
		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Involves breaking the front of the enemy with a fast armored force concentrated into a small area.//
		<br>[[Human Wave|attackOptions][$SecExp.war.chosenTactic = "Human Wave"]]
		<br>&nbsp;&nbsp;&nbsp;&nbsp;//Involves assaulting the enemy with large numbers of infantry to overwhelm their lines.//
	</div>
</div>

<<if _leaderFound === 1>>
	<<if App.SecExp.battle.deployedUnits() > 0>>
		<br>[[Send your orders|attackHandler][$SecExp.war.result = 4, $foughtThisWeek = 1]] /* sets $SecExp.war.result value outside accepted range (-3, 3) to avoid evaluation problems */
	<<else>>
		<br>You need at least a unit in your roster to proceed to battle.
	<</if>>
	<br>[[Surrender|attackReport][$SecExp.war.result = -1, $foughtThisWeek = 1]]
	<br>[[Attempt to bribe|attackHandler][$SecExp.war.result = 1, $foughtThisWeek = 1]]
	 //Will cost around <<print cashFormat(Math.round(App.SecExp.battle.bribeCost() * (1 + either(-1,1) * random(2) * 0.1)))>> (estimate).//
<<else>>
	Your leader needs to be present to proceed.
<</if>>

<<if $SF.Toggle && $SF.Active >= 1 && $majorBattle>> <br>
	<<set _options = new App.UI.OptionsGroup()>>
	<<run _options.addOption("The incoming attack's scale warrants deploying the special force.", "SecExp.war.deploySF")
	.addValue("Green light", 1).on().addValue("Red light", 0).off()
	.addComment("Some upgrades will be able to support your troops even if the special force is not deployed in the fight.")>>
	<<includeDOM _options.render()>>
<</if>>

<br>
<<if $SecExp.battles.lastSelection.length > 0>>
	<<link "Restore saved roster" "attackOptions">>
		<<for _i = 0; _i < $SecExp.battles.lastSelection.length; _i++>>
			<<if $SecExp.battles.lastSelection[_i] == -1>>
				<<set $SecExp.units.bots.isDeployed = 1>>
			<<else>>
				<<for _squad range App.SecExp.unit.humanSquads()>>
					<<if $SecExp.battles.lastSelection[_i] === _squad.ID>>
						<<set _squad.isDeployed = 1>>
						<<break>>
					<</if>>
				<</for>>
			<</if>>
		<</for>>
		<<set $SecExp.war.saveValid = 1, $SecExp.war.commander = $SecExp.battles.saved.commander, $SecExp.war.deploySF = $SecExp.battles.saved.sfSupport>>
	<</link>>
<<else>>
	Restore saved roster
<</if>>
|
<<if $SecExp.war.saveValid !== 1>>
	<<link "Save current roster" "attackOptions">>
		<<if App.SecExp.battle.deployedUnits('bots')>>
			<<set _tmp = -1>>
			<<set $SecExp.battles.lastSelection.push(_tmp)>>
		<</if>>
		<<for _squad range App.SecExp.unit.humanSquads()>>
			<<if _squad.isDeployed === 1>>
				<<set $SecExp.battles.lastSelection.push(_squad.ID)>>
			<</if>>
		<</for>>
		<<set $SecExp.war.saveValid = 1, $SecExp.battles.saved.commander = $SecExp.war.commander, $SecExp.battles.saved.sfSupport = $SecExp.war.deploySF>>
	<</link>>
<<else>>
	Save current roster
<</if>>
|
<<if App.SecExp.battle.deployedUnits() > 0>>
	<<link "Clear current roster" "attackOptions">>
		<<set $SecExp.units.bots.isDeployed = 0>>
		<<for _squad range App.SecExp.unit.humanSquads()>>
			<<set _squad.isDeployed = 0>>
		<</for>>
		<<set $SecExp.war.saveValid = 0>>
	<</link>>
<<else>>
	Clear current roster
<</if>>
|
<<if $SecExp.battles.lastSelection.length > 0>>
	[[Clear saved roster|attackOptions][$SecExp.battles.lastSelection = [], $SecExp.war.saveValid = 0]]
<<else>>
	Clear saved roster
<</if>>

<br> /* troop deployment */
<<if App.SecExp.battle.deployableUnits() > 0>>
	With your current readiness level you can send an additional <strong><<print App.SecExp.battle.deployableUnits()>></strong> units.
<</if>>
<<includeDOM App.SecExp.unit.replenishAll()>>
<<set _mL = $SecExp.units.militia.squads.length>>
<<set _sL = $SecExp.units.slaves.squads.length>>
<<set _meL = $SecExp.units.mercs.squads.length>>

<<run App.UI.tabBar.handlePreSelectedTab($tabChoice.Options)>>

<<if App.SecExp.battle.deployableUnits() === 0>> <strong>Unit roster full.</strong> <</if>>
<br> <<includeDOM App.SecExp.unit.deployMenu($SecExp.units.bots, "bots")>>
<<if _mL > 0>>
	<button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'militia')" id="tab militia">Militia: (_mL)</button>
<</if>>
<<if _sL > 0>>
	<button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'slaves')" id="tab slaves">Slaves: (_sL)</button>
<</if>>
<<if _meL > 0>>
	<button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'mercs')" id="tab mercs">Mercs: (_meL)</button>
<</if>>

<div id="militia" class="tab-content">
	<div class="content">
		<<for _i = 0; _i < _mL; _i++>>
			<<includeDOM App.SecExp.unit.deployMenu($SecExp.units.militia.squads[_i], "militia", _i)>>
		<</for>>
	</div>
</div>
<div id="slaves" class="tab-content">
	<div class="content">
		<<for _i = 0; _i < _sL; _i++>>
			<<includeDOM App.SecExp.unit.deployMenu($SecExp.units.slaves.squads[_i], "slaves", _i)>>
		<</for>>
	</div>
</div>
<div id="mercs" class="tab-content">
	<div class="content">
		<<for _i = 0; _i < _meL; _i++>>
			<<includeDOM App.SecExp.unit.deployMenu($SecExp.units.mercs.squads[_i], "mercs", _i)>>
		<</for>>
	</div>
</div>