Exemple #1
0
void CreatureAI::HandleMovementOnAttackStart(Unit* victim)
{
    MotionMaster* creatureMotion = m_creature->GetMotionMaster();
    if (m_isCombatMovement)
        creatureMotion->MoveChase(victim, m_attackDistance, m_attackAngle);
    // TODO - adapt this to only stop OOC-MMGens when MotionMaster rewrite is finished
    else if (creatureMotion->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE || creatureMotion->GetCurrentMovementGeneratorType() == RANDOM_MOTION_TYPE)
    {
        creatureMotion->MoveIdle();
        m_creature->StopMoving();
    }
}
Exemple #2
0
void UnitAI::HandleMovementOnAttackStart(Unit* victim) const
{
    if (!m_unit->hasUnitState(UNIT_STAT_CAN_NOT_REACT))
    {
        if (m_dismountOnAggro)
            m_unit->Unmount(); // all ais should unmount here

        MotionMaster* creatureMotion = m_unit->GetMotionMaster();

        if (!m_unit->hasUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT))
            creatureMotion->MoveChase(victim, m_attackDistance, m_attackAngle, m_moveFurther);
        // TODO - adapt this to only stop OOC-MMGens when MotionMaster rewrite is finished
        else if (creatureMotion->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE || creatureMotion->GetCurrentMovementGeneratorType() == RANDOM_MOTION_TYPE)
        {
            creatureMotion->MoveIdle();
            m_unit->StopMoving();
        }
    }
}