Core/SmartAI: AI change on charmed (#26065)
* Fix AI refresh on charmed * Remove unnecessary refresh * Check SMART_EVENT_FLAG_WHILE_CHARMED flag (cherry picked from commit f6e52f6b3df92a837787f63514417a7d240144cd)
This commit is contained in:
@@ -671,7 +671,7 @@ void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
|
||||
GetScript()->ProcessEventsFor(apply ? SMART_EVENT_PASSENGER_BOARDED : SMART_EVENT_PASSENGER_REMOVED, who, uint32(seatId), 0, apply);
|
||||
}
|
||||
|
||||
void SmartAI::OnCharmed(bool /*isNew*/)
|
||||
void SmartAI::OnCharmed(bool isNew)
|
||||
{
|
||||
bool const charmed = me->IsCharmed();
|
||||
if (charmed) // do this before we change charmed state, as charmed state might prevent these things from processing
|
||||
@@ -705,6 +705,9 @@ void SmartAI::OnCharmed(bool /*isNew*/)
|
||||
}
|
||||
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, nullptr, 0, 0, charmed);
|
||||
|
||||
if (!GetScript()->HasAnyEventWithFlag(SMART_EVENT_FLAG_WHILE_CHARMED)) // we can change AI if there are no events with this flag
|
||||
UnitAI::OnCharmed(isNew);
|
||||
}
|
||||
|
||||
void SmartAI::DoAction(int32 param)
|
||||
|
||||
Reference in New Issue
Block a user