From 33daebf6c5aff48bf4bd6ed9626ff564a19841df Mon Sep 17 00:00:00 2001 From: Pregmodder <pregmodder@gmail.com> Date: Wed, 8 Jun 2022 23:16:33 -0400 Subject: [PATCH] PC diet controls --- src/endWeek/player/prDiet.js | 4 - src/player/managePersonalAffairs.js | 232 ++++++++++++++++++++++++++++ 2 files changed, 232 insertions(+), 4 deletions(-) diff --git a/src/endWeek/player/prDiet.js b/src/endWeek/player/prDiet.js index dce0eaa4af5..b9ad3090b2b 100644 --- a/src/endWeek/player/prDiet.js +++ b/src/endWeek/player/prDiet.js @@ -645,8 +645,6 @@ App.EndWeek.Player.diet = function(PC = V.PC) { PC.diet = "healthy"; } } - - return r.join(" "); } function loseMuscle() { @@ -764,8 +762,6 @@ App.EndWeek.Player.diet = function(PC = V.PC) { } } } - - return r.join(" "); } function sharedAssetLoss(weightMod) { diff --git a/src/player/managePersonalAffairs.js b/src/player/managePersonalAffairs.js index 7116135f2fb..6199e0237fd 100644 --- a/src/player/managePersonalAffairs.js +++ b/src/player/managePersonalAffairs.js @@ -5,6 +5,7 @@ App.UI.managePersonalAffairs = function() { const skillsDiv = document.createElement("div"); const reputationDiv = document.createElement("div"); const drugsDiv = document.createElement("div"); + const dietDiv = document.createElement("div"); const lactationDiv = document.createElement("div"); const breederExamDiv = document.createElement("div"); @@ -28,6 +29,7 @@ App.UI.managePersonalAffairs = function() { appearance(), skills(), reputation(), + diet(), drugs(), ); @@ -890,6 +892,236 @@ App.UI.managePersonalAffairs = function() { } } + function diet() { + App.UI.DOM.appendNewElement("h2", dietDiv, `Diet`); + + const text = []; + const links = []; + + if (!canEatFood(PC)) { + text.push(`Your body is dependent on slave food for nutrition as your digestive tract has atrophied.`); + } + + if (PC.diet === "healthy") { + text.push(`You are eating healthy.`); + } else if (PC.diet === "restricted") { + text.push(`You are eating less in order to lose weight.`); + } else if (PC.diet === "fattening") { + text.push(`You are eating more in order to gain weight.`); + } else if (PC.diet === "muscle building" || PC.diet === "slimming") { + text.push(`You are eating energy rich food and spending ${PC.muscles > 0 ? "extra " : ""}time in the gym.`); + } else if (PC.diet === "exotic") { + text.push(`You are eating exotic foods to boost your energy in bed.`); + } else if (PC.diet === "corrective") { + text.push(`The automated feeder is controlling your portions in order to correct your weight.`); + } else if (PC.diet === "cum production") { + text.push(`You are eating a blend formulated to increase cum production.`); + } else if (PC.diet === "XX") { + text.push(`You are eating a blend laced with female hormones.`); + } else if (PC.diet === "XY") { + text.push(`You are eating a blend laced with male hormones.`); + } else if (PC.diet === "XXY") { + text.push(`You are eating a blend loaded with sex hormones.`); + } else if (PC.diet === "cleansing") { + text.push(`You are eating a blend formulated to flush carcinogens from your system.`); + } else if (PC.diet === "fertility") { + text.push(`You are eating a blend formulated to increase fertility.`); + } else if (PC.diet === "weaning") { + text.push(`You are on a special diet to wean you of your slave food dependency. You must stick with it until completion for it to have any lasting effect; quitting means you'll have to start it over again.`); + } + + // I hate everything about what comes after this line. + const onDiet = "You are on this diet"; + if (PC.diet === "healthy") { + links.push(App.UI.DOM.disabledLink(`Healthy`, [ + `${onDiet}`, + ])); + } else { + links.push(App.UI.DOM.link(`Healthy`, () => { + PC.diet = "healthy"; + App.UI.DOM.replace(dietDiv, diet); + })); + } + if (!canEatFood(PC)) { + if (PC.diet === "cleansing") { + links.push(App.UI.DOM.disabledLink(`Cleanse`, [ + `${onDiet}`, + ])); + } else if (PC.condition < 90 || PC.chem >= 10) { + links.push(App.UI.DOM.link(`Cleanse`, () => { + PC.diet = "cleansing"; + App.UI.DOM.replace(dietDiv, diet); + })); + } else { + links.push(App.UI.DOM.disabledLink(`Cleanse`, [ + `You are already healthy`, + ])); + } + } + if (PC.diet === "restricted") { + links.push(App.UI.DOM.disabledLink(`Lose weight`, [ + `${onDiet}`, + ])); + } else if (PC.weight >= -95) { + links.push(App.UI.DOM.link(`Lose weight`, () => { + PC.diet = "restricted"; + App.UI.DOM.replace(dietDiv, diet); + })); + } else { + links.push(App.UI.DOM.disabledLink(`Lose weight`, [ + `You have nothing left to lose`, + ])); + } + if (!canEatFood(PC) && V.feeder === 1) { + if (PC.diet === "corrective") { + links.push(App.UI.DOM.disabledLink(`Correct weight`, [ + `${onDiet}`, + ])); + } else if (slave.weight > 10 || slave.weight < -10) { + links.push(App.UI.DOM.link(`Correct weight`, () => { + PC.diet = "corrective"; + App.UI.DOM.replace(dietDiv, diet); + })); + } else { + links.push(App.UI.DOM.disabledLink(`Correct weight`, [ + `You are already a healthy weight`, + ])); + } + } + if (PC.diet === "fattening") { + links.push(App.UI.DOM.disabledLink(`Gain weight`, [ + `${onDiet}`, + ])); + } else if (PC.weight >= -95) { + links.push(App.UI.DOM.link(`Gain weight`, () => { + PC.diet = "fattening"; + App.UI.DOM.replace(dietDiv, diet); + })); + } else { + links.push(App.UI.DOM.disabledLink(`Gain weight`, [ + `You can't risk getting any fatter`, + ])); + } + if (PC.diet === "muscle building") { + links.push(App.UI.DOM.disabledLink(`Build muscle`, [ + `${onDiet}`, + ])); + } else if (PC.muscles < 100 && !isAmputee(PC)) { + links.push(App.UI.DOM.link(`Build muscle`, () => { + PC.diet = "muscle building"; + App.UI.DOM.replace(dietDiv, diet); + })); + } else if (!isAmputee(PC)) { + links.push(App.UI.DOM.disabledLink(`Build muscle`, [ + `You can't get any stronger`, + ])); + } else { + links.push(App.UI.DOM.disabledLink(`Build muscle`, [ + `You can't work out with no limbs`, + ])); + } + if (PC.diet === "slimming") { + links.push(App.UI.DOM.disabledLink(`Slim down`, [ + `${onDiet}`, + ])); + } else if (PC.muscles > 0 && canWalk(PC)) { + links.push(App.UI.DOM.link(`Slim down`, () => { + PC.diet = "slimming"; + App.UI.DOM.replace(dietDiv, diet); + })); + } else if (!canWalk(PC)) { + links.push(App.UI.DOM.disabledLink(`Slim down`, [ + `You can't focus on cardio if you can't walk`, + ])); + } else { + links.push(App.UI.DOM.disabledLink(`Slim down`, [ + `You have no more muscle left to lose`, + ])); + } + if (!canEatFood(PC)) { + if (PC.balls > 0 && V.cumProDiet === 1) { + if (PC.diet === "cum production") { + links.push(App.UI.DOM.disabledLink(`Cum production`, [ + `${onDiet}`, + ])); + } else { + links.push(App.UI.DOM.link(`Cum production`, () => { + PC.diet = "cum production"; + App.UI.DOM.replace(dietDiv, diet); + })); + } + } + if (V.dietFertility === 1 && (PC.ovaries === 1 || PC.mpreg === 1)) { + const superFetKnown = (PC.geneticQuirks.superfetation === 2 && (V.geneticMappingUpgrade >= 1 || PC.counter.birthsTotal > 0 || PC.pregWeek > 3)); + if (PC.diet === "fertility") { + links.push(App.UI.DOM.disabledLink(`Fertility`, [ + `${onDiet}`, + ])); + } else if (!isFertile(PC) || (PC.preg !== 0 && !superFetKnown)) { + links.push(App.UI.DOM.disabledLink(`Fertility`, [ + `You can't get pregnant`, + ])); + } else { + links.push(App.UI.DOM.link(`Fertility`, () => { + PC.diet = "fertility"; + App.UI.DOM.replace(dietDiv, diet); + })); + } + } + if (V.feeder === 1) { + if (PC.diet === "XX") { + links.push(App.UI.DOM.disabledLink(`Estrogen enriched`, [ + `${onDiet}`, + ])); + } else { + links.push(App.UI.DOM.link(`Estrogen enriched`, () => { + PC.diet = "XX"; + App.UI.DOM.replace(dietDiv, diet); + })); + } + if (PC.diet === "XY") { + links.push(App.UI.DOM.disabledLink(`Testosterone enriched`, [ + `${onDiet}`, + ])); + } else { + links.push(App.UI.DOM.link(`Testosterone enriched`, () => { + PC.diet = "XY"; + App.UI.DOM.replace(dietDiv, diet); + })); + } + if (V.dietXXY === 1 && PC.balls > 0 && (PC.ovaries === 1 || PC.mpreg === 1)) { + if (PC.diet === "XXY") { + links.push(App.UI.DOM.disabledLink(`Herm hormone blend`, [ + `${onDiet}`, + ])); + } else { + links.push(App.UI.DOM.link(`Herm hormone blend`, () => { + PC.diet = "XXY"; + App.UI.DOM.replace(dietDiv, diet); + })); + } + } + } + } else { + if (PC.diet === "exotic") { + links.push(App.UI.DOM.disabledLink(`Exotic`, [ + `${onDiet}`, + ])); + } else { + links.push(App.UI.DOM.link(`Exotic`, () => { + PC.diet = "exotic"; + App.UI.DOM.replace(dietDiv, diet); + })); + } + } + + text.push(App.UI.DOM.generateLinksStrip(links)); + + App.Events.addNode(dietDiv, text); + + return dietDiv; + } + function drugs() { const staminaDrugsDiv = document.createElement("div"); const contraceptivesDiv = document.createElement("div"); -- GitLab