Page 1 of 1

*closed* Possible bug in Overkill talent

Posted: Fri Sep 18, 2015 11:50 pm
by Effigy
This is just something I noticed while looking at the source. Overkill has this activation code in /tome/class/Actor.lua : takeHit():

Code: Select all

if dead and src and src.attr and src:attr("overkill") and src.project and not src.turn_procs.overkill then
	src.turn_procs.overkill = true
	local dam = (self.die_at - self.life) * src:attr("overkill") / 100
	local incdam = self.inc_damage
	self.inc_damage = {}
	src:project({type="ball", radius=2, selffire=false, x=self.x, y=self.y}, self.x, self.y, DamageType.BLIGHT, dam, {type="acid"})
	self.inc_damage = incdam
end
"self.inc_damage" is a table, so "local incdam = self.inc_damage" is creating a reference to the existing table and "self.inc_damage = {}" is deleting all the values in the table. The code later does "self.inc_damage = incdam" but I believe these are both references to the same (now empty) table, so it's not actually doing anything.

I haven't heard of anyone seeing issues with Overkill clearing all your damage bonuses, so maybe some other code is refreshing "self.inc_damage" before we actually notice problems in-game.

I think if the line "local incdam = self.inc_damage" is changed to this, it will fix the issue:

Code: Select all

local incdam = table.clone(self.inc_damage, true)
I can make a fix for this, but I wanted to check here to make sure I'm not overlooking something.

Re: Possible bug in Overkill talent

Posted: Sat Sep 19, 2015 12:05 am
by Radon26
as i am a bit slow in those things i have to ask for clarification.
which damage bonuses are you expecting it to be clearing?
on hits? blight%? the damage done by overkill? something else?

Re: Possible bug in Overkill talent

Posted: Sat Sep 19, 2015 12:07 am
by Effigy
I believe "inc_damage" stores the %increased damage values for different damage types.

Re: Possible bug in Overkill talent

Posted: Sat Sep 19, 2015 12:14 am
by Radon26
so you are expecting that after overkill is triggered, the +% modifiers are eaten.
alright. i will test it... in few hours. its 1:14 where i am right now.

Re: Possible bug in Overkill talent

Posted: Sat Sep 19, 2015 12:19 am
by Effigy
Someone else tried and said they weren't noticing any problems with the damage values. There may be some other code that's regenerating the list before you can notice. Either that or I'm misinterpreting what's going on here. It seems wrong though.

Re: Possible bug in Overkill talent

Posted: Sat Sep 19, 2015 4:58 am
by HousePet
It must be copying the table instead of just the reference. Otherwise people would report losing their bonuses.

Re: Possible bug in Overkill talent

Posted: Sun Sep 20, 2015 3:07 pm
by 0player
"self.inc_damage = {}" doesn't erase the table, it replaces the table with an empty one. That's how assignment works.

Re: Possible bug in Overkill talent

Posted: Sun Sep 20, 2015 4:36 pm
by Effigy
Ah, interesting. Thanks for clarifying.