From 0af03643bc4369739117e04eb04cf94fcbba87be Mon Sep 17 00:00:00 2001 From: lowercase-donkey <lowercasedonkey@gmail.com> Date: Fri, 26 Jul 2019 13:38:43 -0400 Subject: [PATCH] rearrange flow for better readability whitespace whitespace --- src/js/DefaultRules.js | 62 ++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index 7a549a27da9..ec611a2322e 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -2852,12 +2852,12 @@ window.DefaultRules = (function() { if ((rule.autoBrand === 1)) { if ((slave.health > -20)) { if (slave.earShape === "none" && rule.brandTarget !== "ears") { + let brandPlace = ""; // Brand location needs to be split into a left and right if (["ankles", "calves", "feet", "hands", "lower arms", "shoulders", "upper arms", "wrists", "cheeks", "ears", "buttocks", "breasts"].includes(rule.brandTarget)) { let left; let right; - let brandPlace = ""; if (rule.brandTarget === "ankles") { left = "left ankle"; right = "right ankle"; @@ -2940,31 +2940,6 @@ window.DefaultRules = (function() { } } - // Apply brands: - if (["left", "right"].includes(brandPlace)) { - if (slave.devotion < 18) { - slave.devotion -= 5; - } - slave.trust -= 5; - slave.health -= 10; - if (brandPlace === "left") { - slave.brand[left] = rule.brandDesign; - r += `<br>${slave.slaveName} has been branded on the ${left}, with <span class="gold">fear</span>${slave.devotion < 18 ? `, <span class="mediumorchid">regard,</span>` : ``} and <span class="red">health</span> consequences. Their ${right} already had this brand.`; - } else if (brandPlace === "right") { - slave.brand[right] = rule.brandDesign; - r += `<br>${slave.slaveName} has been branded on the ${right}, with <span class="gold">fear</span>${slave.devotion < 18 ? `, <span class="mediumorchid">regard,</span>` : ``} and <span class="red">health</span> consequences. Their ${left} already had this brand.`; - } - } else if (brandPlace === "both") { - slave.brand[left] = rule.brandDesign; - slave.brand[right] = rule.brandDesign; - if ((slave.devotion < 18)) { - slave.devotion -= 10; - } - slave.trust -= 10; - slave.health -= 20; - r += `<br>${slave.slaveName} has been branded on both ${rule.brandTarget}, with <span class="gold">fear</span>${slave.devotion < 18 ? `, <span class="mediumorchid">regard,</span>` : ``} and <span class="red">health</span> consequences.`; - } - // Brand location does NOT need to be split into a left and right, (and may or may not contain left OR right already.) } else if (slave.brand[rule.brandTarget] !== rule.brandDesign) { if ( @@ -2973,16 +2948,37 @@ window.DefaultRules = (function() { (!hasLimb(slave, "left leg") && ["left thigh", "left calf", "left ankle", "left foot"].includes(rule.brandTarget)) || (!hasLimb(slave, "right leg") && ["right thigh", "right calf", "right ankle", "rightfoot"].includes(rule.brandTarget)) ) { - // no brand needed due to amp. + brandPlace = ""; } else { - slave.brand[rule.brandTarget] = rule.brandDesign; - if ((slave.devotion < 18)) { - slave.devotion -= 5; - } - slave.trust -= 5; - slave.health -= 10; + brandPlace = "anywhere"; + } + } + + // Apply brands: + if (["left", "right", "anywhere"].includes(brandPlace)) { + if (slave.devotion < 18) { + slave.devotion -= 5; + } + slave.trust -= 5; + slave.health -= 10; + if (brandPlace === "left") { + slave.brand[left] = rule.brandDesign; + r += `<br>${slave.slaveName} has been branded on the ${left}, with <span class="gold">fear</span>${slave.devotion < 18 ? `, <span class="mediumorchid">regard,</span>` : ``} and <span class="red">health</span> consequences. Their ${right} already had this brand.`; + } else if (brandPlace === "right") { + slave.brand[right] = rule.brandDesign; + r += `<br>${slave.slaveName} has been branded on the ${right}, with <span class="gold">fear</span>${slave.devotion < 18 ? `, <span class="mediumorchid">regard,</span>` : ``} and <span class="red">health</span> consequences. Their ${left} already had this brand.`; + } else if (brandPlace === "anywhere") { r += `<br>${slave.slaveName} has been branded, with <span class="gold">fear</span>${slave.devotion < 18 ? `, <span class="mediumorchid">regard,</span>` : ``} and <span class="red">health</span> consequences.`; } + } else if (brandPlace === "both") { + slave.brand[left] = rule.brandDesign; + slave.brand[right] = rule.brandDesign; + if ((slave.devotion < 18)) { + slave.devotion -= 10; + } + slave.trust -= 10; + slave.health -= 20; + r += `<br>${slave.slaveName} has been branded on both ${rule.brandTarget}, with <span class="gold">fear</span>${slave.devotion < 18 ? `, <span class="mediumorchid">regard,</span>` : ``} and <span class="red">health</span> consequences.`; } } } -- GitLab