Commit 3786110573db6e24810381dae93e599cea36c104

Authored by Chris Davidson
1 parent 25bcf6c8

Fix ignore_direct_crit interaction with Shadowstrike

I accidentally broke this when I changed how ignore_direct_crits works.  I thiiiink this is the right fix, but you might want to double check.
... ... @@ -125,13 +125,7 @@ setDefaultProjector(function(src, x, y, type, dam, state)
125 125
126 126 local ignore_direct_crits = target:attr 'ignore_direct_crits'
127 127 if crit_power > 1 and ignore_direct_crits then -- Reduce the post crit damage, we have to do this here since most crits are calculated before knowing their target
128   - dam = dam / crit_power
129   - local reduce = (crit_power - 1) * (util.bound(ignore_direct_crits, 0, 100) / 100)
130   - crit_power = math.max(1, crit_power - reduce)
131   - dam = dam * crit_power
132   - print("[PROJECTOR] crit power reduce dam", dam)
133   - end
134   - if crit_power > 1 then
  128 +
135 129 -- Add crit bonus power for being unseen (direct damage only, diminished with range)
136 130 local unseen_crit = src.__is_actor and target.__is_actor and not src.__project_source and src.unseen_critical_power
137 131 if unseen_crit and not target:canSee(src) and src:canSee(target) then
... ... @@ -144,11 +138,16 @@ setDefaultProjector(function(src, x, y, type, dam, state)
144 138 if target.unseen_crit_defense and target.unseen_crit_defense > 0 then
145 139 unseen_crit = math.max(0, unseen_crit*(1 - target.unseen_crit_defense))
146 140 end
147   - dam = dam * (crit_power + unseen_crit)/crit_power
148 141 crit_power = crit_power + unseen_crit
149 142 print("[PROJECTOR] after unseen_critical_power type/dam/range/power", type, dam, d, unseen_crit, "::", crit_power - unseen_crit, "=>", crit_power)
150 143 end
151   - end
  144 + end
  145 +
  146 + dam = dam / crit_power
  147 + local reduce = (crit_power - 1) * (util.bound(ignore_direct_crits, 0, 100) / 100)
  148 + crit_power = math.max(1, crit_power - reduce)
  149 + dam = dam * crit_power
  150 + print("[PROJECTOR] crit power reduce dam", dam)
152 151 end
153 152
154 153 local hd = {"DamageProjector:base", src=src, x=x, y=y, type=type, dam=dam, state=state}
... ...