18#ifndef TRINITY_SCRIPTEDCREATURE_H
19#define TRINITY_SCRIPTEDCREATURE_H
47 return _storage.begin();
52 return _storage.begin();
57 return _storage.end();
62 return _storage.end();
67 return _storage.erase(i);
72 return _storage.empty();
77 return _storage.size();
88 void DespawnEntry(
uint32 entry);
94 _storage.remove_if(predicate);
97 template <
class Predicate>
102 std::copy_if(std::begin(_storage), std::end(_storage), std::inserter(listCopy, std::end(listCopy)), predicate);
103 DoActionImpl(info, listCopy, max);
106 void DoZoneInCombat(
uint32 entry = 0);
107 void RemoveNotExisting();
108 bool HasEntry(
uint32 entry)
const;
111 void DoActionImpl(
int32 action, StorageType& summons,
uint16 max);
143 void AttackStartNoMove(
Unit* target);
146 virtual void UpdateAI(
uint32 diff)
override;
157 void AttackStart(
Unit* )
override;
164 void DoStartMovement(
Unit* target,
float distance = 0.0f,
float angle = 0.0f);
167 void DoStartNoMovement(
Unit* target);
173 void DoCastSpell(
Unit* target,
SpellInfo const* spellInfo,
bool triggered =
false);
179 void AddThreat(
Unit* victim,
float amount,
Unit* who =
nullptr);
181 void ModifyThreatByPercent(
Unit* victim,
int32 pct,
Unit* who =
nullptr);
183 void ResetThreat(
Unit* victim,
Unit* who =
nullptr);
185 void ResetThreatList(
Unit* who =
nullptr);
187 float GetThreat(
Unit const* victim,
Unit const* who =
nullptr);
189 void ForceCombatStop(
Creature* who,
bool reset =
true);
191 void ForceCombatStopForCreatureEntry(
uint32 entry,
float maxSearchRange = 250.0f,
bool samePhase =
true,
bool reset =
true);
193 void ForceCombatStopForCreatureEntry(std::vector<uint32> creatureEntries,
float maxSearchRange = 250.0f,
bool samePhase =
true,
bool reset =
true);
195 void DoTeleportTo(
float x,
float y,
float z,
uint32 time = 0);
196 void DoTeleportTo(
float const pos[4]);
199 void DoTeleportPlayer(
Unit* unit,
float x,
float y,
float z,
float o);
200 void DoTeleportAll(
float x,
float y,
float z,
float o);
203 Unit* DoSelectLowestHpFriendly(
float range,
uint32 minHPDiff = 1);
206 Unit* DoSelectBelowHpPctFriendlyWithEntry(
uint32 entry,
float range,
uint8 hpPct = 1,
bool excludeSelf =
true);
209 std::list<Creature*> DoFindFriendlyCC(
float range);
212 std::list<Creature*> DoFindFriendlyMissingBuff(
float range,
uint32 spellId);
215 Player* GetPlayerAtMinimumRange(
float minRange);
220 bool HealthBelowPct(
uint32 pct)
const;
221 bool HealthAbovePct(
uint32 pct)
const;
233 void SetCombatMovement(
bool allowMovement);
237 bool IsNormal()
const;
238 bool IsHeroic()
const;
239 bool IsMythic()
const;
240 bool IsMythicPlus()
const;
241 bool IsHeroicOrHigher()
const;
242 bool IsTimewalking()
const;
251 inline T
const&
DUNGEON_MODE(T
const& normal5, T
const& heroic10)
const
267 inline T
const&
RAID_MODE(T
const& normal10, T
const& normal25)
const
283 inline T
const&
RAID_MODE(T
const& normal10, T
const& normal25, T
const& heroic10, T
const& heroic25)
const
315 void JustSummoned(
Creature* summon)
override;
316 void SummonedCreatureDespawn(
Creature* summon)
override;
318 virtual void UpdateAI(
uint32 diff)
override;
333 bool CanAIAttack(
Unit const* target)
const override;
339 void _JustEngagedWith(
Unit* who);
341 void _JustReachedHome();
342 void _DespawnAtEvade(
Seconds delayToRespawn = 30s,
Creature* who =
nullptr);
344 void TeleportCheaters();
360 void JustSummoned(
Creature* summon)
override;
361 void SummonedCreatureDespawn(
Creature* summon)
override;
363 virtual void UpdateAI(
uint32 diff)
override;
377 void _JustEngagedWith();
400template <
typename Container>
406template <
typename Container>
412template <
typename Container>
418template <
typename Container>
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::list< ObjectGuid > GuidList
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
void GetCreatureListWithOptionsInGrid(Container &container, WorldObject *source, float maxSearchRange, FindCreatureOptions const &options)
void GetPlayerListInGrid(Container &container, WorldObject *source, float maxSearchRange, bool alive=true)
Creature * GetClosestCreatureWithOptions(WorldObject *source, float maxSearchRange, FindCreatureOptions const &options)
GameObject * GetClosestGameObjectWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool spawnedOnly=true)
Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive=true)
void GetGameObjectListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
virtual void ExecuteEvent(uint32)
void JustReachedHome() override
virtual void ScheduleTasks()
bool operator()(ObjectGuid const &) const
EntryCheckPredicate(uint32 entry)
bool operator()(ObjectGuid const &guid) const
iterator erase(iterator i)
StorageType::const_iterator const_iterator
void DespawnIf(T const &predicate)
StorageType::size_type size_type
SummonList(Creature *creature)
StorageType::value_type value_type
const_iterator begin() const
const_iterator end() const
StorageType::iterator iterator
void DoAction(int32 info, Predicate &&predicate, uint16 max=0)
void JustDied(Unit *) override
virtual void ExecuteEvent(uint32)
void JustEngagedWith(Unit *) override
void GetPlayerListInGrid(Container &playerContainer, float maxSearchRange, bool alive=true) const
GameObject * FindNearestGameObject(uint32 entry, float range, bool spawnedOnly=true) const
Creature * FindNearestCreatureWithOptions(float range, FindCreatureOptions const &options) const
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
void GetGameObjectListWithEntryInGrid(Container &gameObjectContainer, uint32 entry, float maxSearchRange=250.0f) const
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
void GetCreatureListWithOptionsInGrid(Container &creatureContainer, float maxSearchRange, FindCreatureOptions const &options) const
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const
bool IsCombatMovementAllowed() const
T const & RAID_MODE(T const &normal10, T const &normal25) const
bool _isCombatMovementAllowed
Difficulty GetDifficulty() const
T const & RAID_MODE(T const &normal10, T const &normal25, T const &heroic10, T const &heroic25) const