ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Tue Jan 23, 2018 5:48 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Jun 07, 2016 4:07 am 
Offline
Thalore

Joined: Tue Jul 03, 2012 7:04 pm
Posts: 181
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:
   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.


Top
 Profile  
 
PostPosted: Fri Jun 10, 2016 2:05 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5560
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.


Top
 Profile  
 
PostPosted: Fri Jun 10, 2016 2:33 am 
Offline
Thalore

Joined: Tue Jul 03, 2012 7:04 pm
Posts: 181
Yeah! Definitely a great addition for all of us :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group