fix(Core/Spell): Enslaved Demon does not auto-attack/auto-cast (#11677)

This commit is contained in:
Charlton Lau
2022-05-18 16:59:39 +09:00
committed by GitHub
parent fc6d8f1bb7
commit 3c9b56438e

View File

@@ -17941,7 +17941,18 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
StopMoving();
ToCreature()->AI()->OnCharmed(true);
if (charmer->GetTypeId() == TYPEID_PLAYER &&
charmer->getClass() == CLASS_WARLOCK)
{
// Disable CreatureAI/SmartAI and switch to CharmAI when charmed by warlock
Creature* charmed = ToCreature();
charmed->NeedChangeAI = true;
charmed->IsAIEnabled = false;
}
else
{
ToCreature()->AI()->OnCharmed(true);
}
// Xinef: If creature can fly, add normal player flying flag (fixes speed)
if (charmer->GetTypeId() == TYPEID_PLAYER && ToCreature()->CanFly())