fix(Core/Pets): Properly cast spells on friendly target if not in LoS… (#9570)

* fix(Core/Pets): Properly cast spells on friendly target if not in LoS or out of range.

Fixes #7790
This commit is contained in:
UltraNix
2021-12-12 13:25:10 +01:00
committed by GitHub
parent 5e65ce72cc
commit 4e93671b3c
6 changed files with 26 additions and 9 deletions

View File

@@ -511,13 +511,18 @@ void Pet::Update(uint32 diff)
}
else
{
GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
GetCharmInfo()->SetIsCommandAttack(false);
GetCharmInfo()->SetIsAtStay(false);
GetCharmInfo()->SetIsReturning(true);
GetCharmInfo()->SetIsCommandFollow(true);
GetCharmInfo()->SetIsFollowing(false);
GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, GetFollowAngle());
if (IsAIEnabled)
AI()->PetStopAttack();
else
{
GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
GetCharmInfo()->SetIsCommandAttack(false);
GetCharmInfo()->SetIsAtStay(false);
GetCharmInfo()->SetIsReturning(true);
GetCharmInfo()->SetIsCommandFollow(true);
GetCharmInfo()->SetIsFollowing(false);
GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, GetFollowAngle());
}
}
m_tempoldTarget = nullptr;

View File

@@ -169,6 +169,9 @@ public:
static void HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 asynchLoadType, uint8 loadResult);
uint8 GetAsynchLoadType() const { return asynchLoadType; }
void SetAsynchLoadType(uint8 type) { asynchLoadType = type; }
[[nodiscard]] bool HasTempSpell() const { return m_tempspell != 0; }
protected:
Player* m_owner;
int32 m_happinessTimer;