feat(Core/SmartScripts): SMART_EVENT_FLAG_WHILE_CHARMED (#10286)

This commit is contained in:
IntelligentQuantum
2022-04-23 18:56:42 +04:30
committed by GitHub
parent 6aebf22cb2
commit 9fa3436cbe
10 changed files with 186 additions and 56 deletions

View File

@@ -70,7 +70,7 @@ void npc_escortAI::AttackStart(Unit* who)
}
//see followerAI
bool npc_escortAI::AssistPlayerInCombat(Unit* who)
bool npc_escortAI::AssistPlayerInCombatAgainst(Unit* who)
{
if (!who || !who->GetVictim())
{
@@ -138,7 +138,7 @@ void npc_escortAI::MoveInLineOfSight(Unit* who)
return;
if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack(true, me) && who->isInAccessiblePlaceFor(me))
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who))
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombatAgainst(who))
return;
if (me->CanStartAttack(who))

View File

@@ -114,7 +114,7 @@ protected:
Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); }
private:
bool AssistPlayerInCombat(Unit* who);
bool AssistPlayerInCombatAgainst(Unit* who);
bool IsPlayerOrGroupInRange();
void FillPointMovementListForCreature();

View File

@@ -63,7 +63,7 @@ void FollowerAI::AttackStart(Unit* who)
//This part provides assistance to a player that are attacked by who, even if out of normal aggro range
//It will cause me to attack who that are attacking _any_ player (which has been confirmed may happen also on offi)
//The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate.
bool FollowerAI::AssistPlayerInCombat(Unit* who)
bool FollowerAI::AssistPlayerInCombatAgainst(Unit* who)
{
if (!who || !who->GetVictim())
return false;
@@ -96,7 +96,7 @@ void FollowerAI::MoveInLineOfSight(Unit* who)
return;
if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack(true, me) && who->isInAccessiblePlaceFor(me))
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who))
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombatAgainst(who))
return;
if (me->CanStartAttack(who))

View File

@@ -69,7 +69,7 @@ private:
void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; }
void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; }
bool AssistPlayerInCombat(Unit* who);
bool AssistPlayerInCombatAgainst(Unit* who);
ObjectGuid m_uiLeaderGUID;
uint32 m_uiUpdateFollowTimer;