diff --git a/devTools/types/FC/gameState.d.ts b/devTools/types/FC/gameState.d.ts index 91f7907885aa0e1aafaecbac93dfc1f69f62fd82..922673d8a521ad3b62e44b51ad846d69f77a387c 100644 --- a/devTools/types/FC/gameState.d.ts +++ b/devTools/types/FC/gameState.d.ts @@ -181,7 +181,6 @@ declare namespace FC { relation: number; heroSlaves: SlaveTemplate[]; - HGTastes?: number; //#region FCTV usedRemote: Bool; diff --git a/src/endWeek/saLiveWithHG.js b/src/endWeek/saLiveWithHG.js index c373181c620c112015dd15768fb267cc1407b185..01d248a243de9b298b3ecdfe1b3c20407a209359 100644 --- a/src/endWeek/saLiveWithHG.js +++ b/src/endWeek/saLiveWithHG.js @@ -53,7 +53,6 @@ App.SlaveAssignment.liveWithHG = (function() { App.UI.DOM.appendNewElement("div", el, App.Art.SlaveArtElement(slave, 2, 0), ["imageRef", "medImg"]); } - setHGTastes(); HGSetsDiet(slave, S.HeadGirl); if (V.HGSuiteHormones !== 0) { HGSetsHormones(slave, S.HeadGirl); @@ -94,23 +93,21 @@ App.SlaveAssignment.liveWithHG = (function() { return el; } - function setHGTastes() { - // run this first so that it affects things better + function getHGTastes() { if (arcology.FSSlimnessEnthusiast !== "unset") { - V.HGTastes = 1; + return 1; } else if (arcology.FSRepopulationFocus !== "unset") { - V.HGTastes = 4; + return 4; } else if (arcology.FSBodyPurist !== "unset") { - V.HGTastes = 1; + return 1; } else if (arcology.FSDegradationist !== "unset") { - V.HGTastes = 3; + return 3; } else if (arcology.FSAssetExpansionist !== "unset") { - V.HGTastes = 3; + return 3; } else if (arcology.FSTransformationFetishist !== "unset") { - V.HGTastes = 3; - } else { - V.HGTastes = 2; + return 3; } + return 2; } /** @@ -185,9 +182,9 @@ App.SlaveAssignment.liveWithHG = (function() { } else { slave.drugs = "breast injections"; } - } else if (canImpreg(slave, HG) && arcology.FSRestart === "unset" && (V.HGTastes === 4 || HG.fetish === "pregnancy" || arcology.FSRepopulationFocusPregPolicy === 1)) { + } else if (canImpreg(slave, HG) && arcology.FSRestart === "unset" && (getHGTastes() === 4 || HG.fetish === "pregnancy" || arcology.FSRepopulationFocusPregPolicy === 1)) { slave.drugs = "fertility drugs"; - } else if (V.HGTastes > 1) { + } else if (getHGTastes() > 1) { // need to consider things here if (slave.lips <= 70) { slave.drugs = "lip injections"; @@ -1405,11 +1402,11 @@ App.SlaveAssignment.liveWithHG = (function() { } else { r.push(`eager to see just how much boob ${slave.slaveName} can handle.`); } - } else if (canImpreg(slave, HG) && arcology.FSRestart === "unset" && (V.HGTastes === 4 || HG.fetish === "pregnancy")) { + } else if (canImpreg(slave, HG) && arcology.FSRestart === "unset" && (getHGTastes() === 4 || HG.fetish === "pregnancy")) { r.push(`${HG.slaveName} gives ${slave.slaveName} fertility enhancers, since ${he2} wants to see ${slave.slaveName} heavy with child.`); } else if (arcology.FSRepopulationFocusPregPolicy === 1 && canImpreg(slave, HG)) { r.push(`${HG.slaveName} gives ${slave.slaveName} fertility enhancers, since pregnancy is popular and ${he2} wants ${slave.slaveName} to look hot.`); - } else if (V.HGTastes > 1) { + } else if (getHGTastes() > 1) { if (slave.lips <= 70) { r.push(`${HG.slaveName} gives ${slave.slaveName} lip injections, since ${he2} thinks ${slave.slaveName} should have lips so big ${he} can barely speak.`); } else if (slave.boobs > (125 * Math.pow(slave.butt, 2))) { @@ -1425,6 +1422,74 @@ App.SlaveAssignment.liveWithHG = (function() { } } + /** Allow the HG to set RA surgery rules based on her tastes, for immediate application + * @returns {FC.RA.RuleSurgerySettings} + */ + function getHGSurgeryTargets() { + const thisSurgery = App.RA.newRule.surgery(); + switch (getHGTastes()) { + case 1: + thisSurgery.lactation = 0; + thisSurgery.cosmetic = 1; + thisSurgery.faceShape = "cute"; + thisSurgery.lips = App.RA.makeTarget('==', 10); + thisSurgery.hips = 0; + thisSurgery.hipsImplant = 0; + thisSurgery.butt = App.RA.makeTarget('==', 0); + thisSurgery.accent = 0; + thisSurgery.shoulders = 0; + thisSurgery.shouldersImplant = 0; + thisSurgery.boobs = App.RA.makeTarget('==', 0); + thisSurgery.holes = 0; + break; + case 2: + thisSurgery.lactation = 0; + thisSurgery.cosmetic = 1; + thisSurgery.faceShape = "cute"; + thisSurgery.lips = App.RA.makeTarget('==', 60); + thisSurgery.hips = 0; + thisSurgery.hipsImplant = 0; + thisSurgery.butt = App.RA.makeTarget('==', 4); + thisSurgery.accent = 0; + thisSurgery.shoulders = 0; + thisSurgery.shouldersImplant = 0; + thisSurgery.boobs = App.RA.makeTarget('==', 1200); + thisSurgery.holes = 0; + break; + case 3: + thisSurgery.lactation = 0; + thisSurgery.cosmetic = 1; + thisSurgery.faceShape = "cute"; + thisSurgery.lips = App.RA.makeTarget('==', 95); + thisSurgery.hips = 0; + thisSurgery.hipsImplant = 0; + thisSurgery.butt = App.RA.makeTarget('==', 8); + thisSurgery.accent = 0; + thisSurgery.shoulders = 0; + thisSurgery.shouldersImplant = 0; + thisSurgery.boobs = App.RA.makeTarget('==', 10000); + thisSurgery.holes = 2; + break; + case 4: + thisSurgery.lactation = 1; + thisSurgery.cosmetic = 1; + thisSurgery.faceShape = "cute"; + thisSurgery.lips = App.RA.makeTarget('==', 10); + thisSurgery.hips = 3; + thisSurgery.hipsImplant = 0; + thisSurgery.butt = App.RA.makeTarget('==', 0); + thisSurgery.accent = 0; + thisSurgery.shoulders = 0; + thisSurgery.shouldersImplant = 0; + thisSurgery.boobs = App.RA.makeTarget('==', 0); + thisSurgery.holes = 0; + break; + default: + throw "Unexpected HG tastes"; + } + return thisSurgery; + } + /** * @param {App.Entity.SlaveState} slave * @param {App.Entity.SlaveState} HG @@ -1432,7 +1497,7 @@ App.SlaveAssignment.liveWithHG = (function() { function HGArrangesSurgery(slave, HG) { if (arcology.FSBodyPurist === "unset") { r.push(`${HG.slaveName} sends ${V.assistant.name} notes on what surgical modifications ${he2} wants for ${slave.slaveName}.`); - r.push(rulesAutosurgery(slave)); + r.push(rulesAutosurgery(slave, getHGSurgeryTargets())); } if (HG.fetishKnown === 1) { if (HG.fetish === "sadist" && HG.fetishStrength > 95 && V.seeExtreme === 1 && slave.fetish !== "mindbroken") { @@ -1580,6 +1645,5 @@ App.SlaveAssignment.liveWithHG = (function() { `<div class="indent">${App.SlaveAssignment.devotion(slave)}</span>`); r.push(content); } - delete V.HGTastes; } })(); diff --git a/src/js/rulesAutosurgery.js b/src/js/rulesAutosurgery.js index ff72d90892338c0b7424d850e542531da9590200..b5d6511683f242d848ca071f11bc107846da0000 100644 --- a/src/js/rulesAutosurgery.js +++ b/src/js/rulesAutosurgery.js @@ -7,12 +7,13 @@ globalThis.rulesAutosurgery = (function() { /** * @param {App.Entity.SlaveState} slave + * @param {FC.RA.RuleSurgerySettings} [overrideRules] * @returns {string} */ - function rulesAutoSurgery(slave) { + function rulesAutoSurgery(slave, overrideRules) { r = ""; const surgeries = []; - const thisSurgery = ProcessHGTastes(slave); + const thisSurgery = overrideRules || surgeryFromRules(slave); if (slave.health.health >= -20) { CommitSurgery(slave, thisSurgery, surgeries); } @@ -23,11 +24,10 @@ globalThis.rulesAutosurgery = (function() { } /** - * @param {App.Entity.SlaveState} slave * @param {FC.RA.RuleSetters[]} ruleset * @returns {FC.RA.RuleSurgerySettings} */ - function autoSurgerySelector(slave, ruleset) { + function autoSurgerySelector(ruleset) { const surgery = App.RA.newRule.surgery(); ruleset.forEach(rule => { Object.keys(rule.surgery) @@ -43,93 +43,31 @@ globalThis.rulesAutosurgery = (function() { * @param {App.Entity.SlaveState} slave * @returns {FC.RA.RuleSurgerySettings} */ - function ProcessHGTastes(slave) { - let thisSurgery = App.RA.newRule.surgery(); - switch (V.HGTastes) { - case 1: - thisSurgery.lactation = 0; - thisSurgery.cosmetic = 1; - thisSurgery.faceShape = "cute"; - thisSurgery.lips = App.RA.makeTarget('==', 10); - thisSurgery.hips = 0; - thisSurgery.hipsImplant = 0; - thisSurgery.butt = App.RA.makeTarget('==', 0); - thisSurgery.accent = 0; - thisSurgery.shoulders = 0; - thisSurgery.shouldersImplant = 0; - thisSurgery.boobs = App.RA.makeTarget('==', 0); - thisSurgery.holes = 0; - break; - case 2: - thisSurgery.lactation = 0; - thisSurgery.cosmetic = 1; - thisSurgery.faceShape = "cute"; - thisSurgery.lips = App.RA.makeTarget('==', 60); - thisSurgery.hips = 0; - thisSurgery.hipsImplant = 0; - thisSurgery.butt = App.RA.makeTarget('==', 4); - thisSurgery.accent = 0; - thisSurgery.shoulders = 0; - thisSurgery.shouldersImplant = 0; - thisSurgery.boobs = App.RA.makeTarget('==', 1200); - thisSurgery.holes = 0; - break; - case 3: - thisSurgery.lactation = 0; - thisSurgery.cosmetic = 1; - thisSurgery.faceShape = "cute"; - thisSurgery.lips = App.RA.makeTarget('==', 95); - thisSurgery.hips = 0; - thisSurgery.hipsImplant = 0; - thisSurgery.butt = App.RA.makeTarget('==', 8); - thisSurgery.accent = 0; - thisSurgery.shoulders = 0; - thisSurgery.shouldersImplant = 0; - thisSurgery.boobs = App.RA.makeTarget('==', 10000); - thisSurgery.holes = 2; - break; - case 4: - thisSurgery.lactation = 1; - thisSurgery.cosmetic = 1; - thisSurgery.faceShape = "cute"; - thisSurgery.lips = App.RA.makeTarget('==', 10); - thisSurgery.hips = 3; - thisSurgery.hipsImplant = 0; - thisSurgery.butt = App.RA.makeTarget('==', 0); - thisSurgery.accent = 0; - thisSurgery.shoulders = 0; - thisSurgery.shouldersImplant = 0; - thisSurgery.boobs = App.RA.makeTarget('==', 0); - thisSurgery.holes = 0; - break; - default: - thisSurgery = autoSurgerySelector( - slave, - V.defaultRules - .filter(x => ruleApplied(slave, x) && x.set.autoSurgery === 1) - .map(x => x.set)); - if ((thisSurgery.hips !== null) && (thisSurgery.butt !== null)) { - if (slave.hips < -1) { - if (App.RA.shallGrow(2, thisSurgery.butt)) { - thisSurgery.butt = App.RA.makeTarget('==', 2); - } - } else if (slave.hips < 0) { - if (App.RA.shallGrow(4, thisSurgery.butt)) { - thisSurgery.butt = App.RA.makeTarget('==', 4); - } - } else if (slave.hips > 0) { - if (App.RA.shallGrow(8, thisSurgery.butt)) { - thisSurgery.butt = App.RA.makeTarget('==', 8); - } - } else if (slave.hips > 1) { - // true - } else { - if (App.RA.shallGrow(6, thisSurgery.butt)) { - thisSurgery.butt = App.RA.makeTarget('==', 6); - } - } + function surgeryFromRules(slave) { + let thisSurgery = autoSurgerySelector( + V.defaultRules + .filter(x => ruleApplied(slave, x) && x.set.autoSurgery === 1) + .map(x => x.set)); + if ((thisSurgery.hips !== null) && (thisSurgery.butt !== null)) { + if (slave.hips < -1) { + if (App.RA.shallGrow(2, thisSurgery.butt)) { + thisSurgery.butt = App.RA.makeTarget('==', 2); + } + } else if (slave.hips < 0) { + if (App.RA.shallGrow(4, thisSurgery.butt)) { + thisSurgery.butt = App.RA.makeTarget('==', 4); + } + } else if (slave.hips > 0) { + if (App.RA.shallGrow(8, thisSurgery.butt)) { + thisSurgery.butt = App.RA.makeTarget('==', 8); } - break; + } else if (slave.hips > 1) { + // true + } else { + if (App.RA.shallGrow(6, thisSurgery.butt)) { + thisSurgery.butt = App.RA.makeTarget('==', 6); + } + } } return thisSurgery; }