From 4743a8e37fcc7a21582e4ec37a0b8d57ae02d232 Mon Sep 17 00:00:00 2001 From: DCoded <dcoded@live.com> Date: Wed, 29 Jul 2020 11:32:33 -0400 Subject: [PATCH] Fully DOMified Farmyard --- src/facilities/farmyard/farmyard.js | 1315 ++++++++++++++------------- src/facilities/farmyard/farmyard.tw | 46 +- 2 files changed, 684 insertions(+), 677 deletions(-) diff --git a/src/facilities/farmyard/farmyard.js b/src/facilities/farmyard/farmyard.js index 661a98ded3e..fcc9eba6eb8 100644 --- a/src/facilities/farmyard/farmyard.js +++ b/src/facilities/farmyard/farmyard.js @@ -1,418 +1,445 @@ -App.Facilities.Farmyard.intro = function() { +App.Facilities.Farmyard.farmyard = function() { const frag = new DocumentFragment(), - - desc = document.createElement("div"), - link = document.createElement("div"), - - count = App.Entity.facilities.farmyard.totalEmployeesCount; - - desc.classList.add("scene-intro"); - link.classList.add("indent"); - - desc.append(`${V.farmyardNameCaps} is an oasis of growth in the midst of the jungle of steel and concrete that is ${V.arcologies[0].name}. Animals are kept in pens, tended to by your slaves, while ${V.farmyardUpgrades.hydroponics ? `rows of hydroponics equipment` : `makeshift fields`} grow crops. `); - - switch (V.farmyardDecoration) { - case "Roman Revivalist": - desc.append(`Its red tiles and white stone walls are the very picture of a Roman farm villa's construction, as are the marble statues and reliefs. Saturn and Ceres look over the prosperity of the fields${V.seeBestiality ? `. Mercury watches over the health of the animals, and Feronia ensures strong litters in your slaves.` : `, and Mercury watches over the health of the animals.`} The slaves here are all looked after well, as they have one of the most important jobs in ${V.arcologies[0].name}.`); - break; - case "Aztec Revivalist": - desc.append(`It can't completely recreate the floating farms in the ancient Aztec fashion, but it comes as close as it can, shallow pseudo-canals dividing each field into multiple sections. Smooth stone and colorful murals cover the walls, depicting bloody stories of gods and mortals alike.`); - break; - case "Egyptian Revivalist": - desc.append(`It does its best to capture the wide open nature of ancient Egyptian farms, including mimicking the irrigation systems fed by the Nile. The stone walls are decorated with murals detailing its construction and your prowess in general, ${V.seeBestiality ? `with animal-bloated slaves featured prominently.` : `hieroglyphs spelling out a volumes of praise.`}`); - break; - case "Edo Revivalist": - desc.append(`It does its best to mimic the rice patties and thatch roofed buildings of the Edo period despite the wide variety of crops tended by various slaves. Not every crop can thrive in flooded fields, but the ones that can take advantage of your attention to detail.`); - break; - case "Arabian Revivalist": - desc.append(`Large plots of olive trees and date palms line the outer edges of the main crop area, while a combination of wheat, flax, and barley occupies the interior space. Irrigation canals snake through the area, ensuring every inch of cropland is well-watered.`); - break; - case "Chinese Revivalist": - desc.append(`It does its best to capture the terraces that covered the ancient Chinese hills and mountains, turning every floor into ribbons of fields following a slight incline. Slaves wade through crops that can handle flooding and splash through the irrigation of the others when they aren't tending to${V.seeBestiality ? ` or breeding with` : ``} your animals.`); - break; - case "Chattel Religionist": - desc.append(`It runs like a well oiled machine, slaves bent in humble service as they tend crops grown on the Prophet's command, or see to the animals' needs. Their clothing is tucked up and out of the way as they see to their tasks, keeping them clean as they work ${V.seeBestiality ? `around animal-bloated bellies ` : ``}as divine will dictates.`); - break; - case "Degradationist": - desc.append(`It is constructed less as a converted warehouse and more as something to visit, allowing guests to enjoy the spectacle of slaves ${V.seeBestiality ? `being pounded by eager animals` : `elbow deep in scrubbing animal waste`} to their satisfaction.`); - break; - case "Repopulation Focus": - desc.append(`It teems with life, both in the belly of every animal and the belly of every slave, though the latter makes tending the fields difficult. They're ordered to take care, as they carry the future ${V.seeBestiality ? `of this farm` : `of the arcology`} in their bellies.`); - break; - case "Eugenics": - desc.append(`It holds a wide variety of crops and animals, but the best of the best is easy to find. They're set apart from the others, given only the best care and supplies${V.seeBestiality ? ` and bred with only the highest quality slaves` : ``}, while the sub-par stock is neglected off to the side.`); - break; - case "Asset Expansionist": - desc.append(`It is not easy to look after animals and till fields with such enormous body parts, but your slaves are diligent regardless, working hard to provide food and livestock for the arcology.`); - break; - case "Transformation Fetishist": - // desc.append(`TODO:`); - break; - case "Gender Radicalist": - // desc.append(`TODO:`); - break; - case "Gender Fundamentalist": - // desc.append(`TODO:`); - break; - case "Physical Idealist": - desc.append(`Its animals are in exceptional shape, their coats unable to hide how muscular they are, requiring your slaves to be equally toned to control them. There's plenty of space for their exercise as well${V.seeBestiality ? ` and an abundance of curatives for the slaves full of their fierce, kicking offspring` : ``}.`); - break; - case "Supremacist": - desc.append(`It is a clean and orderly operation, stables and cages mucked by a multitude of inferior slaves, along with grooming your animals and harvesting your crops.`); - break; - case "Subjugationist": - desc.append(`It is a clean and orderly operation, stables and cages mucked by a multitude of ${V.arcologies[0].FSSubjugationistRace} slaves, while the others are tasked with grooming your animals and harvesting your crops.`); - break; - case "Paternalist": - desc.append(`It's full of healthy animals, crops, and slaves, the former's every need diligently looked after by the latter. The fields flourish to capacity under such care, and the animals give the distinct impression of happiness${V.seeBestiality ? ` — some more than others if the growing bellies of your slaves are anything to go by, the only indication that such rutting takes place` : ``}.`); - break; - case "Pastoralist": - // desc.append(`TODO:`); - break; - case "Maturity Preferentialist": - // desc.append(`TODO:`); - break; - case "Youth Preferentialist": - // desc.append(`TODO:`); - break; - case "Body Purist": - // desc.append(`TODO:`); - break; - case "Slimness Enthusiast": - desc.append(`It features trim animals and slaves alike, not a pound of excess among them. The feed for both livestock and crops are carefully maintained to ensure optimal growth without waste, letting them flourish without being weighed down.`); - break; - case "Hedonistic": - desc.append(`It features wider gates and stalls, for both the humans visiting or tending the occupants, and the animals starting to mimic their handlers${V.seeBestiality ? ` and company` : ``}, with plenty of seats along the way.`); - break; - default: - desc.append(`It is very much a converted warehouse still, sectioned off in various 'departments'${V.farmyardUpgrades.machinery ? ` with machinery placed where it can be` : V.farmyardUpgrades.hydroponics ? ` and plumbing for the hydroponics system running every which way` : ``}.`); - break; + introDiv = document.createElement("p"), + expandDiv = document.createElement("div"), + farmMenialsDiv = document.createElement("div"), + rulesDiv = document.createElement("div"), + upgradesDiv = document.createElement("div"), + animalHousingDiv = document.createElement("div"), + slaveListDiv = document.createElement("div"), + renameFarmyardDiv = document.createElement("div"), + renameFarmyardNote = document.createElement("span"); + + introDiv.classList.add("scene-intro"); + renameFarmyardNote.classList.add("note"); + + V.nextButton = "Back to Main"; + V.nextLink = "Main"; + V.returnTo = "Farmyard"; + V.encyclopedia = "Farmyard"; + + if (V.farmyardName !== "the Farmyard") { + V.farmyardNameCaps = V.farmyardName.replace("the ", "The "); } - if (count > 2) { - desc.append(` ${V.farmyardNameCaps} is bustling with activity. Farmhands are hurrying about, on their way to feed animals and maintain farming equipment.`); - } else if (count) { - desc.append(` ${V.farmyardNameCaps} is working steadily. Farmhands are moving about, looking after the animals and crops.`); - } else if (S.Farmer) { - desc.append(` ${S.Farmer.slaveName} is alone in $farmyardName, and has nothing to do but look after the animals and crops.`); - } else { - desc.append(` ${V.farmyardNameCaps} is empty and quiet.`); - } + introDiv.append(intro()); + expandDiv.append(expand()); + farmMenialsDiv.append(transferMenials()); + farmMenialsDiv.append(buyMenials()); + farmMenialsDiv.append(houseMenials()); + rulesDiv.append(rules()); + upgradesDiv.append(upgrades()); + animalHousingDiv.append(animalHousing()); + slaveListDiv.append(` ${App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.farmyard)}`); + + renameFarmyardDiv.append(`Rename ${V.farmyardName}: `); + renameFarmyardNote.append(`Use a noun or similar short phrase`); + + renameFarmyardDiv.append(App.UI.DOM.makeTextBox(V.farmyardName, newName => { + V.farmyardName = newName; + })); - link.append(App.UI.DOM.passageLink(`Decommission ${V.farmyardName}`, "Main", () => { - if (V.farmMenials) { - V.menials += V.farmMenials; - V.farmMenials = 0; - } + renameFarmyardDiv.append(renameFarmyardNote); - V.farmyardName = "the Farmyard"; - V.farmyard = 0; - V.farmyardDecoration = "standard"; + frag.append(introDiv, expandDiv, farmMenialsDiv, rulesDiv, upgradesDiv, animalHousingDiv, slaveListDiv, renameFarmyardDiv); - V.farmMenials = 0; - V.farmMenialsSpace = 0; + App.UI.SlaveList.ScrollPosition.restore(); - V.farmyardShows = 0; - V.farmyardBreeding = 0; - V.farmyardCrops = 0; + function intro() { + const + frag = new DocumentFragment(), - V.farmyardKennels = 0; - V.farmyardStables = 0; - V.farmyardCages = 0; + desc = document.createElement("div"), + link = document.createElement("div"), + + count = App.Entity.facilities.farmyard.totalEmployeesCount; + + desc.classList.add("scene-intro"); + link.classList.add("indent"); + + desc.append(`${V.farmyardNameCaps} is an oasis of growth in the midst of the jungle of steel and concrete that is ${V.arcologies[0].name}. Animals are kept in pens, tended to by your slaves, while ${V.farmyardUpgrades.hydroponics ? `rows of hydroponics equipment` : `makeshift fields`} grow crops. `); + + switch (V.farmyardDecoration) { + case "Roman Revivalist": + desc.append(`Its red tiles and white stone walls are the very picture of a Roman farm villa's construction, as are the marble statues and reliefs. Saturn and Ceres look over the prosperity of the fields${V.seeBestiality ? `. Mercury watches over the health of the animals, and Feronia ensures strong litters in your slaves.` : `, and Mercury watches over the health of the animals.`} The slaves here are all looked after well, as they have one of the most important jobs in ${V.arcologies[0].name}.`); + break; + case "Aztec Revivalist": + desc.append(`It can't completely recreate the floating farms in the ancient Aztec fashion, but it comes as close as it can, shallow pseudo-canals dividing each field into multiple sections. Smooth stone and colorful murals cover the walls, depicting bloody stories of gods and mortals alike.`); + break; + case "Egyptian Revivalist": + desc.append(`It does its best to capture the wide open nature of ancient Egyptian farms, including mimicking the irrigation systems fed by the Nile. The stone walls are decorated with murals detailing its construction and your prowess in general, ${V.seeBestiality ? `with animal-bloated slaves featured prominently.` : `hieroglyphs spelling out a volumes of praise.`}`); + break; + case "Edo Revivalist": + desc.append(`It does its best to mimic the rice patties and thatch roofed buildings of the Edo period despite the wide variety of crops tended by various slaves. Not every crop can thrive in flooded fields, but the ones that can take advantage of your attention to detail.`); + break; + case "Arabian Revivalist": + desc.append(`Large plots of olive trees and date palms line the outer edges of the main crop area, while a combination of wheat, flax, and barley occupies the interior space. Irrigation canals snake through the area, ensuring every inch of cropland is well-watered.`); + break; + case "Chinese Revivalist": + desc.append(`It does its best to capture the terraces that covered the ancient Chinese hills and mountains, turning every floor into ribbons of fields following a slight incline. Slaves wade through crops that can handle flooding and splash through the irrigation of the others when they aren't tending to${V.seeBestiality ? ` or breeding with` : ``} your animals.`); + break; + case "Chattel Religionist": + desc.append(`It runs like a well oiled machine, slaves bent in humble service as they tend crops grown on the Prophet's command, or see to the animals' needs. Their clothing is tucked up and out of the way as they see to their tasks, keeping them clean as they work ${V.seeBestiality ? `around animal-bloated bellies ` : ``}as divine will dictates.`); + break; + case "Degradationist": + desc.append(`It is constructed less as a converted warehouse and more as something to visit, allowing guests to enjoy the spectacle of slaves ${V.seeBestiality ? `being pounded by eager animals` : `elbow deep in scrubbing animal waste`} to their satisfaction.`); + break; + case "Repopulation Focus": + desc.append(`It teems with life, both in the belly of every animal and the belly of every slave, though the latter makes tending the fields difficult. They're ordered to take care, as they carry the future ${V.seeBestiality ? `of this farm` : `of the arcology`} in their bellies.`); + break; + case "Eugenics": + desc.append(`It holds a wide variety of crops and animals, but the best of the best is easy to find. They're set apart from the others, given only the best care and supplies${V.seeBestiality ? ` and bred with only the highest quality slaves` : ``}, while the sub-par stock is neglected off to the side.`); + break; + case "Asset Expansionist": + desc.append(`It is not easy to look after animals and till fields with such enormous body parts, but your slaves are diligent regardless, working hard to provide food and livestock for the arcology.`); + break; + case "Transformation Fetishist": + // desc.append(`TODO:`); + break; + case "Gender Radicalist": + // desc.append(`TODO:`); + break; + case "Gender Fundamentalist": + // desc.append(`TODO:`); + break; + case "Physical Idealist": + desc.append(`Its animals are in exceptional shape, their coats unable to hide how muscular they are, requiring your slaves to be equally toned to control them. There's plenty of space for their exercise as well${V.seeBestiality ? ` and an abundance of curatives for the slaves full of their fierce, kicking offspring` : ``}.`); + break; + case "Supremacist": + desc.append(`It is a clean and orderly operation, stables and cages mucked by a multitude of inferior slaves, along with grooming your animals and harvesting your crops.`); + break; + case "Subjugationist": + desc.append(`It is a clean and orderly operation, stables and cages mucked by a multitude of ${V.arcologies[0].FSSubjugationistRace} slaves, while the others are tasked with grooming your animals and harvesting your crops.`); + break; + case "Paternalist": + desc.append(`It's full of healthy animals, crops, and slaves, the former's every need diligently looked after by the latter. The fields flourish to capacity under such care, and the animals give the distinct impression of happiness${V.seeBestiality ? ` — some more than others if the growing bellies of your slaves are anything to go by, the only indication that such rutting takes place` : ``}.`); + break; + case "Pastoralist": + // desc.append(`TODO:`); + break; + case "Maturity Preferentialist": + // desc.append(`TODO:`); + break; + case "Youth Preferentialist": + // desc.append(`TODO:`); + break; + case "Body Purist": + // desc.append(`TODO:`); + break; + case "Slimness Enthusiast": + desc.append(`It features trim animals and slaves alike, not a pound of excess among them. The feed for both livestock and crops are carefully maintained to ensure optimal growth without waste, letting them flourish without being weighed down.`); + break; + case "Hedonistic": + desc.append(`It features wider gates and stalls, for both the humans visiting or tending the occupants, and the animals starting to mimic their handlers${V.seeBestiality ? ` and company` : ``}, with plenty of seats along the way.`); + break; + default: + desc.append(`It is very much a converted warehouse still, sectioned off in various 'departments'${V.farmyardUpgrades.machinery ? ` with machinery placed where it can be` : V.farmyardUpgrades.hydroponics ? ` and plumbing for the hydroponics system running every which way` : ``}.`); + break; + } - V.activeCanine = 0; - V.activeHooved = 0; - V.activeFeline = 0; + if (count > 2) { + desc.append(` ${V.farmyardNameCaps} is bustling with activity. Farmhands are hurrying about, on their way to feed animals and maintain farming equipment.`); + } else if (count) { + desc.append(` ${V.farmyardNameCaps} is working steadily. Farmhands are moving about, looking after the animals and crops.`); + } else if (S.Farmer) { + desc.append(` ${S.Farmer.slaveName} is alone in $farmyardName, and has nothing to do but look after the animals and crops.`); + } else { + desc.append(` ${V.farmyardNameCaps} is empty and quiet.`); + } - V.pitAnimal = 0; - V.pitAnimalType = 0; + link.append(App.UI.DOM.passageLink(`Decommission ${V.farmyardName}`, "Main", () => { + if (V.farmMenials) { + V.menials += V.farmMenials; + V.farmMenials = 0; + } - V.canines = []; - V.hooved = []; - V.felines = []; + V.farmyardName = "the Farmyard"; + V.farmyard = 0; + V.farmyardDecoration = "standard"; - V.farmyardUpgrades = { - pump: 0, - fertilizer: 0, - hydroponics: 0, - machinery: 0, - seeds: 0 - }; + V.farmMenials = 0; + V.farmMenialsSpace = 0; - App.Facilities.Farmyard.clearAnimalsBought(); - App.Arcology.cellUpgrade(V.building, App.Arcology.Cell.Manufacturing, "Farmyard", "Manufacturing"); - })); + V.farmyardShows = 0; + V.farmyardBreeding = 0; + V.farmyardCrops = 0; - desc.append(link); - frag.append(desc); + V.farmyardKennels = 0; + V.farmyardStables = 0; + V.farmyardCages = 0; - return frag; -}; + V.activeCanine = 0; + V.activeHooved = 0; + V.activeFeline = 0; -App.Facilities.Farmyard.expand = function() { - const - frag = new DocumentFragment(), - - desc = document.createElement("div"), - link = document.createElement("div"), - note = document.createElement("span"), - cost = document.createElement("span"), - - upgradeCost = Math.trunc(V.farmyard * 1000 * V.upgradeMultiplierArcology); + V.pitAnimal = 0; + V.pitAnimalType = 0; - link.classList.add("indent"); - note.classList.add("note"); - cost.classList.add("yellowgreen"); + V.canines = []; + V.hooved = []; + V.felines = []; - cost.append(cashFormat(upgradeCost)); + V.farmyardUpgrades = { + pump: 0, + fertilizer: 0, + hydroponics: 0, + machinery: 0, + seeds: 0 + }; - desc.append(`It can support ${V.farmyard} farmhands. Currently there ${V.farmyard === 1 ? `is` : `are`} ${V.farmyard} ${V.farmyard === 1 ? `farmhand` : `farmhands`} in ${V.farmyardName}. `); - note.append(` Costs `, cost, ` and will increase upkeep costs`); + clearAnimalsBought(); + App.Arcology.cellUpgrade(V.building, App.Arcology.Cell.Manufacturing, "Farmyard", "Manufacturing"); + })); - link.append(App.UI.DOM.passageLink(`Expand ${V.farmyardName}`, "Farmyard", () => { - cashX(forceNeg(cost)); - V.farmyard += 5; - V.PC.skill.engineering += .1; - })); + desc.append(link); + frag.append(desc); - link.append(note); - desc.append(link); - frag.append(desc); + return frag; + } - if (V.farmyardFarmers || V.farmyardShowgirls) { + function expand() { const - removeLink = document.createElement("div"), - warning = document.createElement("span"), - - count = App.Entity.facilities.farmyard.totalEmployeesCount, - newPop = count + V.dormitoryPopulation; - - removeLink.classList.add("indent"); - warning.classList.add("red"); + frag = new DocumentFragment(), - warning.append(` Dormitory capacity will be exceeded.`); + desc = document.createElement("div"), + link = document.createElement("div"), + note = document.createElement("span"), + cost = document.createElement("span"), - removeLink.append(App.UI.DOM.passageLink("Remove all slaves", "Farmyard", () => { - App.Utils.moveFacilityWorkers(App.Entity.facilities.farmyard); - })); + upgradeCost = Math.trunc(V.farmyard * 1000 * V.upgradeMultiplierArcology); - if (newPop > V.dormitory) { - removeLink.append(warning); - } + link.classList.add("indent"); + note.classList.add("note"); + cost.classList.add("yellowgreen"); - frag.append(removeLink); - } + cost.append(cashFormat(upgradeCost)); - return frag; -}; + desc.append(`It can support ${V.farmyard} farmhands. Currently there ${V.farmyard === 1 ? `is` : `are`} ${V.farmyard} ${V.farmyard === 1 ? `farmhand` : `farmhands`} in ${V.farmyardName}. `); + note.append(` Costs `, cost, ` and will increase upkeep costs`); -App.Facilities.Farmyard.transferMenials = function() { - const - frag = new DocumentFragment(), + link.append(App.UI.DOM.passageLink(`Expand ${V.farmyardName}`, "Farmyard", () => { + cashX(forceNeg(cost)); + V.farmyard += 5; + V.PC.skill.engineering += .1; + })); - links = [], - linksDiv = document.createElement("div"), + link.append(note); + desc.append(link); + frag.append(desc); - menials = V.menials, - farmMenials = V.farmMenials, - farmMenialsSpace = V.farmMenialsSpace; + if (V.farmyardFarmers || V.farmyardShowgirls) { + const + removeLink = document.createElement("div"), + warning = document.createElement("span"), - linksDiv.classList.add("indent"); + count = App.Entity.facilities.farmyard.totalEmployeesCount, + newPop = count + V.dormitoryPopulation; - if (farmMenials) { - frag.append(`Assigned to ${V.farmyardName} ${farmMenials === 1 ? `is` : `are`} ${farmMenials} menial ${farmMenials === 1 ? `slave` : `slaves`}, working to produce as much food for your arcology as they can. `); - } + removeLink.classList.add("indent"); + warning.classList.add("red"); - if (farmMenialsSpace) { - frag.append(`You ${menials ? `own ${num(menials)}` : `don't own any`} free menial slaves. ${V.farmyardNameCaps} can house ${farmMenialsSpace} menial slaves total, with ${farmMenialsSpace - farmMenials} free spots. `); - } + warning.append(` Dormitory capacity will be exceeded.`); - if (farmMenialsSpace && farmMenials < farmMenialsSpace) { - if (menials) { - links.push(App.UI.DOM.passageLink("Transfer in a menial slave", "Farmyard", () => { - V.menials--; - V.farmMenials++; + removeLink.append(App.UI.DOM.passageLink("Remove all slaves", "Farmyard", () => { + App.Utils.moveFacilityWorkers(App.Entity.facilities.farmyard); })); - } - if (menials >= 10 && farmMenials <= farmMenialsSpace - 10) { - links.push(App.UI.DOM.passageLink("Transfer in 10 menial slaves", "Farmyard", () => { - V.menials -= 10; - V.farmMenials += 10; - })); - } + if (newPop > V.dormitory) { + removeLink.append(warning); + } - if (menials >= 100 && farmMenials <= farmMenialsSpace - 100) { - links.push(App.UI.DOM.passageLink("Transfer in 100 menial slaves", "Farmyard", () => { - V.menials -= 100; - V.farmMenials += 100; - })); + frag.append(removeLink); } - if (menials) { - links.push(App.UI.DOM.passageLink("Transfer in all free menial slaves", "Farmyard", () => { - if (menials > farmMenialsSpace - farmMenials) { - V.menials -= farmMenialsSpace - farmMenials; - V.farmMenials = farmMenialsSpace; - } else { - V.farmMenials += menials; - V.menials = 0; - } - })); - } - } else if (!farmMenialsSpace) { - frag.append(`${V.farmyardNameCaps} cannot currently house any menial slaves. `); - } else { - frag.append(`${V.farmyardNameCaps} has all the menial slaves it can currently house assigned to it. `); + return frag; } - if (farmMenials) { - links.push(App.UI.DOM.passageLink("Transfer out all menial slaves", "Farmyard", () => { - V.menials += farmMenials; - V.farmMenials = 0; - })); - } + function transferMenials() { + const + frag = new DocumentFragment(), - linksDiv.append(App.UI.DOM.generateLinksStrip(links)); - frag.append(linksDiv); + links = [], + linksDiv = document.createElement("div"), - return frag; -}; + menials = V.menials, + farmMenials = V.farmMenials, + farmMenialsSpace = V.farmMenialsSpace; -App.Facilities.Farmyard.buyMenials = function() { - const - frag = new DocumentFragment(), + linksDiv.classList.add("indent"); - links = [], - linksDiv = document.createElement("div"), + if (farmMenials) { + frag.append(`Assigned to ${V.farmyardName} ${farmMenials === 1 ? `is` : `are`} ${farmMenials} menial ${farmMenials === 1 ? `slave` : `slaves`}, working to produce as much food for your arcology as they can. `); + } - menials = V.menials, - farmMenialsSpace = V.farmMenialsSpace, - bulkMax = V.PopCap - menials - V.fuckdolls - V.menialBioreactors, + if (farmMenialsSpace) { + frag.append(`You ${menials ? `own ${num(menials)}` : `don't own any`} free menial slaves. ${V.farmyardNameCaps} can house ${farmMenialsSpace} menial slaves total, with ${farmMenialsSpace - farmMenials} free spots. `); + } - menialPrice = Math.trunc(menialSlaveCost()), - maxMenials = Math.trunc(Math.clamp(V.cash / menialPrice, 0, bulkMax)); + if (farmMenialsSpace && farmMenials < farmMenialsSpace) { + if (menials) { + links.push(App.UI.DOM.passageLink("Transfer in a menial slave", "Farmyard", () => { + V.menials--; + V.farmMenials++; + })); + } - linksDiv.classList.add("indent"); + if (menials >= 10 && farmMenials <= farmMenialsSpace - 10) { + links.push(App.UI.DOM.passageLink("Transfer in 10 menial slaves", "Farmyard", () => { + V.menials -= 10; + V.farmMenials += 10; + })); + } - if (farmMenialsSpace) { - MenialPopCap(); + if (menials >= 100 && farmMenials <= farmMenialsSpace - 100) { + links.push(App.UI.DOM.passageLink("Transfer in 100 menial slaves", "Farmyard", () => { + V.menials -= 100; + V.farmMenials += 100; + })); + } - if (bulkMax > 0 || V.menials + V.fuckdolls + V.menialBioreactors === 0) { - links.push(App.UI.DOM.passageLink("Buy ", "Farmyard", () => { - V.menials++; - V.menialSupplyFactor--; - cashX(forceNeg(menialPrice), "farmyard"); - })); + if (menials) { + links.push(App.UI.DOM.passageLink("Transfer in all free menial slaves", "Farmyard", () => { + if (menials > farmMenialsSpace - farmMenials) { + V.menials -= farmMenialsSpace - farmMenials; + V.farmMenials = farmMenialsSpace; + } else { + V.farmMenials += menials; + V.menials = 0; + } + })); + } + } else if (!farmMenialsSpace) { + frag.append(`${V.farmyardNameCaps} cannot currently house any menial slaves. `); + } else { + frag.append(`${V.farmyardNameCaps} has all the menial slaves it can currently house assigned to it. `); + } - links.push(App.UI.DOM.passageLink("(x10)", "Farmyard", () => { - V.menials += 10; - V.menialSupplyFactor -= 10; - cashX(forceNeg(menialPrice * 10), "farmyard"); + if (farmMenials) { + links.push(App.UI.DOM.passageLink("Transfer out all menial slaves", "Farmyard", () => { + V.menials += farmMenials; + V.farmMenials = 0; })); + } - links.push(App.UI.DOM.passageLink("(x100)", "Farmyard", () => { - V.menials += 100; - V.menialSupplyFactor -= 100; - cashX(forceNeg(menialPrice * 100), "farmyard"); - })); + linksDiv.append(App.UI.DOM.generateLinksStrip(links)); + frag.append(linksDiv); - links.push(App.UI.DOM.passageLink("(max)", "Farmyard", () => { - V.menials += maxMenials; - V.menialSupplyFactor -= maxMenials; - cashX(forceNeg(maxMenials * menialPrice), "farmyard"); - })); - } + return frag; } - linksDiv.append(App.UI.DOM.generateLinksStrip(links)); - frag.append(linksDiv); + function buyMenials() { + const + frag = new DocumentFragment(), - return frag; -}; + links = [], + linksDiv = document.createElement("div"), -App.Facilities.Farmyard.houseMenials = function() { - const - frag = new DocumentFragment(), + menials = V.menials, + farmMenialsSpace = V.farmMenialsSpace, + bulkMax = V.PopCap - menials - V.fuckdolls - V.menialBioreactors, - desc = document.createElement("div"), - link = document.createElement("div"), - note = document.createElement("span"), - cost = document.createElement("span"), + menialPrice = Math.trunc(menialSlaveCost()), + maxMenials = Math.trunc(Math.clamp(V.cash / menialPrice, 0, bulkMax)); - unitCost = Math.trunc(1000 * V.upgradeMultiplierArcology); + linksDiv.classList.add("indent"); - link.classList.add("indent"); - note.classList.add("note"); - cost.classList.add("yellowgreen"); + if (farmMenialsSpace) { + MenialPopCap(); - cost.append(cashFormat(unitCost)); + if (bulkMax > 0 || V.menials + V.fuckdolls + V.menialBioreactors === 0) { + links.push(App.UI.DOM.passageLink("Buy ", "Farmyard", () => { + V.menials++; + V.menialSupplyFactor--; + cashX(forceNeg(menialPrice), "farmyard"); + })); - if (V.farmMenialsSpace < 500) { - desc.append(`There is enough room in ${V.farmyardName} to build housing, enough to give ${V.farmMenialsSpace + 100} menial slaves a place to sleep and relax. `); - note.append(` Costs `, cost, ` and will increase upkeep costs`); + links.push(App.UI.DOM.passageLink("(x10)", "Farmyard", () => { + V.menials += 10; + V.menialSupplyFactor -= 10; + cashX(forceNeg(menialPrice * 10), "farmyard"); + })); - link.append(App.UI.DOM.passageLink("Build a new housing unit", "Farmyard", () => { - cashX(forceNeg(unitCost), "farmyard"); - V.farmMenialsSpace += 100; - }), note); + links.push(App.UI.DOM.passageLink("(x100)", "Farmyard", () => { + V.menials += 100; + V.menialSupplyFactor -= 100; + cashX(forceNeg(menialPrice * 100), "farmyard"); + })); - desc.append(link); - frag.append(desc); + links.push(App.UI.DOM.passageLink("(max)", "Farmyard", () => { + V.menials += maxMenials; + V.menialSupplyFactor -= maxMenials; + cashX(forceNeg(maxMenials * menialPrice), "farmyard"); + })); + } + } + + linksDiv.append(App.UI.DOM.generateLinksStrip(links)); + frag.append(linksDiv); + + return frag; } - return frag; -}; + function houseMenials() { + const + frag = new DocumentFragment(), + + desc = document.createElement("div"), + link = document.createElement("div"), + note = document.createElement("span"), + cost = document.createElement("span"), -App.Facilities.Farmyard.rules = function() { - const frag = new DocumentFragment(); + unitCost = Math.trunc(1000 * V.upgradeMultiplierArcology); - if (App.Entity.facilities.farmyard.employeesIDs().size > 0) { // TODO: redo this with V.farmyardShowgirls - if (V.farmyardShows && (V.canines || V.hooved || V.felines)) { - const - desc = document.createElement("div"), - option = document.createElement("span"), - bold = document.createElement("span"); + link.classList.add("indent"); + note.classList.add("note"); + cost.classList.add("yellowgreen"); - bold.classList.add("bold"); + cost.append(cashFormat(unitCost)); - desc.append(`Slaves `); - bold.append(`are`); - desc.append(bold, ` putting on shows with animals. `); + if (V.farmMenialsSpace < 500) { + desc.append(`There is enough room in ${V.farmyardName} to build housing, enough to give ${V.farmMenialsSpace + 100} menial slaves a place to sleep and relax. `); + note.append(` Costs `, cost, ` and will increase upkeep costs`); - option.append(App.UI.DOM.passageLink("End shows", "Farmyard", () => { - V.farmyardShows = 0; - V.farmyardBreeding = 0; - V.farmyardRestraints = 0; - })); + link.append(App.UI.DOM.passageLink("Build a new housing unit", "Farmyard", () => { + cashX(forceNeg(unitCost), "farmyard"); + V.farmMenialsSpace += 100; + }), note); - desc.append(option); + desc.append(link); frag.append(desc); + } - if (V.seeBestiality) { - if (V.farmyardBreeding) { - const - desc = document.createElement("div"), - option = document.createElement("span"), - bold = document.createElement("span"); + return frag; + } + + function rules() { + const frag = new DocumentFragment(); + + if (App.Entity.facilities.farmyard.employeesIDs().size > 0) { // TODO: redo this with V.farmyardShowgirls + if (V.farmyardShows && (V.canines || V.hooved || V.felines)) { + const + desc = document.createElement("div"), + option = document.createElement("span"), + bold = document.createElement("span"); bold.classList.add("bold"); - desc.append(`Slaves `); - bold.append(`are`); - desc.append(bold, ` being bred with animals. `); + desc.append(`Slaves `); + bold.append(`are`); + desc.append(bold, ` putting on shows with animals. `); - option.append(App.UI.DOM.passageLink("End breeding", "Farmyard", () => { - V.farmyardShows = 1; - V.farmyardBreeding = 0; - V.farmyardRestraints = 0; - })); + option.append(App.UI.DOM.passageLink("End shows", "Farmyard", () => { + V.farmyardShows = 0; + V.farmyardBreeding = 0; + V.farmyardRestraints = 0; + })); - desc.append(option); - frag.append(desc); + desc.append(option); + frag.append(desc); - if (V.farmyardRestraints) { + if (V.seeBestiality) { + if (V.farmyardBreeding) { const desc = document.createElement("div"), option = document.createElement("span"), @@ -420,19 +447,62 @@ App.Facilities.Farmyard.rules = function() { bold.classList.add("bold"); - bold.append(`All of the slaves`); - desc.append(` are being restrained. `); - - desc.prepend(bold); + desc.append(`Slaves `); + bold.append(`are`); + desc.append(bold, ` being bred with animals. `); - option.append(App.UI.DOM.passageLink("Restrain only disobedient slaves", "Farmyard", () => { + option.append(App.UI.DOM.passageLink("End breeding", "Farmyard", () => { V.farmyardShows = 1; - V.farmyardBreeding = 1; + V.farmyardBreeding = 0; V.farmyardRestraints = 0; })); desc.append(option); frag.append(desc); + + if (V.farmyardRestraints) { + const + desc = document.createElement("div"), + option = document.createElement("span"), + bold = document.createElement("span"); + + bold.classList.add("bold"); + + bold.append(`All of the slaves`); + desc.append(` are being restrained. `); + + desc.prepend(bold); + + option.append(App.UI.DOM.passageLink("Restrain only disobedient slaves", "Farmyard", () => { + V.farmyardShows = 1; + V.farmyardBreeding = 1; + V.farmyardRestraints = 0; + })); + + desc.append(option); + frag.append(desc); + } else { + const + desc = document.createElement("div"), + option = document.createElement("span"), + bold = document.createElement("span"); + + bold.classList.add("bold"); + + bold.append(`Only disobedient slaves`); + desc.append(` are being restrained. `); + + desc.prepend(bold); + + option.append(App.UI.DOM.passageLink("Restrain all slaves", "Farmyard", () => { + V.farmyardShows = 1; + V.farmyardBreeding = 1; + V.farmyardRestraints = 1; + })); + + desc.append(option); + frag.append(desc); + } } else { const desc = document.createElement("div"), @@ -441,112 +511,60 @@ App.Facilities.Farmyard.rules = function() { bold.classList.add("bold"); - bold.append(`Only disobedient slaves`); - desc.append(` are being restrained. `); - - desc.prepend(bold); + desc.append(`Slaves `); + bold.append(`are not`); + desc.append(bold, ` being bred with animals. `); - option.append(App.UI.DOM.passageLink("Restrain all slaves", "Farmyard", () => { + option.append(App.UI.DOM.passageLink("Begin breeding", "Farmyard", () => { V.farmyardShows = 1; V.farmyardBreeding = 1; - V.farmyardRestraints = 1; + V.farmyardRestraints = 0; })); desc.append(option); frag.append(desc); } - } else { - const - desc = document.createElement("div"), - option = document.createElement("span"), - bold = document.createElement("span"); - - bold.classList.add("bold"); - - desc.append(`Slaves `); - bold.append(`are not`); - desc.append(bold, ` being bred with animals. `); - - option.append(App.UI.DOM.passageLink("Begin breeding", "Farmyard", () => { - V.farmyardShows = 1; - V.farmyardBreeding = 1; - V.farmyardRestraints = 0; - })); - - desc.append(option); - frag.append(desc); } - } - } else { - const - desc = document.createElement("div"), - option = document.createElement("span"), - bold = document.createElement("span"); + } else { + const + desc = document.createElement("div"), + option = document.createElement("span"), + bold = document.createElement("span"); - bold.classList.add("bold"); + bold.classList.add("bold"); - desc.append(`Slaves `); - bold.append(`are not`); - desc.append(bold, ` putting on shows with animals. `); + desc.append(`Slaves `); + bold.append(`are not`); + desc.append(bold, ` putting on shows with animals. `); - option.append(App.UI.DOM.passageLink("Begin shows", "Farmyard", () => { - V.farmyardShows = 1; - V.farmyardBreeding = 0; - V.farmyardRestraints = 0; - })); + option.append(App.UI.DOM.passageLink("Begin shows", "Farmyard", () => { + V.farmyardShows = 1; + V.farmyardBreeding = 0; + V.farmyardRestraints = 0; + })); - desc.append(option); - frag.append(desc); + desc.append(option); + frag.append(desc); + } } - } - - return frag; -}; -App.Facilities.Farmyard.upgrades = function() { - const frag = new DocumentFragment(), - - farmyardUpgrades = V.farmyardUpgrades, - - pumpCost = Math.trunc(5000 * V.upgradeMultiplierArcology), - fertilizerCost = Math.trunc(10000 * V.upgradeMultiplierArcology), - hydroponicsCost = Math.trunc(20000 * V.upgradeMultiplierArcology), - seedsCost = Math.trunc(25000 * V.upgradeMultiplierArcology), - machineryCost = Math.trunc(50000 * V.upgradeMultiplierArcology); - - if (!farmyardUpgrades.pump) { - const - desc = document.createElement("div"), - upgrade = document.createElement("div"), - note = document.createElement("span"), - cost = document.createElement("span"); - - upgrade.classList.add("indent"); - note.classList.add("note"); - cost.classList.add("yellowgreen"); - - cost.append(cashFormat(pumpCost)); - - upgrade.append(App.UI.DOM.passageLink("Upgrade the water pump", "Farmyard", () => { - cashX(forceNeg(pumpCost), "farmyard"); - farmyardUpgrades.pump = 1; - })); - - note.append(` Costs `, cost, ` and slightly decreases upkeep costs.`); - - desc.append(`${V.farmyardNameCaps} is currently using the basic water pump that it came with.`); + return frag; + } - upgrade.append(note); - frag.append(desc, upgrade); - } else { - const desc = document.createElement("div"); + function upgrades() { + const frag = new DocumentFragment(), - desc.append(`The water pump in ${V.farmyardName} is a more efficient model, slightly improving the amount of crops it produces.`); + farmyardUpgrades = V.farmyardUpgrades, - frag.append(desc); + pumpCost = Math.trunc(5000 * V.upgradeMultiplierArcology), + fertilizerCost = Math.trunc(10000 * V.upgradeMultiplierArcology), + hydroponicsCost = Math.trunc(20000 * V.upgradeMultiplierArcology), + seedsCost = Math.trunc(25000 * V.upgradeMultiplierArcology), + machineryCost = Math.trunc(50000 * V.upgradeMultiplierArcology); - if (!farmyardUpgrades.fertilizer) { + if (!farmyardUpgrades.pump) { const + desc = document.createElement("div"), upgrade = document.createElement("div"), note = document.createElement("span"), cost = document.createElement("span"); @@ -555,24 +573,27 @@ App.Facilities.Farmyard.upgrades = function() { note.classList.add("note"); cost.classList.add("yellowgreen"); - cost.append(cashFormat(fertilizerCost)); + cost.append(cashFormat(pumpCost)); - upgrade.append(App.UI.DOM.passageLink("Use a higher-quality fertilizer", "Farmyard", () => { - cashX(forceNeg(fertilizerCost), "farmyard"); - farmyardUpgrades.fertilizer = 1; + upgrade.append(App.UI.DOM.passageLink("Upgrade the water pump", "Farmyard", () => { + cashX(forceNeg(pumpCost), "farmyard"); + farmyardUpgrades.pump = 1; })); - note.append(` Costs `, cost, ` and moderately increases crop yield and slightly increases upkeep costs.`); + + note.append(` Costs `, cost, ` and slightly decreases upkeep costs.`); + + desc.append(`${V.farmyardNameCaps} is currently using the basic water pump that it came with.`); upgrade.append(note); - frag.append(upgrade); + frag.append(desc, upgrade); } else { const desc = document.createElement("div"); - desc.append(`${V.farmyardNameCaps} is using a higher-quality fertilizer, moderately increasing the amount of crops it produces and raising slightly raising upkeep costs.`); + desc.append(`The water pump in ${V.farmyardName} is a more efficient model, slightly improving the amount of crops it produces.`); frag.append(desc); - if (!farmyardUpgrades.hydroponics) { + if (!farmyardUpgrades.fertilizer) { const upgrade = document.createElement("div"), note = document.createElement("span"), @@ -582,25 +603,24 @@ App.Facilities.Farmyard.upgrades = function() { note.classList.add("note"); cost.classList.add("yellowgreen"); - cost.append(cashFormat(hydroponicsCost)); + cost.append(cashFormat(fertilizerCost)); - upgrade.append(App.UI.DOM.passageLink("Purchase an advanced hydroponics system", "Farmyard", () => { - cashX(forceNeg(hydroponicsCost), "farmyard"); - farmyardUpgrades.hydroponics = 1; + upgrade.append(App.UI.DOM.passageLink("Use a higher-quality fertilizer", "Farmyard", () => { + cashX(forceNeg(fertilizerCost), "farmyard"); + farmyardUpgrades.fertilizer = 1; })); - - note.append(` Costs `, cost, ` and moderately decreases upkeep costs.`); + note.append(` Costs `, cost, ` and moderately increases crop yield and slightly increases upkeep costs.`); upgrade.append(note); frag.append(upgrade); } else { const desc = document.createElement("div"); - desc.append(`${V.farmyardNameCaps} is outfitted with an advanced hydroponics system, reducing the amount of water your crops consume and thus moderately reducing upkeep costs.`); + desc.append(`${V.farmyardNameCaps} is using a higher-quality fertilizer, moderately increasing the amount of crops it produces and raising slightly raising upkeep costs.`); frag.append(desc); - if (!farmyardUpgrades.seeds) { + if (!farmyardUpgrades.hydroponics) { const upgrade = document.createElement("div"), note = document.createElement("span"), @@ -610,25 +630,25 @@ App.Facilities.Farmyard.upgrades = function() { note.classList.add("note"); cost.classList.add("yellowgreen"); - cost.append(cashFormat(seedsCost)); + cost.append(cashFormat(hydroponicsCost)); - upgrade.append(App.UI.DOM.passageLink("Purchase genetically modified seeds", "Farmyard", () => { - cashX(forceNeg(seedsCost), "farmyard"); - farmyardUpgrades.seeds = 1; + upgrade.append(App.UI.DOM.passageLink("Purchase an advanced hydroponics system", "Farmyard", () => { + cashX(forceNeg(hydroponicsCost), "farmyard"); + farmyardUpgrades.hydroponics = 1; })); - note.append(` Costs `, cost, ` and moderately increases crop yield and slightly increases upkeep costs.`); + note.append(` Costs `, cost, ` and moderately decreases upkeep costs.`); upgrade.append(note); frag.append(upgrade); } else { const desc = document.createElement("div"); - desc.append(`${V.farmyardNameCaps} is using genetically modified seeds, significantly increasing the amount of crops it produces and moderately increasing upkeep costs.`); + desc.append(`${V.farmyardNameCaps} is outfitted with an advanced hydroponics system, reducing the amount of water your crops consume and thus moderately reducing upkeep costs.`); frag.append(desc); - if (!farmyardUpgrades.machinery) { + if (!farmyardUpgrades.seeds) { const upgrade = document.createElement("div"), note = document.createElement("span"), @@ -638,11 +658,11 @@ App.Facilities.Farmyard.upgrades = function() { note.classList.add("note"); cost.classList.add("yellowgreen"); - cost.append(cashFormat(machineryCost)); + cost.append(cashFormat(seedsCost)); - upgrade.append(App.UI.DOM.passageLink("Upgrade the machinery", "Farmyard", () => { - cashX(forceNeg(machineryCost), "farmyard"); - farmyardUpgrades.machinery = 1; + upgrade.append(App.UI.DOM.passageLink("Purchase genetically modified seeds", "Farmyard", () => { + cashX(forceNeg(seedsCost), "farmyard"); + farmyardUpgrades.seeds = 1; })); note.append(` Costs `, cost, ` and moderately increases crop yield and slightly increases upkeep costs.`); @@ -652,244 +672,275 @@ App.Facilities.Farmyard.upgrades = function() { } else { const desc = document.createElement("div"); - desc.append(`The machinery in ${V.farmyardName} has been upgraded, and is more efficient, significantly increasing crop yields and significantly decreasing upkeep costs.`); + desc.append(`${V.farmyardNameCaps} is using genetically modified seeds, significantly increasing the amount of crops it produces and moderately increasing upkeep costs.`); frag.append(desc); + + if (!farmyardUpgrades.machinery) { + const + upgrade = document.createElement("div"), + note = document.createElement("span"), + cost = document.createElement("span"); + + upgrade.classList.add("indent"); + note.classList.add("note"); + cost.classList.add("yellowgreen"); + + cost.append(cashFormat(machineryCost)); + + upgrade.append(App.UI.DOM.passageLink("Upgrade the machinery", "Farmyard", () => { + cashX(forceNeg(machineryCost), "farmyard"); + farmyardUpgrades.machinery = 1; + })); + + note.append(` Costs `, cost, ` and moderately increases crop yield and slightly increases upkeep costs.`); + + upgrade.append(note); + frag.append(upgrade); + } else { + const desc = document.createElement("div"); + + desc.append(`The machinery in ${V.farmyardName} has been upgraded, and is more efficient, significantly increasing crop yields and significantly decreasing upkeep costs.`); + + frag.append(desc); + } } } } } - } - return frag; -}; + return frag; + } -App.Facilities.Farmyard.animalHousing = function() { - const frag = new DocumentFragment(), + function animalHousing() { + const frag = new DocumentFragment(), - baseCost = Math.trunc(5000 * V.upgradeMultiplierArcology), - upgradedCost = Math.trunc(10000 * V.upgradeMultiplierArcology); + baseCost = Math.trunc(5000 * V.upgradeMultiplierArcology), + upgradedCost = Math.trunc(10000 * V.upgradeMultiplierArcology); - let - farmyardKennels = V.farmyardKennels, - farmyardStables = V.farmyardStables, - farmyardCages = V.farmyardCages; + let + farmyardKennels = V.farmyardKennels, + farmyardStables = V.farmyardStables, + farmyardCages = V.farmyardCages; - // MARK: Kennels + // MARK: Kennels - const - CL = V.canines.length, - - dogs = CL === 1 ? V.canines[0] : CL < 3 ? - `several different breeds of dogs` : - `all kinds of dogs`, - canines = CL === 1 ? V.canines[0].species === "dog" ? - V.canines[0].breed : V.canines[0].speciesPlural : CL < 3 ? - `several different ${V.canines.every( - c => c.species === "dog") ? - `breeds of dogs` : `species of canines`}` : - `all kinds of canines`, - - kennels = document.createElement("div"), - kennelsCost = document.createElement("span"), - kennelsNote = document.createElement("span"), - kennelsUpgrade = document.createElement("div"); - - kennelsCost.classList.add("yellowgreen"); - kennelsNote.classList.add("note"); - kennelsUpgrade.classList.add("indent"); - - if (farmyardKennels === 0) { - kennels.append(App.UI.DOM.passageLink("Add kennels", "Farmyard", - () => { - cashX(forceNeg(baseCost), "farmyard"); - V.farmyardKennels = 1; - })); + const + CL = V.canines.length, + + dogs = CL === 1 ? V.canines[0] : CL < 3 ? + `several different breeds of dogs` : + `all kinds of dogs`, + canines = CL === 1 ? V.canines[0].species === "dog" ? + V.canines[0].breed : V.canines[0].speciesPlural : CL < 3 ? + `several different ${V.canines.every( + c => c.species === "dog") ? + `breeds of dogs` : `species of canines`}` : + `all kinds of canines`, + + kennels = document.createElement("div"), + kennelsCost = document.createElement("span"), + kennelsNote = document.createElement("span"), + kennelsUpgrade = document.createElement("div"); + + kennelsCost.classList.add("yellowgreen"); + kennelsNote.classList.add("note"); + kennelsUpgrade.classList.add("indent"); + + if (farmyardKennels === 0) { + kennels.append(App.UI.DOM.passageLink("Add kennels", "Farmyard", + () => { + cashX(forceNeg(baseCost), "farmyard"); + V.farmyardKennels = 1; + })); - kennelsCost.append(cashFormat(baseCost)); - kennelsNote.append(` Costs `, kennelsCost, `, will incur upkeep costs, and unlocks domestic canines`); + kennelsCost.append(cashFormat(baseCost)); + kennelsNote.append(` Costs `, kennelsCost, `, will incur upkeep costs, and unlocks domestic canines`); - kennels.append(kennelsNote); - } else if (farmyardKennels === 1) { - kennels.append(App.UI.DOM.passageLink("Kennels", "Farmyard Animals")); - kennels.append(` have been built in one corner of ${V.farmyardName}, and are currently ${CL < 1 ? `empty` : `occupied by ${dogs}.`}`); + kennels.append(kennelsNote); + } else if (farmyardKennels === 1) { + kennels.append(App.UI.DOM.passageLink("Kennels", "Farmyard Animals")); + kennels.append(` have been built in one corner of ${V.farmyardName}, and are currently ${CL < 1 ? `empty` : `occupied by ${dogs}.`}`); - if (V.rep > 10000) { - kennelsUpgrade.append(App.UI.DOM.passageLink("Upgrade kennels", "Farmyard", - () => { - cashX(forceNeg(upgradedCost), "farmyard"); - V.farmyardKennels = 2; - })); + if (V.rep > 10000) { + kennelsUpgrade.append(App.UI.DOM.passageLink("Upgrade kennels", "Farmyard", + () => { + cashX(forceNeg(upgradedCost), "farmyard"); + V.farmyardKennels = 2; + })); - kennelsCost.append(cashFormat(upgradedCost)); - kennelsNote.append(` Costs `, kennelsCost, `, will incur additional upkeep costs, and unlocks exotic canines`); + kennelsCost.append(cashFormat(upgradedCost)); + kennelsNote.append(` Costs `, kennelsCost, `, will incur additional upkeep costs, and unlocks exotic canines`); - kennelsUpgrade.append(kennelsNote); - kennels.append(kennelsUpgrade); + kennelsUpgrade.append(kennelsNote); + kennels.append(kennelsUpgrade); + } + } else if (farmyardKennels === 2) { + kennels.append(App.UI.DOM.passageLink("Large kennels", "Farmyard Animals")); + kennels.append(` have been built in one corner of ${V.farmyardName}, and are currently ${CL < 1 ? `empty` : `occupied by ${canines}`} `); } - } else if (farmyardKennels === 2) { - kennels.append(App.UI.DOM.passageLink("Large kennels", "Farmyard Animals")); - kennels.append(` have been built in one corner of ${V.farmyardName}, and are currently ${CL < 1 ? `empty` : `occupied by ${canines}`} `); - } - // MARK: Stables + // MARK: Stables - const - HL = V.hooved.length, - - hooved = HL === 1 ? V.hooved[0] : HL < 3 ? - `several different types of hooved animals` : - `all kinds of hooved animals`, - - stables = document.createElement("div"), - stablesCost = document.createElement("span"), - stablesNote = document.createElement("span"), - stablesUpgrade = document.createElement("div"); - - stablesCost.classList.add("yellowgreen"); - stablesNote.classList.add("note"); - stablesUpgrade.classList.add("indent"); - - if (farmyardStables === 0) { - stables.append(App.UI.DOM.passageLink("Add stables", "Farmyard", - () => { - cashX(forceNeg(baseCost), "farmyard"); - V.farmyardStables = 1; - })); + const + HL = V.hooved.length, - stablesCost.append(cashFormat(baseCost)); - stablesNote.append(` Costs `, stablesCost, `, will incur upkeep costs, and unlocks domestic hooved animals`); + hooved = HL === 1 ? V.hooved[0] : HL < 3 ? + `several different types of hooved animals` : + `all kinds of hooved animals`, - stables.append(stablesNote); - } else if (farmyardStables === 1) { - stables.append(App.UI.DOM.passageLink("Stables", "Farmyard Animals")); - stables.append(` have been built in one corner of ${V.farmyardName}, and are currently ${HL < 1 ? `empty` : `occupied by ${hooved}.`}`); + stables = document.createElement("div"), + stablesCost = document.createElement("span"), + stablesNote = document.createElement("span"), + stablesUpgrade = document.createElement("div"); - if (V.rep > 10000) { - stablesUpgrade.append(App.UI.DOM.passageLink("Upgrade stables", "Farmyard", + stablesCost.classList.add("yellowgreen"); + stablesNote.classList.add("note"); + stablesUpgrade.classList.add("indent"); + + if (farmyardStables === 0) { + stables.append(App.UI.DOM.passageLink("Add stables", "Farmyard", () => { - cashX(forceNeg(upgradedCost), "farmyard"); - V.farmyardStables = 2; + cashX(forceNeg(baseCost), "farmyard"); + V.farmyardStables = 1; })); - stablesCost.append(cashFormat(upgradedCost)); - stablesNote.append(` Costs `, stablesCost, `, will incur additional upkeep costs, and unlocks exotic hooved animals`); + stablesCost.append(cashFormat(baseCost)); + stablesNote.append(` Costs `, stablesCost, `, will incur upkeep costs, and unlocks domestic hooved animals`); - stablesUpgrade.append(stablesNote); - stables.append(stablesUpgrade); - } - } else if (farmyardStables === 2) { - stables.append(App.UI.DOM.passageLink("Large stables", "Farmyard Animals")); - stables.append(` have been built in one corner of ${V.farmyardName}, and are currently ${HL < 1 ? `empty` : `occupied by ${hooved}`} `); - } + stables.append(stablesNote); + } else if (farmyardStables === 1) { + stables.append(App.UI.DOM.passageLink("Stables", "Farmyard Animals")); + stables.append(` have been built in one corner of ${V.farmyardName}, and are currently ${HL < 1 ? `empty` : `occupied by ${hooved}.`}`); + if (V.rep > 10000) { + stablesUpgrade.append(App.UI.DOM.passageLink("Upgrade stables", "Farmyard", + () => { + cashX(forceNeg(upgradedCost), "farmyard"); + V.farmyardStables = 2; + })); + stablesCost.append(cashFormat(upgradedCost)); + stablesNote.append(` Costs `, stablesCost, `, will incur additional upkeep costs, and unlocks exotic hooved animals`); - // MARK: Cages + stablesUpgrade.append(stablesNote); + stables.append(stablesUpgrade); + } + } else if (farmyardStables === 2) { + stables.append(App.UI.DOM.passageLink("Large stables", "Farmyard Animals")); + stables.append(` have been built in one corner of ${V.farmyardName}, and are currently ${HL < 1 ? `empty` : `occupied by ${hooved}`} `); + } - const - FL = V.felines.length, - - cats = FL === 1 ? V.felines[0] : FL < 3 ? - `several different breeds of cats` : - `all kinds of cats`, - felines = FL === 1 ? V.felines[0].species === "cat" ? - V.felines[0].breed : V.felines[0].speciesPlural : FL < 3 ? - `several different ${V.felines.every( - c => c.species === "cat") ? - `breeds of cats` : `species of felines`}` : - `all kinds of felines`, - - cages = document.createElement("div"), - cagesCost = document.createElement("span"), - cagesNote = document.createElement("span"), - cagesUpgrade = document.createElement("div"); - - cagesCost.classList.add("yellowgreen"); - cagesNote.classList.add("note"); - cagesUpgrade.classList.add("indent"); - - if (farmyardCages === 0) { - cages.append(App.UI.DOM.passageLink("Add cages", "Farmyard", - () => { - cashX(forceNeg(baseCost), "farmyard"); - V.farmyardCages = 1; - })); - cagesCost.append(cashFormat(baseCost)); - cagesNote.append(` Costs `, cagesCost, `, will incur upkeep costs, and unlocks domestic felines`); - cages.append(cagesNote); - } else if (farmyardCages === 1) { - cages.append(App.UI.DOM.passageLink("Cages", "Farmyard Animals")); - cages.append(` have been built in one corner of ${V.farmyardName}, and are currently ${FL < 1 ? `empty` : `occupied by ${cats}.`}`); + // MARK: Cages - if (V.rep > 10000) { - cagesUpgrade.append(App.UI.DOM.passageLink("Upgrade cages", "Farmyard", + const + FL = V.felines.length, + + cats = FL === 1 ? V.felines[0] : FL < 3 ? + `several different breeds of cats` : + `all kinds of cats`, + felines = FL === 1 ? V.felines[0].species === "cat" ? + V.felines[0].breed : V.felines[0].speciesPlural : FL < 3 ? + `several different ${V.felines.every( + c => c.species === "cat") ? + `breeds of cats` : `species of felines`}` : + `all kinds of felines`, + + cages = document.createElement("div"), + cagesCost = document.createElement("span"), + cagesNote = document.createElement("span"), + cagesUpgrade = document.createElement("div"); + + cagesCost.classList.add("yellowgreen"); + cagesNote.classList.add("note"); + cagesUpgrade.classList.add("indent"); + + if (farmyardCages === 0) { + cages.append(App.UI.DOM.passageLink("Add cages", "Farmyard", () => { - cashX(forceNeg(upgradedCost), "farmyard"); - V.farmyardCages = 2; + cashX(forceNeg(baseCost), "farmyard"); + V.farmyardCages = 1; })); - cagesCost.append(cashFormat(upgradedCost)); - cagesNote.append(` Costs `, cagesCost, `, will incur additional upkeep costs, and unlocks exotic felines`); + cagesCost.append(cashFormat(baseCost)); + cagesNote.append(` Costs `, cagesCost, `, will incur upkeep costs, and unlocks domestic felines`); - cagesUpgrade.append(cagesNote); - cages.append(cagesUpgrade); + cages.append(cagesNote); + } else if (farmyardCages === 1) { + cages.append(App.UI.DOM.passageLink("Cages", "Farmyard Animals")); + cages.append(` have been built in one corner of ${V.farmyardName}, and are currently ${FL < 1 ? `empty` : `occupied by ${cats}.`}`); + + if (V.rep > 10000) { + cagesUpgrade.append(App.UI.DOM.passageLink("Upgrade cages", "Farmyard", + () => { + cashX(forceNeg(upgradedCost), "farmyard"); + V.farmyardCages = 2; + })); + + cagesCost.append(cashFormat(upgradedCost)); + cagesNote.append(` Costs `, cagesCost, `, will incur additional upkeep costs, and unlocks exotic felines`); + + cagesUpgrade.append(cagesNote); + cages.append(cagesUpgrade); + } + } else if (farmyardCages === 2) { + cages.append(App.UI.DOM.passageLink("Large cages", "Farmyard Animals")); + cages.append(` have been built in one corner of ${V.farmyardName}, and are currently ${FL < 1 ? `empty` : `occupied by ${felines}`} `); } - } else if (farmyardCages === 2) { - cages.append(App.UI.DOM.passageLink("Large cages", "Farmyard Animals")); - cages.append(` have been built in one corner of ${V.farmyardName}, and are currently ${FL < 1 ? `empty` : `occupied by ${felines}`} `); - } - // MARK: Remove Housing + // MARK: Remove Housing - const - removeHousing = document.createElement("div"), - removeHousingCost = document.createElement("span"), + const + removeHousing = document.createElement("div"), + removeHousingCost = document.createElement("span"), - removeHousingPrice = ((farmyardKennels + farmyardStables + farmyardCages) * 5000) * V.upgradeMultiplierArcology; + removeHousingPrice = ((farmyardKennels + farmyardStables + farmyardCages) * 5000) * V.upgradeMultiplierArcology; - removeHousingCost.classList.add("yellowgreen"); + removeHousingCost.classList.add("yellowgreen"); - if (farmyardKennels || farmyardStables || farmyardCages) { - removeHousing.append(document.createElement("br")); + if (farmyardKennels || farmyardStables || farmyardCages) { + removeHousing.append(document.createElement("br")); - removeHousing.append(App.UI.DOM.passageLink("Remove the animal housing", "Farmyard", - () => { - V.farmyardKennels = 0; - V.farmyardStables = 0; - V.farmyardCages = 0; + removeHousing.append(App.UI.DOM.passageLink("Remove the animal housing", "Farmyard", + () => { + V.farmyardKennels = 0; + V.farmyardStables = 0; + V.farmyardCages = 0; - V.farmyardShows = 0; - V.farmyardBreeding = 0; - V.farmyardRestraints = 0; + V.farmyardShows = 0; + V.farmyardBreeding = 0; + V.farmyardRestraints = 0; - V.canines = []; - V.hooved = []; - V.felines = []; + V.canines = []; + V.hooved = []; + V.felines = []; - App.Facilities.Farmyard.clearAnimalsBought(); - cashX(forceNeg(removeHousingPrice), "farmyard"); - })); + clearAnimalsBought(); + cashX(forceNeg(removeHousingPrice), "farmyard"); + })); - removeHousingCost.append(cashFormat(removeHousingPrice)); - removeHousing.append(` Will cost `, removeHousingCost); - } + removeHousingCost.append(cashFormat(removeHousingPrice)); + removeHousing.append(` Will cost `, removeHousingCost); + } - frag.append(kennels, stables, cages, removeHousing); + frag.append(kennels, stables, cages, removeHousing); - return frag; -}; + return frag; + } -App.Facilities.Farmyard.clearAnimalsBought = function() { - for (const i in V.animalsBought) { - V.animalsBought[i] = 0; + function clearAnimalsBought() { + for (const i in V.animalsBought) { + V.animalsBought[i] = 0; + } } + + return frag; }; diff --git a/src/facilities/farmyard/farmyard.tw b/src/facilities/farmyard/farmyard.tw index feaf8de2017..c7f495ae5e6 100644 --- a/src/facilities/farmyard/farmyard.tw +++ b/src/facilities/farmyard/farmyard.tw @@ -4,48 +4,4 @@ /* TODO: allow slaves that can't walk to put on shows */ /* TODO: write placeholders */ -<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Farmyard", $encyclopedia = "Farmyard">> - -<<if $farmyardName != "the Farmyard">> - <<set $farmyardNameCaps = $farmyardName.replace("the ", "The ")>> -<</if>> - -<<set _CL = $canines.length, _HL = $hooved.length, _FL = $felines.length, _FyL = App.Entity.facilities.farmyard.employeesIDs().size>> -<p class="scene-intro"> -<<includeDOM App.Facilities.Farmyard.intro()>> -</p> - -<div id="farmhandcount"> -<<includeDOM App.Facilities.Farmyard.expand()>> -</div> - -<div id="menials"> -<br> -<<includeDOM App.Facilities.Farmyard.transferMenials()>> -<<includeDOM App.Facilities.Farmyard.buyMenials()>> -<<includeDOM App.Facilities.Farmyard.houseMenials()>> -</div> - -<div id="rules"> -<br> -<<includeDOM App.Facilities.Farmyard.rules()>> -<br> -</div> - -<div id="upgrades"> -<br> -<<includeDOM App.Facilities.Farmyard.upgrades()>> -<br> -</div> - -<div id="animalhousing"> -<<includeDOM App.Facilities.Farmyard.animalHousing()>> -</div> - -<br><hr><br> - -<<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.farmyard)>> - -<br><br>Rename $farmyardName: <<textbox "$farmyardName" $farmyardName "Farmyard">> //Use a noun or similar short phrase// - -<<run App.UI.SlaveList.ScrollPosition.restore()>> +<<includeDOM App.Facilities.Farmyard.farmyard()>> -- GitLab