Skip to content
Snippets Groups Projects
Commit 96b7198c authored by Arkerthan's avatar Arkerthan
Browse files

split prosthetics and organs for loop

parent 9b5e8565
No related branches found
No related tags found
No related merge requests found
......@@ -8,24 +8,22 @@ You head down to your <<if $surgeryUpgrade == 1>>heavily upgraded and customized
/* count for estimating health impact */
<<set _organCount = $completedOrgans.filter(o => o.ID == $activeSlave.ID).length>>
<<set _prostheticCount = $adjustProsthetics.filter(p => p.slaveID == $activeSlave.ID && p.workLeft <= 0).length>>
/* since we already have count, skip slaves that don't need work */
<<if _organCount + _prostheticCount < 1>>
<<if _organCount < 1>>
<<continue>>
<</if>>
/*
Ensures that a slave can never die during the execution of this passage.
Calculation based on worst case, so when changing worst case change it here too.
*/
<<if $activeSlave.health - (_organCount * 40 + _prostheticCount * 20) < -75>>
<<if $activeSlave.health - (_organCount * 40) < -75>>
<br><hr>
@@.red;Estimated health impact too great; $activeSlave.slaveName skipped.@@
<<continue>>
<</if>>
/* start actual work */
<<if _organCount > 0>> /* check _organCount */
<<setLocalPronouns $activeSlave>>
<<set _slaveOrgans = {
penis: 0,
......@@ -995,131 +993,148 @@ You head down to your <<if $surgeryUpgrade == 1>>heavily upgraded and customized
<</if>>
<</if>>
/* finished checking _slaveOrgans */
<</if>> /* check _organCount closed */
<</if>>
/* start prosthetics */
<<if _prostheticCount > 0>>
<<for _k = 0; _k < $adjustProsthetics.length; _k++>>
<<set _p = $adjustProsthetics[_k]>>
<<if _p.slaveID == $activeSlave.ID && _p.workLeft <= 0>>
<<set $adjustProsthetics.splice(_k, 1), _k-->>
<<set addProsthetic($activeSlave, _p.id)>>
<br><hr>
<<switch _p.id>>
<<case "ocular">>
<<if getBestVision($activeSlave) === 0>>
<<run eyeSurgery($activeSlave, "both", "cybernetic"), cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave)>>
<<set $activeSlave.health -= 20, $surgeryType = "ocular implant">>
<<include "Surgery Degradation">>
<<else>>
//Since $he has working eyes the <<= setup.prosthetics.ocular.name>> will be put into storage.//
<</if>>
<<case "cochlear">>
<<if $activeSlave.hears != 0>>
<<set $activeSlave.earImplant = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "cochlear implant">>
<<include "Surgery Degradation">>
<<else>>
//Since $he has working ears the <<= setup.prosthetics.cochlear.name>> will be put into storage.//
<</if>>
<<case "electrolarynx">>
<<if $activeSlave.voice <= 0>>
<<set $activeSlave.electrolarynx = 1, $activeSlave.voice = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "electrolarynx">>
<<include "Surgery Degradation">>
<<else>>
//Since $he has a voice the <<= setup.prosthetics.electrolarynx.name>> will be put into storage.//
<</if>>
<<case "interfaceP1">>
<<if hasAnyNaturalLimbs($activeSlave)>>
//Since $he has at least one healthy limb the <<= setup.prosthetics.interfaceP1.name>> will be put into storage.//
<<elseif $activeSlave.PLimb == 2>>
//Since $he already has <<= addA(setup.prosthetics.interfaceP2.name)>> installed the <<= setup.prosthetics.interfaceP1.name>> will be put into storage.//
<<else>>
<<set $activeSlave.PLimb = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "PLimb interface1">>
<<include "Surgery Degradation">>
<</if>>
<<case "interfaceP2">>
<<if hasAllNaturalLimbs($activeSlave)>>
//Since $he has no amputated limbs the <<= setup.prosthetics.interfaceP2.name>> will be put into storage.//
<<elseif $activeSlave.PLimb == 1>>
<<set $activeSlave.PLimb = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "PLimb interface3">>
<<include "Surgery Degradation">>
<<else>>
<<set $activeSlave.PLimb = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "PLimb interface2">>
<<include "Surgery Degradation">>
<</if>>
<<case "basicL" "sexL" "beautyL" "combatL" "cyberneticL">>
<<if $activeSlave.fuckdoll != 0>>
//Since a Fuckdoll can't use prosthetic limbs the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<elseif hasAllNaturalLimbs($activeSlave)>>
//Since $he needs an amputated limb to attach prosthetics the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<elseif $activeSlave.PLimb == 0>>
//Since $he must have a prosthetic interface installed to attach prosthetic limbs the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
/* prosthetics */
<<for _i = 0; _i < $slaves.length; _i++>>
<<set $activeSlave = $slaves[_i]>>
/* count for estimating health impact */
<<set _prostheticCount = $adjustProsthetics.filter(p => p.slaveID == $activeSlave.ID && p.workLeft <= 0).length>>
/* since we already have count, skip slaves that don't need work */
<<if _prostheticCount < 1>>
<<continue>>
<</if>>
/*
Ensures that a slave can never die during the execution of this passage.
Calculation based on worst case, so when changing worst case change it here too.
*/
<<if $activeSlave.health - (_prostheticCount * 20) < -75>>
<br><hr>
@@.red;Estimated health impact too great; $activeSlave.slaveName skipped.@@
<<continue>>
<</if>>
<<for _k = 0; _k < $adjustProsthetics.length; _k++>>
<<set _p = $adjustProsthetics[_k]>>
<<if _p.slaveID == $activeSlave.ID && _p.workLeft <= 0>>
<<set $adjustProsthetics.splice(_k, 1), _k-->>
<<set addProsthetic($activeSlave, _p.id)>>
<br><hr>
<<switch _p.id>>
<<case "ocular">>
<<if getBestVision($activeSlave) === 0>>
<<run eyeSurgery($activeSlave, "both", "cybernetic"), cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave)>>
<<set $activeSlave.health -= 20, $surgeryType = "ocular implant">>
<<include "Surgery Degradation">>
<<else>>
//Since $he has working eyes the <<= setup.prosthetics.ocular.name>> will be put into storage.//
<</if>>
<<case "cochlear">>
<<if $activeSlave.hears != 0>>
<<set $activeSlave.earImplant = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "cochlear implant">>
<<include "Surgery Degradation">>
<<else>>
//Since $he has working ears the <<= setup.prosthetics.cochlear.name>> will be put into storage.//
<</if>>
<<case "electrolarynx">>
<<if $activeSlave.voice <= 0>>
<<set $activeSlave.electrolarynx = 1, $activeSlave.voice = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "electrolarynx">>
<<include "Surgery Degradation">>
<<else>>
//Since $he has a voice the <<= setup.prosthetics.electrolarynx.name>> will be put into storage.//
<</if>>
<<case "interfaceP1">>
<<if hasAnyNaturalLimbs($activeSlave)>>
//Since $he has at least one healthy limb the <<= setup.prosthetics.interfaceP1.name>> will be put into storage.//
<<elseif $activeSlave.PLimb == 2>>
//Since $he already has <<= addA(setup.prosthetics.interfaceP2.name)>> installed the <<= setup.prosthetics.interfaceP1.name>> will be put into storage.//
<<else>>
<<set $activeSlave.PLimb = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "PLimb interface1">>
<<include "Surgery Degradation">>
<</if>>
<<case "interfaceP2">>
<<if hasAllNaturalLimbs($activeSlave)>>
//Since $he has no amputated limbs the <<= setup.prosthetics.interfaceP2.name>> will be put into storage.//
<<elseif $activeSlave.PLimb == 1>>
<<set $activeSlave.PLimb = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "PLimb interface3">>
<<include "Surgery Degradation">>
<<else>>
<<set $activeSlave.PLimb = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "PLimb interface2">>
<<include "Surgery Degradation">>
<</if>>
<<case "basicL" "sexL" "beautyL" "combatL" "cyberneticL">>
<<if $activeSlave.fuckdoll != 0>>
//Since a Fuckdoll can't use prosthetic limbs the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<elseif hasAllNaturalLimbs($activeSlave)>>
//Since $he needs an amputated limb to attach prosthetics the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<elseif $activeSlave.PLimb == 0>>
//Since $he must have a prosthetic interface installed to attach prosthetic limbs the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<else>>
<<if _p.id == "basicL">>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 2)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<<else>>
//Since $he already has more advanced prosthetic limbs attached the <<= setup.prosthetics.basicL.name>> will be put into storage.//
<</if>>
<<elseif _p.id == "sexL">>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 3)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<<else>>
//Since $he already has advanced prosthetic limbs attached the <<= setup.prosthetics.sexL.name>> will be put into storage.//
<</if>>
<<elseif _p.id == "beautyL">>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 4)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<<else>>
//Since $he already has advanced prosthetic limbs attached the <<= setup.prosthetics.beautyL.name>> will be put into storage.//
<</if>>
<<elseif _p.id == "combatL">>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 5)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<<else>>
//Since $he already has advanced prosthetic limbs attached the <<= setup.prosthetics.combatL.name>> will be put into storage.//
<</if>>
<<else>>
<<if _p.id == "basicL">>
<<if $activeSlave.PLimb == 2>>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 2)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<<else>>
//Since $he already has more advanced prosthetic limbs attached the <<= setup.prosthetics.basicL.name>> will be put into storage.//
<</if>>
<<elseif _p.id == "sexL">>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 3)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<<else>>
//Since $he already has advanced prosthetic limbs attached the <<= setup.prosthetics.sexL.name>> will be put into storage.//
<</if>>
<<elseif _p.id == "beautyL">>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 4)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<<else>>
//Since $he already has advanced prosthetic limbs attached the <<= setup.prosthetics.beautyL.name>> will be put into storage.//
<</if>>
<<elseif _p.id == "combatL">>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 5)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<<else>>
//Since $he already has advanced prosthetic limbs attached the <<= setup.prosthetics.combatL.name>> will be put into storage.//
<</if>>
<<else>>
<<if $activeSlave.PLimb == 2>>
<<set _state = App.Desc.limbChange().currentLimbs($activeSlave), _change = upgradeLimbs($activeSlave, 2)>>
<<if _change>>
<<= App.Desc.limbChange().reaction($activeSlave, _state)>>
<</if>>
<<else>>
//Since $he must have <<= addA(setup.prosthetics.interfaceP2.name)>> installed to attach cybernetic limbs the <<= setup.prosthetics.cyberneticL.name>> will be put into storage.//
<</if>>
//Since $he must have <<= addA(setup.prosthetics.interfaceP2.name)>> installed to attach cybernetic limbs the <<= setup.prosthetics.cyberneticL.name>> will be put into storage.//
<</if>>
<</if>>
<<case "interfaceTail">>
<<set $activeSlave.PTail = 1, $activeSlave.tail = "none", $activeSlave.tailColor = "none", cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 10, $surgeryType = "tailInterface">>
<<include "Surgery Degradation">>
<<case "modT" "sexT" "combatT">>
<<if $activeSlave.PTail == 0>>
//Since $he must have <<= addA(setup.prosthetics.interfaceTail.name)>> installed to attach tails the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<elseif $activeSlave.tail != "none">>
//Since $he currently has a tail attached the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<elseif _p.id == "modT">>
//Since installing <<= addA(setup.prosthetics.modT.name)>> is complicated it can't be automated.//
/*Reason: there are different designs player can choose from.*/
<<elseif _p.id == "combatT">>
<<set $prostheticsConfig = "attachTail", $activeSlave.tail = "combat", $activeSlave.tailColor = "jet black">>
<<include "Prosthetics Configuration">>
<<elseif _p.id == "sexT">>
<<set $prostheticsConfig = "attachTail", $activeSlave.tail = "sex", $activeSlave.tailColor = "pink">>
<<include "Prosthetics Configuration">>
<</if>>
<<default>>
//Since there is no automated procedure to implant/attach <<= setup.prosthetics[_p.id].name>> it will be put into storage.//
<</switch>>
<br>
<</if>>
<</for>>
<</if>>
/* end prosthetics */
<</if>>
<<case "interfaceTail">>
<<set $activeSlave.PTail = 1, $activeSlave.tail = "none", $activeSlave.tailColor = "none", cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 10, $surgeryType = "tailInterface">>
<<include "Surgery Degradation">>
<<case "modT" "sexT" "combatT">>
<<if $activeSlave.PTail == 0>>
//Since $he must have <<= addA(setup.prosthetics.interfaceTail.name)>> installed to attach tails the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<elseif $activeSlave.tail != "none">>
//Since $he currently has a tail attached the <<= setup.prosthetics[_p.id].name>> will be put into storage.//
<<elseif _p.id == "modT">>
//Since installing <<= addA(setup.prosthetics.modT.name)>> is complicated it can't be automated.//
/*Reason: there are different designs player can choose from.*/
<<elseif _p.id == "combatT">>
<<set $prostheticsConfig = "attachTail", $activeSlave.tail = "combat", $activeSlave.tailColor = "jet black">>
<<include "Prosthetics Configuration">>
<<elseif _p.id == "sexT">>
<<set $prostheticsConfig = "attachTail", $activeSlave.tail = "sex", $activeSlave.tailColor = "pink">>
<<include "Prosthetics Configuration">>
<</if>>
<<default>>
//Since there is no automated procedure to implant/attach <<= setup.prosthetics[_p.id].name>> it will be put into storage.//
<</switch>>
<br>
<</if>>
<</for>>
/* updates the interrogated slave */
<<set $slaves[_i] = $activeSlave>>
<</for>> /* end of the $slaves loop */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment