From fb3596ab4654a1eb90d27fb063b71bc37aef4c48 Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Sun, 16 Sep 2018 19:03:02 -0700
Subject: [PATCH] Bugfixes, possibly added bugs

---
 src/pregmod/farmyard.tw | 152 +++++++++++++++++++++++++++++-----------
 1 file changed, 110 insertions(+), 42 deletions(-)

diff --git a/src/pregmod/farmyard.tw b/src/pregmod/farmyard.tw
index 3973e7f58d6..794987e16cc 100644
--- a/src/pregmod/farmyard.tw
+++ b/src/pregmod/farmyard.tw
@@ -6,36 +6,6 @@
 	<<set $farmyardNameCaps = $farmyardName.replace("the ", "The ")>>
 <</if>>
 
-<<set _hooved = {species: "horse", type: "hooved", dickSize: "huge", ballType: "horse"}>>
-
-<<switch $continent>>
-<<case "North America">>
-	<<set _canine = {species: "wolf", type: "canine", dickSize: "large", ballType: "wolf"}>>
-<<case "South America" "Brazil">>
-	<<set _canine = {species: "fox", type: "canine", dickSize: "large", ballType: "fox"}>>
-<<case "Europe" "the Middle East" "Africa" "Asia" "Japan">>
-	<<set _canine = {species: "jackal", type: "canine", dickSize: "large", ballType: "jackal"}>>
-<<case "Australia">>
-	<<set _canine = {species: "dingo", type: "canine", dickSize: "large", ballType: "dingo"}>>
-<</switch>>
-
-<<switch $continent>>
-<<case "North America">>
-	<<set _feline = {species: "cougar", type: "feline", dickSize: "large", ballType: "cougar"}>>
-<<case "South America">>
-	<<set _feline = {species: "jaguar", type: "feline", dickSize: "large", ballType: "jaguar"}>>
-<<case "Brazil">>
-	<<set _feline = {species: "puma", type: "feline", dickSize: "large", ballType: "puma"}>>
-<<case "Europe">>
-	<<set _feline = {species: "lynx", type: "feline", dickSize: "large", ballType: "lynx"}>>
-<<case "the Middle East" "Australia">>  /*Australia doesn't actually have a native big cat, so it's assumed they imported some*/
-	<<set _feline = {species: "leopard", type: "feline", dickSize: "large", ballType: "leopard"}>>
-<<case "Africa">>
-	<<set _feline = {species: "lion", type: "feline", dickSize: "large", ballType: "lion"}>>
-<<case "Asia" "Japan">>
-	<<set _feline = {species: "tiger", type: "feline", dickSize: "large", ballType: "tiger"}>>
-<</switch>>
-
 $farmyardNameCaps is not dissimilar to a warehouse in its basic size and form, but most warehouses don't contain the huge, dense, banks of crop-growing machinery this one does. Here, fruits and vegetables of all shapes and sizes are grown; from exotic, succulent Old World fruits to the average, everyday, vegetables. This is where the majority of the food in $arcologies[0].name comes from, making this one of the more critical facilities in your arcology.
 
 <br><br>
@@ -74,34 +44,132 @@ $farmyardNameCaps is not dissimilar to a warehouse in its basic size and form, b
 <</if>>
 
 <<if $seeBestiality == 1>>
-<br><br>
+<br>
 	<<if ($farmyardKennels == 0)>>
+		<br>
+		<<switch $continent>>
+		<<case "North America">>
+			<<set $activeCanine = {species: "wolf", speciesCap: "Wolf", speciesPlural: "wolves", type: "canine", dickSize: "large", ballType: "wolf"}>>
+			<<set $boughtWolves = 1>>
+		<<case "South America" "Brazil">>
+			<<set $activeCanine = {species: "fox", speciesCap: "Fox", speciesPlural: "foxes", type: "canine", dickSize: "large", ballType: "fox"}>>
+			<<set $boughtFoxes = 1>>
+		<<case "Europe" "the Middle East" "Africa" "Asia" "Japan">>
+			<<set $activeCanine = {species: "jackal", speciesCap: "Jackal", speciesPlural: "jackals", type: "canine", dickSize: "large", ballType: "jackal"}>>
+			<<set $boughtJackals = 1>>
+		<<case "Australia">>
+			<<set $activeCanine = {species: "dingo", speciesCap: "Dingo", speciesPlural: "dingos", type: "canine", dickSize: "large", ballType: "dingo"}>>
+			<<set $boughtDingos = 1>>
+		<</switch>>
 		[[Add kennels|Farmyard][$cash -= Math.trunc(5000*$upgradeMultiplierArcology), $farmyardKennels = 1]]
-		//Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology))>> and allows you to keep <<print _canine.species>>s. This description is temporary and will be changed.//
+		//Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology))>> and allows you to keep <<print $activeCanine.species>>s. This description is temporary and will be changed.//
 		<br>
-	<</if>>
-	<<if ($farmyardKennels == 1)>>
-		Kennels have been built in one corner of $farmyardName, and are currently occupied by <<print _canine.species>>s. //This description is temporary and will be changed.//
+	<<elseif ($farmyardKennels == 1)>>
+		<br>
+		Kennels have been built in one corner of $farmyardName, and are currently occupied by <<print $activeCanine.species>>s. //This description is temporary and will be changed.//
+		<<if $rep > 10000>>
+		<br>
+			[[Upgrade kennels|Farmyard][$cash -= Math.trunc(20000*$upgradeMultiplierArcology), $farmyardKennels = 2]]
+			//Costs <<print cashFormat(Math.trunc(20000*$upgradeMultiplierArcology))>> and allows you to keep all types of exotic canines. This description is temporary and will be changed.//
+		<</if>>
+		<br>
+	<<elseif ($farmyardKennels == 2)>>
+		<br>
+		<<link"Kennels" "FarmyardAnimals">><</link>> have been built in one corner of $farmyardName, and are currently occupied by 
+		<<nobr>>
+		<<if $boughtCanines > 0>>
+			<<if $boughtWolves == 1 && $activeCanine.species != "wolf">>
+				wolves<<if $boughtCanines > 1>>,<</if>> 
+			<</if>>
+			<<if $boughtFoxes == 1 && $activeCanine.species != "fox">>
+				foxes<<if $boughtCanines > 1>>,<</if>> 
+			<</if>>
+			<<if $boughtJackals == 1 && $activeCanine.species != "jackal">>
+				jackals<<if $boughtCanines > 1>>,<</if>> 
+			<</if>>
+			<<if $boughtDingos == 1 && $activeCanine.species != "dingo">>
+				dingos<<if $boughtCanines > 1>>,<</if>> 
+			<</if>>
+			and
+		<</if>>
+		<<print $activeCanine.speciesPlural>>.
+		<</nobr>>
 		<br>
 	<</if>>
 
 	<<if ($farmyardStable == 0)>>
+		<br>
+		<<set $activeHooved = {species: "horse", speciesCap: "Horse", speciesPlural: "horses", type: "hooved", dickSize: "huge", ballType: "horse"}>>
 		[[Add a stable|Farmyard][$cash -= Math.trunc(10000*$upgradeMultiplierArcology), $farmyardStable = 1]]
 		//Costs <<print cashFormat(Math.trunc(10000*$upgradeMultiplierArcology))>> and allows you to keep <<print "horse">>s. This description is temporary and will be changed.//
 		<br>
-	<</if>>
-	<<if ($farmyardStable == 1)>>
+	<<elseif ($farmyardStable == 1)>>
+		<br>
 		A large stable has been built at the far end of $farmyardName, and currently holds a decent amount of large <<print "horse">>s. //This description is temporary and will be changed.//
 		<br>
 	<</if>>
 
 	<<if ($farmyardCages == 0)>>
+		<br>
+		<<switch $continent>>
+		<<case "North America">>
+			<<set $activeFeline = {species: "cougar", speciesCap: "Cougar", speciesPlural: "cougars", type: "feline", dickSize: "large", ballType: "cougar"}>>
+			<<set $boughtCougars = 1>>
+		<<case "South America" "Brazil">>
+			<<set $activeFeline = {species: "jaguar", speciesCap: "Jaguar", speciesPlural: "jaguars", type: "feline", dickSize: "large", ballType: "jaguar"}>>
+			<<set $boughtJaguars = 1>>
+		<<case "Europe">>
+			<<set $activeFeline = {species: "lynx", speciesCap: "Lynx", speciesPlural: "lynx", type: "feline", dickSize: "large", ballType: "lynx"}>>
+			<<set $boughtLynx = 1>>
+		<<case "the Middle East" "Australia">>
+			<<set $activeFeline = {species: "leopard", speciesCap: "Leopard", speciesPlural: "leopards", type: "feline", dickSize: "large", ballType: "leopard"}>>
+			<<set $boughtLeopards = 1>>
+		<<case "Africa">>
+			<<set $activeFeline = {species: "lion", speciesCap: "Lion", speciesPlural: "lions", type: "feline", dickSize: "large", ballType: "lion"}>>
+			<<set $boughtLions = 1>>
+		<<case "Asia" "Japan">>
+			<<set $activeFeline = {species: "tiger", speciesCap: "Tiger", speciesPlural: "tigers", type: "feline", dickSize: "large", ballType: "tiger"}>>
+			<<set $boughtTigers = 1>>
+		<</switch>>
 		[[Add cages|Farmyard][$cash -= Math.trunc(25000*$upgradeMultiplierArcology), $farmyardCages = 1]]
-		//Costs <<print cashFormat(Math.trunc(25000*$upgradeMultiplierArcology))>> and allows you to keep <<print _feline.species>>s. This description is temporary and will be changed.//
+		//Costs <<print cashFormat(Math.trunc(25000*$upgradeMultiplierArcology))>> and allows you to keep <<print $activeFeline.species>>s. This description is temporary and will be changed.//
+		<br>
+	<<elseif ($farmyardCages == 1)>>
+		<br>
+		Large cages have been set up along one wall of $farmyardName, and are currently occupied by large <<print($activeFeline.species)>>s. //This description is temporary and will be changed.//
+		<<if $rep > 15000>>
+		<br>
+			[[Upgrade cages|Farmyard][$cash -= Math.trunc(20000*$upgradeMultiplierArcology), $farmyardCages = 2]]
+			//Costs <<print cashFormat(Math.trunc(20000*$upgradeMultiplierArcology))>> and allows to keep all types of exotic felines. This description is temporary and will be changed.//
+		<</if>>
+	<<elseif ($farmyardCages == 2)>>
+		<br>
+		<<link "Large cages" "FarmyardAnimals">><</link>> have been built in one corner of $farmyardName, and are currently occupied by large
+		<<nobr>>
+		<<if $boughtFelines > 0>>
+			<<if $boughtCougars == 1 && $activeFeline.species != "cougar">>
+				cougars<<if $boughtFelines > 1>>,<</if>> 
+			<</if>>
+			<<if $boughtJaguars == 1 && $activeFeline.species != "jaguar">>
+				jaguars<<if $boughtFelines > 1>>,<</if>> 
+			<</if>>
+			<<if $boughtLynx == 1 && $activeFeline.species != "lynx">>
+				lynx<<if $boughtFelines > 1>>,<</if>> 
+			<</if>>
+			<<if $boughtLeopards == 1 && $activeFeline.species != "leopard">>
+				leopards<<if $boughtFelines > 1>>,<</if>> 
+			<</if>>
+			<<if $boughtLions == 1 && $activeFeline.species != "lion">>
+				lions<<if $boughtFelines > 1>>,<</if>> 
+			<</if>>
+			<<if $boughtTigers == 1 && $activeFeline.species != "tiger">>
+				tigers<<if $boughtFelines > 1>>,<</if>>
+			<</if>>
+			and
+		<</if>>
+		<<print $activeFeline.speciesPlural>>.
+		<</nobr>>
 		<br>
-	<</if>>
-	<<if ($farmyardCages == 1)>>
-		Large cages have been set up along one wall of $farmyardName, and are currently occupied by large <<print(_feline.species)>>s. //This description is temporary and will be changed.//
 	<</if>>
 <</if>>
 
@@ -113,7 +181,7 @@ $farmyardNameCaps is not dissimilar to a warehouse in its basic size and form, b
 <br><br>
 
 <<link "Decommission $farmyardName and return this sector to manufacturing">>
-	<<set $farmyardName = "the Farmyard", $farmyard = 0, $farmyardUpgrade = 0, $farmyardUpgradeList = [], $farmyardLab = 0, $farmyardCrops = 0, $farmyardKennels = 0, $farmyardStable = 0, $farmyardCages = 0>>
+	<<set $farmyardName = "the Farmyard", $farmyard = 0, $farmyardUpgrade = 0, $farmyardUpgradeList = [], $farmyardLab = 0, $farmyardCrops = 0, $farmyardKennels = 0, $farmyardStable = 0, $farmyardCages = 0, $activeCanine = "wolf", $activeHooved = "horse", $activeFeline = "cougar", $boughtCanines = 0, $boughtFelines = 0, $boughtWolves = 0, $boughtFoxes = 0, $boughtJackals = 0, $boughtDingos = 0, $boughtCougars = 0, $boughtJaguars = 0, $boughtLynx = 0, $boughtLeopards = 0, $boughtLions = 0, $boughtTigers = 0, $pitAnimal = 0>>
 	<<for _i = 0; _i < $sectors.length; _i++>>
 		<<if $sectors[_i].type == "Farmyard">><<set $sectors[_i].type = "Manufacturing">><<break>><</if>>
 	<</for>>
-- 
GitLab