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);
144 void AttackStartNoMove(
Unit* target);
147 virtual void UpdateAI(
uint32 diff)
override;
161 void AttackStart(
Unit* )
override;
168 void DoStartMovement(
Unit* target,
float distance = 0.0f,
float angle = 0.0f);
171 void DoStartNoMovement(
Unit* target);
177 void DoCastSpell(
Unit* target,
SpellInfo const* spellInfo,
bool triggered =
false);
183 void AddThreat(
Unit* victim,
float amount,
Unit* who =
nullptr);
185 void ModifyThreatByPercent(
Unit* victim,
int32 pct,
Unit* who =
nullptr);
187 void ResetThreat(
Unit* victim,
Unit* who =
nullptr);
189 void ResetThreatList(
Unit* who =
nullptr);
191 float GetThreat(
Unit const* victim,
Unit const* who =
nullptr);
193 void ForceCombatStop(
Creature* who,
bool reset =
true);
195 void ForceCombatStopForCreatureEntry(
uint32 entry,
float maxSearchRange = 250.0f,
bool samePhase =
true,
bool reset =
true);
197 void ForceCombatStopForCreatureEntry(std::vector<uint32> creatureEntries,
float maxSearchRange = 250.0f,
bool samePhase =
true,
bool reset =
true);
199 void DoTeleportTo(
float x,
float y,
float z,
uint32 time = 0);
200 void DoTeleportTo(
float const pos[4]);
203 void DoTeleportPlayer(
Unit* unit,
float x,
float y,
float z,
float o);
204 void DoTeleportAll(
float x,
float y,
float z,
float o);
207 Unit* DoSelectLowestHpFriendly(
float range,
uint32 minHPDiff = 1);
210 Unit* DoSelectBelowHpPctFriendlyWithEntry(
uint32 entry,
float range,
uint8 hpPct = 1,
bool excludeSelf =
true);
213 std::list<Creature*> DoFindFriendlyCC(
float range);
216 std::list<Creature*> DoFindFriendlyMissingBuff(
float range,
uint32 spellId);
219 Player* GetPlayerAtMinimumRange(
float minRange);
224 bool HealthBelowPct(
uint32 pct)
const;
225 bool HealthAbovePct(
uint32 pct)
const;
237 void SetCombatMovement(
bool allowMovement);
241 bool IsNormal()
const;
242 bool IsHeroic()
const;
243 bool IsMythic()
const;
244 bool IsMythicPlus()
const;
245 bool IsHeroicOrHigher()
const;
246 bool IsTimewalking()
const;
255 inline T
const&
DUNGEON_MODE(T
const& normal5, T
const& heroic10)
const
271 inline T
const&
RAID_MODE(T
const& normal10, T
const& normal25)
const
287 inline T
const&
RAID_MODE(T
const& normal10, T
const& normal25, T
const& heroic10, T
const& heroic25)
const
319 void JustSummoned(
Creature* summon)
override;
320 void SummonedCreatureDespawn(
Creature* summon)
override;
322 virtual void UpdateAI(
uint32 diff)
override;
337 bool CanAIAttack(
Unit const* target)
const override;
343 void _JustEngagedWith(
Unit* who);
345 void _JustReachedHome();
346 void _DespawnAtEvade(
Seconds delayToRespawn = 30s,
Creature* who =
nullptr);
348 void TeleportCheaters();
364 void JustSummoned(
Creature* summon)
override;
365 void SummonedCreatureDespawn(
Creature* summon)
override;
367 virtual void UpdateAI(
uint32 diff)
override;
381 void _JustEngagedWith();
404template <
typename Container>
410template <
typename Container>
416template <
typename Container>
422template <
typename Container>
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::milliseconds Milliseconds
Milliseconds 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