18#ifndef TRINITY_SPELLAURAS_H
19#define TRINITY_SPELLAURAS_H
28struct ProcTriggerSpell;
54#define UPDATE_TARGET_MAP_INTERVAL 500
74 void _HandleEffect(
uint8 effIndex,
bool apply);
88 void UpdateApplyEffectMask(
uint32 newEffMask,
bool canHandleNewEffects);
93 void SetNeedClientUpdate();
96 void ClientUpdate(
bool remove =
false);
126 static Aura* TryRefreshStackOrCreate(
AuraCreateInfo& createInfo,
bool updateEffectMask =
true);
130 void _InitEffects(
uint32 effMask,
Unit* caster,
int32 const* baseAmount);
144 Unit* GetCaster()
const;
158 void UpdateTargetMap(
Unit* caster,
bool apply =
true);
162 void _ApplyEffectForTargets(
uint8 effIndex);
171 int32 CalcMaxDuration(
Unit* caster)
const;
172 static int32 CalcMaxDuration(
SpellInfo const* spellInfo,
WorldObject const* caster, std::vector<SpellPowerCost>
const* powerCosts);
174 void SetDuration(
int32 duration,
bool withMods =
false);
175 void RefreshDuration(
bool withMods =
false);
176 void RefreshTimers(
bool resetPeriodicTimer);
177 bool IsExpired()
const {
return !GetDuration() && !m_dropEvent; }
181 void SetCharges(
uint8 charges);
182 uint8 CalcMaxCharges(
Unit* caster)
const;
190 void SetStackAmount(
uint8 num);
192 uint32 CalcMaxStackAmount()
const;
193 bool IsUsingStacks()
const;
197 bool HasMoreThanOneEffectForType(
AuraType auraType)
const;
199 bool IsPassive()
const;
200 bool IsDeathPersistent()
const;
202 bool IsRemovedOnShapeLost(
Unit* target)
const;
204 bool CanBeSaved()
const;
208 bool IsSingleTargetWith(
Aura const* aura)
const;
210 void UnregisterSingleTarget();
211 int32 CalcDispelChance(
Unit const* auraTarget,
bool offensive)
const;
226 bool HasEffectType(
AuraType type)
const;
227 static bool EffectTypeNeedsSendingAmount(
AuraType type);
229 uint32 GetEffectMask()
const;
230 void RecalculateAmountOfEffects();
235 void GetApplicationVector(std::vector<AuraApplication*>& applications)
const;
238 bool IsAppliedOnTarget(
ObjectGuid guid)
const;
240 void SetNeedClientUpdateForTargets()
const;
242 bool CanBeAppliedOn(
Unit* target);
243 bool CheckAreaTarget(
Unit* target);
244 bool CanStackWith(
Aura const* existingAura)
const;
246 bool IsProcOnCooldown(
TimePoint now)
const;
248 void ResetProcCooldown();
257 float CalcPPMProcChance(
Unit* actor)
const;
263 bool CallScriptCheckAreaTargetHandlers(
Unit* target);
264 void CallScriptDispel(
DispelInfo* dispelInfo);
265 void CallScriptAfterDispel(
DispelInfo* dispelInfo);
271 void CallScriptEffectUpdatePeriodicHandlers(
AuraEffect* aurEff);
272 void CallScriptEffectCalcAmountHandlers(
AuraEffect const* aurEff,
int32& amount,
bool& canBeRecalculated);
273 void CallScriptEffectCalcPeriodicHandlers(
AuraEffect const* aurEff,
bool& isPeriodic,
int32& amplitude);
284 void CallScriptEnterLeaveCombatHandlers(
AuraApplication const* aurApp,
bool isNowInCombat);
300 template <
class Script>
303 return static_cast<Script*
>(GetScriptByType(
typeid(
Script)));
321 AuraScript* GetScriptByType(std::type_info
const& type)
const;
322 void _DeleteRemovedApplications();
378 void FillTargetMap(std::unordered_map<Unit*, uint32>& targets,
Unit* caster)
override;
384 void AddStaticApplication(
Unit* target,
uint32 effMask);
397 DynObjAura(
SpellInfo const* spellproto,
ObjectGuid castId,
uint32 effMask,
WorldObject* owner,
Unit* caster,
Difficulty castDifficulty,
int32 *baseAmount,
Item* castItem,
ObjectGuid casterGUID,
ObjectGuid castItemGuid,
uint32 castItemId,
int32 castItemLevel);
401 void FillTargetMap(std::unordered_map<Unit*, uint32>& targets,
Unit* caster)
override;
#define MAX_SPELL_EFFECTS
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
std::string GetDebugInfo()
std::vector< AuraEffect * > AuraEffectVector
void SetRemoveMode(AuraRemoveMode mode)
bool IsNeedClientUpdate() const
uint32 GetEffectsToApply() const
uint32 GetEffectMask() const
AuraRemoveMode GetRemoveMode() const
bool HasEffect(uint8 effect) const
AuraRemoveMode _removeMode
Aura & operator=(Aura &&)=delete
ObjectGuid GetCastId() const
static Aura * Create(AuraCreateInfo &createInfo)
int32 GetMaxDuration() const
Trinity::unique_trackable_ptr< Aura > m_scriptRef
UnitAura const * ToUnitAura() const
ApplicationMap const & GetApplicationMap()
int32 GetCastItemLevel() const
AuraEffectVector _effects
Unit * GetUnitOwner() const
void SetLastProcAttemptTime(TimePoint lastProcAttemptTime)
DynamicObject * GetDynobjOwner() const
void SetUsingCharges(bool val)
void _RegisterForTargets()
ObjectGuid GetCasterGUID() const
bool HasEffect(uint8 effIndex) const
AuraEffectVector const & GetAuraEffects() const
std::vector< AuraApplication * > _removedApplications
uint8 GetCasterLevel() const
WorldObject * GetOwner() const
Aura(Aura const &)=delete
void SaveCasterInfo(Unit *caster)
ApplicationMap m_applications
int32 GetDuration() const
bool IsUsingCharges() const
uint32 GetCastItemId() const
TimePoint m_lastProcSuccessTime
ObjectGuid const m_castItemGuid
virtual void FillTargetMap(std::unordered_map< Unit *, uint32 > &targets, Unit *caster)=0
DynObjAura * ToDynObjAura()
std::vector< AuraScript * > m_loadedScripts
int32 CalcMaxDuration() const
SpellInfo const *const m_spellInfo
TimePoint m_lastProcAttemptTime
ObjectGuid const m_castId
uint8 GetStackAmount() const
Aura & operator=(Aura const &)=delete
Trinity::unique_weak_ptr< Aura > GetWeakPtr() const
WorldObject *const m_owner
SpellInfo const * GetSpellInfo() const
ObjectGuid GetCastItemGUID() const
void SetMaxDuration(int32 duration)
ObjectGuid const m_casterGuid
uint8 const m_casterLevel
Script * GetScript() const
void SetLastProcSuccessTime(TimePoint lastProcSuccessTime)
Difficulty GetCastDifficulty() const
void SetIsSingleTarget(bool val)
uint8 CalcMaxCharges() const
time_t GetApplyTime() const
std::vector< SpellPowerEntry const * > m_periodicCosts
int32 m_updateTargetMapInterval
Difficulty const m_castDifficulty
DynObjAura const * ToDynObjAura() const
std::unordered_map< ObjectGuid, AuraApplication * > ApplicationMap
SpellCastVisual const m_spellVisual
ChargeDropEvent * m_dropEvent
SpellCastVisual GetSpellVisual() const
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
bool DropCharge(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
bool IsSingleTarget() const
DynObjAura(SpellInfo const *spellproto, ObjectGuid castId, uint32 effMask, WorldObject *owner, Unit *caster, Difficulty castDifficulty, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint32 castItemId, int32 castItemLevel)
Trinity::unique_trackable_ptr< Object > m_scriptRef
Trinity::unique_trackable_ptr companion class, replicating what std::weak_ptr is to std::shared_ptr.
DiminishingGroup m_AuraDRGroup
void SetDiminishGroup(DiminishingGroup group)
DiminishingGroup GetDiminishGroup() const
std::unordered_map< ObjectGuid, uint32 > _staticApplications
std::unique_ptr< VignetteData > Create(VignetteEntry const *vignetteData, WorldObject const *owner)
void Update(VignetteData &vignette, WorldObject const *owner)
void Remove(VignetteData &vignette, WorldObject const *owner)
friend std::strong_ordering operator<=>(AuraKey const &left, AuraKey const &right)=default
std::array< int32, MAX_SPELL_EFFECTS > BaseAmounts
std::array< int32, MAX_SPELL_EFFECTS > Amounts
void operator()(Aura *) const