Page 1 of 1

Resistance penetration makes things less vulnerable

Posted: Sun Sep 18, 2011 2:41 pm
by Zonk
Was looking at how resistance penetration was applied, and I think I found a bug.

Code: Select all

		-- Reduce damage with resistance
		if target.resists then
			local pen = 0
			if src.resists_pen then pen = (src.resists_pen.all or 0) + (src.resists_pen[type] or 0) end
			local res = target:combatGetResist(type)
			res = res * (100 - pen) / 100
			print("[PROJECTOR] res", res, (100 - res) / 100, " on dam", dam)
			if res >= 100 then dam = 0
			elseif res <= -100 then dam = dam * 2
			else dam = dam * ((100 - res) / 100)
			end
		end
There's a problem - sometimes things have vulnerabilities, resists below 0%..and penetration will reduce that!
So for example 50% penetration against a -100% resistance would bring that to -50%, which I don't think is intended.

Basically - check for res > 0 before applying penetration.

Re: Resistance penetration makes things less vulnerable

Posted: Sun Sep 18, 2011 3:11 pm
by marvalis
Ah damn I though resistance penetration 10% would turn 10% resist into 0% resist (10% resist - 10% resistance penetration). Turns out it makes it 9% resist xD (10%*0.9). That is pretty bad.

Re: Resistance penetration makes things less vulnerable

Posted: Sun Sep 18, 2011 3:32 pm
by Zonk
marvalis wrote:Ah damn I though resistance penetration 10% would turn 10% resist into 0% resist (10% resist - 10% resistance penetration). Turns out it makes it 9% resist xD (10%*0.9). That is pretty bad.
I actually thought that was how it would work too, based on APR, but then I code dived...At least it's mentioned in the resistance penetration mouseover text in your character sheet :)