61 && (!entry || summon->
GetEntry() == entry))
75 else if (summon->
GetEntry() == entry)
112 if (summon && summon->
GetEntry() == entry)
200 TC_LOG_ERROR(
"scripts.ai",
"ScriptedAI::DoPlaySoundToSet: Invalid soundId {} used in DoPlaySoundToSet (Source: {})", soundId, source->
GetGUID().
ToString());
272 std::list<Creature*> creatures;
281 for (
Creature* creature : creatures)
287 for (
uint32 const entry : creatureEntries)
327 tempSpell =
sSpellMgr->GetSpellInfo(spell);
339 if (effects && !(
SpellSummary[spell].Effects & (1 << (effects-1))))
343 if (school && (tempSpell->
SchoolMask & school) == 0)
347 if (mechanic && tempSpell->
Mechanic != mechanic)
351 if (powerCostMin && tempSpell->
ManaCost < powerCostMin)
354 if (powerCostMax && tempSpell->
ManaCost > powerCostMax)
372 apSpell[spellCount] = tempSpell;
380 return apSpell[
urand(0, spellCount - 1)];
386 float speed =
me->
GetDistance(x, y, z) / ((float)time * 0.001f);
403 TC_LOG_ERROR(
"scripts.ai",
"ScriptedAI::DoTeleportPlayer: Creature {} Tried to teleport non-player unit ({}) to x: {} y:{} z: {} o: {}. Aborted.",
414 if (
Player* player = mapref.GetSource())
415 if (player->IsAlive())
421 Unit* unit =
nullptr;
431 Unit* unit =
nullptr;
441 std::list<Creature*> list;
451 std::list<Creature*> list;
572 Unit* target = pair.second->GetOther(
me);
617 if (delayToRespawn < 2s)
619 TC_LOG_ERROR(
"scripts.ai",
"BossAI::_DespawnAtEvade: called with delay of {} seconds, defaulting to 2 (me: {})", delayToRespawn.count(),
me->
GetGUID().
ToString());
629 whoSummon->UnSummon();
static const uint32 MAX_CREATURE_SPELLS
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define TC_LOG_WARN(filterType__,...)
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
@ TELE_TO_NOT_LEAVE_COMBAT
uint32 urand(uint32 min, uint32 max)
TSpellSummary * SpellSummary
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
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
@ EVADE_REASON_SEQUENCE_BREAK
void DoZoneInCombat(Creature *creature=nullptr)
bool IsInBoundary(Position const *who=nullptr) const
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
bool LoadCreaturesAddon()
void SetCombatPulseDelay(uint32 delay)
int8 GetOriginalEquipmentId() const
uint32 m_spells[MAX_CREATURE_SPELLS]
void SetLootRecipient(Unit *unit, bool withGroup=true)
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 DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
std::string GetDebugInfo() const override
void AddEvent(BasicEvent *event, Milliseconds e_time, bool set_addtime=true)
Milliseconds CalculateTime(Milliseconds t_offset) const
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
uint8 GetSpawnMode() const
PlayerList const & GetPlayers() const
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
static ObjectGuid const Empty
std::string ToString() const
static ObjectGuid GetGUID(Object const *o)
static Player * ToPlayer(Object *o)
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)
void DoMeleeAttackIfReady()
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
virtual void AttackStart(Unit *)
bool HealthAbovePct(int32 pct) const
ThreatManager & GetThreatManager()
void StopMoving(bool force=false)
MotionMaster * GetMotionMaster()
bool HasUnitFlag(UnitFlags flags) const
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
TempSummon * ToTempSummon()
void SetVirtualItem(uint32 slot, uint32 itemId)
bool HealthBelowPct(int32 pct) const
bool Attack(Unit *victim, bool meleeAttack)
void NearTeleportTo(Position const &pos, bool casting=false)
bool HasUnitState(const uint32 f) const
bool IsControlledByPlayer() const
uint32 GetPower(Powers power) const
void CombatStop(bool includingCast=false, bool mutualPvP=true)
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
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
void PlayDirectSound(uint32 soundId, Player *target=nullptr)
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)
float GetPositionZ() const
float GetPositionX() const
void GetPosition(float &x, float &y) const
float GetPositionY() const
void Relocate(float x, float y)
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
void SetCombatMovement(bool allowMovement)
bool IsCombatMovementAllowed() const
bool HealthAbovePct(uint32 pct) const
Unit * DoSelectLowestHpFriendly(float range, uint32 minHPDiff=1)
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
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, uint32 powerCostMin, uint32 powerCostMax, 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)
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 DoAddEvent(Milliseconds timer, BasicEvent *event, WorldObject *who=nullptr)
void ResetThreatList(Unit *who=nullptr)
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void SetAggressiveStateAfter(Milliseconds timer, Creature *who=nullptr, bool startCombat=true, Creature *summoner=nullptr, StartCombatArgs const &combatArgs={ })
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