TrinityCore
Loading...
Searching...
No Matches
PassiveAI.cpp
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#include "PassiveAI.h"
19#include "Creature.h"
20#include "MovementDefines.h"
21
23{
25}
26
28{
30}
31
36
38{
40 return PERMIT_BASE_PROACTIVE + 50;
41
42 if (creature->IsTrigger())
44
45 return PERMIT_BASE_IDLE;
46}
47
53
55{
56 me->Attack(target, true);
57}
58
60{
61 if (me->GetVictim())
62 {
64 me->AttackStop();
65 else
67 }
68}
69
71{
72 // We died while possessed, disable our loot
74}
75
81
87
94
96{
97 if (creature->IsCritter() && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
99
100 return PERMIT_BASE_NO;
101}
102
104{
105 if (me->m_spells[0])
106 {
107 CastSpellExtraArgs extra;
108 extra.OriginalCaster = summoner->GetGUID();
109 me->CastSpell(me, me->m_spells[0], extra);
110 }
111}
112
114{
115 if (creature->IsTrigger() && creature->m_spells[0])
116 return PERMIT_BASE_SPECIAL;
117
118 return PERMIT_BASE_NO;
119}
@ PERMIT_BASE_SPECIAL
Definition CreatureAI.h:48
@ PERMIT_BASE_PROACTIVE
Definition CreatureAI.h:46
@ PERMIT_BASE_NO
Definition CreatureAI.h:43
@ PERMIT_BASE_IDLE
Definition CreatureAI.h:44
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TIMED_FLEEING_MOTION_TYPE
@ UNIT_DYNFLAG_LOOTABLE
@ REACT_PASSIVE
@ UNIT_NPC_FLAG_SPELLCLICK
@ UNIT_MASK_GUARDIAN
Definition Unit.h:366
@ UNIT_STATE_FLEEING
Definition Unit.h:227
@ EVADE_REASON_OTHER
Definition CreatureAI.h:98
@ EVADE_REASON_NO_HOSTILES
Definition CreatureAI.h:94
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
bool IsTrigger() const
Definition Creature.h:98
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition Creature.h:229
bool IsEngaged() const override
void SetReactState(ReactStates st)
Definition Creature.h:119
void JustEngagedWith(Unit *) override
Definition PassiveAI.cpp:76
void MovementInform(uint32 type, uint32 id) override
Definition PassiveAI.cpp:82
void EnterEvadeMode(EvadeReason why) override
Definition PassiveAI.cpp:88
static int32 Permissible(Creature const *creature)
Definition PassiveAI.cpp:95
static int32 Permissible(Creature const *creature)
Definition PassiveAI.cpp:37
NullCreatureAI(Creature *creature)
Definition PassiveAI.cpp:32
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:90
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
PassiveAI(Creature *creature)
Definition PassiveAI.cpp:22
void UpdateAI(uint32) override
Definition PassiveAI.cpp:48
void AttackStart(Unit *target) override
Definition PassiveAI.cpp:54
void UpdateAI(uint32) override
Definition PassiveAI.cpp:59
void JustDied(Unit *) override
Definition PassiveAI.cpp:70
PossessedAI(Creature *creature)
Definition PassiveAI.cpp:27
void IsSummonedBy(WorldObject *summoner) override
static int32 Permissible(Creature const *creature)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
Definition Unit.h:769
void SetControlled(bool apply, UnitState state)
Definition Unit.cpp:11256
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:5535
bool HasNpcFlag(NPCFlags flags) const
Definition Unit.h:1096
Unit * GetVictim() const
Definition Unit.h:859
bool IsCritter() const
Definition Unit.h:1117
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:880
bool AttackStop()
Definition Unit.cpp:5645
bool IsInCombat() const
Definition Unit.h:1144
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2856
ObjectGuid OriginalCaster