aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp18
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h2
2 files changed, 9 insertions, 11 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 59fdee4d181..71125e716a6 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -20,6 +20,7 @@
#include "DB2Stores.h"
#include "Cell.h"
#include "CellImpl.h"
+#include "CreatureAIImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "InstanceScript.h"
@@ -30,13 +31,6 @@
#include "SpellMgr.h"
#include "TemporarySummon.h"
-// Spell summary for ScriptedAI::SelectSpell
-struct TSpellSummary
-{
- uint8 Targets; // set of enum SelectTarget
- uint8 Effects; // set of enum SelectEffect
-} extern* SpellSummary;
-
void SummonList::Summon(Creature const* summon)
{
storage_.push_back(summon->GetGUID());
@@ -231,23 +225,25 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
uint32 spellCount = 0;
SpellInfo const* tempSpell = nullptr;
+ AISpellInfoType const* aiSpell = nullptr;
//Check if each spell is viable(set it to null if not)
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; i++)
{
- tempSpell = sSpellMgr->GetSpellInfo(me->m_spells[i]);
+ tempSpell = sSpellMgr->GetSpellInfo(me->m_spells[i], me->GetMap()->GetDifficultyID());
+ aiSpell = GetAISpellInfo(me->m_spells[i], me->GetMap()->GetDifficultyID());
//This spell doesn't exist
- if (!tempSpell)
+ if (!tempSpell || !aiSpell)
continue;
// Targets and Effects checked first as most used restrictions
//Check the spell targets if specified
- if (targets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (targets-1))))
+ if (targets && !(aiSpell->Targets & (1 << (targets-1))))
continue;
//Check the type of spell if we are looking for a specific spell type
- if (effect && !(SpellSummary[me->m_spells[i]].Effects & (1 << (effect-1))))
+ if (effect && !(aiSpell->Effects & (1 << (effect-1))))
continue;
//Check for school if specified
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index 53fb97be2aa..bb61dfbaab0 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -24,6 +24,8 @@
#include "TaskScheduler.h"
class InstanceScript;
+enum SelectTargetType : uint8;
+enum SelectEffect : uint8;
class TC_GAME_API SummonList
{