Resistance penetration makes things less vulnerable

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Zonk
Sher'Tul
Posts: 1067
Joined: Sat Mar 01, 2003 4:01 pm

Resistance penetration makes things less vulnerable

#1 Post 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.
ToME online profile: http://te4.org/users/zonk
Addons (most likely obsolete): Wights, Trolls, Starting prodigy, Alternate save/resistance system

marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

Re: Resistance penetration makes things less vulnerable

#2 Post 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.

Zonk
Sher'Tul
Posts: 1067
Joined: Sat Mar 01, 2003 4:01 pm

Re: Resistance penetration makes things less vulnerable

#3 Post 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 :)
ToME online profile: http://te4.org/users/zonk
Addons (most likely obsolete): Wights, Trolls, Starting prodigy, Alternate save/resistance system

Post Reply