diff options
author | megamage <none@none> | 2009-05-31 16:24:19 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-31 16:24:19 -0500 |
commit | 067cbec40d33b865b30299368534ae0cd673f336 (patch) | |
tree | 32df305081bddb28a8f24ed9997454adc3462b80 /src/game/CreatureEventAI.cpp | |
parent | 552e08b3f0efc19f3aa3504badccffbb05a983bd (diff) |
[7922] Implement param2 for ACTION_T_COMBAT_MOVEMENT for allow control start/stop melee combat state for creature at start/stop movement in combat. Author: VladimirMangos
--HG--
branch : trunk
Diffstat (limited to 'src/game/CreatureEventAI.cpp')
-rw-r--r-- | src/game/CreatureEventAI.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 42f64ccdcd0..e2c51f40804 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -577,15 +577,27 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 MeleeEnabled = action.auto_attack.state != 0; break; case ACTION_T_COMBAT_MOVEMENT: + // ignore no affect case + if(CombatMovementEnabled==(action.combat_movement.state!=0)) + return; + CombatMovementEnabled = action.combat_movement.state != 0; //Allow movement (create new targeted movement gen only if idle) if (CombatMovementEnabled) { - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle); + if(action.combat_movement.melee && m_creature->isInCombat()) + if(Unit* victim = m_creature->getVictim()) + m_creature->SendMeleeAttackStart(victim); + + m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle); } else { + if(action.combat_movement.melee && m_creature->isInCombat()) + if(Unit* victim = m_creature->getVictim()) + m_creature->SendMeleeAttackStop(victim); + m_creature->GetMotionMaster()->MoveIdle(); } break; |