diff --git a/src/js/modification.js b/src/js/modification.js index 2fd4cefea4da8f0e218d2b4451f1cc3d3f05bc06..610db94e4ff95427bbf2fa6df926110613b7b695 100644 --- a/src/js/modification.js +++ b/src/js/modification.js @@ -25,6 +25,39 @@ App.Medicine.Modification.addScar = function(slave, scar, design, weight) { slave.scar[scar][design] += weight; } }; +/** + * Basic application of scar + * @param {App.Entity.SlaveState} slave + * @param {string} scar + * @param {string} design + */ +App.Medicine.Modification.removeScar = function(slave, scar, design) { + /* const V = State.variables; + V.scarApplied = 1; + V.degradation += 10; + slave.health -= 10; //dangerous to uncomment this as sometimes many scars are applied at once. + cashX(forceNeg(surgery.costs), "slaveSurgery", slave); + slave.health -= (V.PC.medicine >= 100) ? Math.round(surgery.healthCosts / 2) : surgery.healthCosts;*/ + if (slave.scar.hasOwnProperty(scar)) { // if scar object exists for this body part + if (slave.scar[scar].hasOwnProperty(design)) { // if object has this kind of scar (might be custom) + if (["generic", "whip", "chain", "burn", "menacing", "exotic", "surgical", "c-section", "cutting"].includes(design)) { + slave.scar[scar][design] = 0; + } else { + delete slave.scar[scar][design]; // scar was custom + } + } + // remove the scar object entirely if no entry is scarred: + let weights = Object.values(slave.scar[scar]); + let total = 0; + let i; + for (i = 0; i < weights.length; i++) { + total += weights[i]; + } + if (total === 0) { + delete slave.scar[scar]; + } + } +}; /** * Slave is whipped over the entire body, and strains in manacles so much that the wrists and ankles scar if present. diff --git a/src/js/rulesAutosurgery.js b/src/js/rulesAutosurgery.js index ea109a6efb2c610d57e27dde4432471957350aa4..38fb72d13b75081443bf6eecc48884e92a56e6e0 100644 --- a/src/js/rulesAutosurgery.js +++ b/src/js/rulesAutosurgery.js @@ -360,7 +360,7 @@ window.rulesAutosurgery = (function() { } }); } else if (slave.scar.hasOwnProperty("belly") && slave.scar.belly["c-section"] > 0 && thisSurgery.cosmetic > 0) { - commitProcedure("surgery to remove a c-section scar", s => { s.scar["belly"]["c-section"] = 0; }); + commitProcedure("surgery to remove a c-section scar", s => { App.Medicine.Modification.removeScar(s, "belly", "c-section"); }); } else if (slave.faceImplant <= 45 && slave.face <= 95 && thisSurgery.cosmetic === 2) { commitProcedure("a nicer face", slave => { if (slave.faceShape === "masculine") { slave.faceShape = "androgynous"; } diff --git a/src/npc/databases/dSlavesDatabase.tw b/src/npc/databases/dSlavesDatabase.tw index a8df5bcf97b792ef311afae13e5765c78cbc5353..aa36e8422b1a98dcd3f459d3dc5e804ac5d021fe 100644 --- a/src/npc/databases/dSlavesDatabase.tw +++ b/src/npc/databases/dSlavesDatabase.tw @@ -561,7 +561,11 @@ /*Tweaked smart piercing setting, corrected piercings -BoneyM*/ <<set _HS = App.Entity.SlaveState.makeSkeleton()>> -<<set _HS.slaveName = "Fleshlight", _HS.birthName = "Fleshlight", _HS.origin = "Nothing remains of the person $he originally was, either mentally or physically.", _HS.ID = _i++, _HS.birthWeek = random(0,51), _HS.actualAge = 21, _HS.physicalAge = 21, _HS.visualAge = 21, _HS.ovaryAge = 21, _HS.health = 20, _HS.devotion = 60, _HS.race = "white", _HS.eyeColor = "blue", _HS.hColor = "blonde", _HS.pubicHColor = "blonde", _HS.override_Skin = 1, _HS.skin = "spray tanned", _HS.hStyle = "long", _HS.waist = -55, _HS.boobs = 800, _HS.boobsImplant = 600, _HS.butt = 5, _HS.buttImplant = 2, _HS.lips = 55, _HS.lipsImplant = 2, _HS.lipsTat = "permanent makeup", _HS.vagina = 2, _HS.vaginaLube = 1, _HS.anus = 2, _HS.ovaries = 1, _HS.makeup = 3, _HS.nails = 3, _HS.skill.vaginal = 35, _HS.skill.oral = 35, _HS.skill.anal = 35, _HS.shoes = "heels", _HS.attrXY = 40, _HS.fetish = "mindbroken", _HS.fetishKnown = 1, _HS.custom.desc = "$He has many surgical scars and something seems off about $him.", _HS.scar["left breast"].surgical = 2 _HS.scar["right breast"].surgical = 2, _HS.scar["left buttock"].surgical = 2, _HS.scar["right buttock"].surgical = 2>> +<<set _HS.slaveName = "Fleshlight", _HS.birthName = "Fleshlight", _HS.origin = "Nothing remains of the person $he originally was, either mentally or physically.", _HS.ID = _i++, _HS.birthWeek = random(0,51), _HS.actualAge = 21, _HS.physicalAge = 21, _HS.visualAge = 21, _HS.ovaryAge = 21, _HS.health = 20, _HS.devotion = 60, _HS.race = "white", _HS.eyeColor = "blue", _HS.hColor = "blonde", _HS.pubicHColor = "blonde", _HS.override_Skin = 1, _HS.skin = "spray tanned", _HS.hStyle = "long", _HS.waist = -55, _HS.boobs = 800, _HS.boobsImplant = 600, _HS.butt = 5, _HS.buttImplant = 2, _HS.lips = 55, _HS.lipsImplant = 2, _HS.lipsTat = "permanent makeup", _HS.vagina = 2, _HS.vaginaLube = 1, _HS.anus = 2, _HS.ovaries = 1, _HS.makeup = 3, _HS.nails = 3, _HS.skill.vaginal = 35, _HS.skill.oral = 35, _HS.skill.anal = 35, _HS.shoes = "heels", _HS.attrXY = 40, _HS.fetish = "mindbroken", _HS.fetishKnown = 1, _HS.custom.desc = "$He has many surgical scars and something seems off about $him.">> +<<run App.Medicine.Modification.addScar(_HS, "left breast", "surgical", 2)>> +<<run App.Medicine.Modification.addScar(_HS, "right breast", "surgical", 2)>> +<<run App.Medicine.Modification.addScar(_HS, "left buttock", "surgical", 2)>> +<<run App.Medicine.Modification.addScar(_HS, "right buttock", "surgical", 2)>> <<set $heroSlaves.push(_HS)>> /*heels*/ /*Added origin, makeup and nails, changed eyes -BoneyM*/ diff --git a/src/pregmod/csec.tw b/src/pregmod/csec.tw index 00e3203d2bb4a15a825ea1d73128cb6cf95ebbdb..6aae432b09bfe55e6b659b08329cb3bdfe4b7470 100644 --- a/src/pregmod/csec.tw +++ b/src/pregmod/csec.tw @@ -606,7 +606,7 @@ Since $his <<if $activeSlave.mpreg == 1>>ass<<else>>vagina<</if>> was spared fro </span> <</if>> <</if>> -<<set $activeSlave.scar["belly"]["c-section"] = 1>> +<<run App.Medicine.Modification.addScar($activeSlave, "belly", "c-section")>> <<run SetBellySize($activeSlave)>> <<set $reservedChildren = FetusGlobalReserveCount("incubator")>> <<set $reservedChildrenNursery = FetusGlobalReserveCount("nursery")>> diff --git a/src/uncategorized/pRivalryHostage.tw b/src/uncategorized/pRivalryHostage.tw index 6e0cb87554bf273feac238f18c4f60b086e8911f..df27bdea9c02e2ff9f273fce47c89b6249e72b2c 100644 --- a/src/uncategorized/pRivalryHostage.tw +++ b/src/uncategorized/pRivalryHostage.tw @@ -75,7 +75,7 @@ <<set $activeSlave.counter.vaginal = 158>> <<set $activeSlave.counter.anal = 76>> <<set $activeSlave.counter.mammary = 320>> - <<set $activeSlave.scar["belly"]["c-section"] = 1>> + <<run App.Medicine.Modification.addScar($activeSlave, "belly", "c-section")>> <<case "servant">> <<set $activeSlave.career = "a maid">> <<if $pedo_mode == 1>> diff --git a/src/uncategorized/remoteSurgery.tw b/src/uncategorized/remoteSurgery.tw index b7db6eb66c239ab322862b5bd0fc311f33184872..d703f9d702f6b9a24e578bcd218a7aa0d685810b 100644 --- a/src/uncategorized/remoteSurgery.tw +++ b/src/uncategorized/remoteSurgery.tw @@ -492,11 +492,11 @@ $He has <<if $activeSlave.scar["left cheek"]>> <br> $He has <<= App.Desc.expandScarString($activeSlave, "left cheek")>> on $his left cheek. - [[Remove scars|Surgery Degradation][delete $activeSlave.scar["left cheek"], cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "scarRemov"]] + [[Remove all scars there|Surgery Degradation][delete $activeSlave.scar["left cheek"], cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "scarRemov"]] <<else>> <br> - $His face is unscarred. [[Give a menacing scar|Surgery Degradation][$activeSlave.scar["left cheek"].menacing = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "scarFear"]] | - [[Give an exotic scar|Surgery Degradation][$activeSlave.scar["left cheek"].exotic = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "scarExo"]] + $His face is unscarred. [[Give a menacing scar|Surgery Degradation][App.Medicine.Modification.addScar($activeSlave, "left cheek", "menacing"), cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "scarFear"]] | + [[Give an exotic scar|Surgery Degradation][App.Medicine.Modification.addScar($activeSlave, "left cheek", "exotic"), cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "scarExo"]] <</if>> <br><br> @@ -844,7 +844,7 @@ $He's <br> $He has an unsightly c-section scar. <<link "Remove Caesarean scar">> - <<set $activeSlave.scar["belly"]["c-section"] = 0>> + <<run App.Medicine.Modification.removeScar($activeSlave, "belly", "c-section")>> <<run cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave)>> <<set $activeSlave.health -= 10,$surgeryType = "bellyscar">> <<goto "Surgery Degradation">> diff --git a/src/utility/birthWidgets.tw b/src/utility/birthWidgets.tw index 7624b8eeffb75270294ad71fb9247b88c5441524..fdccdf15283c1450b59c1e29800f40a078517350 100644 --- a/src/utility/birthWidgets.tw +++ b/src/utility/birthWidgets.tw @@ -4,7 +4,8 @@ <br> <<if $birthDamage > 5 || $universalRulesCSec == 1>> <<if $universalRulesCSec == 1 || ($slaves[$i].mpreg == 0 && $slaves[$i].vagina < 0)>> - <<set $csec = 1, $slaves[$i].scar["belly"]["c-section"] = 1>> + <<set $csec = 1>> + <<run App.Medicine.Modification.addScar($slaves[$i], "belly", "c-section")>> <<if $clinic != 0>> $slaves[$i].slaveName is taken to $clinicName since $he <<if ($slaves[$i].mpreg == 0 && $slaves[$i].vagina < 0)>> @@ -24,9 +25,10 @@ <</if>> <<else>> <<if $clinic != 0>> - $He is lead to $clinicName since $he is likely to face complications with childbirth. $He is helped from $his clothes and into a comfortable hospital bed to relax until $he is ready. $He makes $himself comfortable and begins working on birthing $his bab<<if $slaves[$i].pregType > 1>>ies<<else>>y<</if>>, fully aware of $his watching helpers. <<if $birthDamage > 10>><<set $csec = 1, $slaves[$i].scar["belly"]["c-section"] = 1>>After several hours of intense labor, $he is transferred to the surgery wing. Following an emergency c-section, $he is returned to the recovery wing to rest<<else>>After several hours, and a touch of morphine, $he has successfully given birth<</if>>. $His child<<if $slaves[$i].pregType > 1>>ren are<<else>> is<</if>> promptly taken and $he is left under observation to make sure $he recovers. + $He is lead to $clinicName since $he is likely to face complications with childbirth. $He is helped from $his clothes and into a comfortable hospital bed to relax until $he is ready. $He makes $himself comfortable and begins working on birthing $his bab<<if $slaves[$i].pregType > 1>>ies<<else>>y<</if>>, fully aware of $his watching helpers. <<if $birthDamage > 10>><<set $csec = 1>><<run App.Medicine.Modification.addScar($slaves[$i], "belly", "c-section")>>After several hours of intense labor, $he is transferred to the surgery wing. Following an emergency c-section, $he is returned to the recovery wing to rest<<else>>After several hours, and a touch of morphine, $he has successfully given birth<</if>>. $His child<<if $slaves[$i].pregType > 1>>ren are<<else>> is<</if>> promptly taken and $he is left under observation to make sure $he recovers. <<else>> - <<set $csec = 1, $slaves[$i].scar["belly"]["c-section"] = 1>> + <<set $csec = 1>> + <<run App.Medicine.Modification.addScar($slaves[$i], "belly", "c-section")>> $He is lead to the autosurgery, since $he is likely to face complications with childbirth. $He is stripped from $his clothes and set up on the operating table. $He is quickly sedated and subjected to a c-section in order to avoid potential problems. The surgery is quick, and $he is moved to a bed to recover. When $he awakes, $his child<<if $slaves[$i].pregType > 1>>ren have<<else>> has<</if>> already been taken away. <</if>> <</if>> @@ -409,9 +411,10 @@ <<if $birthDamage > 5>> <<set $csec = 1>> <<if $clinic != 0>> - $He is carried to $clinicName, since $he is likely to face complications with childbirth. $He is stripped from $his clothes and set up in a comfortable hospital bed to relax until $he is ready. $He wiggles $himself into a comfortable spot and begins working on birthing $his bab<<if $slaves[$i].pregType > 1>>ies<<else>>y<</if>>, fully aware of $his watching helpers. <<if $birthDamage > 10>><<set $csec = 1, $slaves[$i].scar["belly"]["c-section"] = 1>>After several hours of intense labor, $he is transferred to the surgery wing. Following an emergency c-section, $he is returned to the recovery wing to rest<<else>>After several hours, and a touch of morphine, $he has successfully given birth<</if>>. $His child<<if $slaves[$i].pregType > 1>>ren are<<else>> is<</if>> promptly taken and $he is left under observation to make sure $he recovers. + $He is carried to $clinicName, since $he is likely to face complications with childbirth. $He is stripped from $his clothes and set up in a comfortable hospital bed to relax until $he is ready. $He wiggles $himself into a comfortable spot and begins working on birthing $his bab<<if $slaves[$i].pregType > 1>>ies<<else>>y<</if>>, fully aware of $his watching helpers. <<if $birthDamage > 10>><<set $csec = 1>><<run App.Medicine.Modification.addScar($slaves[$i], "belly", "c-section")>>After several hours of intense labor, $he is transferred to the surgery wing. Following an emergency c-section, $he is returned to the recovery wing to rest<<else>>After several hours, and a touch of morphine, $he has successfully given birth<</if>>. $His child<<if $slaves[$i].pregType > 1>>ren are<<else>> is<</if>> promptly taken and $he is left under observation to make sure $he recovers. <<else>> - <<set $csec = 1, $slaves[$i].scar["belly"]["c-section"] = 1>> + <<set $csec = 1>> + <<run App.Medicine.Modification.addScar($slaves[$i], "belly", "c-section")>> $He is carried to the autosurgery, since $he is likely to face complications with childbirth. $He is stripped from $his clothes and set up on the operating table. $He is quickly sedated and subjected to a c-section in order to avoid potential problems. The surgery is quick and $he is moved to a bed to recover. When $he awakes, $his child<<if $slaves[$i].pregType > 1>>ren have<<else>> has<</if>> already been taking away. <</if>>