:: Upgrades [nobr]
<<if ($SF.Units < 30 || $SF.Units !== _max) && $SF.U < 1>> <span id="resultX"> <<set _T1 = $SF.Units >= 30>>
@@.orange;Which facility or equipment do you wish to upgrade this week?@@
	<<if $SFUnit.Firebase < 1||$SFUnit.Firebase < 2||$SFUnit.Firebase < 4>><br>More firebase upgrades are required to unlock further options.<</if>>
	<<if $SFUnit.Firebase < 5||_T1 && $SFUnit.Firebase < _FU>>
		@@.green;<<link "Firebase">> <<replace "#resultX">>
			<<set $SF.U = 1, $SFUnit.Firebase++, $cash -= Math.ceil(100000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Firebase/100)))>> <<goto "Firebase">>
		<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(100000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Firebase/100))))>>@@ //
	<</if>>
	<<if $SFUnit.Armoury < 5||_T1 && $SFUnit.Armoury < _AU>>
		@@.green;<<link "Armoury">> <<replace "#resultX">>
			<<set $SF.U = 1, $SFUnit.Armoury++, $cash -= Math.ceil(40000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Armoury/100)))>> <<goto "Firebase">>
		<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(40000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Armoury/100))))>>@@ //
	<</if>>
	<<if $SFUnit.Drugs < 5||_T1 && $SFUnit.Drugs < _DrugsU>>
		@@.green;<<link "Drug lab">> <<replace "#resultX">>
			<<set $SF.U = 1, $SFUnit.Drugs++, $cash -= Math.ceil(40000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Drugs/100)))>> <<goto "Firebase">>
		<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(40000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Drugs/100))))>>@@ //
	<</if>>
	<<if $SFUnit.Firebase >= 2 && ($SFUnit.Drones < 5 ||_T1 && $SFUnit.Drones < _DU)>>
		@@.green;<<link "Drone bay">> <<replace "#resultX">>
			<<set $SF.U = 1, $SFUnit.Drones++, $cash -= Math.ceil(45000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Drones/100))*HSM())>> <<goto "Firebase">>
		<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(45000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Drones/100))*HSM()))>>@@ //
	<</if>>

	<<if $SFUnit.Firebase >= 1 && (_G < 5||_T1 && _G < _GU)>> @@.green;<<link "Garage">> <<replace "#resultX">> <span id="resultY">
		"Which unit do you wish to upgrade or 'borrow'?"
		@@.green;<<link "Go back""Firebase">> <</link>>@@
			<<if ($SFUnit.AV < 5||_T1 && $SFUnit.AV < _AVU)>>
				@@.green;<<link "Attack vehicle fleet">> <<replace "#resultY">>
					<<set $SF.U = 1, $SFUnit.AV++, $cash -= Math.ceil(60000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.AV/100)))>> <<goto "Firebase">>
				<</replace>> <</link>>@@// @@.yellowgreen;<<print cashFormat(Math.ceil(60000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.AV/100))))>>@@ //
			<</if>>
			<<if ($SFUnit.TV < 5||_T1 && $SFUnit.TV < _TVU)>>
				@@.green;<<link "Transport vehicle fleet">> <<replace "#resultY">>
					<<set $SF.U = 1, $SFUnit.TV++, $cash -= Math.ceil(60000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.TV/100)))>> <<goto "Firebase">>
				<</replace>> <</link>>@@// @@.yellowgreen;<<print cashFormat(Math.ceil(60000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.TV/100))))>>@@ //
			<</if>>
			<<if _T1 && $SFUnit.PGT < _PGTU>>
					@@.green;<<link "Prototype Goliath tank">> <<replace "#resultY">>
					<<set $SF.U = 1, $SFUnit.PGT++, $cash -= Math.ceil(735000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.PGT/100)))>> <<goto "Firebase">>
				<</replace>> <</link>>@@// @@.yellowgreen;<<print cashFormat(Math.ceil(735000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.PGT/100))))>>@@ //
			<</if>>
	</span> <</replace>> <</link>>@@ <</if>>

	<<if $SFUnit.Firebase >= 4 && (_H < 5||_T1 && _H < _HU)>> @@.green;<<link "Hangar">> <<replace "#resultX">> <span id="resultY">
		"Which unit do you wish to upgrade or 'borrow'?"
		@@.green;<<link "Go back""Firebase">> <</link>>@@
		<<if $SFUnit.AA < 5||_T1 && $SFUnit.AA < _AAU>>
			@@.green;<<link "Attack aircraft fleet">> <<replace "#resultY">>
				<<set $SF.U = 1, $SFUnit.AA++, $cash -= Math.ceil(70000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.AA/100)))>> <<goto "Firebase">>
			<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(70000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.AA/100))))>>@@ //
		<</if>>
		<<if $SFUnit.TA < 5||_T1 && $SFUnit.TA < _TAU>>
			@@.green;<<link "Transport aircraft fleet">> <<replace "#resultY">>
				<<set $SF.U = 1, $SFUnit.TA++, $cash -= Math.ceil(70000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.TA/100)))>> <<goto "Firebase">>
			<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(70000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.TA/100))))>>@@ //
		<</if>>
		<<if _T1 && $SFUnit.SpacePlane < _SPU>>
			@@.green;<<link "Space plane">> <<replace "#resultY">>
				<<set $SF.U = 1, $SFUnit.SpacePlane++, $cash -= Math.ceil(250000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.SpacePlane/100))*HSM())>> <<goto "Firebase">>
			<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(250000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.SpacePlane/100))*HSM()))>>@@ //
		<</if>>
		<<if _T1 && $SFUnit.GunS < _GunSU>>
			@@.green;<<link "Gunship">> <<replace "#resultY">>
				<<set $SF.U = 1, $SFUnit.GunS++, $cash -= Math.ceil(350000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.GunS/100))*HSM())>> <<goto "Firebase">>
			<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(350000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.GunS/100))*HSM()))>>@@ //
		<</if>>
	</span> <</replace>> <</link>>@@ <</if>>

	<<if _T1 && (_LB < _LBU)>> @@.green;<<link "Launch Bay">> <<replace "#resultX">> <span id="resultY">
		"Which unit do you wish to upgrade or 'borrow'?"
		@@.green;<<link "Go back""Firebase">> <</link>>@@
			<<if $SFUnit.Satellite < _SatU && $SatLaunched < 1>>
				@@.green;<<link "Satellite">> <<replace "#resultY">>
					<<set $SF.U = 1, $SFUnit.Satellite++, $cash -= Math.ceil(525000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Satellite/100))*HSM())>> <<goto "Firebase">>
				<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(525000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Satellite/100))*HSM()))>>@@ //
			<</if>>
			<<if $SFUnit.GiantRobot < _GRU>>
				@@.green;<<link "Giant robot">> <<replace "#resultY">>
					<<set $SF.U = 1, $SFUnit.GiantRobot++, $cash -= Math.ceil(550000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.GiantRobot/100))*HSM())>> <<goto "Firebase">>
				<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(550000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.GiantRobot/100))*HSM()))>>@@ //
			<</if>>
			<<if $SFUnit.MissileSilo < _MSU>>
					@@.green;<<link "Missile silo">> <<replace "#resultY">>
						<<set $SF.U = 1, $SFUnit.MissileSilo++, $cash -= Math.ceil(565000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.MissileSilo/100))*HSM())>> <<goto "Firebase">>
					<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(565000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.MissileSilo/100))*HSM()))>>@@ //
			<</if>>
	</span> <</replace>> <</link>>@@ <</if>>

	<<if _T1 && _NY < _NYU>> @@.green;<<link "Naval Yard">> <<replace "#resultX">> <span id="resultY">
			"Which unit do you wish to upgrade or 'borrow'?"
				@@.green;<<link "Go back""Firebase">> <</link>>@@
				<<if $SFUnit.AircraftCarrier < _ACU>>
					@@.green;<<link "Aircraft carrier">> <<replace "#resultY">>
						<<set $SF.U = 1, $SFUnit.AircraftCarrier++, $cash -= Math.ceil(650000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.AircraftCarrier/100))*HSM())>> <<goto "Firebase">>
					<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(650000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.AircraftCarrier/100))*HSM()))>>@@ //
				<</if>>
				<<if $SFUnit.Sub < _SubU>>
					@@.green;<<link "Submarine">> <<replace "#resultY">>
						<<set $SF.U = 1, $SFUnit.Sub++, $cash -= Math.ceil(700000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Sub/100))*HSM())>> <<goto "Firebase">>
					<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(700000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.Sub/100))*HSM()))>>@@ //
				<</if>>
				<<if $SFUnit.HAT < _HATU>>
					@@.green;<<link "Heavy amphibious transport">> <<replace "#resultY">>
						<<set $SF.U = 1, $SFUnit.HAT++, $cash -= Math.ceil(665000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.HAT/100)))>> <<goto "Firebase">>
					<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(665000*_Env*(1.15+($SF.Units/10))*(1.15+($SFUnit.HAT/100))))>>@@ //
				<</if>>
	</span> <</replace>> <</link>>@@ <</if>>
</span> <</if>>
/* @@.green;<<link "Support Facility">> <<replace "#resultX">>
<<set $SF.U = 1, $cash -= Math.ceil( (($C*(1.15+(($SFA0/1000))*($U+.15))*_Env )>>
<<set $SFIDs = [], $SupportFacilityDecoration = "standard", $SupportFacilityNameCount = "The Support Facility", $SupportFacilityEfficiency = 0>>
<<set $SupportFacility = 5, $SupportFacilitySlaves = 0, $LieutenantColonel = 0>>
<<set $FacilitySupportSpeedUpgrades = 0, $FacilitySupportTrainingUpgrade = 0>>
<</replace>> <</link>>@@ // @@.yellowgreen;<<print cashFormat(Math.ceil(Math.ceil($C*(1.15+(($SFA0/1000)*($U+.15)*_Env)))>>@@ //*/