mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[c12596] Change default reaction on aggro for non-combat movement mobs
This commit is contained in:
parent
8791705198
commit
962883552c
2 changed files with 31 additions and 1 deletions
|
|
@ -122,3 +122,33 @@ bool CreatureAI::DoMeleeAttackIfReady()
|
||||||
{
|
{
|
||||||
return m_creature->UpdateMeleeAttackingState();
|
return m_creature->UpdateMeleeAttackingState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=false*/)
|
||||||
|
{
|
||||||
|
m_isCombatMovement = enable;
|
||||||
|
|
||||||
|
if (enable)
|
||||||
|
m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
|
||||||
|
else
|
||||||
|
m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
|
||||||
|
|
||||||
|
if (stopOrStartMovement && m_creature->getVictim()) // Only change current movement while in combat
|
||||||
|
{
|
||||||
|
if (enable)
|
||||||
|
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_attackDistance, m_attackAngle);
|
||||||
|
else if (!enable && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
|
||||||
|
m_creature->StopMoving();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatureAI::HandleMovementOnAttackStart(Unit* victim)
|
||||||
|
{
|
||||||
|
if (m_isCombatMovement)
|
||||||
|
m_creature->GetMotionMaster()->MoveChase(victim, m_attackDistance, m_attackAngle);
|
||||||
|
// TODO - adapt this to only stop OOC-MMGens when MotionMaster rewrite is finished
|
||||||
|
else if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE || m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == RANDOM_MOTION_TYPE)
|
||||||
|
{
|
||||||
|
m_creature->GetMotionMaster()->MoveIdle();
|
||||||
|
m_creature->StopMoving();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12595"
|
#define REVISION_NR "12596"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue