From 0276b141a84487a0d9ee57c2b9f82541b666c566 Mon Sep 17 00:00:00 2001 From: Gultask <100873791+Gultask@users.noreply.github.com> Date: Sun, 6 Aug 2023 15:25:31 -0300 Subject: [PATCH] feat(Core/SmartAI): Implement castFlag THREATLIST_NOT_SINGLE (#16911) * init * Update SmartScript.cpp --- src/server/game/AI/SmartScripts/SmartScript.cpp | 4 ++++ src/server/game/AI/SmartScripts/SmartScriptMgr.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 41889c9be..784451441 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -606,6 +606,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u me->InterruptNonMeleeSpells(false); } + if (e.action.cast.castFlags & SMARTCAST_THREATLIST_NOT_SINGLE) + if (me->GetThreatMgr().GetThreatListSize() <= 1) + break; + TriggerCastFlags triggerFlags = TRIGGERED_NONE; if (e.action.cast.castFlags & SMARTCAST_TRIGGERED) { diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index b839e3224..e8b6b5947 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1876,7 +1876,8 @@ enum SmartCastFlags //CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range //CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself SMARTCAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell - SMARTCAST_COMBAT_MOVE = 0x40 //Prevents combat movement if cast successful. Allows movement on range, OOM, LOS + SMARTCAST_COMBAT_MOVE = 0x40, //Prevents combat movement if cast successful. Allows movement on range, OOM, LOS + SMARTCAST_THREATLIST_NOT_SINGLE = 0x80 //Only cast if the source's threatlist is higher than one. This includes pets (see Skeram's True Fulfillment) }; // one line in DB is one event