|
| PetAI (Creature *c) |
|
void | UpdateAI (uint32) override |
|
void | KilledUnit (Unit *) override |
|
void | AttackStart (Unit *target) override |
|
void | MovementInform (uint32 moveType, uint32 data) override |
|
void | OwnerAttackedBy (Unit *attacker) override |
|
void | OwnerAttacked (Unit *target) override |
|
void | AttackedBy (Unit *attacker) override |
|
void | ReceiveEmote (Player *player, uint32 textEmote) override |
|
void | MoveInLineOfSight (Unit *) override |
|
void | MoveInLineOfSight_Safe (Unit *) |
|
void | EnterEvadeMode (EvadeReason) override |
|
void | SpellHit (Unit *caster, SpellInfo const *spellInfo) override |
|
void | PetStopAttack () override |
|
void | Talk (uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s) |
| Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
|
|
void | Talk (uint8 id, Milliseconds delay) |
|
| CreatureAI (Creature *creature) |
|
| ~CreatureAI () override |
|
void | MoveCircleChecks () |
|
void | MoveBackwardsChecks () |
|
void | MoveInLineOfSight_Safe (Unit *who) |
| == Reactions At =================================
|
|
void | TriggerAlert (Unit const *who) const |
|
virtual bool | CanRespawn () |
|
virtual void | EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER) |
|
virtual void | JustEngagedWith (Unit *) |
| Called for reaction when initially engaged.
|
|
virtual void | JustDied (Unit *) |
|
virtual void | KilledUnit (Unit *) |
|
virtual void | JustSummoned (Creature *) |
|
virtual void | IsSummonedBy (WorldObject *) |
|
virtual void | SummonedCreatureDespawn (Creature *) |
|
virtual void | SummonedCreatureDies (Creature *, Unit *) |
|
virtual void | SummonedCreatureDespawnAll () |
|
virtual void | SpellHit (Unit *, SpellInfo const *) |
|
virtual void | SpellHitTarget (Unit *, SpellInfo const *) |
|
virtual void | AttackedBy (Unit *) |
|
virtual bool | IsEscorted () |
|
virtual void | JustRespawned () |
|
virtual void | MovementInform (uint32, uint32) |
|
virtual void | PathEndReached (uint32) |
|
void | OnCharmed (bool apply) override |
|
virtual void | JustReachedHome () |
|
void | DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f) |
|
virtual void | ReceiveEmote (Player *, uint32) |
|
virtual void | OwnerAttackedBy (Unit *) |
|
virtual void | OwnerAttacked (Unit *) |
|
virtual void | CorpseRemoved (uint32 &) |
| == Triggered Actions Requested ==================
|
|
virtual void | PassengerBoarded (Unit *, int8, bool) |
| == Fields =======================================
|
|
virtual bool | BeforeSpellClick (Unit *) |
|
virtual void | OnSpellClick (Unit *, bool &) |
|
virtual bool | CanSeeAlways (WorldObject const *) |
|
virtual bool | CanBeSeen (Player const *) |
|
virtual bool | CanAlwaysBeDetectable (WorldObject const *) |
|
virtual void | PetStopAttack () |
|
virtual bool | CheckInRoom () |
|
CreatureBoundary const * | GetBoundary () const |
|
void | SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false) |
|
bool | IsInBoundary (Position const *who=nullptr) const |
|
virtual void | CalculateThreat (Unit *, float &, SpellInfo const *) |
|
virtual bool | OnTeleportUnreacheablePlayer (Player *) |
|
| UnitAI (Unit *unit) |
|
virtual | ~UnitAI () |
|
virtual bool | CanAIAttack (Unit const *) const |
|
virtual void | AttackStart (Unit *) |
|
virtual void | UpdateAI (uint32)=0 |
|
virtual void | InitializeAI () |
|
virtual void | Reset () |
|
virtual void | OnCharmed (bool apply)=0 |
|
virtual void | DoAction (int32) |
|
virtual uint32 | GetData (uint32) const |
|
virtual void | SetData (uint32, uint32) |
|
virtual void | SetGUID (ObjectGuid, int32=0) |
|
virtual ObjectGuid | GetGUID (int32=0) const |
|
Unit * | SelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0) |
|
template<class PREDICATE > |
Unit * | SelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate) |
|
void | SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0) |
|
template<class PREDICATE > |
void | SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate) |
|
virtual void | JustEnteredCombat (Unit *) |
| Called when the unit enters combat (NOTE: Creature engage logic should NOT be here, but in JustEngagedWith, which happens once threat is established!)
|
|
virtual void | JustExitedCombat () |
| Called when the unit leaves combat.
|
|
virtual void | DamageDealt (Unit *, uint32 &, DamageEffectType) |
|
virtual void | DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) |
|
virtual void | HealReceived (Unit *, uint32 &) |
|
virtual void | HealDone (Unit *, uint32 &) |
|
void | AttackStartCaster (Unit *victim, float dist) |
|
SpellCastResult | DoAddAuraToAllHostilePlayers (uint32 spellid) |
|
SpellCastResult | DoCast (uint32 spellId) |
|
SpellCastResult | DoCast (Unit *victim, uint32 spellId, bool triggered=false) |
|
SpellCastResult | DoCastSelf (uint32 spellId, bool triggered=false) |
|
SpellCastResult | DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false) |
|
SpellCastResult | DoCastVictim (uint32 spellId, bool triggered=false) |
|
SpellCastResult | DoCastAOE (uint32 spellId, bool triggered=false) |
|
SpellCastResult | DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false) |
|
SpellCastResult | DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false) |
| Cast spell on the max threat target, which may not always be the current victim.
|
|
float | DoGetSpellMaxRange (uint32 spellId, bool positive=false) |
|
void | DoMeleeAttackIfReady () |
|
bool | DoSpellAttackIfReady (uint32 spell) |
|
void | DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true) |
|
virtual void | SummonMovementInform (Creature *, uint32, uint32) |
|
virtual void | sGossipHello (Player *) |
|
virtual void | sGossipSelect (Player *, uint32, uint32) |
|
virtual void | sGossipSelectCode (Player *, uint32, uint32, char const *) |
|
virtual void | sQuestAccept (Player *, Quest const *) |
|
virtual void | sQuestSelect (Player *, Quest const *) |
|
virtual void | sQuestComplete (Player *, Quest const *) |
|
virtual void | sQuestReward (Player *, Quest const *, uint32) |
|
virtual void | sOnGameEvent (bool, uint16) |
|
virtual std::string | GetDebugInfo () const |
|
void PetAI::UpdateAI |
( |
uint32 |
diff | ) |
|
|
overridevirtual |
Implements UnitAI.
148{
150 return;
151
153
155
157 else
159
161 {
162
164 {
166 return;
167 }
168
170 {
173 return;
174 }
175
176
178 {
181 }
182 else
184 }
186 {
188 {
189
190
191
192
193
195
196 if (nextTarget)
198 else
200 }
201 else
203 }
204
205
207 return;
208
209
211 {
213 {
215
216
218 {
220 {
223 }
224 else
226 }
227 return;
228 }
229
230
232 return;
233
234 typedef std::vector<std::pair<Unit*, Spell*> > TargetSpellList;
235 TargetSpellList targetSpellStore;
236
238 {
240 if (!spellID)
241 continue;
242
244 if (!spellInfo)
245 continue;
246
248 continue;
249
250
252 continue;
253
255 {
257 {
258
260 {
261 continue;
262 }
263 }
264
267 bool spellUsed = false;
268
269
270
272 if (!target && owner)
274
275 if (target)
276 {
278 {
279 targetSpellStore.push_back(std::make_pair(target, spell));
280 spellUsed = true;
281 }
282 }
283
284
285 if (!spellUsed)
286 {
288 {
290
291
292 if (!ally)
293 continue;
294
296 {
297 targetSpellStore.push_back(std::make_pair(ally, spell));
298 spellUsed = true;
299 break;
300 }
301 }
302 }
303
304
305 if (!spellUsed)
306 delete spell;
307 }
309 {
312 targetSpellStore.push_back(std::make_pair(
me->
GetVictim(), spell));
313 else
314 delete spell;
315 }
316 }
317
318
319 if (!targetSpellStore.empty())
320 {
321 uint32 index =
urand(0, targetSpellStore.size() - 1);
322
323 Spell* spell = targetSpellStore[index].second;
324 Unit* target = targetSpellStore[index].first;
325
326 targetSpellStore.erase(targetSpellStore.begin() + index);
327
330
332 {
336
339 }
340
342
344 }
345
346
347 for (TargetSpellList::const_iterator itr = targetSpellStore.begin(); itr != targetSpellStore.end(); ++itr)
348 delete itr->second;
349 }
350}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ ACT_ENABLED
Definition: Unit.h:1027
@ TRIGGERED_NONE
Definition: SpellDefines.h:131
@ POWER_ENERGY
Definition: SharedDefines.h:244
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:204
bool _needToStop(void)
Definition: PetAI.cpp:48
GuidSet m_AllySet
Definition: PetAI.h:83
void _doMeleeAttack()
Definition: PetAI.cpp:90
uint32 m_updateAlliesTimer
Definition: PetAI.h:84
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Creature.cpp:2819
void AddSpellCooldown(uint32 spell_id, uint32, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition: Creature.cpp:2764
void SendUpdateToPlayer(Player *player)
Definition: Object.cpp:246
Definition: ObjectGuid.h:120
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition: Position.cpp:140
bool HasTempSpell() const
Definition: Pet.h:146
WorldSession * GetSession() const
Definition: Player.h:1958
bool HasGlobalCooldown(SpellInfo const *spellInfo) const
Definition: Unit.cpp:341
int32 GetForcedSpell()
Definition: Unit.h:1157
ObjectGuid GetForcedTarget()
Definition: Unit.h:1159
GlobalCooldownMgr & GetGlobalCooldownMgr()
Definition: Unit.h:1139
void StopMoving()
Definition: Unit.cpp:16902
bool IsPetInCombat() const
Definition: Unit.h:1703
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20862
bool IsInCombat() const
Definition: Unit.h:1700
void HandlePetActionHelper(Unit *pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2)
Definition: PetHandler.cpp:150
void SetUnitTarget(Unit *target)
Definition: Spell.cpp:233
void LoadScripts()
Definition: Spell.cpp:8457
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition: Spell.cpp:3450
SpellInfo const *const m_spellInfo
Definition: Spell.h:520
bool CanAutoCast(Unit *target)
Definition: Spell.cpp:6977
uint32 Id
Definition: SpellInfo.h:318
int32 GetMaxDuration() const
Definition: SpellInfo.cpp:2329
bool CanBeUsedInCombat() const
Definition: SpellInfo.cpp:1216
bool IsPositive() const
Definition: SpellInfo.cpp:1221
References _doMeleeAttack(), _needToStop(), _stopAttack(), ACT_ENABLED, Creature::AddSpellCooldown(), AttackStart(), CanAttack(), Spell::CanAutoCast(), SpellInfo::CanBeUsedInCombat(), MotionMaster::Clear(), COMMAND_STAY, Unit::getAttackerForHelper(), Unit::GetCharmerOrOwner(), Unit::GetCharmInfo(), CharmInfo::GetForcedSpell(), CharmInfo::GetForcedTarget(), CharmInfo::GetGlobalCooldownMgr(), Object::GetGUID(), SpellInfo::GetMaxDuration(), Unit::GetMotionMaster(), Creature::GetPetAutoSpellOnPos(), Creature::GetPetAutoSpellSize(), Unit::GetPower(), Player::GetSession(), Object::GetTypeId(), ObjectAccessor::GetUnit(), Unit::GetVictim(), WorldSession::HandlePetActionHelper(), HandleReturnMovement(), Unit::HasBreakableByDamageCrowdControlAura(), CharmInfo::HasCommandState(), GlobalCooldownMgr::HasGlobalCooldown(), Position::HasInArc(), Creature::HasReactState(), Creature::HasSpellCooldown(), Pet::HasTempSpell(), Unit::HasUnitState(), SpellInfo::Id, Unit::InterruptNonMeleeSpells(), Unit::IsAlive(), CharmInfo::IsAtStay(), CharmInfo::IsCommandAttack(), Unit::IsInCombat(), Unit::IsPet(), Minion::IsPetGhoul(), Unit::IsPetInCombat(), SpellInfo::IsPositive(), Unit::IsWithinMeleeRange(), Spell::LoadScripts(), LOG_DEBUG, m_AllySet, Spell::m_spellInfo, m_updateAlliesTimer, CreatureAI::me, POWER_ENERGY, Spell::prepare(), REACT_AGGRESSIVE, REACT_PASSIVE, SelectNextTarget(), Object::SendUpdateToPlayer(), Unit::SetInFront(), SpellCastTargets::SetUnitTarget(), sSpellMgr, Unit::StopMoving(), Unit::ToPet(), Object::ToPlayer(), ObjectGuid::ToString(), TRIGGERED_NONE, TYPEID_PLAYER, UNIT_STATE_CASTING, UpdateAllies(), and urand().