diff --git a/src/endWeek/player/prDrugs.js b/src/endWeek/player/prDrugs.js index 40b706d59a075037133a827c0a40727d8fcbfad0..4b7be0f3c2a2621dabd8fe3172eff109b76af048 100644 --- a/src/endWeek/player/prDrugs.js +++ b/src/endWeek/player/prDrugs.js @@ -1727,7 +1727,7 @@ App.EndWeek.Player.drugs = function(PC = V.PC) { case Drug.GROWTHSTIM: if (!canImproveHeight(PC)) { r.push(`Your body has grown far past its natural limits, and with their recent reduced effects, it makes sense that the stimulants have also reached their limit. <span class="noteworthy">You stop using them.</span>`); - PC.height = Math.clamp(PC.height, 0, maxHeight(PC)); + PC.height = Math.clamp(PC.height, 0, Math.min(maxHeight(PC) + PC.heightImplant * 10, 274)); PC.drugs = Drug.NONE; } break; diff --git a/src/endWeek/saDrugs.js b/src/endWeek/saDrugs.js index 01e0c8c7782a67a543549a369ab9efad36adbb29..45c6ba1163010dbafca098698f33a3cfa730a894 100644 --- a/src/endWeek/saDrugs.js +++ b/src/endWeek/saDrugs.js @@ -1914,7 +1914,7 @@ App.SlaveAssignment.drugs = function saDrugs(slave) { case Drug.GROWTHSTIM: if (!canImproveHeight(slave)) { r += ` ${His} body has already grown far past ${his} natural limits; further injections of stimulants will have no effect. <span class="yellow">${His} drug regimen has been ended.</span>`; - slave.height = Math.clamp(slave.height, 0, maxHeight(slave)); + slave.height = Math.clamp(slave.height, 0, Math.min(maxHeight(slave) + slave.heightImplant * 10, 274)); slave.drugs = Drug.NONE; } break; diff --git a/src/js/utilsAssessSlave.js b/src/js/utilsAssessSlave.js index 74fb09839884a3c2df424668c79b3254f8ad5b2d..b0268f33c0f2d1da4453fd8c383947dd91adf6dc 100644 --- a/src/js/utilsAssessSlave.js +++ b/src/js/utilsAssessSlave.js @@ -111,14 +111,15 @@ globalThis.canImproveIntelligence = function(slave) { }; /** + * This function returns the max *growable* height; remember to consider implants at call sites. * @param {FC.HumanState} slave * @returns {number} */ globalThis.maxHeight = function(slave) { - let max = Math.clamp(((slave.natural.height * 1.25) + slave.heightImplant * 10), 0, 274); /* max achievable height is expected height plus 25% */ + let max = Math.clamp(slave.natural.height * 1.25, 0, 274); /* max achievable height is expected height plus 25% */ if (slave.geneticQuirks.neoteny === 2 && slave.physicalAge > 12) { /* Limit neoteny slaves to 12 year old max height */ - max = Math.clamp(((Height.mean(slave.nationality, slave.race, slave.genes, 12) * 1.25) + slave.heightImplant * 10), 0, 274); + max = Math.clamp(Height.mean(slave.nationality, slave.race, slave.genes, 12) * 1.25, 0, 274); } if (slave.geneticQuirks.dwarfism === 2 && slave.geneticQuirks.gigantism !== 2) { @@ -137,7 +138,7 @@ globalThis.maxHeight = function(slave) { * @returns {boolean} */ globalThis.canImproveHeight = function(slave) { - return slave.height < maxHeight(slave); + return slave.height - slave.heightImplant * 10 < maxHeight(slave); }; /**