[1.7.2] Shadow Strike does not work from being unseen

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
zczczc1680
Low Yeek
Posts: 8
Joined: Sun Dec 01, 2019 11:08 pm

[1.7.2] Shadow Strike does not work from being unseen

#1 Post by zczczc1680 »

The bonus crit multi only works after exiting stealth(with the shadow strike buff). The critical hits made in stealth(or anytime) without shadow strike buff will have a normal critical damage.

Code: Select all

local ignore_direct_crits = target:attr 'ignore_direct_crits'
		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

			-- Add crit bonus power for being unseen (direct damage only, diminished with range)
			local unseen_crit = src.__is_actor and target.__is_actor and not src.__project_source and src.unseen_critical_power
			if unseen_crit and not target:canSee(src) and src:canSee(target) then
				local d, reduc = core.fov.distance(src.x, src.y, x, y), 0
				if d > 3 then
					reduc = math.scale(d, 3, 10, 0, 1)
					unseen_crit = math.max(0, unseen_crit*(1 - reduc))
				end
				if unseen_crit > 0 then
					if target.unseen_crit_defense and target.unseen_crit_defense > 0 then
						unseen_crit = math.max(0, unseen_crit*(1 - target.unseen_crit_defense))
					end
					crit_power = crit_power + unseen_crit
					print("[PROJECTOR] after unseen_critical_power type/dam/range/power", type, dam, d, unseen_crit, "::", crit_power - unseen_crit, "=>", crit_power)
				end
			end	

			dam = dam / crit_power
			local reduce = (crit_power - 1) * (util.bound(ignore_direct_crits, 0, 100) / 100)
			crit_power = math.max(1, crit_power - reduce)
			dam = dam * crit_power
			print("[PROJECTOR] crit power reduce dam", dam)
		end
the line
dam = dam / crit_power
should be executed before calculating unssen crit power

Post Reply