diff --git a/src/js/storyJS.tw b/src/js/storyJS.tw index 099a05d0f16178b0f1676194ad7afe00336709d5..b928d9ba217df706ba189e45adbc8f17a72d3d7e 100644 --- a/src/js/storyJS.tw +++ b/src/js/storyJS.tw @@ -670,6 +670,26 @@ window.relationTargetWord = function(slave) { return slave.relation; }; +window.checkRelations = function(slave) { + if (!slave) { + return null; + } else { + var relations = State.variables.slaves.filter(function(s) { return areSisters(slave, s) > 0 || s.mother == slave.ID || s.father == slave.ID || s.ID == slave.mother || s.ID == slave.father; }) + + return relations; + } +}; + +window.getRandomRelation = function(slave) { + var relations = checkRelations(slave) + + if (relations == null) { + return null; + } else { + return relations.random(); + } +}; + /* intended to condense the clothing/toy/etc availability checks into something less asinine */ window.isItemAccessible = function(string) { if (State.variables.cheatMode === 1){