mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
AI/SmartAI: Fix an issue where SmartAI creatures would not properly follow their owner on evade. Also fix a bug where creatures with INHABIT_ROOT would get stuck in evade under certain conditions.
This allows us to fix quest 12261 (No Place to Run). Closes #16291.
This commit is contained in:
4
sql/updates/world/3.3.5/2016_09_09_01_world.sql
Normal file
4
sql/updates/world/3.3.5/2016_09_09_01_world.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- Fix SAI for quest "No Place to Run" (issue #16291)
|
||||
UPDATE `creature_template` SET `unit_flags`=`unit_flags`&~0x4 WHERE `entry`=27430;
|
||||
UPDATE `smart_scripts` SET `event_flags`=`event_flags`|0x200 WHERE `entryorguid`=2743000 AND `source_type`=9;
|
||||
UPDATE `smart_scripts` SET `event_type`=54,`comment`="Destructive Ward - On Just Summoned - Run Script" WHERE `entryorguid`=27430 AND `id`=0;
|
||||
@@ -449,14 +449,17 @@ void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
|
||||
AddEscortState(SMART_ESCORT_RETURNING);
|
||||
ReturnToLastOOCPos();
|
||||
}
|
||||
else if (mFollowGuid)
|
||||
else if (Unit* target = mFollowGuid ? ObjectAccessor::GetUnit(*me, mFollowGuid) : nullptr)
|
||||
{
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
// evade is not cleared in MoveFollow, so we can't keep it
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
}
|
||||
else if (Unit* owner = me->GetCharmerOrOwner())
|
||||
{
|
||||
me->GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
}
|
||||
else
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
|
||||
@@ -44,7 +44,10 @@ void HomeMovementGenerator<Creature>::DoReset(Creature*) { }
|
||||
void HomeMovementGenerator<Creature>::_setTargetLocation(Creature* owner)
|
||||
{
|
||||
if (owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
|
||||
{ // if we are ROOT/STUNNED/DISTRACTED even after aura clear, immediately finalize - otherwise we would get stuck in evade
|
||||
arrived = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Movement::MoveSplineInit init(owner);
|
||||
float x, y, z, o;
|
||||
@@ -65,6 +68,6 @@ void HomeMovementGenerator<Creature>::_setTargetLocation(Creature* owner)
|
||||
|
||||
bool HomeMovementGenerator<Creature>::DoUpdate(Creature* owner, const uint32 /*time_diff*/)
|
||||
{
|
||||
arrived = owner->movespline->Finalized();
|
||||
arrived = arrived || owner->movespline->Finalized();
|
||||
return !arrived;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user