diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js index 3cf15015d3fa36147fa0f9063df63f57f415a021..8fa439431bee7656bf5e06ddf22e294c43372a04 100644 --- a/src/js/slaveCostJS.js +++ b/src/js/slaveCostJS.js @@ -1811,26 +1811,28 @@ globalThis.FResultArray = (function() { * @param {App.Entity.SlaveState} slave */ function calcWorksWithRelatives(slave) { - V.slaves.forEach(potentialRel => { - if (isParentP(slave, potentialRel) && sameAssignmentP(slave, potentialRel)) { - adjustFResult(`Works with their parent(s)`, 1); - if (incestBonus) { - adjustFResult(`Works with their parent(s): incest bonus`, 1); + for (const potentialRel of V.slaves) { + if (sameAssignmentP(slave, potentialRel)) { + if (isParentP(slave, potentialRel)) { + adjustFResult(`Works with their parent(s)`, 1); + if (incestBonus) { + adjustFResult(`Works with their parent(s): incest bonus`, 1); + } } - } - if (isParentP(potentialRel, slave) && sameAssignmentP(slave, potentialRel)) { - adjustFResult(`Works with their kid(s)`, 1); - if (incestBonus) { - adjustFResult(`Works with their kid(s): incest bonus`, 1); + if (isParentP(potentialRel, slave)) { + adjustFResult(`Works with their kid(s)`, 1); + if (incestBonus) { + adjustFResult(`Works with their kid(s): incest bonus`, 1); + } } - } - if (areSisters(slave, potentialRel) > 0 && sameAssignmentP(slave, potentialRel)) { - adjustFResult(`Works with their sibling(s)`, 1); - if (incestBonus) { - adjustFResult(`Works with their sibling(s): incest bonus`, 1); + if (areSisters(slave, potentialRel) > 0) { + adjustFResult(`Works with their sibling(s)`, 1); + if (incestBonus) { + adjustFResult(`Works with their sibling(s): incest bonus`, 1); + } } } - }); + } } /**