diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 3c91314d9fcb8bbe95fa75df13f07ddb32fb67da..6e1ee63c3d74c0c2ecd8c7932120c395d7a1e21a 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -2132,6 +2132,17 @@ function _M:onTakeHit(value, src, death_note) end end + -- Flat damage cap + if self.flat_damage_cap and self.max_life and death_note and death_note.damtype then + local cap = nil + if self.flat_damage_cap.all then cap = self.flat_damage_cap.all end + if self.flat_damage_cap[death_note.damtype] then cap = self.flat_damage_cap[death_note.damtype] end + if cap and cap > 0 then + value = math.max(math.min(value, cap * self.max_life / 100), 0) + print("[TAKE HIT] after flat damage cap", value) + end + end + local hd = {"Actor:takeHit", value=value, src=src, death_note=death_note} if self:triggerHook(hd) then value = hd.value end diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua index 2e428171ec3e72c9820b90bebe3efbe1d1c810ef..bd0337f20a66df8b488155ceaca1502d9742ce2a 100644 --- a/game/modules/tome/data/damage_types.lua +++ b/game/modules/tome/data/damage_types.lua @@ -296,17 +296,6 @@ setDefaultProjector(function(src, x, y, type, dam, tmp, no_martyr) print("[PROJECTOR] after flat damage armor", dam) end - -- Flat damage cap - if target.flat_damage_cap and target.max_life then - local cap = nil - if target.flat_damage_cap.all then cap = target.flat_damage_cap.all end - if target.flat_damage_cap[type] then cap = target.flat_damage_cap[type] end - if cap and cap > 0 then - dam = math.max(math.min(dam, cap * target.max_life / 100), 0) - print("[PROJECTOR] after flat damage cap", dam) - end - end - -- roll with it damage reduction if type == DamageType.PHYSICAL and target:knowTalent(target.T_ROLL_WITH_IT) and not target:attr("never_move") then dam = dam * target:callTalent(target.T_ROLL_WITH_IT, "getMult")