aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI
diff options
context:
space:
mode:
authorModoX <moardox@gmail.com>2023-11-05 21:14:24 +0100
committerGitHub <noreply@github.com>2023-11-05 21:14:24 +0100
commitcaa4cfb5695deabd0bb9059f01435f3c8027aff7 (patch)
tree9ead131b50cfd9aa5c8a4b00392d242f5b431a97 /src/server/game/AI
parentf4e4e62aea79ff478dbc0f2bb2c5ab7f412a8a66 (diff)
Core/AI: Move ArcherAI to individual creature script (#29383)
Diffstat (limited to 'src/server/game/AI')
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.cpp49
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.h13
-rw-r--r--src/server/game/AI/CreatureAIRegistry.cpp1
3 files changed, 0 insertions, 63 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index efa8df549a2..16c161dbd7a 100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -190,55 +190,6 @@ void CasterAI::UpdateAI(uint32 diff)
}
//////////////
-// ArcherAI
-//////////////
-
-ArcherAI::ArcherAI(Creature* creature, uint32 scriptId) : CreatureAI(creature, scriptId)
-{
- if (!creature->m_spells[0])
- TC_LOG_ERROR("scripts.ai", "ArcherAI set for creature with spell1 = 0. AI will do nothing ({})", creature->GetGUID().ToString());
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creature->m_spells[0], creature->GetMap()->GetDifficultyID());
- _minimumRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
-
- if (!_minimumRange)
- _minimumRange = MELEE_RANGE;
- creature->m_CombatDistance = spellInfo ? spellInfo->GetMaxRange(false) : 0;
- creature->m_SightDistance = creature->m_CombatDistance;
-}
-
-void ArcherAI::AttackStart(Unit* who)
-{
- if (!who)
- return;
-
- if (me->IsWithinCombatRange(who, _minimumRange))
- {
- if (me->Attack(who, true) && !who->IsFlying())
- me->GetMotionMaster()->MoveChase(who);
- }
- else
- {
- if (me->Attack(who, false) && !who->IsFlying())
- me->GetMotionMaster()->MoveChase(who, me->m_CombatDistance);
- }
-
- if (who->IsFlying())
- me->GetMotionMaster()->MoveIdle();
-}
-
-void ArcherAI::UpdateAI(uint32 /*diff*/)
-{
- if (!UpdateVictim())
- return;
-
- if (!me->IsWithinCombatRange(me->GetVictim(), _minimumRange))
- DoSpellAttackIfReady(me->m_spells[0]);
- else
- DoMeleeAttackIfReady();
-}
-
-//////////////
// TurretAI
//////////////
diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h
index bfcb1042670..cd861b52398 100644
--- a/src/server/game/AI/CoreAI/CombatAI.h
+++ b/src/server/game/AI/CoreAI/CombatAI.h
@@ -65,19 +65,6 @@ class TC_GAME_API CasterAI : public CombatAI
float _attackDistance;
};
-struct TC_GAME_API ArcherAI : public CreatureAI
-{
- public:
- explicit ArcherAI(Creature* creature, uint32 scriptId = {});
- void AttackStart(Unit* who) override;
- void UpdateAI(uint32 diff) override;
-
- static int32 Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
-
- protected:
- float _minimumRange;
-};
-
struct TC_GAME_API TurretAI : public CreatureAI
{
public:
diff --git a/src/server/game/AI/CreatureAIRegistry.cpp b/src/server/game/AI/CreatureAIRegistry.cpp
index 462dc5ae9b0..7b85c3ce540 100644
--- a/src/server/game/AI/CreatureAIRegistry.cpp
+++ b/src/server/game/AI/CreatureAIRegistry.cpp
@@ -45,7 +45,6 @@ namespace AIRegistry
(new CreatureAIFactory<PetAI, false>("PetAI"))->RegisterSelf();
(new CreatureAIFactory<TotemAI, false>("TotemAI"))->RegisterSelf();
(new CreatureAIFactory<CombatAI>("CombatAI"))->RegisterSelf();
- (new CreatureAIFactory<ArcherAI>("ArcherAI"))->RegisterSelf();
(new CreatureAIFactory<TurretAI>("TurretAI"))->RegisterSelf();
(new CreatureAIFactory<VehicleAI>("VehicleAI"))->RegisterSelf();
(new CreatureAIFactory<SmartAI>("SmartAI"))->RegisterSelf();