From 4a2e905fa08be693b48276f871503ac5229013a9 Mon Sep 17 00:00:00 2001 From: DCoded <dcoded@live.com> Date: Tue, 7 Jul 2020 23:24:45 -0400 Subject: [PATCH] Bugfixes (mostly) --- src/endWeek/saWorkTheFarm.js | 108 +++++++++++------- .../farmyard/reports/farmyardReport.js | 2 +- 2 files changed, 66 insertions(+), 44 deletions(-) diff --git a/src/endWeek/saWorkTheFarm.js b/src/endWeek/saWorkTheFarm.js index 6726e524b39..15d3dac78e3 100644 --- a/src/endWeek/saWorkTheFarm.js +++ b/src/endWeek/saWorkTheFarm.js @@ -17,14 +17,19 @@ App.SlaveAssignment.workTheFarm = function (slave) { slaveApproves = () => sexualQuirks.includes(slave.sexualQuirk) || behavorialQuirks.includes(slave.behavioralQuirk) || fetishes.includes(slave.fetish); let - r = [], + foodAmount = Math.trunc(App.Facilities.Farmyard.foodAmount(slave)), + sexualQuirks = ["perverted", "unflinching"], behavorialQuirks = ["sinful"], fetishes = ["humiliation", "masochist"]; - function total(slave) { + function fullReport(slave) { + const report = App.UI.appendNewElement("p", frag, '', "indent"); + + let r = []; + r.push(intro()); r.push(farmer()); r.push(devotion(slave)); @@ -34,6 +39,9 @@ App.SlaveAssignment.workTheFarm = function (slave) { r.push(sight(slave)); r.push(hearing(slave)); r.push(food(slave)); + r.push(farmerEffects(slave)); + + $(report).append(r.join(' ')); } const intro = () => `works as a farmhand this week.`; @@ -55,7 +63,12 @@ App.SlaveAssignment.workTheFarm = function (slave) { } function health(slave) { - return healthCondition(slave) + healthIllness(slave); + let r = []; + + r.push(healthCondition(slave)); + r.push(healthIllness(slave)); + + return r.join(' '); } function healthCondition(slave) { @@ -118,7 +131,9 @@ App.SlaveAssignment.workTheFarm = function (slave) { } function weight(slave) { - return slave.weight > 95 ? `${He} is so overweight that ${he} has to stop every few minutes to catch ${his} breath, and so ${his} productivity suffers. ` : ``; + if (slave.weight > 95) { + return `${He} is so overweight that ${he} has to stop every few minutes to catch ${his} breath, and so ${his} productivity suffers. `; + } } function sight(slave) { @@ -137,60 +152,57 @@ App.SlaveAssignment.workTheFarm = function (slave) { } } - function food(slave) { - const - food = Math.trunc(App.Facilities.Farmyard.foodAmount(slave)), - fsGain = 0.0001 * food; + function food() { + const fsGain = 0.0001 * foodAmount; + + FutureSocieties.DecorationBonus(V.farmyardDecoration, fsGain); if (V.foodMarket) { - r.push(`As a result, ${he} produces <span class="chocolate">${massFormat(food)}</span> of food over the week.`); + return `As a result, ${he} produces <span class="chocolate">${massFormat(foodAmount)}</span> of food over the week.`; } - - FutureSocieties.DecorationBonus(V.farmyardDecoration, fsGain); } - if (V.Farmer) { - // TODO: replace with something else - r.push(`While there, ${he} benefits from ${V.Farmer.slaveName}'s ${V.Farmer.physicalAge < 21 ? `youthful energy` : `care`} ${V.Farmer.skill.oral ? ` and talented tongue` : ``}.`); - if (slave.devotion < V.FarmerDevotionThreshold) { - slave.devotion += V.FarmerDevotionBonus; - } + function farmerEffects(slave) { + if (V.Farmer) { + if (slave.devotion < V.FarmerDevotionThreshold) { + slave.devotion += V.FarmerDevotionBonus; + } - if (slave.devotion < V.FarmerTrustThreshold) { - slave.trust += V.FarmerTrustBonus; - } + if (slave.devotion < V.FarmerTrustThreshold) { + slave.trust += V.FarmerTrustBonus; + } - if (slave.health.condition < 100) { - improveCondition(slave, V.FarmerHealthBonus); + if (slave.health.condition < 100) { + improveCondition(slave, V.FarmerHealthBonus); + } + + return `${S.Farmer} is a tough boss, but a fair one. ${slave.slaveName} benefits from ${his} care while working in ${V.farmyardName}.`; } } // Open Food Production if (V.foodMarket) { - if (foodAmount < 1) { - foodAmount = 1; - } + foodAmount = foodAmount > 1 ? 1 : foodAmount; + V.food += foodAmount; V.foodTotal += foodAmount; incomeStats.food += foodAmount; - - total(slave, foodAmount); } // Close Food Production // Open Shows - incomeStats.income += App.Facilities.Farmyard.farmShowsIncome(slave); - if (V.farmyardShows) { const shows = App.UI.DOM.appendNewElement("p", frag, '', "indent"); let r = []; + incomeStats.income += App.Facilities.Farmyard.farmShowsIncome(slave); + r.push(`${He} also puts on shows with animals this week.`); // Open FS Subsection @@ -537,22 +549,30 @@ App.SlaveAssignment.workTheFarm = function (slave) { // Open Long-Term Effects - if (slave.fetishKnown && slaveApproves() || slave.energy > 95) { - if (V.farmyardShows) { - if (V.seeBestiality) { - r.push(`Getting fucked by animals is the perfect job for ${him}, as far as ${he} can tell. <span class="devotion inc">${He} is happy</span> to spend ${his} days being utterly degraded.`); - } else { - r.push(`${He} loves putting on shows with animals, and as far as ${he} can tell, it's the perfect job for ${him}. It isn't as degrading as ${he} would like, but <span class="devotion inc">${he} is happy nonetheless.</span>`); + function longTermEffects(slave) { + const longTermEffects = App.UI.appendNewElement("p", frag, '', "indent"); + + let r = []; + + if (slave.fetishKnown && slaveApproves() || slave.energy > 95) { + if (V.farmyardShows) { + if (V.seeBestiality) { + r.push(`Getting fucked by animals is the perfect job for ${him}, as far as ${he} can tell. <span class="devotion inc">${He} is happy</span> to spend ${his} days being utterly degraded.`); + } else { + r.push(`${He} loves putting on shows with animals, and as far as ${he} can tell, it's the perfect job for ${him}. It isn't as degrading as ${he} would like, but <span class="devotion inc">${he} is happy nonetheless.</span>`); + } } + + slave.need = 0; } - slave.need = 0; - } + // TODO: keep this? replace with something else? + if (slave.behavioralQuirk === "fitness") { + r.push(`${slave.slaveName} <span class="devotion inc">privately enjoys</span> the exercise ${he} receives while working in ${V.farmyardName}.`); + slave.devotion += 1; + } - // TODO: keep this? - if (slave.behavioralQuirk === "fitness") { - r.push(`${slave.slaveName} <span class="devotion inc">privately enjoys</span> the exercise ${he} receives while working in ${V.farmyardName}.`); - slave.devotion += 1; + $(longTermEffects).append(r.join(' ')); } // Close Long-Term Effects @@ -678,8 +698,7 @@ App.SlaveAssignment.workTheFarm = function (slave) { } if (V.showVignettes) { - const - vignettes = App.UI.DOM.appendNewElement("div", frag, '', "indent"); + const vignettes = App.UI.DOM.appendNewElement("div", frag, '', "indent"); slaveVignettes(); @@ -688,5 +707,8 @@ App.SlaveAssignment.workTheFarm = function (slave) { // Close Vignettes + fullReport(); + longTermEffects(); + return frag; }; diff --git a/src/facilities/farmyard/reports/farmyardReport.js b/src/facilities/farmyard/reports/farmyardReport.js index 3a6aa78ede8..dc668f42ec2 100644 --- a/src/facilities/farmyard/reports/farmyardReport.js +++ b/src/facilities/farmyard/reports/farmyardReport.js @@ -410,7 +410,7 @@ App.Facilities.Farmyard.farmyardReport = function farmyardReport(slave) { } } - $(intro).append(r); + $(intro).append(r); // FIXME: verify this is correct } -- GitLab