54 && (!entry || summon->
GetEntry() == entry))
68 else if (summon->
GetEntry() == entry)
105 if (summon && summon->
GetEntry() == entry)
191 TC_LOG_ERROR(
"scripts.ai",
"ScriptedAI::DoPlaySoundToSet: Invalid soundId {} used in DoPlaySoundToSet (Source: {})", soundId, source->
GetGUID().
ToString());
266 std::list<Creature*> creatures;
278 for (
Creature* creature : creatures)
284 for (
uint32 const entry : creatureEntries)
364 if (!tempSpell || !aiSpell)
369 if (targets && !(aiSpell->
Targets & (1 << (targets-1))))
373 if (effect && !(aiSpell->
Effects & (1 << (effect-1))))
377 if (school && (tempSpell->
SchoolMask & school) == 0)
381 if (mechanic && tempSpell->
Mechanic != mechanic)
385 bool hasPower =
true;
409 apSpell[spellCount] = tempSpell;
417 return apSpell[
urand(0, spellCount - 1)];
423 float speed =
me->
GetDistance(x, y, z) / ((float)time * 0.001f);
440 TC_LOG_ERROR(
"scripts.ai",
"ScriptedAI::DoTeleportPlayer: Creature {} Tried to teleport non-player unit ({}) to x: {} y:{} z: {} o: {}. Aborted.",
451 if (
Player* player = mapref.GetSource())
452 if (player->IsAlive())
458 Unit* unit =
nullptr;
468 Unit* unit =
nullptr;
478 std::list<Creature*> list;
488 std::list<Creature*> list;
592 Unit* target = pair.second->GetOther(
me);
635 if (delayToRespawn < 2s)
637 TC_LOG_ERROR(
"scripts.ai",
"BossAI::_DespawnAtEvade: called with delay of {} seconds, defaulting to 2 (me: {})", delayToRespawn.count(),
me->
GetGUID().
ToString());
647 whoSummon->UnSummon();
AISpellInfoType * GetAISpellInfo(uint32 spellId, Difficulty difficulty)
const uint32 MAX_CREATURE_SPELLS
DB2Storage< SoundKitEntry > sSoundKitStore("SoundKit.db2", &SoundKitLoadInfo::Instance)
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define TC_LOG_DEBUG(filterType__, message__,...)
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_WARN(filterType__, message__,...)
@ TELE_TO_NOT_LEAVE_COMBAT
uint32 urand(uint32 min, uint32 max)
@ SPELL_SCHOOL_MASK_MAGIC
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_NONE
Not triggered.
InstanceScript *const instance
void _JustEngagedWith(Unit *who)
void JustSummoned(Creature *summon) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
bool CanAIAttack(Unit const *target) const override
virtual void UpdateAI(uint32 diff) override
virtual void ExecuteEvent(uint32)
void SummonedCreatureDespawn(Creature *summon) override
BossAI(Creature *creature, uint32 bossId)
virtual void ScheduleTasks()
std::unordered_map< ObjectGuid, CombatReference * > const & GetPvECombatRefs() const
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool IsInBoundary(Position const *who=nullptr) const
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
bool LoadCreaturesAddon()
bool IsTapListNotClearedOnEvade() const
int8 GetOriginalEquipmentId() const
void StartDefaultCombatMovement(Unit *victim, Optional< float > range={}, Optional< float > angle={})
uint32 m_spells[MAX_CREATURE_SPELLS]
void SetLastDamagedTime(time_t val)
void LoadEquipment(int8 id=1, bool force=false)
void DoNotReacquireSpellFocusTarget()
bool IsEngaged() const override
void ResetPlayerDamageReq()
void SetCannotReachTarget(bool cannotReach)
void SetTappedBy(Unit const *unit, bool withGroup=true)
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
std::string GetDebugInfo() const override
virtual bool SetBossState(uint32 id, EncounterState state)
CreatureBoundary const * GetBossBoundary(uint32 id) const
EncounterState GetBossState(uint32 id) const
virtual bool CheckRequiredBosses(uint32, Player const *=nullptr) const
bool IsMythicPlus() const
bool IsTimewalking() const
bool IsHeroicOrHigher() const
Difficulty GetDifficultyID() const
PlayerList const & GetPlayers() const
std::string ToString() const
static ObjectGuid GetGUID(Object const *o)
static Player * ToPlayer(Object *o)
static void SetAlwaysVisible(WorldObject *object, bool apply, bool updateVisibility)
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
SpellSchoolMask GetSchoolMask() const
bool HasEntry(uint32 entry) const
void Despawn(Creature const *summon)
void DespawnEntry(uint32 entry)
void Summon(Creature const *summon)
void DoZoneInCombat(uint32 entry=0)
void DoActionImpl(int32 action, StorageType &summons, uint16 max)
TaskScheduler & CancelAll()
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
void ModifyThreatByPercent(Unit *target, int32 percent)
void ResetThreat(Unit *target)
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
float GetThreat(Unit const *who, bool includeOffline=false) const
virtual void DoAction(int32)
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
bool HealthAbovePct(int32 pct) const
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
void SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId=0, uint16 itemVisual=0)
ThreatManager & GetThreatManager()
MotionMaster * GetMotionMaster()
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
bool IsSilenced(SpellSchoolMask schoolMask) const
TempSummon * ToTempSummon()
bool HealthBelowPct(int32 pct) const
bool Attack(Unit *victim, bool meleeAttack)
void NearTeleportTo(Position const &pos, bool casting=false)
int32 GetPower(Powers power) const
bool HasUnitState(const uint32 f) const
bool IsControlledByPlayer() const
CombatManager & GetCombatManager()
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
virtual void UpdateAI(uint32 diff) override
virtual void ExecuteEvent(uint32)
void JustSummoned(Creature *summon) override
WorldBossAI(Creature *creature)
void SummonedCreatureDespawn(Creature *summon) override
constexpr uint32 GetMapId() const
void PlayDirectSound(uint32 soundId, Player const *target=nullptr, uint32 broadcastTextId=0) const
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
void setActive(bool isActiveObject)
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
float GetSpellMinRangeForTarget(Unit const *target, SpellInfo const *spellInfo) const
float GetDistance(WorldObject const *obj) const
float GetSpellMaxRangeForTarget(Unit const *target, SpellInfo const *spellInfo) const
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void RandomResize(C &container, std::size_t requestedSize)
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
constexpr float GetPositionX() const
constexpr float GetPositionY() const
constexpr void GetPosition(float &x, float &y) const
constexpr void Relocate(float x, float y)
constexpr float GetPositionZ() const
void DoStartNoMovement(Unit *target)
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
void ForceCombatStop(Creature *who, bool reset=true)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void SetCombatMovement(bool allowMovement)
bool IsCombatMovementAllowed() const
bool HealthAbovePct(uint32 pct) const
Unit * DoSelectLowestHpFriendly(float range, uint32 minHPDiff=1)
bool IsTimewalking() const
void DoTeleportTo(float x, float y, float z, uint32 time=0)
float GetThreat(Unit const *victim, Unit const *who=nullptr)
Player * GetPlayerAtMinimumRange(float minRange)
bool _isCombatMovementAllowed
bool IsMythicPlus() const
void DoTeleportPlayer(Unit *unit, float x, float y, float z, float o)
void DoTeleportAll(float x, float y, float z, float o)
bool HealthBelowPct(uint32 pct) const
SpellInfo const * SelectSpell(Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, float rangeMin, float rangeMax, SelectEffect effect)
void DoCastSpell(Unit *target, SpellInfo const *spellInfo, bool triggered=false)
void ModifyThreatByPercent(Unit *victim, int32 pct, Unit *who=nullptr)
void AttackStartNoMove(Unit *target)
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)
std::list< Creature * > DoFindFriendlyMissingBuff(float range, uint32 spellId)
void ResetThreat(Unit *victim, Unit *who=nullptr)
bool IsHeroicOrHigher() const
void ForceCombatStopForCreatureEntry(uint32 entry, float maxSearchRange=250.0f, bool samePhase=true, bool reset=true)
std::list< Creature * > DoFindFriendlyCC(float range)
ScriptedAI(Creature *creature)
Unit * DoSelectBelowHpPctFriendlyWithEntry(uint32 entry, float range, uint8 hpPct=1, bool excludeSelf=true)
void ResetThreatList(Unit *who=nullptr)
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
virtual void UpdateAI(uint32 diff) override