Pet/Guardian AI hook re-organizing#19824
Conversation
- Adjust OwnerAttacked/OwnerAttackedBy hooks on CreatureAI to fire for all owned units, not just player pets. This should allow guardians to more reliably recognize valid targets. - Kill off the AttackedBy hook. While it was defined in CreatureAI.h as virtual, it was only ever invoked for player pets in specific situations. This makes it classic developer bait. - Adjust PetAI to use DamageTaken instead of AttackedBy. - Adjust behavior of AttackStart on PetAI to compensate.
|
Shouldn't AttackedBy fire on events that cause aggro but not deal damage like taunt/debuff/dot without instant damage component? |
|
In current core, EnterCombat is used if it's initial aggro, plus various spell related hooks. |
|
Well, all of the scenarios I described are valid even as non-initial-aggro |
|
Yes, but currently
|
| if (!attacker || !me->IsAlive()) | ||
| return; | ||
|
|
||
| if (!me->HasReactState(REACT_PASSIVE) && me->CanStartAttack(attacker, false)) |
There was a problem hiding this comment.
me->CanStartAttack(attacker, false)
prevents combat with neutral units that the owner is attacking
me->CanStartAttack(attacker, true)
testing with force = true
There was a problem hiding this comment.
actually makes sense for it to be true, faction check can be sort of ignored and distance check is useless
You were supposed to tell me whether it worked without force, not lead me into darkness.
|
|
||
| // Called when owner attacks something | ||
| virtual void OwnerAttacked(Unit* /*target*/) { } | ||
| virtual void OwnerAttacked(Unit* target) { CreatureAI::OwnerAttackedBy(target); } |
There was a problem hiding this comment.
You talked about traps for scripters but here you add another one - it would be better to introduce a separate (nonvirtual) method that is called by both OwnerAttacked and OwnerAttackedBy. Someone less experienced might think that if he overrides OwnerAttackedBy in his own script but not OwnerAttacked that it will call his overriden OwnerAttackedBy (but it will be the base CreatureAI one)
* Pet/Guardian AI hook re-organizing: - Adjust OwnerAttacked/OwnerAttackedBy hooks on CreatureAI to fire for all owned units, not just player pets. This should allow guardians to more reliably recognize valid targets. - Kill off the AttackedBy hook. While it was defined in CreatureAI.h as virtual, it was only ever invoked for player pets in specific situations. This makes it classic developer bait. - Adjust PetAI to use DamageTaken instead of AttackedBy. - Adjust behavior of AttackStart on PetAI to compensate.
* Pet/Guardian AI hook re-organizing: - Adjust OwnerAttacked/OwnerAttackedBy hooks on CreatureAI to fire for all owned units, not just player pets. This should allow guardians to more reliably recognize valid targets. - Kill off the AttackedBy hook. While it was defined in CreatureAI.h as virtual, it was only ever invoked for player pets in specific situations. This makes it classic developer bait. - Adjust PetAI to use DamageTaken instead of AttackedBy. - Adjust behavior of AttackStart on PetAI to compensate. (cherry picked from commit 1660bb7)
* Pet/Guardian AI hook re-organizing: - Adjust OwnerAttacked/OwnerAttackedBy hooks on CreatureAI to fire for all owned units, not just player pets. This should allow guardians to more reliably recognize valid targets. - Kill off the AttackedBy hook. While it was defined in CreatureAI.h as virtual, it was only ever invoked for player pets in specific situations. This makes it classic developer bait. - Adjust PetAI to use DamageTaken instead of AttackedBy. - Adjust behavior of AttackStart on PetAI to compensate. (cherry picked from commit 1660bb7)
* Pet/Guardian AI hook re-organizing: - Adjust OwnerAttacked/OwnerAttackedBy hooks on CreatureAI to fire for all owned units, not just player pets. This should allow guardians to more reliably recognize valid targets. - Kill off the AttackedBy hook. While it was defined in CreatureAI.h as virtual, it was only ever invoked for player pets in specific situations. This makes it classic developer bait. - Adjust PetAI to use DamageTaken instead of AttackedBy. - Adjust behavior of AttackStart on PetAI to compensate. (cherry picked from commit 1660bb7)
* Pet/Guardian AI hook re-organizing: - Adjust OwnerAttacked/OwnerAttackedBy hooks on CreatureAI to fire for all owned units, not just player pets. This should allow guardians to more reliably recognize valid targets. - Kill off the AttackedBy hook. While it was defined in CreatureAI.h as virtual, it was only ever invoked for player pets in specific situations. This makes it classic developer bait. - Adjust PetAI to use DamageTaken instead of AttackedBy. - Adjust behavior of AttackStart on PetAI to compensate. (cherry picked from commit 1660bb7)
Pet/Guardian AI hook re-organizing: