mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 09:33:47 +00:00
feat(Core/CreatureAI): improve npc position during the combat (#3369)
+ tangent equation to find correct angle and distance when moving + implemented proper backward * Improved performance + random angle margin * chore: add tollerance calculation in instance * improved LOS checks with movements * implemented collisions using raycast (imported by TC) + improved collision detection for CanReachPositionAndGetCoords + improved collision check + set correct flags for the backward movement + first implementation of slope angle (to improve) Co-authored-by: Yehonal <yehonal.azeroth@gmail.com>
This commit is contained in:
@@ -257,6 +257,40 @@ bool CreatureAI::_EnterEvadeMode()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CreatureAI::MoveCircleChecks()
|
||||
{
|
||||
Unit *victim = me->GetVictim();
|
||||
|
||||
if (
|
||||
!victim ||
|
||||
!me->IsFreeToMove() ||
|
||||
!me->IsWithinMeleeRange(victim) ||
|
||||
(victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet())
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
me->GetMotionMaster()->MoveCircleTarget(me->GetVictim());
|
||||
}
|
||||
|
||||
void CreatureAI::MoveBackwardsChecks() {
|
||||
Unit *victim = me->GetVictim();
|
||||
|
||||
if (
|
||||
!victim ||
|
||||
!me->IsFreeToMove() ||
|
||||
(victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet())
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float moveDist = CalculatePct(me->GetCombatReach() + victim->GetCombatReach(), 100);
|
||||
|
||||
me->GetMotionMaster()->MoveBackwards(victim, moveDist);
|
||||
}
|
||||
|
||||
Creature* CreatureAI::DoSummon(uint32 entry, const Position& pos, uint32 despawnTime, TempSummonType summonType)
|
||||
{
|
||||
return me->SummonCreature(entry, pos, summonType, despawnTime);
|
||||
|
||||
Reference in New Issue
Block a user