Build the bonus HashMap from all active BonusObj's
()
| 295 | * Build the bonus HashMap from all active BonusObj's |
| 296 | */ |
| 297 | void buildActiveBonusMap() |
| 298 | { |
| 299 | activeBonusMap = new ConcurrentHashMap<>(); |
| 300 | cachedActiveBonusSumsMap = new ConcurrentHashMap<>(); |
| 301 | Map<String, String> nonStackMap = new ConcurrentHashMap<>(); |
| 302 | Map<String, String> stackMap = new ConcurrentHashMap<>(); |
| 303 | Set<BonusObj> processedBonuses = Collections.newSetFromMap(new IdentityHashMap<>()); |
| 304 | |
| 305 | //Logging.log(Logging.INFO, "=== Start bonus processing."); |
| 306 | |
| 307 | // |
| 308 | // We do a first pass of just the "static" bonuses |
| 309 | // as they require less computation and no recursion |
| 310 | for (BonusObj bonus : getActiveBonusList()) |
| 311 | { |
| 312 | if (!bonus.isValueStatic()) |
| 313 | { |
| 314 | continue; |
| 315 | } |
| 316 | |
| 317 | final Object source = getSourceObject(bonus); |
| 318 | |
| 319 | if (source == null) |
| 320 | { |
| 321 | if (Logging.isDebugMode()) |
| 322 | { |
| 323 | Logging.debugPrint("BONUS: " + bonus + " ignored due to no creator"); |
| 324 | } |
| 325 | continue; |
| 326 | } |
| 327 | |
| 328 | // Keep track of which bonuses have been calculated |
| 329 | //Logging.log(Logging.INFO, "Processing bonus " + bonus + " - static."); |
| 330 | processedBonuses.add(bonus); |
| 331 | for (BonusPair bp : getStringListFromBonus(bonus)) |
| 332 | { |
| 333 | final double iBonus = bp.resolve(pc).doubleValue(); |
| 334 | setActiveBonusStack(iBonus, bp.fullyQualifiedBonusType, nonStackMap, stackMap); |
| 335 | totalBonusesForType(nonStackMap, stackMap, bp.fullyQualifiedBonusType, activeBonusMap); |
| 336 | |
| 337 | if (Logging.isDebugMode()) |
| 338 | { |
| 339 | String id; |
| 340 | if (source instanceof CDOMObject) |
| 341 | { |
| 342 | id = ((CDOMObject) source).getDisplayName(); |
| 343 | } |
| 344 | else |
| 345 | { |
| 346 | id = source.toString(); |
| 347 | } |
| 348 | Logging.debugPrint("BONUS: " + id + " : " + iBonus + " : " + bp.fullyQualifiedBonusType); |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | // |
| 354 | // Now we do all the BonusObj's that require calculations |
no test coverage detected