TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CreatureAIImpl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 #ifndef CREATUREAIIMPL_H
18 #define CREATUREAIIMPL_H
19 
20 #include "Common.h"
21 #include "Define.h"
22 #include "TemporarySummon.h"
23 #include "CreatureAI.h"
24 #include "SpellMgr.h"
25 
26 #include <functional>
27 #include <type_traits>
28 
29 template<typename First, typename Second, typename... Rest>
30 static inline First const& RAND(First const& first, Second const& second, Rest const&... rest)
31 {
32  std::reference_wrapper<typename std::add_const<First>::type> const pack[] = { first, second, rest... };
33  return pack[urand(0, sizeof...(rest) + 1)].get();
34 }
35 
37 {
44 };
45 
47 {
51 };
52 
53 #define AI_DEFAULT_COOLDOWN 5000
54 
56 {
63  float maxRange;
64 };
65 
67 
68 #endif
69 
float maxRange
Definition: CreatureAIImpl.h:63
uint32 realCooldown
Definition: CreatureAIImpl.h:62
AICondition
Definition: CreatureAIImpl.h:46
Definition: CreatureAIImpl.h:43
Definition: CreatureAIImpl.h:40
AICondition condition
Definition: CreatureAIImpl.h:60
Definition: CreatureAIImpl.h:48
Definition: CreatureAIImpl.h:42
static First const & RAND(First const &first, Second const &second, Rest const &...rest)
Definition: CreatureAIImpl.h:30
#define AI_DEFAULT_COOLDOWN
Definition: CreatureAIImpl.h:53
AISpellInfoType * GetAISpellInfo(uint32 i)
Definition: CreatureAI.cpp:40
Definition: CreatureAIImpl.h:41
Definition: CreatureAIImpl.h:50
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
AISpellInfoType()
Definition: CreatureAIImpl.h:57
uint32_t uint32
Definition: Define.h:150
Definition: CreatureAIImpl.h:38
AITarget target
Definition: CreatureAIImpl.h:59
uint32 cooldown
Definition: CreatureAIImpl.h:61
Definition: CreatureAIImpl.h:49
Definition: CreatureAIImpl.h:39
AITarget
Definition: CreatureAIImpl.h:36
Definition: CreatureAIImpl.h:55