From 7e165967c765adb78272eb5fa52eede9d61333e1 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Sun, 3 Jan 2021 19:14:08 -0500 Subject: [PATCH] major --- src/facilities/penthouse/penthousePassage.js | 252 ++++++++----------- 1 file changed, 106 insertions(+), 146 deletions(-) diff --git a/src/facilities/penthouse/penthousePassage.js b/src/facilities/penthouse/penthousePassage.js index 6439c7c8bfc..1ef262cde6c 100644 --- a/src/facilities/penthouse/penthousePassage.js +++ b/src/facilities/penthouse/penthousePassage.js @@ -10,8 +10,8 @@ App.UI.managePenthouse = function() { const el = new DocumentFragment(); el.append(intro()); el.append(capacity()); - el.append(facilities()); - el.append(surgery()); + el.append(major()); + el.append(minor()); el.append(upgrades()); return el; } @@ -45,206 +45,166 @@ App.UI.managePenthouse = function() { function capacity() { const el = new DocumentFragment(); - const cost = Math.trunc(V.dormitory * 1000 * V.upgradeMultiplierArcology); - const options = new App.UI.OptionsGroup(); + let r = []; + let cost; App.UI.DOM.appendNewElement("h2", el, "Penthouse Capacity"); - options.addOption(`The main penthouse dormitory has a capacity of ${V.dormitory} slaves.`) - .customButton( + + // Dorms + cost = Math.trunc(V.dormitory * 1000 * V.upgradeMultiplierArcology); + r.push(`The main penthouse dormitory, which houses slaves who aren't living in a facility and aren't granted a luxurious standard of living, has a capacity of`); + r.push(App.UI.DOM.makeElement("span", JSON.stringify(V.dormitory), "bold")); + r.push(`slaves.`); + r.push( + App.UI.DOM.link( "Expand the dormitory", () => { cashX(forceNeg(cost), "capEx"); V.dormitory += 10; V.PC.skill.engineering += .1; + App.UI.reload(); }, - "Manage Penthouse" + [], + "", + `Costs ${cashFormat(cost)}` ) - .addComment(`${cashFormat(cost)}. Houses slaves who aren't living in a facility and aren't granted a luxurious standard of living. Exceeding the dorm limit is bad for slaves' health, devotion and trust.`); - options.addOption(`Luxury rooms: capacity for ${V.rooms} slaves.`) - .customButton( + ); + r.push(App.UI.DOM.makeElement("span", `Exceeding this limit is bad for slaves' health, devotion and trust.`, "detail")); + App.Events.addNode(el, r, "div"); + + // Luxury rooms + r = []; + cost = Math.trunc(V.rooms * 1000 * V.upgradeMultiplierArcology); + r.push(`The penthouse also features little individual rooms, which house slaves who do enjoy a luxurious standard of living. They have a capacity of`); + r.push(App.UI.DOM.makeElement("span", JSON.stringify(V.rooms), "bold")); + r.push(`slaves.`); + r.push( + App.UI.DOM.link( "Expand the rooms", () => { cashX(forceNeg(cost), "capEx"); V.rooms += 5; V.PC.skill.engineering += .1; + App.UI.reload(); }, - "Manage Penthouse" + [], + "", + `Costs ${cashFormat(cost)}` ) - .addComment(`${cashFormat(cost)}. The penthouse also features little individual rooms, which house slaves who enjoy a luxurious standard of living. The number of rooms determines the number of slaves that can be granted luxury.`); - - - el.append(options.render()); - + ); + r.push(App.UI.DOM.makeElement("span", `The number of rooms determines the number of slaves that can be granted luxury.`, "detail")); + App.Events.addNode(el, r, "div"); return el; } - function facilities() { + function major() { const el = new DocumentFragment(); - const options = new App.UI.OptionsGroup(); - let option; - let desc; - const cost = Math.trunc(5000 * V.upgradeMultiplierArcology); - - App.UI.DOM.appendNewElement("h2", el, "Penthouse Facilities"); - option = options.addOption("Upgrade for master bedroom which turns it a harem for personal toys", "masterSuite", V); - if (!V.masterSuite) { - option.addValue("Purchase", 1, - () => { - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); - } + App.UI.DOM.appendNewElement("h2", el, "Major Penthouse Facilities"); + let r = []; - option = options.addOption("Dormitory to house large numbers of house servants", "servantsQuarters", V); - if (!V.servantsQuarters) { - option.addValue("Purchase", 1, - () => { - V.servantsQuarters = 5; - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); + if (V.masterSuite === 0) { + r.push(makeLink("Improve your master bedroom to house a harem of personal toys", () => { V.masterSuite = 1; })); + } else { + r.push(`Your penthouse is capped by a master suite with room for an entire harem of personal toys.`); } - option = options.addOption("A schoolroom where slaves can be educated", "schoolroom", V); - if (!V.schoolroom) { - option.addValue("Purchase", 5, - () => { - V.schoolroom = 5; - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); + if (V.servantsQuarters === 0) { + r.push(makeLink("Build a dormitory to house large numbers of house servants", () => { V.servantsQuarters = 5; })); + } else { + r.push(`Your penthouse includes a dormitory to house large numbers of house servants.`); } - option = options.addOption("Open baths that provide relaxation space for resting slaves", "spa", V); - if (!V.spa) { - option.addValue("Purchase", 5, - () => { - V.spa = 5; - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); - } - option = options.addOption("Clinic; a surgical recovery area to accommodate patients and a nurse", "clinic", V); - if (!V.clinic) { - option.addValue("Purchase", 5, - () => { - V.clinic = 5; - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); + + if (V.schoolroom === 0) { + r.push(makeLink("Build a schoolroom where slaves can be educated", () => { V.schoolroom = 5; })); + } else { + r.push(`Your penthouse includes a schoolroom where slaves can be educated.`); } - option = options.addOption("Cells to properly confine disobedient slaves", "cellblock", V); - if (!V.cellblock) { - option.addValue("Purchase", 5, - () => { - V.cellblock = 5; - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); + if (V.spa === 0) { + r.push(makeLink("Install open baths to provide relaxation space for resting slaves", () => { V.spa = 5; })); + } else { + r.push(`The penthouse includes a fully appointed spa where slaves can rest and recuperate.`); } if (V.seePreg !== 0) { if (V.experimental.nursery === 1) { - option = options.addOption("A nursery to raise children from birth", "schoolroom", V); - if (!V.nursery) { - option.addValue("Purchase", 5, - () => { - V.nursery = 5; - V.nurseryNannies = 1; - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); + if (V.nursery === 0) { + r.push(makeLink("Build a nursery to raise children from birth", () => { + V.nursery = 5; + V.nurseryNannies = 1; + })); + } else { + r.push(`The penthouse has a nursery built where infants can be brought up.`); } } - if (V.arcologyUpgrade.grid === 1) { - option = options.addOption("Incubation chamber to rapidly age children", "incubator", V); - if (!V.incubator) { - option.addValue("Purchase", 1, - () => { - V.readySlaves = 0; - V.PC.skill.engineering += 1; - cashX(forceNeg(20 * cost), "capEx"); - } - ); - } - } else if (V.arcologyUpgrade.hydro === 1 || V.arcologyUpgrade.apron === 1) { - options.addOption("Installation of a child aging facility will require the arcology's electrical infrastructure to be overhauled."); - } } - option = options.addOption("A a small suite for a Head Girl to live in", "HGSuite", V); - if (V.HGSuite !== 1) { - option.addValue("Purchase", 1, - () => { - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); - } - if (!V.dojo) { - desc = "Set up a personal armory to support a bodyguard"; - } else if (V.dojo === 1) { - desc = "There is a small armory next to your office that can support a bodyguard."; + if (V.clinic === 0) { + r.push(makeLink("Expand the surgical recovery area to accommodate patients and a nurse", () => { V.clinic = 5; })); } else { - desc = "There is a small armory next to your office that can support a bodyguard, with a little room for them to rest in when off duty."; + r.push(`The surgical recovery area has been expanded to take in more unhealthy slaves and be staffed by a nurse.`); } - option = options.addOption(desc, "dojo", V); - if (!V.dojo) { - option.addValue("Set up a personal armory to support a bodyguard", 1, - () => { - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); - } else if (V.dojo === 1) { - option.addValue("Upgrade the armory with a private room for the bodyguard", 2, - () => { - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); - } - ); + if (V.cellblock === 0) { + r.push(makeLink("Construct cells to properly confine disobedient slaves", () => { V.cellblock = 5; })); + } else { + r.push(`The lower level of the penthouse includes a hallway of cells to confine slaves in.`); } - option = options.addOption("Workshop for making custom toys", "toyShop", V); - if (!V.toyShop) { - option.addValue("Purchase", true, - () => { - V.PC.skill.engineering += 1; - cashX(forceNeg(cost), "capEx"); + + if (V.seePreg !== 0) { + if (V.arcologyUpgrade.grid === 1) { + if (V.incubator === 0) { + r.push(makeLink("Install an incubation chamber to rapidly age children", () => { + V.incubator = 5; + V.readySlaves = 0; + })); + } else { + r.push(`The penthouse has a specialized facility dedicated to rapidly aging children.`); } - ); + } else if (V.arcologyUpgrade.hydro === 1 || V.arcologyUpgrade.apron === 1) { + r.push(App.UI.DOM.makeElement("span", "Installation of a child aging facility will require the arcology's electrical infrastructure to be overhauled.", "note")); + } } - el.append(options.render()); + return el; } - function surgery() { + function minor() { const el = new DocumentFragment(); - const options = new App.UI.OptionsGroup(); + App.UI.DOM.appendNewElement("h2", el, "Minor Penthouse Facilities"); - el.append(options.render()); return el; } function upgrades() { const el = new DocumentFragment(); - const options = new App.UI.OptionsGroup(); - el.append(options.render()); return el; } - function refresh() { - jQuery(container).empty().append(createPage()); + + /** + * + * @param {string} title + * @param {function(void):void} func + * @param {number} [cost=5000] + * @returns {HTMLAnchorElement} + */ + function makeLink(title, func, cost = 5000) { + cost = Math.trunc(cost * V.upgradeMultiplierArcology); + return App.UI.DOM.link( + title, + () => { + cashX(forceNeg(cost), "capEx"); + V.PC.skill.engineering += .1; + jQuery(container).empty().append(createPage()); + }, + [], + "", + `Costs ${cashFormat(cost)}` + ); } }; -- GitLab