From 5c98a23fd6755cd53350aca394e2a2f2ef524fd6 Mon Sep 17 00:00:00 2001 From: lowercase-donkey <lowercasedonkey@gmail.com> Date: Fri, 12 Jul 2019 00:16:22 -0400 Subject: [PATCH] fixes and more flair for descriptions --- src/js/descriptionWidgets.js | 91 ++++++++++++++++----------- src/js/slaveCostJS.js | 9 ++- src/uncategorized/bodyModification.tw | 31 ++------- 3 files changed, 68 insertions(+), 63 deletions(-) diff --git a/src/js/descriptionWidgets.js b/src/js/descriptionWidgets.js index 08a8bb0fc4b..77aef45c7f2 100644 --- a/src/js/descriptionWidgets.js +++ b/src/js/descriptionWidgets.js @@ -704,30 +704,6 @@ App.Desc.scar = function(slave, surface) { he, him, his, hers, himself, boy, He, His } = getPronouns(slave); /* eslint-enable */ - function describeScarInt(slave, surface) { // scars can sometimes be an int. This function generates a reasonable description. It can later be expanded to apply to different body parts, or include features of the slave such as skin tone or weight - switch (slave.scar[surface]) { - case 1: - return "light scarring"; - case 2: - return "heavy scarring"; - case 3: - return "fresh scarring"; - case 4: - return "burns"; - case 5: - return "a menacing scar"; - case 6: - return "an exotic scar"; - case 7: - if (surface === "belly") { - return "a cSection"; - } else { - return "a surgical scar"; - } - default: - return slave[surface]; - } - } if (State.variables.showBodyMods === 1) { if (surface === "extra") { // Make a sentence that describes all body parts that aren't explicitly described elsewhere in longSlave. If you scar a slave on her thumb, for instance. But why. let extraMarks = App.Desc.extraMarks(slave, "scar"); @@ -755,7 +731,7 @@ App.Desc.scar = function(slave, surface) { counter++; surface = App.Desc.oppositeSides(bodyPart); if (slave.scar[surface.center]) { // center defined, body part has no mirror. - r += `${describeScarInt(slave, surface.center)} on ${his} ${surface.center}`; + r += `${App.Desc.describeScarInt(slave, surface.center)} on ${his} ${surface.center}`; } else { // Center not defined, body part has a mirror. if (!slave.scar[surface.left] && !slave.scar[surface.right]) { // no marks @@ -764,16 +740,16 @@ App.Desc.scar = function(slave, surface) { } else if (slave.scar[surface.left] === slave.scar[surface.right]) { // matching places and marks // note that the slave.scar object won't have slave.scar["upper armS"] with an S defined, just the left and right, so we just use the left since we know they match. - r += `${describeScarInt(slave, surface.left)} on both ${his} ${surface.both}`; + r += `${App.Desc.describeScarInt(slave, surface.left)} on both ${his} ${surface.both}`; } else if (slave.scar[surface.left] && slave.scar[surface.right]) { // matching places but different marks - r += `both ${describeScarInt(slave, surface.left)} on ${his} ${surface.left}, and ${describeScarInt(slave, surface.right)} scared into ${his} ${surface.right}`; + r += `both ${App.Desc.describeScarInt(slave, surface.left)} on ${his} ${surface.left}, and ${App.Desc.describeScarInt(slave, surface.right)} scared into ${his} ${surface.right}`; } else if (slave.scar[surface.left]) { // left - r += `${describeScarInt(slave, surface.left)} on ${his} ${surface.left}`; + r += `${App.Desc.describeScarInt(slave, surface.left)} on ${his} ${surface.left}`; } else if (slave.scar[surface.right]) { // right - r += `${describeScarInt(slave, surface.right)} on ${his} ${surface.right}`; + r += `${App.Desc.describeScarInt(slave, surface.right)} on ${his} ${surface.right}`; } } if (counter === length) { @@ -790,23 +766,23 @@ App.Desc.scar = function(slave, surface) { } else { surface = App.Desc.oppositeSides(surface); if (slave.scar[surface.center]) { // center defined, body part has no mirror. - r += `${He} has ${describeScarInt(slave, surface.center)} on ${his} ${surface.center}. `; + r += `${He} has ${App.Desc.describeScarInt(slave, surface.center)} on ${his} ${surface.center}. `; } else { // Center not defined, body part has a mirror. if (!slave.scar[surface.left] && !slave.scar[surface.right]) { // no marks } else if (slave.scar[surface.left] === slave.scar[surface.right]) { // matching places and marks // note that the slave.scar object won't have slave.scar["upper armS"] with an S defined, just the left and right, so we just use the left since we know they match. - r += `${He} has ${describeScarInt(slave, surface.left)} on both ${his} ${surface.both}. `; + r += `${He} has ${App.Desc.describeScarInt(slave, surface.left)} on both ${his} ${surface.both}. `; } else if (slave.scar[surface.left] && slave.scar[surface.right]) { // matching places but different marks - r += `${He} has both ${describeScarInt(slave, surface.left)} on ${his} ${surface.left}, and ${describeScarInt(slave, surface.right)} scared into ${his} ${surface.right}. `; + r += `${He} has both ${App.Desc.describeScarInt(slave, surface.left)} on ${his} ${surface.left}, and ${App.Desc.describeScarInt(slave, surface.right)} scared into ${his} ${surface.right}. `; } else if (slave.scar[surface.left]) { // left - r += `${He} has ${describeScarInt(slave, surface.left)} on ${his} ${surface.left}. `; - } else if (describeScarInt(slave, surface.right)) { + r += `${He} has ${App.Desc.describeScarInt(slave, surface.left)} on ${his} ${surface.left}. `; + } else if (App.Desc.describeScarInt(slave, surface.right)) { // right - r += `${He} has ${describeScarInt(slave, surface.right)} on ${his} ${surface.right}. `; + r += `${He} has ${App.Desc.App.Desc.describeScarInt(slave, surface.right)} on ${his} ${surface.right}. `; } } } @@ -831,6 +807,51 @@ App.Desc.scar = function(slave, surface) { return r; }; +/** + * @param {App.Entity.SlaveState} slave + * @returns {string} Slave's scar. Slave is the slave in question, but call the body part without modifiers. Rather than using "left breast" and "right breast" just use "breast". The function will then describe any scars on the breasts, if present, in natural language. + */ +App.Desc.describeScarInt = function(slave, surface) { // scars can sometimes be an int. This function generates a reasonable description. It can later be expanded to apply to different body parts, or include features of the slave such as skin tone or weight + switch (slave.scar[surface]) { + case 1: + if (["left wrist", "right wrist", "left ankle", "right ankle"].includes(surface)) { + return "scars from manacles"; + } else { + return "light scarring"; + } + case 2: + if (["left wrist", "right wrist", "left ankle", "right ankle"].includes(surface)) { + return "scars from heavy manacles"; + } else { + return "heavy scarring"; + } + case 3: + return "fresh scarring"; + case 4: + return "burns"; + case 5: + return "a menacing scar"; + case 6: + return "an exotic scar"; + case 7: + if (surface === "belly") { + return "a cSection"; + } else if (surface === "left breast" || surface === "right breast" ) { + if (slave.boobsImplant > 0) { + return "scars from sloppily inserted implants"; + } else { + return "scars as though she had sloppy sugery to remove implants"; + } + } else { + return "a surgical scar"; + } + default: + return slave[surface]; + } +} + + + /** * @param {App.Entity.SlaveState} slave * @returns {string} Description of slave's amputation, if present diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js index 3763f57aa8c..98ea408fb77 100644 --- a/src/js/slaveCostJS.js +++ b/src/js/slaveCostJS.js @@ -200,8 +200,13 @@ window.Beauty = (function() { if (slave.minorInjury !== 0) { beauty -= 2; } - if (slave.scar["belly"] === 7) { - beauty -= 2; + if (slave.scar !== {}) { + const scars = Object.keys(slave.scar); + for (const scar of scars) { + if (scar === 7) { + beauty -= 2; + } + } } if (slave.nails > 0) { beauty += 1; diff --git a/src/uncategorized/bodyModification.tw b/src/uncategorized/bodyModification.tw index b0a54bc2478..70c2166c257 100644 --- a/src/uncategorized/bodyModification.tw +++ b/src/uncategorized/bodyModification.tw @@ -28,9 +28,9 @@ <<case 4>> Your goal wasn't to make the distinct shape of a brand, but rather to permanently mar the skin with an open flame. <<case 7>> - <<if $PC.medical === 100>> + <<if $PC.medicine === 100>> Your medical mastery is perfect, so creating Frankenstein's monster was a deliberate work of art. - <<elseif $PC.medical > 0>> + <<elseif $PC.medicine > 0>> Your medical skills are progressing, and the Frankenstein effect reminds you of your earliest attempts. <<else>> You really slashed away with your knife, but were careful not to allow $her to bleed out. @@ -46,9 +46,9 @@ <<case 4>> Your goal wasn't to make the distinct shape of a brand, but rather to permanently mar the $activeSlave.skin skin of $his $scarTarget.local with an open flame. <<case 7>> - <<if $PC.medical === 100>> + <<if $PC.medicine === 100>> Your medical mastery is perfect, so creating such a scar was a deliberate act of degredation. - <<elseif $PC.medical > 0>> + <<elseif $PC.medicine > 0>> Your medical skills are progressing, and the sloppy scar reminds you of your earliest attempts. <<else>> You really slashed away at $scarTarget.local with your knife, but were careful not to allow $her to bleed out. @@ -1178,28 +1178,7 @@ Or a custom site: <<textbox "$brandTarget.local" $brandTarget.local "Body Modifi Scars: <<for _scarName, _scar range $activeSlave.scar>> <br> - <<switch _scar>> - <<case 1>> - $His _scarName is marked with light scarring: - <<case 2>> - $His _scarName is marked with heavy scarring: - <<case 3>> - $His _scarName is marked with fresh scarring: - <<case 4>> - $His _scarName is covered in burns: - <<case 5>> - $His _scarName is marked with a menacing scar: - <<case 6>> - $His _scarName is marked with an exotic scar: - <<case 7>> - <<if _scarName === "belly">> - $His _scarName is scarred from a cSection: - <<else>> - $His _scarName is marked with a surgical scar: - <</if>> - <<default>> - $His _scarName is marked with _scar: - <</switch>> + $His _scarName is marked with <<= App.Desc.describeScarInt($activeSlave, _scarName)>>: <<capture _scarName>> <<link "Remove Scar">> <<set $scarApplied = 0>> -- GitLab