Drop candidates whose effective-DPS curve is dominated everywhere. Sample each candidate's application-only multiplier (ignoring resists, which are mod-independent and uniformly scale all candidates) over a coarse distance grid. A candidate X is dominated if there exists Y such
(candidates, src)
| 177 | |
| 178 | |
| 179 | def _pruneDominated(candidates, src): |
| 180 | """Drop candidates whose effective-DPS curve is dominated everywhere. |
| 181 | |
| 182 | Sample each candidate's application-only multiplier (ignoring resists, |
| 183 | which are mod-independent and uniformly scale all candidates) over a |
| 184 | coarse distance grid. A candidate X is dominated if there exists Y such |
| 185 | that Y's raw_damage * multiplier(distance) >= X's at every sample. |
| 186 | """ |
| 187 | if len(candidates) <= 1: |
| 188 | return candidates |
| 189 | # Sample multipliers under a neutral mid-range scenario; this captures |
| 190 | # the shape of each ammo's range envelope without depending on misc inputs. |
| 191 | sampleDistances = [0, 1000, 5000, 10000, 20000, 40000, 80000, 160000, 320000] |
| 192 | tgtSpeed = 0 |
| 193 | atkSpeed = 0 |
| 194 | tgtSigRadius = 125 |
| 195 | sigRefMod = src.getSigRadius() # not directly used, kept for clarity |
| 196 | del sigRefMod |
| 197 | # For each candidate, build a scalar score vector across samples. |
| 198 | scores = [] |
| 199 | for snap in candidates: |
| 200 | rawTotal = snap['dmg'].total |
| 201 | vec = [] |
| 202 | for d in sampleDistances: |
| 203 | if snap['kind'] == 'turret': |
| 204 | # Use only the range factor (drop tracking — angular speed is 0 here) |
| 205 | # by passing 0 atkSpeed/tgtSpeed/tgtAngle. |
| 206 | mult = _turretApplication(snap, src, src, atkSpeed, 0, d, tgtSpeed, 0, tgtSigRadius) |
| 207 | else: |
| 208 | mult = _missileApplication(snap, d, tgtSpeed, tgtSigRadius) |
| 209 | vec.append(rawTotal * mult) |
| 210 | scores.append(vec) |
| 211 | # Mark dominated |
| 212 | n = len(candidates) |
| 213 | eps = 1e-9 |
| 214 | keep = [True] * n |
| 215 | for i in range(n): |
| 216 | if not keep[i]: |
| 217 | continue |
| 218 | for j in range(n): |
| 219 | if i == j or not keep[j]: |
| 220 | continue |
| 221 | # j dominates i if scores[j][k] >= scores[i][k] - eps for all k |
| 222 | # and scores[j][k] > scores[i][k] + eps for at least one k |
| 223 | dominates = True |
| 224 | strict = False |
| 225 | for k in range(len(sampleDistances)): |
| 226 | if scores[j][k] + eps < scores[i][k]: |
| 227 | dominates = False |
| 228 | break |
| 229 | if scores[j][k] > scores[i][k] + eps: |
| 230 | strict = True |
| 231 | if dominates and strict: |
| 232 | keep[i] = False |
| 233 | break |
| 234 | return [c for c, k in zip(candidates, keep) if k] |
| 235 | |
| 236 |
no test coverage detected