Commit 14e391f9dc86146217a288d407e7055b48d770fa

Authored by DarkGod
1 parent 1dd041ae

Flat damage cap% is now applied after shields

... ... @@ -2132,6 +2132,17 @@ function _M:onTakeHit(value, src, death_note)
2132 2132 end
2133 2133 end
2134 2134
  2135 + -- Flat damage cap
  2136 + if self.flat_damage_cap and self.max_life and death_note and death_note.damtype then
  2137 + local cap = nil
  2138 + if self.flat_damage_cap.all then cap = self.flat_damage_cap.all end
  2139 + if self.flat_damage_cap[death_note.damtype] then cap = self.flat_damage_cap[death_note.damtype] end
  2140 + if cap and cap > 0 then
  2141 + value = math.max(math.min(value, cap * self.max_life / 100), 0)
  2142 + print("[TAKE HIT] after flat damage cap", value)
  2143 + end
  2144 + end
  2145 +
2135 2146 local hd = {"Actor:takeHit", value=value, src=src, death_note=death_note}
2136 2147 if self:triggerHook(hd) then value = hd.value end
2137 2148
... ...
... ... @@ -296,17 +296,6 @@ setDefaultProjector(function(src, x, y, type, dam, tmp, no_martyr)
296 296 print("[PROJECTOR] after flat damage armor", dam)
297 297 end
298 298
299   - -- Flat damage cap
300   - if target.flat_damage_cap and target.max_life then
301   - local cap = nil
302   - if target.flat_damage_cap.all then cap = target.flat_damage_cap.all end
303   - if target.flat_damage_cap[type] then cap = target.flat_damage_cap[type] end
304   - if cap and cap > 0 then
305   - dam = math.max(math.min(dam, cap * target.max_life / 100), 0)
306   - print("[PROJECTOR] after flat damage cap", dam)
307   - end
308   - end
309   -
310 299 -- roll with it damage reduction
311 300 if type == DamageType.PHYSICAL and target:knowTalent(target.T_ROLL_WITH_IT) and not target:attr("never_move") then
312 301 dam = dam * target:callTalent(target.T_ROLL_WITH_IT, "getMult")
... ...