Hook request in combat.lua (attackTargetWith)

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Peppersauce
Thalore
Posts: 190
Joined: Tue Jul 03, 2012 7:04 pm

Hook request in combat.lua (attackTargetWith)

#1 Post by Peppersauce »

So, I have a talent in my addon that keeps track of enemies with a certain debuff and grants attack, apr and damage multiplier if the player is attacking any enemy with this debuff. When I was coding it I was unable to find a simple way to actually apply the bonuses based on those conditions and I ended up with a really bad superload of attackTargetWith, because I had to change those values in the very middle of the function. This could be solved by making a hook so... here I am.
The hook should be placed at line 435, after the apr is declared and before the Repel check and any actual hit check is done. Alternatively, placing it at line 472 would still work as intended.

Here's an example of how the hook could look like:

Code: Select all

	local hd = {"Combat:attackTargetWith:attackerBonuses", target=target, weapon=weapon, damtype=damtype, mult=mult, dam=dam, apr=apr, atk=atk, def=def, armor=armor}
	if self:triggerHook(hd) then
		target, weapon, damtype, mult, dam, apr, atk, def, armor = hd.target, hd.weapon, hd.damtype, hd.mult, hd.dam, hd.apr, hd.atk, hd.def, hd.armor
	if hd.stop then return end
	end
I may be giving too many parameters too the hook this way, also giving the ability to addon makers to change target and weapon used by the function *might* be a bad idea, but that's your call if you get around to it. :twisted:

PS: the hook can't be called "Combat:attackTargetWith" because that's the name of a hook at the very end of "attackTargetHitProcs", just saying.

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

Re: Hook request in combat.lua (attackTargetWith)

#2 Post by HousePet »

Hooray its finally added!

I was going to add it with the Cursed stuff (since it would use it a lot), but Hooray anyway!
My feedback meter decays into coding. Give me feedback and I make mods.

Peppersauce
Thalore
Posts: 190
Joined: Tue Jul 03, 2012 7:04 pm

Re: Hook request in combat.lua (attackTargetWith)

#3 Post by Peppersauce »

Yeah! Definitely a great addition for all of us :D

Post Reply