Jump to content

Dots - Caster Never Gets Removed From Attacker List


Recommended Posts

Posted

Greetings,

While testing my PetAI code with a Warlock, I noticed that DOTs are not being handled by MaNGOS

correctly for any unit.

If a Warlock casts a DOT on you, the Warlock gets added to your attacker list through: Unit::_addAttacker().

The problem is that Unit::_removeAttacker() never gets called for that same caster if you drop combat without

being killed.

This causes problems with any function that checks your attacker list (m_attackers) and returns m_attackers.begin()

because that Warlock will always be in the list (until you die in which case all attackers get erased).

Here's a scenario where this becomes a problem for pet classes:

1) Warlock casts a DOT on you and is added to m_attackers

2) You do nothing but stand around

3) Some random mob attacks you

4) Your pet calls owner->getAttackerForHelper() to defend you

5) m_attackers.begin() returns the Warlock because it's on the top of the list but it should be attacking the random mob

So, should getAttackerForHelper() return m_attackers.end() instead so you always get the most recent attacker

or should we put code somewhere (like ClearInCombat) to remove the DOT caster?

I wrote a function: getAttacker() that does return m_attackers.end() but this seems incomplete to me because the DOT

issue itself still hasn't been remedied. The caster remains with you forever until you die or perform some action that

clears your attacker list (like take a flight somewhere or log out).

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use