*closed* Possible bug in Overkill talent

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Effigy
Uruivellas
Posts: 970
Joined: Fri Oct 10, 2014 4:00 pm

*closed* Possible bug in Overkill talent

#1 Post 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.
Last edited by Effigy on Sun Sep 20, 2015 4:37 pm, edited 1 time in total.

Radon26
Sher'Tul
Posts: 1439
Joined: Mon Jun 23, 2014 11:50 am

Re: Possible bug in Overkill talent

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

Effigy
Uruivellas
Posts: 970
Joined: Fri Oct 10, 2014 4:00 pm

Re: Possible bug in Overkill talent

#3 Post by Effigy »

I believe "inc_damage" stores the %increased damage values for different damage types.

Radon26
Sher'Tul
Posts: 1439
Joined: Mon Jun 23, 2014 11:50 am

Re: Possible bug in Overkill talent

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

Effigy
Uruivellas
Posts: 970
Joined: Fri Oct 10, 2014 4:00 pm

Re: Possible bug in Overkill talent

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

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Possible bug in Overkill talent

#6 Post by HousePet »

It must be copying the table instead of just the reference. Otherwise people would report losing their bonuses.
My feedback meter decays into coding. Give me feedback and I make mods.

0player
Uruivellas
Posts: 717
Joined: Fri May 24, 2013 4:27 pm

Re: Possible bug in Overkill talent

#7 Post by 0player »

"self.inc_damage = {}" doesn't erase the table, it replaces the table with an empty one. That's how assignment works.

Effigy
Uruivellas
Posts: 970
Joined: Fri Oct 10, 2014 4:00 pm

Re: Possible bug in Overkill talent

#8 Post by Effigy »

Ah, interesting. Thanks for clarifying.

Post Reply