@@ -434,10 +434,19 @@ local function determineCursePriority(curseName, activeSkill)
434434 return basePriority + socketPriority + slotPriority + sourcePriority
435435end
436436
437- local function applyEnemyModifiers (actor )
438- -- Process enemy modifiers
437+ local function applyEnemyModifiers (actor , clearCache )
438+ if clearCache or not actor .appliedEnemyModifiers then
439+ actor .appliedEnemyModifiers = { }
440+ end
441+ local cache = actor .appliedEnemyModifiers
442+ local enemyDB = actor .enemy .modDB
439443 for _ , value in ipairs (actor .modDB :Tabulate (nil , nil , " EnemyModifier" )) do
440- actor .enemy .modDB :AddMod (modLib .setSource (value .value .mod , value .value .mod .source or value .mod .source ))
444+ local mod = value .value and value .value .mod
445+ if mod and not cache [mod ] then
446+ local source = mod .source or value .mod .source
447+ enemyDB :AddMod (modLib .setSource (mod , source ))
448+ cache [mod ] = true
449+ end
441450 end
442451end
443452
@@ -447,6 +456,9 @@ local function doActorMisc(env, actor)
447456 local enemyDB = actor .enemy .modDB
448457 local output = actor .output
449458 local condList = modDB .conditions
459+
460+ -- Process enemy modifiers
461+ applyEnemyModifiers (actor )
450462
451463 -- Add misc buffs/debuffs
452464 if env .mode_combat then
@@ -1021,11 +1033,11 @@ function calcs.perform(env, skipEHP)
10211033 output .WarcryPower = modDB :Override (nil , " WarcryPower" ) or modDB :Sum (" BASE" , nil , " WarcryPower" ) or 0
10221034 modDB .multipliers [" WarcryPower" ] = output .WarcryPower
10231035
1024- applyEnemyModifiers (env .player )
1036+ applyEnemyModifiers (env .player , true )
10251037 if env .minion then
1026- applyEnemyModifiers (env .minion )
1038+ applyEnemyModifiers (env .minion , true )
10271039 end
1028- applyEnemyModifiers (env .enemy )
1040+ applyEnemyModifiers (env .enemy , true )
10291041
10301042 local minionTypeCount , ammoTypeCount , grenadeTypeCount = 0 , 0 , 0
10311043 local minionType , ammoType , grenadeType = { }, { }, { }
0 commit comments