From b786373710f321e6003d19ed0627ceb6ec00b758 Mon Sep 17 00:00:00 2001 From: bo Date: Tue, 21 Jul 2026 19:51:31 -0500 Subject: [PATCH] more reliable cc range approach --- .../playerbot/strategy/actions/CcActions.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/modules/Bots/playerbot/strategy/actions/CcActions.cpp b/src/modules/Bots/playerbot/strategy/actions/CcActions.cpp index 9938adb30..7b3b7547d 100644 --- a/src/modules/Bots/playerbot/strategy/actions/CcActions.cpp +++ b/src/modules/Bots/playerbot/strategy/actions/CcActions.cpp @@ -171,12 +171,17 @@ bool CastCcOnMyTargetAction::Execute(Event event) return true; } - float range = AI_VALUE2(float, "spell range", ccSpell); - if (bot->GetDistance(target) > range || bot->IsNonMeleeSpellCasted(false)) + if (bot->IsNonMeleeSpellCasted(false)) { return true; } + float range = AI_VALUE2(float, "spell range", ccSpell); + if (bot->GetDistance(target) > range) + { + return MoveTo(target, range); + } + uint32 spellId = AI_VALUE2(uint32, "spell id", ccSpell); if (!spellId) { @@ -191,6 +196,15 @@ bool CastCcOnMyTargetAction::Execute(Event event) return true; } + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (spellInfo && bot->GetShapeshiftForm() != FORM_NONE) + { + if (GetErrorAtShapeshiftedCast(spellInfo, bot->GetShapeshiftForm()) == SPELL_FAILED_NOT_SHAPESHIFT) + { + ai->RemoveShapeshift(); + } + } + ai->CastSpell(spellId, target); m_lastCastAttempt = time(0);