TrinityCore
CombatAI.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_COMBATAI_H
19#define TRINITY_COMBATAI_H
20
21#include "CreatureAI.h"
22#include "EventMap.h"
23
24class Creature;
25
27{
28 public:
30
31 void UpdateAI(uint32) override;
32 static int32 Permissible(Creature const* creature);
33};
34
35typedef std::vector<uint32> SpellVector;
36
38{
39 public:
41
42 void InitializeAI() override;
43 void Reset() override;
44 void JustEngagedWith(Unit* who) override;
45 void JustDied(Unit* killer) override;
46 void UpdateAI(uint32 diff) override;
47 void SpellInterrupted(uint32 spellId, uint32 unTimeMs) override;
48
49 static int32 Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
50
51 protected:
54};
55
57{
58 public:
59 explicit CasterAI(Creature* creature, uint32 scriptId = {}) : CombatAI(creature, scriptId) { _attackDistance = MELEE_RANGE; }
60 void InitializeAI() override;
61 void AttackStart(Unit* victim) override { AttackStartCaster(victim, _attackDistance); }
62 void UpdateAI(uint32 diff) override;
63 void JustEngagedWith(Unit* /*who*/) override;
64 private:
66};
67
69{
70 public:
71 explicit TurretAI(Creature* creature, uint32 scriptId = {});
72 bool CanAIAttack(Unit const* who) const override;
73 void AttackStart(Unit* who) override;
74 void UpdateAI(uint32 diff) override;
75
76 static int32 Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
77
78 protected:
80};
81
82#define VEHICLE_CONDITION_CHECK_TIME 1000
83#define VEHICLE_DISMISS_TIME 5000
84
86{
87 public:
88 explicit VehicleAI(Creature* creature, uint32 scriptId = {});
89
90 void UpdateAI(uint32 diff) override;
91 void MoveInLineOfSight(Unit*) override { }
92 void AttackStart(Unit*) override { }
93 void OnCharmed(bool isNew) override;
94
95 static int32 Permissible(Creature const* creature);
96
97 private:
98 void LoadConditions();
99 void CheckConditions(uint32 diff);
100
105};
106
107#endif
std::vector< uint32 > SpellVector
Definition: CombatAI.h:35
@ PERMIT_BASE_NO
Definition: CreatureAI.h:44
#define TC_GAME_API
Definition: Define.h:123
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
#define MELEE_RANGE
Definition: ObjectDefines.h:45
void AttackStart(Unit *victim) override
Definition: CombatAI.h:61
CasterAI(Creature *creature, uint32 scriptId={})
Definition: CombatAI.h:59
float _attackDistance
Definition: CombatAI.h:65
SpellVector _spells
Definition: CombatAI.h:53
static int32 Permissible(Creature const *)
Definition: CombatAI.h:49
EventMap _events
Definition: CombatAI.h:52
virtual void JustEngagedWith(Unit *)
Definition: CreatureAI.h:99
virtual void JustDied(Unit *)
Definition: CreatureAI.h:105
void OnCharmed(bool isNew) override
Definition: CreatureAI.cpp:62
CreatureAI(Creature *creature, uint32 scriptId={})
Definition: CreatureAI.cpp:45
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
void AttackStartCaster(Unit *victim, float dist)
Definition: UnitAI.cpp:55
virtual void SpellInterrupted(uint32, uint32)
Definition: UnitAI.h:153
virtual void Reset()
Definition: UnitAI.h:63
virtual bool CanAIAttack(Unit const *) const
Definition: UnitAI.h:57
virtual void InitializeAI()
Definition: UnitAI.cpp:43
virtual void UpdateAI(uint32 diff)=0
Definition: Unit.h:627
float _minimumRange
Definition: CombatAI.h:79
static int32 Permissible(Creature const *)
Definition: CombatAI.h:76
bool _hasConditions
Definition: CombatAI.h:101
void MoveInLineOfSight(Unit *) override
Definition: CombatAI.h:91
bool _dismiss
Definition: CombatAI.h:103
void AttackStart(Unit *) override
Definition: CombatAI.h:92
uint32 _dismissTimer
Definition: CombatAI.h:104
uint32 _conditionsTimer
Definition: CombatAI.h:102