def escapeGraph(self, emptyContainer, graph, maxDiff):
     if not self.escapeRando:
         return
     possibleTargets, dst, path = self.getPossibleEscapeTargets(emptyContainer, graph, maxDiff)
     # update graph with escape transition
     graph.addTransition(escapeSource, dst)
     # get timer value
     self.escapeTimer(graph, path)
     self.log.debug("escapeGraph: ({}, {}) timer: {}".format(escapeSource, dst, graph.EscapeAttributes['Timer']))
     # animals
     GraphUtils.escapeAnimalsTransitions(graph, possibleTargets, dst)
Beispiel #2
0
 def escapeGraph(self, container, graph, maxDiff, escapeTrigger):
     if not self.escapeRando:
         return True
     emptyContainer = copy.copy(container)
     emptyContainer.resetCollected(reassignItemLocs=True)
     dst = None
     if escapeTrigger is None:
         possibleTargets, dst, path = self.getPossibleEscapeTargets(emptyContainer, graph, maxDiff)
         # update graph with escape transition
         graph.addTransition(escapeSource, dst)
         paths = [path]
     else:
         possibleTargets, paths = self.escapeTrigger(emptyContainer, graph, maxDiff, escapeTrigger)
         if paths is None:
             return False
     # get timer value
     self.escapeTimer(graph, paths, self.areaRando or escapeTrigger is not None)
     self.log.debug("escapeGraph: ({}, {}) timer: {}".format(escapeSource, dst, graph.EscapeAttributes['Timer']))
     # animals
     GraphUtils.escapeAnimalsTransitions(graph, possibleTargets, dst)
     return True