From 3d69a594f441630137efd09cba103ea77a1d5ae8 Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Thu, 30 Jan 2020 13:38:56 +0100 Subject: [PATCH] convert organ farm to new style --- src/npc/surgery/organFarm.js | 66 ++++++++++++ src/pregmod/organFarm.tw | 190 +++++++++++++---------------------- 2 files changed, 138 insertions(+), 118 deletions(-) diff --git a/src/npc/surgery/organFarm.js b/src/npc/surgery/organFarm.js index 7c4f2ae79df..94442106260 100644 --- a/src/npc/surgery/organFarm.js +++ b/src/npc/surgery/organFarm.js @@ -219,3 +219,69 @@ App.Medicine.OrganFarm.fullMenu = function(slave) { return ""; } }; + +App.Medicine.OrganFarm.currentlyGrowing = function() { + + function weeksToCompletion(weeks) { + if (V.organFarmUpgrade === 1) { + return weeks; + } else if (V.organFarmUpgrade === 2) { + return Math.ceil(weeks / 2); + } else { + return Math.ceil(weeks / 4); + } + } + + let r = ""; + + let growLines = []; + let finishLines = []; + + V.organs.forEach(o => { + const index = V.slaveIndices[o.ID]; + if (index !== undefined) { + growLines.push(`${V.slaves[index].slaveName}'s ${App.Medicine.OrganFarm.Organs[o.type].name}, ${ + weeksToCompletion(o.weeksToCompletion)} week(s) left.`); + } else { + growLines.push(`<span class="error">ERROR: No slave with ID ${o.ID} found.</span>`); + } + }); + V.incubatorOrgans.forEach(o => { + const tank = V.tanks.find((t) => t.ID === o.ID); + if (tank !== undefined) { + if (o.weeksToCompletion <= 0) { + finishLines.push(`${tank.slaveName}'s ${App.Medicine.OrganFarm.Organs[o.type].name}.`); + } else { + growLines.push(`${tank.slaveName}'s ${App.Medicine.OrganFarm.Organs[o.type].name}, ${ + weeksToCompletion(o.weeksToCompletion)} week(s) left.`); + } + } else { + growLines.push(`<span class="error">ERROR: No tank with ID ${o.ID} found.</span>`); + } + }); + + V.completedOrgans.forEach(o => { + const index = V.slaveIndices[o.ID]; + if (index !== undefined) { + finishLines.push(`${V.slaves[index].slaveName}'s ${App.Medicine.OrganFarm.Organs[o.type].name}.`); + } else { + finishLines.push(`<span class="error">ERROR: No slave with ID ${o.ID} found.</span>`); + } + }); + + if (growLines.length > 0) { + r += "<h3>Growing Organs</h3>"; + } + growLines.forEach(l => { + r += `<div>${l}</div>`; + }); + + if (finishLines.length > 0) { + r += "<h3>Finished Organs</h3>"; + } + finishLines.forEach(l => { + r += `<div>${l}</div>`; + }); + + return r; +}; diff --git a/src/pregmod/organFarm.tw b/src/pregmod/organFarm.tw index 52e1290ba53..e758469e22d 100644 --- a/src/pregmod/organFarm.tw +++ b/src/pregmod/organFarm.tw @@ -2,171 +2,126 @@ <<set $nextButton = "Back", $nextLink = "Manage Penthouse", $showEncyclopedia = 1, $encyclopedia = "The Pharmaceutical Fab.", _PCSkillCheck = Math.min($upgradeMultiplierMedicine, $HackingSkillMultiplier)>> -<br> -The Organ Farm -<hr> +<h1>The Organ Farm</h1> +<div class="scene-intro"> <<if $organFarmUpgrade > 2>> - //The organ farm is running smoothly. It can rapidly grow tailored organs for implantation in slaves. It can easily produce altered variants should you obtain the data necessary to create them.// - <br> + The organ farm is running smoothly. It can rapidly grow tailored organs for implantation in slaves. It can easily produce altered variants should you obtain the data necessary to create them. <<elseif $organFarmUpgrade > 1>> - //The organ farm is running smoothly. It can quickly grow tailored organs for implantation in slaves, though there will be side-effects. It can easily produce altered variants should you obtain the data necessary to create them.// - <br> + The organ farm is running smoothly. It can quickly grow tailored organs for implantation in slaves, though there will be side-effects. It can easily produce altered variants should you obtain the data necessary to create them. <<elseif ($organFarmUpgrade > 0)>> - //The organ farm is running smoothly. It can grow tailored organs for implantation in slaves. It can easily produce altered variants should you obtain the data necessary to create them.// - <br> + The organ farm is running smoothly. It can grow tailored organs for implantation in slaves. It can easily produce altered variants should you obtain the data necessary to create them. <</if>> +</div> <<if ($organFarmUpgrade < 3) && ($rep <= 10000*_PCSkillCheck)>> - //You lack the reputation to access experimental organ farm parts// - <br> + <div class="note"> + You lack the reputation to access experimental organ farm parts. + </div> <<elseif $dispensary == 0 && $organFarmUpgrade == 2>> - //An upgraded pharmaceutical fabricator is required by the perfected organ farm// - <br> + <div class="note"> + An upgraded pharmaceutical fabricator is required by the perfected organ farm. + </div> <<elseif $dispensary == 0 && $organFarmUpgrade == 1>> - //A pharmaceutical fabricator is required to produce the chemicals for the accelerated organ farm// - <br> + <div class="note"> + A pharmaceutical fabricator is required to produce the chemicals for the accelerated organ farm. + </div> <<elseif $dispensaryUpgrade == 0 && $organFarmUpgrade == 2>> - //The pharmaceutical fabricator must upgraded in order to produce the drugs required by the perfected organ farm// - <br> + <div class="note"> + The pharmaceutical fabricator must upgraded in order to produce the drugs required by the perfected organ farm. + </div> <<elseif $organs.length > 0>> - //The organ farm cannot be upgraded while it is use// - <br> + <div class="note"> + The organ farm cannot be upgraded while it is use. + </div> <<elseif ($organFarmUpgrade == 2) && ($rep > 10000*_PCSkillCheck)>> - [[Upgrade the organ farm to the cutting edge model|Organ Farm][cashX(forceNeg(150000*_PCSkillCheck), "capEx"), $organFarmUpgrade = 3]] - //Costs <<print cashFormat(150000*_PCSkillCheck)>>// - <br> //Will allow the organ farm to rapidly grow organs without risk to the implantee's health.// - <br> + <div> + [[Upgrade the organ farm to the cutting edge model|Organ Farm][cashX(forceNeg(150000*_PCSkillCheck), "capEx"), $organFarmUpgrade = 3]] + <span class="detail">Costs <<print cashFormat(150000*_PCSkillCheck)>></span> + </div> + <div class="indent detail"> + Will allow the organ farm to rapidly grow organs without risk to the implantee's health. + </div> <<elseif ($organFarmUpgrade == 1) && ($rep > 10000*_PCSkillCheck)>> - [[Upgrade the organ farm with an experimental growth accelerator|Organ Farm][cashX(forceNeg(75000*_PCSkillCheck), "capEx"), $organFarmUpgrade = 2]] - //Costs <<print cashFormat(75000*_PCSkillCheck)>>// - <br> //Will allow the organ farm to quickly grow organs. Implanted organs may cause health issues.// - <br> + <div> + [[Upgrade the organ farm with an experimental growth accelerator|Organ Farm][cashX(forceNeg(75000*_PCSkillCheck), "capEx"), $organFarmUpgrade = 2]] + <span class="detail">Costs <<print cashFormat(75000*_PCSkillCheck)>></span> + </div> + <div class="indent detail"> + Will allow the organ farm to quickly grow organs. Implanted organs may cause health issues. + </div> <</if>> <<if ($youngerOvaries != 1) && ($rep <= 10000*_PCSkillCheck)>> - //You lack the reputation to access designs for cloning fertile ovaries for menopausal slaves.// - <br> + <div class="note"> + You lack the reputation to access designs for cloning fertile ovaries for menopausal slaves. + </div> <<elseif ($youngerOvaries != 1) && ($rep > 10000*_PCSkillCheck)>> - [[Purchase designs for cloning fertile ovaries for menopausal slaves|Organ Farm][cashX(forceNeg(30000*_PCSkillCheck), "capEx"), $youngerOvaries = 1]] - //Costs <<print cashFormat(30000*_PCSkillCheck)>>// - <br> //Will allow the growth of younger, fertile ovaries for menopausal slaves. Restored fertility will only last for a couple years at most.// - <br> + <div> + [[Purchase designs for cloning fertile ovaries for menopausal slaves|Organ Farm][cashX(forceNeg(30000*_PCSkillCheck), "capEx"), $youngerOvaries = 1]] + <span class="detail">Costs <<print cashFormat(30000*_PCSkillCheck)>></span> + </div> + <div class="indent detail"> + Will allow the growth of younger, fertile ovaries for menopausal slaves. Restored fertility will only last for a couple years at most. + </div> <<elseif ($youngerOvaries > 0)>> - The organ farm is capable of growing fertile ovaries for postmenopausal slaves. - <br> + <div>The organ farm is capable of growing fertile ovaries for postmenopausal slaves.</div> <</if>> <<if $asexualReproduction == 1>> - The organ farm is capable of growing modified ovary pairs capable of self-fertilization. - <br> + <div>The organ farm is capable of growing modified ovary pairs capable of self-fertilization.</div> <</if>> <<if $seePreg != 0 && $seeBestiality == 1 && $cheatMode == 1>> <<if $farmyardLabUpgrades.animalOvaries > 0>> <<if $animalOvaries < 1>> - //You lack the required designs for cloning animal ovaries for slaves.// - <br> + <div class="note"> + You lack the required designs for cloning animal ovaries for slaves. + </div> <<else>> - The organ farm is capable of growing animal ovaries for slaves. - <br> + <div>The organ farm is capable of growing animal ovaries for slaves.</div> <</if>> <</if>> <<if $farmyardLabUpgrades.animalTesticles > 0>> <<if $animalTesticles < 1>> - //You lack the required designs for cloning animal testicles for slaves.// - <br> + <div class="note"> + You lack the required designs for cloning animal testicles for slaves. + </div> <<else>> - The organ farm is capable of growing animal testicles for slaves. - <br> + <div>The organ farm is capable of growing animal testicles for slaves.</div> <</if>> <</if>> <<if $farmyardLabUpgrades.animalMpreg > 0 && $arcologies[0].FSGenderRadicalistResearch == 1>> <<if $animalMpreg < 1>> - //You lack the required designs for cloning animal anal wombs and ovaries for slaves.// - <br> + <div class="note"> + You lack the required designs for cloning animal anal wombs and ovaries for slaves. + </div> <<else>> - The organ farm is capable of growing animal anal wombs and ovaries for slaves. - <br> + <div>The organ farm is capable of growing animal anal wombs and ovaries for slaves.</div> <</if>> <</if>> <</if>> -<br> -Organ Production -<hr> - -<<if $organs.length > 0>> - The following organs are being grown: - <<for $i = 0; $i < $organs.length; $i++>> - <<set $j = $slaveIndices[$organs[$i].ID]>> - <<if def $j>> - <br> - $slaves[$j].slaveName's $organs[$i].type, - <<if $organFarmUpgrade == 1>> - <<print $organs[$i].weeksToCompletion>> - <<elseif $organFarmUpgrade == 2>> - <<print Math.ceil($organs[$i].weeksToCompletion/2)>> - <<elseif $organFarmUpgrade == 3>> - <<print Math.ceil($organs[$i].weeksToCompletion/4)>> - <</if>> weeks from completion. - <<else>> - @@.red;Error: organID not found.@@ - <</if>> - <</for>> - <br> -<</if>> -<<if $incubatorSlaves > 0>> - <<for _x = 0; _x < $incubatorOrgans.length; _x++>> - <<set _tank = $tanks.find((t) => t.ID === $incubatorOrgans[_x].ID)>> - <<if def _tank>> - <br> - _tank.slaveName's $incubatorOrgans[_x].type, - <<if $incubatorOrgans[_x].weeksToCompletion <= 0>> - ready to be implanted as soon as $he exits the incubator. - <<else>> - <<if $organFarmUpgrade == 1>> - <<print $incubatorOrgans[_x].weeksToCompletion>> - <<elseif $organFarmUpgrade == 2>> - <<print Math.ceil($incubatorOrgans[_x].weeksToCompletion/2)>> - <<elseif $organFarmUpgrade == 3>> - <<print Math.ceil($incubatorOrgans[_x].weeksToCompletion/4)>> - <</if>> weeks from completion. - <</if>> - <</if>> - <</for>> - <br> -<</if>> -/* TODO: potentially allow organs to be implanted into children in the nursery */ +<h2>Organ Production</h2> -<<if $completedOrgans.length > 0>> - <br> - Currently the following organs are completed and ready for implantation: - <<for $i = 0; $i < $completedOrgans.length; $i++>> - <<set $j = $slaveIndices[$completedOrgans[$i].ID]>> - <<if def $j>> - <br>$slaves[$j].slaveName's $completedOrgans[$i].type. - <<else>> - @@.red;Error: completedOrganID not found.@@ - <</if>> - <</for>> - <br> -<</if>> +<<= App.Medicine.OrganFarm.currentlyGrowing()>> -<br> -Future Societies Research -<hr> +<h2>Future Societies Research</h2> <<if $seePreg != 0>> + <div> <<if $arcologies[0].FSGenderRadicalistDecoration == 100>> <<if ($arcologies[0].FSGenderRadicalistResearch == 0)>> <<if ($rep >= 10000*_PCSkillCheck)>> - [[Fund research into developing male pregnancy methods|Organ Farm][cashX(forceNeg(50000*_PCSkillCheck), "capEx"),$arcologies[0].FSGenderRadicalistResearch = 1]] //Costs <<print cashFormat(50000*_PCSkillCheck)>>. Will allow cloning and production of anal uteri and ovaries.// - <br> + [[Fund research into developing male pregnancy methods|Organ Farm][cashX(forceNeg(50000*_PCSkillCheck), "capEx"),$arcologies[0].FSGenderRadicalistResearch = 1]] + <span class="note"> + Costs <<print cashFormat(50000*_PCSkillCheck)>>. + <div class="indent">Will allow cloning and production of anal uteri and ovaries.</div> + </span> <<else>> - // You lack the reputation to access the research necessary to develop anal uteri and ovaries. // + <span class="note">You lack the reputation to access the research necessary to develop anal uteri and ovaries.</span> <br> <</if>> <<else>> @@ -174,10 +129,9 @@ Future Societies Research <br> <</if>> <<elseif $arcologies[0].FSGenderRadicalistResearch == 1>> - The organ farm has been upgraded with schematics for modified uteri and ovaries. - <br> + <span class="note">The organ farm has been upgraded with schematics for modified uteri and ovaries.</span> <<else>> - // Gender Radicalist focused research unavailable. // - <br> + <span class="note">Gender Radicalist focused research unavailable.</span> <</if>> + </div> <</if>> \ No newline at end of file -- GitLab