![]() |
TrinityCore
|
#include <PetAI.h>
Inheritance diagram for PetAI:Public Member Functions | |
| PetAI (Creature *creature, uint32 scriptId={}) | |
| void | UpdateAI (uint32) override |
| void | KilledUnit (Unit *) override |
| void | AttackStart (Unit *target) override |
| == Triggered Actions Requested ================== | |
| void | _AttackStart (Unit *target) |
| void | MovementInform (uint32 type, uint32 id) override |
| void | OwnerAttackedBy (Unit *attacker) override |
| void | OwnerAttacked (Unit *target) override |
| void | DamageTaken (Unit *attacker, uint32 &, DamageEffectType, SpellInfo const *) override |
| void | ReceiveEmote (Player *player, uint32 textEmote) override |
| void | JustEnteredCombat (Unit *who) override |
| void | JustExitedCombat () override |
| void | OnCharmed (bool isNew) override |
| void | MoveInLineOfSight (Unit *) override |
| void | MoveInLineOfSight_Safe (Unit *) |
| void | JustAppeared () override |
| void | EnterEvadeMode (EvadeReason) override |
Public Member Functions inherited from CreatureAI | |
| CreatureAI (Creature *creature, uint32 scriptId={}) noexcept | |
| virtual | ~CreatureAI () |
| uint32 | GetId () const |
| bool | IsEngaged () const |
| void | Talk (uint8 id, WorldObject const *whisperTarget=nullptr) |
| void | MoveInLineOfSight_Safe (Unit *who) |
| == Reactions At ================================= | |
| void | TriggerAlert (Unit const *who) const |
| virtual void | JustStartedThreateningMe (Unit *who) |
| virtual void | JustEngagedWith (Unit *) |
| virtual void | OnHealthDepleted (Unit *, bool) |
| virtual void | JustDied (Unit *) |
| virtual void | JustSummoned (Creature *) |
| virtual void | IsSummonedBy (WorldObject *) |
| virtual void | SummonedCreatureDespawn (Creature *) |
| virtual void | SummonedCreatureDies (Creature *, Unit *) |
| virtual void | JustSummonedGameobject (GameObject *) |
| virtual void | SummonedGameobjectDespawn (GameObject *) |
| virtual void | JustRegisteredDynObject (DynamicObject *) |
| virtual void | JustUnregisteredDynObject (DynamicObject *) |
| virtual void | JustRegisteredAreaTrigger (AreaTrigger *) |
| virtual void | JustUnregisteredAreaTrigger (AreaTrigger *) |
| virtual void | SpellHit (WorldObject *, SpellInfo const *) |
| virtual void | SpellHitTarget (WorldObject *, SpellInfo const *) |
| virtual void | OnSpellCast (SpellInfo const *) |
| virtual void | OnSpellFailed (SpellInfo const *) |
| virtual void | OnSpellStart (SpellInfo const *) |
| virtual void | OnChannelFinished (SpellInfo const *) |
| virtual void | OnAuraApplied (AuraApplication const *) |
| virtual void | OnAuraRemoved (AuraApplication const *) |
| virtual bool | IsEscorted () const |
| virtual void | JustReachedHome () |
| void | DoZoneInCombat () |
| virtual void | CorpseRemoved (uint32 &) |
| == State checks ================================= | |
| virtual Optional< QuestGiverStatus > | GetDialogStatus (Player const *player) |
| == Gossip system ================================ | |
| virtual bool | OnGossipHello (Player *) |
| virtual bool | OnGossipSelect (Player *, uint32, uint32) |
| virtual bool | OnGossipSelectCode (Player *, uint32, uint32, char const *) |
| virtual void | OnQuestAccept (Player *, Quest const *) |
| virtual void | OnQuestReward (Player *, Quest const *, LootItemType, uint32) |
| virtual void | WaypointStarted (uint32, uint32) |
| == Waypoints system ============================= | |
| virtual void | WaypointReached (uint32, uint32) |
| virtual void | WaypointPathEnded (uint32, uint32) |
| virtual void | PassengerBoarded (Unit *, int8, bool) |
| == Fields ======================================= | |
| virtual void | OnSpellClick (Unit *, bool) |
| virtual bool | CanSeeAlways (WorldObject const *) |
| virtual PlayerAI * | GetAIForCharmedPlayer (Player *) |
| int32 | VisualizeBoundary (Seconds duration, Unit *owner=nullptr, bool fill=false) const |
| virtual bool | CheckInRoom () |
| CreatureBoundary const * | GetBoundary () const |
| void | SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false) |
| bool | IsInBoundary (Position const *who=nullptr) const |
Public Member Functions inherited from UnitAI | |
| UnitAI (Unit *unit) | |
| virtual | ~UnitAI () |
| virtual bool | CanAIAttack (Unit const *) const |
| virtual void | InitializeAI () |
| virtual void | Reset () |
| virtual void | DoAction (int32 param) |
| virtual uint32 | GetData (uint32 id) const |
| virtual void | SetData (uint32 id, uint32 value) |
| virtual void | SetGUID (ObjectGuid const &guid, int32 id) |
| virtual ObjectGuid | GetGUID (int32 id) const |
| Unit * | SelectTarget (SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0) |
| template<class PREDICATE > | |
| Unit * | SelectTarget (SelectTargetMethod targetType, uint32 offset, PREDICATE const &predicate) |
| void | SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 offset=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 offset, PREDICATE const &predicate) |
| virtual void | OnDespawn () |
| virtual void | DamageDealt (Unit *, uint32 &, DamageEffectType) |
| virtual void | HealReceived (Unit *, uint32 &) |
| virtual void | HealDone (Unit *, uint32 &) |
| virtual void | SpellInterrupted (uint32, uint32) |
| void | AttackStartCaster (Unit *victim, float dist) |
| SpellCastResult | DoCast (uint32 spellId) |
| SpellCastResult | DoCast (Unit *victim, uint32 spellId, CastSpellExtraArgs const &args={}) |
| SpellCastResult | DoCastSelf (uint32 spellId, CastSpellExtraArgs const &args={}) |
| SpellCastResult | DoCastVictim (uint32 spellId, CastSpellExtraArgs const &args={}) |
| SpellCastResult | DoCastAOE (uint32 spellId, CastSpellExtraArgs const &args={}) |
| bool | DoSpellAttackIfReady (uint32 spellId) |
| virtual void | OnGameEvent (bool, uint16) |
| virtual std::string | GetDebugInfo () const |
Static Public Member Functions | |
| static int32 | Permissible (Creature const *creature) |
Static Public Member Functions inherited from CreatureAI | |
| static void | DoZoneInCombat (Creature *creature) |
| static bool | IsInBounds (CreatureBoundary const &boundary, Position const *who) |
Static Public Member Functions inherited from UnitAI | |
| static void | FillAISpellInfo () |
Private Member Functions | |
| bool | NeedToStop () |
| void | StopAttack () |
| void | UpdateAllies () |
| Unit * | SelectNextTarget (bool allowAutoSelect) const |
| void | HandleReturnMovement () |
| void | DoAttack (Unit *target, bool chase) |
| bool | CanAttack (Unit *target) |
| void | ClearCharmInfoFlags () |
Private Attributes | |
| TimeTracker | _tracker |
| GuidSet | _allySet |
| uint32 | _updateAlliesTimer |
Additional Inherited Members | |
Static Public Attributes inherited from UnitAI | |
| static std::unordered_map< std::pair< uint32, Difficulty >, AISpellInfoType > | AISpellInfo |
Protected Member Functions inherited from CreatureAI | |
| bool | UpdateVictim () |
| Creature * | DoSummon (uint32 entry, Position const &pos, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN) |
| Creature * | DoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN) |
| Creature * | DoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN) |
| void | EngagementStart (Unit *who) |
| void | EngagementOver () |
| bool | _EnterEvadeMode (EvadeReason why=EvadeReason::Other) |
Protected Attributes inherited from CreatureAI | |
| Creature *const | me |
| CreatureBoundary const * | _boundary |
| bool | _negateBoundary |
Protected Attributes inherited from UnitAI | |
| Unit *const | me |
Definition at line 47 of file PetAI.cpp.
References Unit::GetCharmInfo(), CreatureAI::me, and UpdateAllies().
| void PetAI::_AttackStart | ( | Unit * | target | ) |
Definition at line 257 of file PetAI.cpp.
References CanAttack, COMMAND_STAY, DoAttack(), Unit::GetCharmInfo(), CharmInfo::HasCommandState(), CharmInfo::IsCommandAttack(), and CreatureAI::me.
Referenced by AttackStart().
|
overridevirtual |
== Triggered Actions Requested ==================
Reimplemented from CreatureAI.
Definition at line 245 of file PetAI.cpp.
References _AttackStart(), Unit::EnsureVictim(), Unit::GetVictim(), Unit::IsAlive(), and CreatureAI::me.
Referenced by KilledUnit(), OwnerAttacked(), OwnerAttackedBy(), and UpdateAI().
|
private |
Definition at line 473 of file PetAI.cpp.
References COMMAND_FOLLOW, COMMAND_STAY, Unit::GetCharmerOrOwner(), Unit::GetCharmInfo(), UnitAI::GetDebugInfo(), BaseEntity::GetGUID(), Unit::GetVictim(), Unit::HasBreakableByDamageCrowdControlAura(), CharmInfo::HasCommandState(), Creature::HasReactState(), Unit::IsAlive(), CharmInfo::IsCommandAttack(), CharmInfo::IsCommandFollow(), CharmInfo::IsReturning(), Unit::IsWithinMeleeRange(), CreatureAI::me, REACT_PASSIVE, TC_LOG_WARN, and Object::ToPlayer().
|
private |
Definition at line 640 of file PetAI.cpp.
References Unit::GetCharmInfo(), CreatureAI::me, CharmInfo::SetIsAtStay(), CharmInfo::SetIsCommandAttack(), CharmInfo::SetIsCommandFollow(), CharmInfo::SetIsFollowing(), and CharmInfo::SetIsReturning().
Referenced by DoAttack(), HandleReturnMovement(), MovementInform(), and StopAttack().
|
inlineoverridevirtual |
Reimplemented from UnitAI.
Definition at line 45 of file PetAI.h.
References CreatureAI::AttackStart().
|
private |
Definition at line 400 of file PetAI.cpp.
References Unit::Attack(), ClearCharmInfoFlags(), FOLLOW_MOTION_TYPE, Unit::GetCharmInfo(), BaseEntity::GetGUID(), Unit::GetMotionMaster(), Creature::GetPetChaseDistance(), Creature::HasReactState(), Unit::HasUnitState(), CharmInfo::IsCommandAttack(), M_PI, M_PI_4, CreatureAI::me, MotionMaster::MoveChase(), MotionMaster::MoveIdle(), REACT_AGGRESSIVE, MotionMaster::Remove(), Unit::SendPetAIReaction(), CharmInfo::SetIsAtStay(), CharmInfo::SetIsCommandAttack(), Unit::SetUnitFlag(), UNIT_FLAG_PET_IN_COMBAT, and UNIT_STATE_FOLLOW.
Referenced by _AttackStart().
|
inlineoverridevirtual |
Reimplemented from CreatureAI.
|
private |
Definition at line 352 of file PetAI.cpp.
References CHASE_MOTION_TYPE, ClearCharmInfoFlags(), COMMAND_STAY, Unit::GetCharmerOrOwner(), Unit::GetCharmInfo(), ObjectGuid::GetCounter(), UnitAI::GetDebugInfo(), Unit::GetFollowAngle(), BaseEntity::GetGUID(), Unit::GetMotionMaster(), CharmInfo::GetStayPosition(), CharmInfo::HasCommandState(), Unit::HasUnitState(), CharmInfo::IsAtStay(), CharmInfo::IsFollowing(), Unit::isPossessed(), CharmInfo::IsReturning(), CreatureAI::me, MotionMaster::MoveFollow(), MotionMaster::MovePoint(), PET_FOLLOW_DIST, MotionMaster::Remove(), Unit::RemoveUnitFlag(), CharmInfo::SetIsReturning(), TC_LOG_WARN, UNIT_FLAG_PET_IN_COMBAT, and UNIT_STATE_CHASE.
Referenced by KilledUnit(), StopAttack(), and UpdateAI().
|
inlineoverridevirtual |
Reimplemented from CreatureAI.
|
inlineoverridevirtual |
Reimplemented from CreatureAI.
Definition at line 47 of file PetAI.h.
References CreatureAI::EngagementStart().
|
inlineoverridevirtual |
Reimplemented from UnitAI.
Definition at line 48 of file PetAI.h.
References CreatureAI::EngagementOver().
|
overridevirtual |
Reimplemented from CreatureAI.
Definition at line 224 of file PetAI.cpp.
References AttackStart(), Unit::AttackStop(), Unit::GetVictim(), HandleReturnMovement(), Unit::InterruptNonMeleeSpells(), CreatureAI::me, and SelectNextTarget().
|
inlineoverridevirtual |
Reimplemented from CreatureAI.
Reimplemented from CreatureAI.
Definition at line 440 of file PetAI.cpp.
References ClearCharmInfoFlags(), FOLLOW_MOTION_TYPE, Unit::GetCharmerOrOwner(), Unit::GetCharmInfo(), ObjectGuid::GetCounter(), BaseEntity::GetGUID(), Unit::GetMotionMaster(), CharmInfo::IsReturning(), CreatureAI::me, MotionMaster::MoveIdle(), POINT_MOTION_TYPE, CharmInfo::SetIsAtStay(), and CharmInfo::SetIsFollowing().
Referenced by npc_snufflenose_gopher::npc_snufflenose_gopherAI::MovementInform().
|
private |
Definition at line 561 of file PetAI.cpp.
References Unit::GetCharmer(), Unit::GetCharmerOrOwner(), Unit::GetVictim(), Unit::IsCharmed(), WorldObject::IsValidAttackTarget(), and CreatureAI::me.
Referenced by UpdateAI().
|
overridevirtual |
Reimplemented from CreatureAI.
Definition at line 632 of file PetAI.cpp.
References Unit::GetCharmer(), Unit::GetFollowAngle(), Unit::GetMotionMaster(), Unit::IsCharmed(), Unit::isPossessedByPlayer(), CreatureAI::me, MotionMaster::MoveFollow(), CreatureAI::OnCharmed(), and PET_FOLLOW_DIST.
|
overridevirtual |
Reimplemented from CreatureAI.
Definition at line 287 of file PetAI.cpp.
References AttackStart(), Unit::EnsureVictim(), Unit::GetVictim(), Creature::HasReactState(), Unit::IsAlive(), CreatureAI::me, and REACT_PASSIVE.
|
overridevirtual |
Reimplemented from CreatureAI.
Definition at line 267 of file PetAI.cpp.
References AttackStart(), Unit::EnsureVictim(), Unit::GetVictim(), Creature::HasReactState(), Unit::IsAlive(), CreatureAI::me, and REACT_PASSIVE.
Definition at line 35 of file PetAI.cpp.
References Unit::HasUnitTypeMask(), PERMIT_BASE_NO, PERMIT_BASE_PROACTIVE, PERMIT_BASE_REACTIVE, TYPEID_PLAYER, and UNIT_MASK_CONTROLABLE_GUARDIAN.
Reimplemented from CreatureAI.
Definition at line 535 of file PetAI.cpp.
References EMOTE_ONESHOT_OMNICAST_GHOUL, EMOTE_STATE_STUN, BaseEntity::GetGUID(), Unit::GetOwnerGUID(), Unit::HandleEmoteCommand(), Unit::IsPet(), Minion::IsPetGhoul(), CreatureAI::me, TEXT_EMOTE_ANGRY, TEXT_EMOTE_COWER, TEXT_EMOTE_GLARE, TEXT_EMOTE_SOOTHE, and Unit::ToPet().
|
private |
Definition at line 308 of file PetAI.cpp.
References Unit::getAttackerForHelper(), Unit::GetCharmerOrOwner(), Unit::GetCharmInfo(), Unit::GetVictim(), Creature::HasReactState(), CharmInfo::IsAtStay(), CharmInfo::IsFollowing(), CharmInfo::IsReturning(), CreatureAI::me, REACT_AGGRESSIVE, REACT_PASSIVE, and Creature::SelectNearestHostileUnitInAggroRange().
Referenced by KilledUnit(), and UpdateAI().
|
private |
Definition at line 575 of file PetAI.cpp.
References Unit::AttackStop(), MotionMaster::Clear(), ClearCharmInfoFlags(), Unit::CombatStop(), Unit::GetCharmInfo(), Unit::GetMotionMaster(), HandleReturnMovement(), Unit::InterruptNonMeleeSpells(), Unit::IsAlive(), CreatureAI::me, MotionMaster::MoveIdle(), and CharmInfo::SetIsCommandAttack().
Referenced by UpdateAI().
|
overridevirtual |
Implements UnitAI.
Definition at line 55 of file PetAI.cpp.
References _allySet, _updateAlliesTimer, AttackStart(), CanAttack, Spell::CanAutoCast(), SpellInfo::CanBeUsedInCombat(), CURRENT_CHANNELED_SPELL, Unit::EnsureVictim(), Unit::getAttackerForHelper(), Unit::GetCharmerOrOwner(), Unit::GetCharmInfo(), Unit::GetCurrentSpell(), Map::GetDifficultyID(), BaseEntity::GetGUID(), WorldObject::GetMap(), Creature::GetPetAutoSpellOnPos(), Creature::GetPetAutoSpellSize(), Unit::GetSpellHistory(), ObjectAccessor::GetUnit(), Unit::GetVictim(), HandleReturnMovement(), Unit::HasBreakableByDamageCrowdControlAura(), SpellInfo::HasEffect(), SpellHistory::HasGlobalCooldown(), Creature::HasReactState(), Unit::HasUnitState(), Unit::InterruptNonMeleeSpells(), Unit::IsAlive(), CharmInfo::IsAtStay(), CharmInfo::IsCommandAttack(), Unit::IsInCombat(), SpellInfo::IsPositive(), SpellHistory::IsReady(), CreatureAI::me, MOVE_FLIGHT, MOVE_RUN, MOVE_WALK, NeedToStop(), Spell::prepare(), REACT_AGGRESSIVE, SelectNextTarget(), SpellCastTargets::SetUnitTarget(), SPELL_EFFECT_JUMP_DEST, sSpellMgr, StopAttack(), TC_LOG_TRACE, ObjectGuid::ToString(), TRIGGERED_NONE, UNIT_STATE_CASTING, UpdateAllies(), Unit::UpdateSpeed(), and urand().
Referenced by npc_snufflenose_gopher::npc_snufflenose_gopherAI::UpdateAI().
|
private |
Definition at line 592 of file PetAI.cpp.
References _allySet, _updateAlliesTimer, Unit::GetCharmerOrOwner(), BaseEntity::GetGUID(), Group::GetMembers(), Group::GetMembersCount(), IN_MILLISECONDS, WorldObject::IsInMap(), Group::isRaidGroup(), CreatureAI::me, Group::SameSubGroup(), and Object::ToPlayer().
Referenced by PetAI(), and UpdateAI().
|
private |
Definition at line 71 of file PetAI.h.
Referenced by UpdateAI(), and UpdateAllies().
|
private |
|
private |
Definition at line 72 of file PetAI.h.
Referenced by UpdateAI(), and UpdateAllies().