fix(Core/Unit): Make players turn to their target during charm automatically (#23534)

This commit is contained in:
killerwife
2025-11-04 09:46:49 +01:00
committed by GitHub
parent 9bada17dfa
commit 7d2b86d7be
2 changed files with 4 additions and 3 deletions

View File

@@ -1968,10 +1968,7 @@ void Player::UpdateCharmedAI()
Unit* target = GetVictim();
if (target)
{
SetInFront(target);
SendMovementFlagUpdate(true);
}
if (HasUnitState(UNIT_STATE_CASTING))
return;

View File

@@ -10963,7 +10963,11 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
}
else
{
charm->m_ControlledByPlayer = false;
if (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
}
// PvP, FFAPvP
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));