diff --git a/src/endWeek/saRivalries.js b/src/endWeek/saRivalries.js index f2c6a2e3668e4254359d4861ad7ac9c80706e06c..4bc862e15d709f29bd7d7d97f0ba438d1633a950 100644 --- a/src/endWeek/saRivalries.js +++ b/src/endWeek/saRivalries.js @@ -7,7 +7,6 @@ App.SlaveAssignment.rivalries = (function() { let he, him, his, hers, himself, girl, loli, He, His; let rival; - let slavesLength; return saRivalries; @@ -17,20 +16,15 @@ App.SlaveAssignment.rivalries = (function() { */ function saRivalries(slave) { r = []; - slavesLength = V.slaves.length; ({ // eslint-disable-next-line no-unused-vars he, him, his, hers, himself, girl, He, His, loli } = getPronouns(slave)); - if (slave.rivalry === 0) { - if (slave.fuckdoll === 0 && slave.fetish !== "mindbroken") { - if (isSlaveAvailable(slave) && slave.assignment !== window.Job.CONFINEMENT) { - if (slave.devotion < jsRandom(20, 100) && slave.trust > jsRandom(-100, -20)) { - generateRivalry(slave); - } - } + if (canStartRivalry(slave)) { + if (isSlaveAvailable(slave) && slave.assignment !== Job.CONFINEMENT) { + generateRivalry(slave); } } else { existingRivalry(slave); @@ -42,142 +36,146 @@ App.SlaveAssignment.rivalries = (function() { return r.join(" "); } + /** Can this slave possibly get a new rival? + * @param {App.Entity.SlaveState} slave + * @returns {boolean} + */ + function canStartRivalry(slave) { + const headstrong = (slave.devotion < jsRandom(20, 100)) && (slave.trust > jsRandom(-100, -20)); + return (slave.rivalry === 0 && slave.fetish !== "mindbroken" && slave.fuckdoll === 0 && headstrong); + } + /** * @param {App.Entity.SlaveState} slave * */ function generateRivalry(slave) { let foundRival = 0; - const slavesLength = V.slaves.length; - for (let sar = 0; sar < slavesLength; sar++) { - if (V.slaves[sar].ID !== slave.ID && V.slaves[sar].rivalry === 0 && V.slaves[sar].ID !== slave.relationshipTarget) { - if (V.slaves[sar].fetish !== "mindbroken" && V.slaves[sar].fuckdoll === 0) { - if (V.slaves[sar].devotion < jsRandom(20, 100) && V.slaves[sar].trust > jsRandom(-100, -20)) { - if (V.slaves[sar].origBodyOwnerID === slave.ID && V.slaves[sar].devotion > 0 && slave.devotion < -30) { - r.push(`${slave.slaveName} loathes that ${SlaveFullName(V.slaves[sar])} is using <span class="em">${his}</span> body to benefit you and makes it abundantly clear every chance ${he} gets. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - if (foundRival !== 1 && slave.behavioralFlaw !== "none") { - switch (slave.behavioralFlaw) { - case "arrogant": - if (V.slaves[sar].intelligence > slave.intelligence+slave.intelligenceImplant) { - r.push(`${slave.slaveName} is an arrogant bitch, and ${SlaveFullName(V.slaves[sar])} is authentically smarter than ${he} is, which of course ${he} cannot stand. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - break; - case "bitchy": - if (V.slaves[sar].behavioralFlaw === "odd") { - r.push(`${slave.slaveName} is a bit of a bitch, and poor odd ${SlaveFullName(V.slaves[sar])} is a convenient target for ${his} bullying. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - break; - case "odd": - if (V.slaves[sar].behavioralFlaw === "bitchy") { - r.push(`${slave.slaveName} is rather strange. ${SlaveFullName(V.slaves[sar])}, who is kind of a bitch, frequently bullies ${him} about it. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - break; - case "hates men": - if (V.slaves[sar].attrXX > 35) { - if (V.slaves[sar].faceShape === "masculine" || V.slaves[sar].faceShape === "androgynous" ) { - if (V.slaves[sar].muscles > 10) { - if (V.slaves[sar].vagina > -1) { - r.push(`${slave.slaveName} hates men, and poor butch ${SlaveFullName(V.slaves[sar])} really gets to ${him}, despite having a pussy and everything. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } else { - r.push(`${slave.slaveName} hates men, and poor masculine ${SlaveFullName(V.slaves[sar])} really gets to ${him}. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - } + for (const potentialRival of V.slaves) { + if (canStartRivalry(potentialRival) && potentialRival.ID !== slave.ID && potentialRival.ID !== slave.relationshipTarget) { + if (potentialRival.origBodyOwnerID === slave.ID && potentialRival.devotion > 0 && slave.devotion < -30) { + r.push(`${slave.slaveName} loathes that ${SlaveFullName(potentialRival)} is using <span class="em">${his}</span> body to benefit you and makes it abundantly clear every chance ${he} gets. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } + if (foundRival !== 1 && slave.behavioralFlaw !== "none") { + switch (slave.behavioralFlaw) { + case "arrogant": + if (potentialRival.intelligence > slave.intelligence+slave.intelligenceImplant) { + r.push(`${slave.slaveName} is an arrogant bitch, and ${SlaveFullName(potentialRival)} is authentically smarter than ${he} is, which of course ${he} cannot stand. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } + break; + case "bitchy": + if (potentialRival.behavioralFlaw === "odd") { + r.push(`${slave.slaveName} is a bit of a bitch, and poor odd ${SlaveFullName(potentialRival)} is a convenient target for ${his} bullying. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } + break; + case "odd": + if (potentialRival.behavioralFlaw === "bitchy") { + r.push(`${slave.slaveName} is rather strange. ${SlaveFullName(potentialRival)}, who is kind of a bitch, frequently bullies ${him} about it. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } + break; + case "hates men": + if (potentialRival.attrXX > 35) { + if (potentialRival.faceShape === "masculine" || potentialRival.faceShape === "androgynous" ) { + if (potentialRival.muscles > 10) { + if (potentialRival.vagina > -1) { + r.push(`${slave.slaveName} hates men, and poor butch ${SlaveFullName(potentialRival)} really gets to ${him}, despite having a pussy and everything. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } else { + r.push(`${slave.slaveName} hates men, and poor masculine ${SlaveFullName(potentialRival)} really gets to ${him}. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; } } - break; - case "hates women": - if (V.slaves[sar].attrXY > 35) { - if (V.slaves[sar].faceShape !== "masculine") { - if (V.slaves[sar].muscles <= 30) { - if (V.slaves[sar].vagina > -1) { - r.push(`${slave.slaveName} hates women, and something about the feminine ${SlaveFullName(V.slaves[sar])} really gets to ${him}. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } else { - r.push(`${slave.slaveName} hates women, and something about the girly ${SlaveFullName(V.slaves[sar])} really gets to ${him}, despite poor V.slaves[sar].slaveName not being perfectly female at all. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - } + } + } + break; + case "hates women": + if (potentialRival.attrXY > 35) { + if (potentialRival.faceShape !== "masculine") { + if (potentialRival.muscles <= 30) { + if (potentialRival.vagina > -1) { + r.push(`${slave.slaveName} hates women, and something about the feminine ${SlaveFullName(potentialRival)} really gets to ${him}. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } else { + r.push(`${slave.slaveName} hates women, and something about the girly ${SlaveFullName(potentialRival)} really gets to ${him}, despite poor potentialRival.slaveName not being perfectly female at all. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; } } - break; - case "gluttonous": - if (V.slaves[sar].behavioralFlaw === "anorexic") { - r.push(`${slave.slaveName}, who loves food, can't stand ${SlaveFullName(V.slaves[sar])}'s prissy anorexia. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } else if (V.slaves[sar].weight < -30) { - r.push(`${slave.slaveName}, who loves food, can't stand ${SlaveFullName(V.slaves[sar])}'s severe emaciation. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - break; - case "anorexic": - if (V.slaves[sar].behavioralFlaw === "gluttonous") { - r.push(`${slave.slaveName}, an anorexic, can't stand ${SlaveFullName(V.slaves[sar])}'s disgusting gluttony. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } else if (V.slaves[sar].weight > 95) { - r.push(`${slave.slaveName}, an anorexic, can't stand ${SlaveFullName(V.slaves[sar])}'s immense girth. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - break; - case "devout": - if (V.slaves[sar].behavioralFlaw === "liberated") { - r.push(`${slave.slaveName}, who is devout and might be considered rather conservative if ${he} were free, can't stand ${SlaveFullName(V.slaves[sar])}'s revolting gender liberation. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - break; - case "liberated": - if (V.slaves[sar].behavioralFlaw === "devout") { - r.push(`${slave.slaveName}, who is liberated and might be considered rather liberal if ${he} were free, can't stand ${SlaveFullName(V.slaves[sar])}'s bigoted religious faith. <span class="rivalry inc">They start to dislike each other.</span>`); - foundRival = 1; - } - break; - } - } - if (foundRival !== 1 && V.slaves[sar].assignment === slave.assignment) { - if (jsRandom(0, 1) === 1) { - r.push(`${slave.slaveName} and ${SlaveFullName(V.slaves[sar])} see too much of each other while they`); - switch (V.slaves[sar].assignment) { - case window.Job.HOUSE: - case window.Job.QUARTER: - r.push(`work as servants`); - break; - case window.Job.SUBORDINATE: - r.push(`prepare to serve your other slaves`); - break; - case window.Job.GLORYHOLE: - r.push(`work nearby glory holes`); - break; - case window.Job.CELLBLOCK: - r.push(`are confined in nearby cells`); - break; - case window.Job.FUCKTOY: - r.push(`wait for you to use them`); - break; - default: - r.push(`${V.slaves[sar].assignment}`); } - r.push(`and <span class="rivalry inc">start to dislike each other.</span>`); + } + break; + case "gluttonous": + if (potentialRival.behavioralFlaw === "anorexic") { + r.push(`${slave.slaveName}, who loves food, can't stand ${SlaveFullName(potentialRival)}'s prissy anorexia. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } else if (potentialRival.weight < -30) { + r.push(`${slave.slaveName}, who loves food, can't stand ${SlaveFullName(potentialRival)}'s severe emaciation. <span class="rivalry inc">They start to dislike each other.</span>`); foundRival = 1; } - } - if (foundRival === 1) { - // needed to break the loop if the case statement picked a rival. - // might as well use it to condense all the rival sets too. - slave.rivalry = 1; - slave.rivalryTarget = V.slaves[sar].ID; - V.slaves[sar].rivalry = 1; - V.slaves[sar].rivalryTarget = slave.ID; break; + case "anorexic": + if (potentialRival.behavioralFlaw === "gluttonous") { + r.push(`${slave.slaveName}, an anorexic, can't stand ${SlaveFullName(potentialRival)}'s disgusting gluttony. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } else if (potentialRival.weight > 95) { + r.push(`${slave.slaveName}, an anorexic, can't stand ${SlaveFullName(potentialRival)}'s immense girth. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } + break; + case "devout": + if (potentialRival.behavioralFlaw === "liberated") { + r.push(`${slave.slaveName}, who is devout and might be considered rather conservative if ${he} were free, can't stand ${SlaveFullName(potentialRival)}'s revolting gender liberation. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } + break; + case "liberated": + if (potentialRival.behavioralFlaw === "devout") { + r.push(`${slave.slaveName}, who is liberated and might be considered rather liberal if ${he} were free, can't stand ${SlaveFullName(potentialRival)}'s bigoted religious faith. <span class="rivalry inc">They start to dislike each other.</span>`); + foundRival = 1; + } + break; + } + } + if (foundRival !== 1 && potentialRival.assignment === slave.assignment) { + if (jsRandom(0, 1) === 1) { + r.push(`${slave.slaveName} and ${SlaveFullName(potentialRival)} see too much of each other while they`); + switch (potentialRival.assignment) { + case Job.HOUSE: + case Job.QUARTER: + r.push(`work as servants`); + break; + case Job.SUBORDINATE: + r.push(`prepare to serve your other slaves`); + break; + case Job.GLORYHOLE: + r.push(`work nearby glory holes`); + break; + case Job.CELLBLOCK: + r.push(`are confined in nearby cells`); + break; + case Job.FUCKTOY: + r.push(`wait for you to use them`); + break; + default: + r.push(`${potentialRival.assignment}`); } + r.push(`and <span class="rivalry inc">start to dislike each other.</span>`); + foundRival = 1; } } + if (foundRival === 1) { + // needed to break the loop if the case statement picked a rival. + // might as well use it to condense all the rival sets too. + slave.rivalry = 1; + slave.rivalryTarget = potentialRival.ID; + potentialRival.rivalry = 1; + potentialRival.rivalryTarget = slave.ID; + break; + } } } } @@ -206,7 +204,7 @@ App.SlaveAssignment.rivalries = (function() { r.push(`Since ${slave.slaveName} is mindbroken, ${he} <span class="rivalry dec">can't really maintain any meaningful rivalry</span> with ${SlaveFullName(rival)}.`); reconciled = 1; } else if (rival.ID === slave.relationshipTarget && slave.relationship > 3) { - r.push(`Since ${slave.slaveName} and ${slave.slaveName} are in a commited sexual relationship, they <span class="rivalry dec">can't really maintain any meaningful rivalry;</span> most disputes just end in a quick hatefucking.`); + r.push(`Since ${slave.slaveName} and ${slave.slaveName} are in a committed sexual relationship, they <span class="rivalry dec">can't really maintain any meaningful rivalry;</span> most disputes just end in a quick hatefucking.`); reconciled = 1; } else { if (slave.need) {