(self, xRange, miscParams, src, tgt)
| 236 | return applicationMap |
| 237 | |
| 238 | def getRange(self, xRange, miscParams, src, tgt): |
| 239 | xs = [] |
| 240 | ys = [] |
| 241 | minTime, maxTime = xRange |
| 242 | # Prepare time cache and various shared data |
| 243 | self._prepareTimeCache(src=src, maxTime=maxTime) |
| 244 | timeCache = self._getTimeCacheData(src=src) |
| 245 | applicationMap = self._prepareApplicationMap(miscParams=miscParams, src=src, tgt=tgt) |
| 246 | # Custom iteration for time graph to show all data points |
| 247 | currentDmg = None |
| 248 | currentTime = None |
| 249 | for currentTime in sorted(timeCache): |
| 250 | prevDmg = currentDmg |
| 251 | currentDmgData = timeCache[currentTime] |
| 252 | currentDmg = applyDamage( |
| 253 | dmgMap=currentDmgData, |
| 254 | applicationMap=applicationMap, |
| 255 | tgtResists=tgt.getResists(), |
| 256 | tgtFullHp=tgt.getFullHp()).total |
| 257 | if currentTime < minTime: |
| 258 | continue |
| 259 | # First set of data points |
| 260 | if not xs: |
| 261 | # Start at exactly requested time, at last known value |
| 262 | initialDmg = prevDmg or 0 |
| 263 | xs.append(minTime) |
| 264 | ys.append(initialDmg) |
| 265 | # If current time is bigger then starting, extend plot to that time with old value |
| 266 | if currentTime > minTime: |
| 267 | xs.append(currentTime) |
| 268 | ys.append(initialDmg) |
| 269 | # If new value is different, extend it with new point to the new value |
| 270 | if currentDmg != prevDmg: |
| 271 | xs.append(currentTime) |
| 272 | ys.append(currentDmg) |
| 273 | continue |
| 274 | # Last data point |
| 275 | if currentTime >= maxTime: |
| 276 | xs.append(maxTime) |
| 277 | ys.append(prevDmg) |
| 278 | break |
| 279 | # Anything in-between |
| 280 | if currentDmg != prevDmg: |
| 281 | if prevDmg is not None: |
| 282 | xs.append(currentTime) |
| 283 | ys.append(prevDmg) |
| 284 | xs.append(currentTime) |
| 285 | ys.append(currentDmg) |
| 286 | # Special case - there are no damage dealers |
| 287 | if currentDmg is None and currentTime is None: |
| 288 | xs.append(minTime) |
| 289 | ys.append(0) |
| 290 | # Make sure that last data point is always at max time |
| 291 | if maxTime > (currentTime or 0): |
| 292 | xs.append(maxTime) |
| 293 | ys.append(currentDmg or 0) |
| 294 | return xs, ys |
| 295 |
nothing calls this directly
no test coverage detected