From bd2beb601e2c35a54b257dfbf389a78ef6af7db4 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Tue, 10 Nov 2020 02:44:14 -0500 Subject: [PATCH] eliminate hg training global --- src/endWeek/reports/penthouseReport.js | 72 +++++++++++++++++++++++++- src/endWeek/slaveAssignmentReport.js | 65 ----------------------- 2 files changed, 70 insertions(+), 67 deletions(-) diff --git a/src/endWeek/reports/penthouseReport.js b/src/endWeek/reports/penthouseReport.js index e981e02118e..5a833a562bf 100644 --- a/src/endWeek/reports/penthouseReport.js +++ b/src/endWeek/reports/penthouseReport.js @@ -3,6 +3,7 @@ App.EndWeek.penthouseReport = function() { let r; const _HGSuitSlaves = App.Utils.jobForAssignment(Job.HEADGIRLSUITE).employees(); + const HGTrainSlavesIDs = slavesToTrain(); for (const slave of V.slaves) { if (assignmentVisible(slave)) { @@ -160,8 +161,8 @@ App.EndWeek.penthouseReport = function() { r.push(personalAttention(slave)); } - if (V.HGTrainSlavesIDs.length > 0) { - const trainee = V.HGTrainSlavesIDs.find(trainee => slave.ID === trainee.ID); + if (HGTrainSlavesIDs.length > 0) { + const trainee = HGTrainSlavesIDs.find(trainee => slave.ID === trainee.ID); if (trainee) { r.push(HGApplication(slave, trainee.training)); } @@ -613,4 +614,71 @@ App.EndWeek.penthouseReport = function() { } } } + + function slavesToTrain() { + if (S.HeadGirl) { + /** @type {FC.HeadGirlTrainee[][]} */ + const HGPossibleSlaves = [[], [], [], [], [], []]; + for (const slave of V.slaves) { + if (!assignmentVisible(slave) || slave.fuckdoll === 1 || slave.ID === V.BodyguardID || slave.ID === V.HeadGirlID || slave.fetish === "mindbroken") { + continue; + } else if (Array.isArray(V.personalAttention) && V.personalAttention.some(p => p.ID === slave.ID)) { + continue; + } + + if (V.headGirlTrainsHealth && slave.health.condition < -20) { + HGPossibleSlaves[0].push({ID: slave.ID, training: "health"}); + continue; + } + + if (slave.health.tired < 50) { + const hasParaphilia = (["abusive", "anal addict", "attention whore", "breast growth", "breeder", "cum addict", "malicious", "neglectful", "self hating"].includes(slave.sexualFlaw)); + if (V.headGirlTrainsParaphilias && hasParaphilia) { + HGPossibleSlaves[1].push({ID: slave.ID, training: "paraphilia"}); + continue; + } + + if (V.headGirlTrainsFlaws || V.headGirlSoftensFlaws) { + if (slave.behavioralFlaw !== "none" || (slave.sexualFlaw !== "none" && !hasParaphilia)) { + if (V.headGirlSoftensFlaws) { + if (slave.devotion > 20) { + if ((slave.behavioralFlaw !== "none" && slave.behavioralQuirk === "none") || (slave.sexualFlaw !== "none" && slave.sexualQuirk === "none" && !hasParaphilia)) { + HGPossibleSlaves[3].push({ID: slave.ID, training: "soften"}); + } else { + HGPossibleSlaves[3].push({ID: slave.ID, training: "flaw"}); + } + continue; + } + } else if (V.headGirlTrainsFlaws) { + HGPossibleSlaves[2].push({ID: slave.ID, training: "flaw"}); + continue; + } + } + } + + if (V.headGirlTrainsObedience && slave.devotion <= 20 && slave.trust >= -20) { + HGPossibleSlaves[4].push({ID: slave.ID, training: "obedience"}); + continue; + } + + if (V.headGirlTrainsSkills) { + if (slave.skill.oral < S.HeadGirl.skill.oral) { + HGPossibleSlaves[5].push({ID: slave.ID, training: "oral skill"}); + } else if ((slave.skill.vaginal < S.HeadGirl.skill.vaginal) && (slave.vagina > 0) && (canDoVaginal(slave))) { + HGPossibleSlaves[5].push({ID: slave.ID, training: "fuck skill"}); + } else if ((slave.skill.anal < S.HeadGirl.skill.anal) && (slave.anus > 0) && (canDoAnal(slave))) { + HGPossibleSlaves[5].push({ID: slave.ID, training: "anal skill"}); + } else if (slave.skill.whoring < S.HeadGirl.skill.whoring) { + HGPossibleSlaves[5].push({ID: slave.ID, training: "whore skill"}); + } else if ((slave.skill.entertainment < S.HeadGirl.skill.entertainment) && !isAmputee(slave)) { + HGPossibleSlaves[5].push({ID: slave.ID, training: "entertain skill"}); + } + } + } + } + return HGPossibleSlaves.flatten().slice(0, App.EndWeek.saVars.HGEnergy); + } else { + return []; + } + } }; diff --git a/src/endWeek/slaveAssignmentReport.js b/src/endWeek/slaveAssignmentReport.js index 6e2c5ba8601..ae7220bd607 100644 --- a/src/endWeek/slaveAssignmentReport.js +++ b/src/endWeek/slaveAssignmentReport.js @@ -232,71 +232,6 @@ App.EndWeek.slaveAssignmentReport = function() { } } - if (S.HeadGirl) { - /** @type {FC.HeadGirlTrainee[][]} */ - const HGPossibleSlaves = [[], [], [], [], [], []]; - for (const slave of V.slaves) { - if (!assignmentVisible(slave) || slave.fuckdoll === 1 || slave.ID === V.BodyguardID || slave.ID === V.HeadGirlID || slave.fetish === "mindbroken") { - continue; - } else if (Array.isArray(V.personalAttention) && V.personalAttention.some(p => p.ID === slave.ID)) { - continue; - } - - if (V.headGirlTrainsHealth && slave.health.condition < -20) { - HGPossibleSlaves[0].push({ID: slave.ID, training: "health"}); - continue; - } - - if (slave.health.tired < 50) { - const hasParaphilia = (["abusive", "anal addict", "attention whore", "breast growth", "breeder", "cum addict", "malicious", "neglectful", "self hating"].includes(slave.sexualFlaw)); - if (V.headGirlTrainsParaphilias && hasParaphilia) { - HGPossibleSlaves[1].push({ID: slave.ID, training: "paraphilia"}); - continue; - } - - if (V.headGirlTrainsFlaws || V.headGirlSoftensFlaws) { - if (slave.behavioralFlaw !== "none" || (slave.sexualFlaw !== "none" && !hasParaphilia)) { - if (V.headGirlSoftensFlaws) { - if (slave.devotion > 20) { - if ((slave.behavioralFlaw !== "none" && slave.behavioralQuirk === "none") || (slave.sexualFlaw !== "none" && slave.sexualQuirk === "none" && !hasParaphilia)) { - HGPossibleSlaves[3].push({ID: slave.ID, training: "soften"}); - } else { - HGPossibleSlaves[3].push({ID: slave.ID, training: "flaw"}); - } - continue; - } - } else if (V.headGirlTrainsFlaws) { - HGPossibleSlaves[2].push({ID: slave.ID, training: "flaw"}); - continue; - } - } - } - - if (V.headGirlTrainsObedience && slave.devotion <= 20 && slave.trust >= -20) { - HGPossibleSlaves[4].push({ID: slave.ID, training: "obedience"}); - continue; - } - - if (V.headGirlTrainsSkills) { - if (slave.skill.oral < S.HeadGirl.skill.oral) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "oral skill"}); - } else if ((slave.skill.vaginal < S.HeadGirl.skill.vaginal) && (slave.vagina > 0) && (canDoVaginal(slave))) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "fuck skill"}); - } else if ((slave.skill.anal < S.HeadGirl.skill.anal) && (slave.anus > 0) && (canDoAnal(slave))) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "anal skill"}); - } else if (slave.skill.whoring < S.HeadGirl.skill.whoring) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "whore skill"}); - } else if ((slave.skill.entertainment < S.HeadGirl.skill.entertainment) && !isAmputee(slave)) { - HGPossibleSlaves[5].push({ID: slave.ID, training: "entertain skill"}); - } - } - } - } - V.HGTrainSlavesIDs = HGPossibleSlaves.flatten().slice(0, App.EndWeek.saVars.HGEnergy); - } else { - V.HGTrainSlavesIDs = []; - } - /** * Accordion * @version 0.7RC -- GitLab