(self, src, maxTime)
| 148 | finalVolleyCache[time] = timeVolleyData |
| 149 | |
| 150 | def _generateInternalForm(self, src, maxTime): |
| 151 | if self._isTimeCacheValid(src=src, maxTime=maxTime): |
| 152 | return |
| 153 | fitCache = self._data[src.item.ID] = {'maxTime': maxTime} |
| 154 | intCacheDpsVolley = fitCache['internalDpsVolley'] = {} |
| 155 | intCacheDmg = fitCache['internalDmg'] = {} |
| 156 | |
| 157 | def addDpsVolley(ddKey, addedTimeStart, addedTimeFinish, addedVolleys): |
| 158 | if not addedVolleys: |
| 159 | return |
| 160 | volleySum = sum(addedVolleys, DmgTypes.default()) |
| 161 | if volleySum.total > 0: |
| 162 | addedDps = volleySum / (addedTimeFinish - addedTimeStart) |
| 163 | # We can take "just best" volley, no matter target resistances, because all |
| 164 | # known items have the same damage type ratio throughout their cycle - and |
| 165 | # applying resistances doesn't change final outcome |
| 166 | bestVolley = max(addedVolleys, key=lambda v: v.total) |
| 167 | ddCacheDps = intCacheDpsVolley.setdefault(ddKey, []) |
| 168 | ddCacheDps.append((addedTimeStart, addedTimeFinish, addedDps, bestVolley)) |
| 169 | |
| 170 | def addDmg(ddKey, addedTime, addedDmg): |
| 171 | if addedDmg.total == 0: |
| 172 | return |
| 173 | addedDmg._breachers = {addedTime + k: v for k, v in addedDmg._breachers.items()} |
| 174 | addedDmg._clear_cached() |
| 175 | intCacheDmg.setdefault(ddKey, {})[addedTime] = addedDmg |
| 176 | |
| 177 | # Modules |
| 178 | for mod in src.item.activeModulesIter(): |
| 179 | if not mod.isDealingDamage(): |
| 180 | continue |
| 181 | cycleParams = mod.getCycleParametersForDps(reloadOverride=True) |
| 182 | if cycleParams is None: |
| 183 | continue |
| 184 | currentTime = 0 |
| 185 | nonstopCycles = 0 |
| 186 | isBreacher = mod.isBreacher |
| 187 | for cycleTimeMs, inactiveTimeMs, isInactivityReload in cycleParams.iterCycles(): |
| 188 | cycleVolleys = [] |
| 189 | volleyParams = mod.getVolleyParameters(spoolOptions=SpoolOptions(SpoolType.CYCLES, nonstopCycles, True)) |
| 190 | |
| 191 | for volleyTimeMs, volley in volleyParams.items(): |
| 192 | cycleVolleys.append(volley) |
| 193 | time = currentTime + volleyTimeMs / 1000 |
| 194 | if isBreacher: |
| 195 | time += 1 |
| 196 | addDmg(mod, time, volley) |
| 197 | if isBreacher: |
| 198 | break |
| 199 | timeStart = currentTime |
| 200 | timeFinish = currentTime + cycleTimeMs / 1000 |
| 201 | if isBreacher: |
| 202 | timeStart += 1 |
| 203 | timeFinish += 1 |
| 204 | addDpsVolley(mod, timeStart, timeFinish, cycleVolleys) |
| 205 | if inactiveTimeMs > 0: |
| 206 | nonstopCycles = 0 |
| 207 | else: |
no test coverage detected