AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
CreatureAIImpl.h File Reference
#include "Common.h"
#include "CreatureAI.h"
#include "Define.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"
#include <functional>
#include <type_traits>

Go to the source code of this file.

Classes

struct  AISpellInfoType
 

Macros

#define AI_DEFAULT_COOLDOWN   5000
 

Enumerations

enum  AITarget {
  AITARGET_SELF ,
  AITARGET_VICTIM ,
  AITARGET_ENEMY ,
  AITARGET_ALLY ,
  AITARGET_BUFF ,
  AITARGET_DEBUFF
}
 
enum  AICondition {
  AICOND_AGGRO ,
  AICOND_COMBAT ,
  AICOND_DIE
}
 

Functions

template<typename First , typename Second , typename... Rest>
static First const & RAND (First const &first, Second const &second, Rest const &... rest)
 
AISpellInfoTypeGetAISpellInfo (uint32 i)
 
bool InstanceHasScript (WorldObject const *obj, char const *scriptName)
 
template<class AI , class T >
AI * GetInstanceAI (T *obj, char const *scriptName)
 

Macro Definition Documentation

◆ AI_DEFAULT_COOLDOWN

#define AI_DEFAULT_COOLDOWN   5000

Enumeration Type Documentation

◆ AICondition

Enumerator
AICOND_AGGRO 
AICOND_COMBAT 
AICOND_DIE 
47{
51};
@ AICOND_COMBAT
Definition: CreatureAIImpl.h:49
@ AICOND_AGGRO
Definition: CreatureAIImpl.h:48
@ AICOND_DIE
Definition: CreatureAIImpl.h:50

◆ AITarget

enum AITarget
Enumerator
AITARGET_SELF 
AITARGET_VICTIM 
AITARGET_ENEMY 
AITARGET_ALLY 
AITARGET_BUFF 
AITARGET_DEBUFF 
37{
44};
@ AITARGET_ALLY
Definition: CreatureAIImpl.h:41
@ AITARGET_BUFF
Definition: CreatureAIImpl.h:42
@ AITARGET_SELF
Definition: CreatureAIImpl.h:38
@ AITARGET_VICTIM
Definition: CreatureAIImpl.h:39
@ AITARGET_ENEMY
Definition: CreatureAIImpl.h:40
@ AITARGET_DEBUFF
Definition: CreatureAIImpl.h:43

Function Documentation

◆ GetAISpellInfo()

AISpellInfoType * GetAISpellInfo ( uint32  i)
40{ return &CreatureAI::AISpellInfo[i]; }
static AISpellInfoType * AISpellInfo
Definition: UnitAI.h:394

References UnitAI::AISpellInfo.

Referenced by CasterAI::InitializeAI(), CasterAI::JustEngagedWith(), and CasterAI::UpdateAI().

◆ GetInstanceAI()

template<class AI , class T >
AI * GetInstanceAI ( T *  obj,
char const *  scriptName 
)
inline
72{
73 return InstanceHasScript(obj, scriptName) ? new AI(obj) : nullptr;
74}
bool InstanceHasScript(WorldObject const *obj, char const *scriptName)
Definition: InstanceScript.cpp:765

References InstanceHasScript().

◆ InstanceHasScript()

bool InstanceHasScript ( WorldObject const *  obj,
char const *  scriptName 
)
766{
767 if (InstanceMap* instance = obj->GetMap()->ToInstanceMap())
768 {
769 return instance->GetScriptName() == scriptName;
770 }
771
772 return false;
773}
InstanceMap * ToInstanceMap()
Definition: Map.h:545
Definition: Map.h:818

References WorldObject::GetMap(), and Map::ToInstanceMap().

Referenced by GetInstanceAI().

◆ RAND()

template<typename First , typename Second , typename... Rest>
static First const & RAND ( First const &  first,
Second const &  second,
Rest const &...  rest 
)
inlinestatic
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}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44

References urand().

Referenced by npc_anubisath_guardian::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::EmpowerCultist(), PartyTimeEmoteEvent::Execute(), npc_simon_bunny::npc_simon_bunnyAI::GenerateColorSequence(), go_wind_stone::go_wind_stoneAI::GossipSelect(), spell_cataclysm_breath::spell_cataclysm_breath_SpellScript::HandleAfterCast(), spell_voodoo::spell_voodoo_SpellScript::HandleDummy(), spell_dred_raptor_call::spell_dred_raptor_call_SpellScript::HandleDummy(), spell_item_deviate_fish::HandleDummy(), spell_item_vanquished_clutches::HandleDummy(), Unit::HandleDummyAuraProc(), spell_item_party_time::HandleEffectApply(), spell_q10930_big_bone_worm::spell_q10930_big_bone_worm_AuraScript::HandleEffectRemove(), spell_q10929_fumping::spell_q10929_fumping_AuraScript::HandleEffectRemove(), spell_halion_meteor_strike_spread::spell_halion_meteor_strike_spread_AuraScript::HandlePeriodic(), spell_q10923_evil_draws_near_periodic::spell_q10923_evil_draws_near_periodic_AuraScript::HandlePeriodic(), spell_gen_brood_power::HandleScript(), spell_apothecary_validate_area::HandleScript(), spell_winter_veil_mistletoe::HandleScript(), spell_q13011_bear_flank_master::HandleScript(), spell_lady_vashj_summon_sporebat::HandleScriptEffect(), spell_dtk_summon_random_drakkari::spell_dtk_summon_random_drakkari_SpellScript::HandleScriptEffect(), spell_q14112_14145_chum_the_water::HandleScriptEffect(), boss_moroes::InitializeGuests(), npc_anubisath_guardian::JustEngagedWith(), boss_nexusprince_shaffar::JustEngagedWith(), boss_mekgineer_steamrigger::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_mechano_lord_capacitus::JustEngagedWith(), boss_curator::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::JustRespawned(), npc_medivh_bm::JustSummoned(), npc_necromancer::npc_necromancerAI::KilledUnit(), npc_anubisath_guardian::npc_anubisath_guardian(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::npc_vh_teleportation_portalAI(), spell_item_ashbringer::OnDummyEffect(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), boss_thekal::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::Reset(), npc_violet_hold_defense_system::Reset(), boss_ayamiss::ScheduleTasks(), boss_gathios_the_shatterer::boss_gathios_the_shattererAI::SelectCouncilMember(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetBossState(), npc_cameron::SoundPicker(), pyrewood_ambush::pyrewood_ambushAI::SummonCreatureWithRandomTarget(), spell_mother_shahraz_random_periodic::spell_mother_shahraz_random_periodic_AuraScript::Update(), boss_chromaggus::boss_chromaggusAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_time_rift::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_violet_hold_defense_system::UpdateAI(), boss_mother_shahraz::boss_shahrazAI::UpdateAI(), boss_gathios_the_shatterer::boss_gathios_the_shattererAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), and boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::UpdateAI().