From ceae9b8e0f48f3961884fa40be71915f3b8df851 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 14 Apr 2009 21:07:52 -0500 Subject: [7668] Cleanup In CreatureAI function descriptions and AttackStart/AttackedBy use. Author: VladimirMangos * Use AI::AttackStart calls only in case explicit request creature attack from core or AI code "attack it if can". Like taunt, pet handler attack command. * Use AI::AttackedBy for reaction at hostile action "do something at hostile action" Like non-dot damage, swing, negative spell landing, or fade fear/etc. And provided by default call AttackStart if no current target. This fix some problems, like: * Civilian will react propertly at attack by another creature (not pet or player). * Will not cases (at least triggred by core) when attack target start run to attacker before any real hostile action apply. *Note: AttackBy is still disabled until proved useful to TC. --HG-- branch : trunk --- src/game/CreatureAI.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/game/CreatureAI.cpp') diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index e7043c6042f..fdd145737ab 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -167,3 +167,8 @@ void SimpleCharmedAI::UpdateAI(const uint32 /*diff*/) AttackStart(charmer->SelectNearestTarget()); } +/*void CreatureAI::AttackedBy( Unit* attacker ) +{ + if(!m_creature->getVictim()) + AttackStart(attacker); +}*/ -- cgit v1.2.3