From ec91c779f30d3c4bf6307895c019f68d28089a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefano=20Borz=C3=AC?= Date: Sat, 14 Mar 2020 17:41:03 +0100 Subject: [PATCH] fix(Core/SAI): SMARTCAST_COMBAT_MOVE (#2672) Co-authored-by: Stoabrogga <38475780+Stoabrogga@users.noreply.github.com> --- src/server/game/AI/SmartScripts/SmartScript.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index c40661b3d..5ba608593 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -767,7 +767,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if ((e.action.cast.flags & SMARTCAST_COMBAT_MOVE) && GetCasterMaxDist() > 0.0f && me->GetMaxPower(GetCasterPowerType()) > 0) { // Xinef: check mana case only and operate movement accordingly, LoS and range is checked in targetet movement generator - if (me->GetPowerPct(GetCasterPowerType()) < 15.0f) + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.action.cast.spell); + int32 currentPower = me->GetPower(GetCasterPowerType()); + + if ((spellInfo && (currentPower < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) { SetCasterActualDist(0); CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(0);