fix(Core/AI): crashfix(#22352) (#22353)

This commit is contained in:
Tereneckla 2025-06-24 20:03:45 +00:00 committed by GitHub
parent 8dbde7a588
commit e77f5d63da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -193,6 +193,9 @@ SpellCastResult UnitAI::DoCast(uint32 spellId)
{
DefaultTargetSelector targetSelector(me, spellInfo->GetMaxRange(false), false, true, 0);
target = SelectTarget(SelectTargetMethod::Random, 0, [&](Unit* target) {
if (!target)
return false;
if (target->IsPlayer())
{
if (spellInfo->HasAttribute(SPELL_ATTR5_NOT_ON_PLAYER))
@ -225,6 +228,9 @@ SpellCastResult UnitAI::DoCast(uint32 spellId)
DefaultTargetSelector defaultTargetSelector(me, range, false, true, -(int32)spellId);
auto targetSelector = [&](Unit* target) {
if (!target)
return false;
if (target->IsPlayer())
{
if (spellInfo->HasAttribute(SPELL_ATTR5_NOT_ON_PLAYER))