60 _castId(castId), _spellInfo(spellInfo), _castDifficulty(castDifficulty), _auraEffectMask(auraEffMask), _owner(owner)
71_flags(
AFLAG_NONE), _effectsToApply(effMask), _needClientUpdate(false), _effectMask(0)
80 if (slot < visibleAura->
GetSlot())
119 bool negativeFound =
false;
124 negativeFound =
true;
134 bool positiveFound =
false;
139 positiveFound =
true;
146 auto effectNeedsAmount = [
this](
AuraEffect const* effect)
152 || std::find_if(
GetBase()->GetAuraEffects().begin(),
GetBase()->GetAuraEffects().end(), std::cref(effectNeedsAmount)) !=
GetBase()->GetAuraEffects().end())
161 TC_LOG_ERROR(
"spells",
"Aura {} has no effect at effectIndex {} but _HandleEffect was called",
GetBase()->GetSpellInfo()->Id,
uint32(effIndex));
202 if (
HasEffect(i) && (removeEffMask & (1 << i)))
207 if (canHandleNewEffects)
209 if (addEffMask & (1 << i))
263 bool hasEstimatedAmounts =
false;
266 if (effect &&
HasEffect(effect->GetEffIndex()))
269 if (effect->GetEstimatedAmount())
270 hasEstimatedAmounts =
true;
273 if (hasEstimatedAmounts)
278 if (effect &&
HasEffect(effect->GetEffIndex()))
279 auraData.
EstimatedPoints[effect->GetEffIndex()] = effect->GetEstimatedAmount().value_or(effect->GetAmount());
294 update.
Auras.push_back(auraInfo);
301 std::stringstream sstr;
318 if (spellEffectInfo.IsUnitOwnedAuraEffect())
319 effMask |= 1 << spellEffectInfo.EffectIndex;
326 effMask |= 1 << spellEffectInfo.EffectIndex;
334 return effMask & availableEffectMask;
358 if (foundAura->IsRemoved())
368 if (updateEffectMask)
370 aurApp->UpdateApplyEffectMask(effMask,
false);
374 return Create(createInfo);
387 return Create(createInfo);
403 else if (createInfo.
Caster)
408 if (!ownerUnit->IsInWorld() || ownerUnit->IsDuringRemoveFromWorld())
413 Aura* aura =
nullptr;
456m_spellInfo(createInfo._spellInfo), m_castDifficulty(createInfo._castDifficulty), m_castId(createInfo._castId), m_casterGuid(createInfo.CasterGUID),
457m_castItemGuid(createInfo.CastItemGUID), m_castItemId(createInfo.CastItemId),
459m_applyTime(
GameTime::GetGameTime()), m_owner(createInfo._owner), m_timeCla(0), m_updateTargetMapInterval(0),
460m_casterLevel(createInfo.Caster ? createInfo.Caster->GetLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
461m_isRemoved(
false), m_isSingleTarget(
false), m_isUsingCharges(
false), m_dropEvent(
nullptr),
462m_procCooldown(TimePoint::min()),
467 m_periodicCosts.push_back(power);
469 if (!m_periodicCosts.empty())
472 m_maxDuration = CalcMaxDuration(createInfo.Caster);
473 m_duration = m_maxDuration;
474 m_procCharges = CalcMaxCharges(createInfo.Caster);
475 m_isUsingCharges = m_procCharges != 0;
482 if (
typeid(*script) == type)
493 if (effMask & (1 << spellEffectInfo.EffectIndex))
494 _effects[spellEffectInfo.EffectIndex] =
new AuraEffect(
this, spellEffectInfo, baseAmount ? baseAmount + spellEffectInfo.EffectIndex :
nullptr, caster);
573 TC_LOG_ERROR(
"spells",
"Aura::_UnapplyForTarget, target: {}, caster: {}, spell:{} was not found in owners application map!",
579 ASSERT(itr->second == auraApp);
585 if (caster &&
GetSpellInfo()->IsCooldownStartedOnEvent())
623 std::unordered_map<Unit*, uint32> targets;
627 std::vector<Unit*> targetsToRemove;
632 auto itr = targets.find(applicationPair.second->GetTarget());
634 if (itr == targets.end())
635 targetsToRemove.push_back(applicationPair.second->GetTarget());
642 targetsToRemove.push_back(applicationPair.second->GetTarget());
648 if (itr->first->IsImmunedToSpellEffect(
GetSpellInfo(), spellEffectInfo, caster,
true))
649 itr->second &= ~(1 << spellEffectInfo.EffectIndex);
652 if (applicationPair.second->GetEffectMask() != itr->second)
662 for (
auto itr = targets.begin(); itr != targets.end();)
670 if (itr->first->IsImmunedToSpellEffect(
GetSpellInfo(), spellEffectInfo, caster))
671 itr->second &= ~(1 << spellEffectInfo.EffectIndex);
677 if (addUnit && !itr->first->IsHighestExclusiveAura(
this,
true))
692 for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
694 Aura const* aura = iter->second->GetBase();
705 itr = targets.erase(itr);
712 TC_LOG_FATAL(
"spells",
"Aura {}: Owner {} (map {}) is not in the same map as target {} (map {}).",
GetSpellInfo()->Id,
714 itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() :
uint32(-1));
721 itr = targets.erase(itr);
725 itr->first->_CreateAuraApplication(
this, itr->second);
732 for (
Unit* unit : targetsToRemove)
740 for (
auto itr = targets.begin(); itr!= targets.end(); ++itr)
746 itr->first->_ApplyAura(aurApp, itr->second);
758 if ((appIter->second->GetEffectsToApply() & (1 << effIndex)) && !appIter->second->HasEffect(effIndex))
759 targetList.push_back(appIter->second->GetTarget());
763 for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
769 (*itr)->_ApplyAuraEffect(
this, effIndex);
780 Spell* modSpell =
nullptr;
781 Player* modOwner =
nullptr;
803 effect->Update(diff, caster);
852 else if (
int32(caster->
GetPower(powertype)) >= manaPerSecond)
871 Player* modOwner =
nullptr;
886 if (maxDuration != -1 && modOwner)
906 if (withMods && caster)
925 aurEff->ResetTicks();
936 resetPeriodicTimer =
false;
947 aurEff->CalculatePeriodic(caster, resetPeriodicTimer,
false);
964 maxProcCharges = procEntry->Charges;
970 return uint8(maxProcCharges);
981 if ((num > 0) && (charges >
int32(maxCharges)))
982 charges = maxCharges;
984 else if (charges <= 0)
1021 std::vector<AuraApplication*> applications;
1025 if (!aurApp->GetRemoveMode())
1030 aurEff->ChangeAmount(aurEff->CalculateAmount(caster),
false,
true);
1033 if (!aurApp->GetRemoveMode())
1051 return maxStackAmount;
1060 if ((num > 0) && (stackAmount > maxStackAmount))
1069 else if (stackAmount <= 0)
1096 if (
HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.ApplyAuraName == auraType)
1105 if (
HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.IsAreaAuraEffect())
1143 if (!spellEffectInfo.IsEffect())
1146 if (spellEffectInfo.IsTargetingArea() || spellEffectInfo.IsAreaAuraEffect())
1202 int32 resistChance = 0;
1210 return 100 - resistChance;
1220 recalculateMask = 0;
1226 if (effect->CanBeRecalculated())
1227 recalculateMask |= 1 << i;
1247 effect->SetAmount(amount[effect->GetEffIndex()]);
1248 effect->SetCanBeRecalculated((recalculateMask & (1 << effect->GetEffIndex())) != 0);
1249 effect->CalculatePeriodic(caster,
false,
true);
1250 effect->CalculateSpellMod();
1251 effect->RecalculateAmount(caster);
1259 if (effect && effect->GetAuraType() == type)
1289 effect->RecalculateAmount(caster);
1297 effect->HandleEffect(aurApp, mode,
apply);
1305 effMask |= 1 << aurEff->GetEffIndex();
1313 if (!applicationPair.second->GetEffectMask())
1316 applications.push_back(applicationPair.second);
1338 appIter->second->SetNeedClientUpdate();
1348 if (saBounds.first != saBounds.second)
1353 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1361 if (!target->
HasAura(itr->second->spellId))
1376 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1381 caster->
AddAura(*itr, target);
1390 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1402 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1417 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1420 triggeredAura->ModStackAmount(
GetStackAmount() - triggeredAura->GetStackAmount());
1506 if (
AuraEffect const* aurEff = aura->GetEffect(0))
1508 float multiplier = float(aurEff->GetAmount());
1519 if (
GetId() == 1784)
1536 if (owner->HasAura(34692))
1539 owner->CastSpell(owner, 34471,
GetEffect(0));
1541 owner->RemoveAurasDueToSpell(34471);
1595 if (
this == existingAura)
1616 if (spellEffectInfo.TriggerSpell ==
GetId())
1623 if (spellEffectInfo.TriggerSpell == existingAura->
GetId())
1661 auto hasPeriodicNonAreaEffect = [](
SpellInfo const* spellInfo)
1663 for (
SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
1665 switch (spellEffectInfo.ApplyAuraName)
1682 if (spellEffectInfo.IsTargetingArea())
1692 if (hasPeriodicNonAreaEffect(
m_spellInfo) && hasPeriodicNonAreaEffect(existingSpellInfo))
1852 if (!spell->m_appliedMods.count(
const_cast<Aura*
>(
this)))
1876 if (procEffectMask & (1u << i))
1878 procEffectMask &= ~(1u << i);
1880 if (!procEffectMask)
1896 Item* item =
nullptr;
1904 if (damageInfo->GetAttackType() !=
OFF_ATTACK)
1938 return procEffectMask;
1945 float chance = procEntry.
Chance;
1967 chance = std::max(0.f, (1.f - ((eventInfo.
GetActor()->
GetLevel() - 60) * 1.f / 30.f)) * chance);
1981 if (!(procEffectMask & (1 << i)))
1998 using FSeconds = std::chrono::duration<float, Seconds::period>;
2002 float averageProcInterval = 60.0f / ppm;
2005 float secondsSinceLastAttempt = std::min(std::chrono::duration_cast<FSeconds>(currentTime -
m_lastProcAttemptTime).count(), 10.0f);
2006 float secondsSinceLastProc = std::min(std::chrono::duration_cast<FSeconds>(currentTime -
m_lastProcSuccessTime).count(), 1000.0f);
2008 float chance = std::max(1.0f, 1.0f + ((secondsSinceLastProc / averageProcInterval - 1.5f) * 3.0f)) * ppm * secondsSinceLastAttempt / 60.0f;
2010 return chance * 100.0f;
2026 TC_LOG_DEBUG(
"spells",
"Aura::LoadScripts: Script `{}` for aura `{}` is loaded now", script->GetScriptName(),
m_spellInfo->
Id);
2038 result &= checkAreaTarget.
Call(script, target);
2040 script->_FinishScriptCall();
2051 onDispel.
Call(script, dispelInfo);
2053 script->_FinishScriptCall();
2063 afterDispel.
Call(script, dispelInfo);
2065 script->_FinishScriptCall();
2071 bool preventDefault =
false;
2077 onEffectApply.
Call(script, aurEff, mode);
2079 if (!preventDefault)
2080 preventDefault = script->_IsDefaultActionPrevented();
2082 script->_FinishScriptCall();
2085 return preventDefault;
2090 bool preventDefault =
false;
2096 onEffectRemove.
Call(script, aurEff, mode);
2098 if (!preventDefault)
2099 preventDefault = script->_IsDefaultActionPrevented();
2101 script->_FinishScriptCall();
2103 return preventDefault;
2113 afterEffectApply.
Call(script, aurEff, mode);
2115 script->_FinishScriptCall();
2126 afterEffectRemove.
Call(script, aurEff, mode);
2128 script->_FinishScriptCall();
2134 bool preventDefault =
false;
2140 onEffectPeriodic.
Call(script, aurEff);
2142 if (!preventDefault)
2143 preventDefault = script->_IsDefaultActionPrevented();
2145 script->_FinishScriptCall();
2148 return preventDefault;
2158 onEffectUpdatePeriodic.
Call(script, aurEff);
2160 script->_FinishScriptCall();
2171 effectCalcAmount.
Call(script, aurEff, amount, canBeRecalculated);
2173 script->_FinishScriptCall();
2184 effectCalcPeriodic.
Call(script, aurEff, isPeriodic, amplitude);
2186 script->_FinishScriptCall();
2197 effectCalcSpellMod.
Call(script, aurEff, spellMod);
2199 script->_FinishScriptCall();
2210 effectCalcCritChance.
Call(script, aurEff, victim, critChance);
2212 script->_FinishScriptCall();
2223 effectCalcDamageAndHealing.
Call(script, aurEff, victim, damageOrHealing, flatMod, pctMod);
2225 script->_FinishScriptCall();
2236 onEffectAbsorb.
Call(script, aurEff, dmgInfo, absorbAmount);
2238 if (!defaultPrevented)
2239 defaultPrevented = script->_IsDefaultActionPrevented();
2241 script->_FinishScriptCall();
2252 afterEffectAbsorb.
Call(script, aurEff, dmgInfo, absorbAmount);
2254 script->_FinishScriptCall();
2265 onEffectAbsorbHeal.
Call(script, aurEff, healInfo, absorbAmount);
2267 if (!defaultPrevented)
2268 defaultPrevented = script->_IsDefaultActionPrevented();
2270 script->_FinishScriptCall();
2281 afterEffectAbsorbHeal.
Call(script, aurEff, healInfo, absorbAmount);
2283 script->_FinishScriptCall();
2294 onEffectManaShield.
Call(script, aurEff, dmgInfo, absorbAmount);
2296 if (!defaultPrevented)
2297 defaultPrevented = script->_IsDefaultActionPrevented();
2299 script->_FinishScriptCall();
2310 afterEffectManaShield.
Call(script, aurEff, dmgInfo, absorbAmount);
2312 script->_FinishScriptCall();
2323 effectSplit.
Call(script, aurEff, dmgInfo, splitAmount);
2325 script->_FinishScriptCall();
2335 onEnterLeaveCombat.
Call(script, isNowInCombat);
2337 script->_FinishScriptCall();
2348 result &= checkProc.
Call(script, eventInfo);
2350 script->_FinishScriptCall();
2358 bool prepare =
true;
2363 prepareProc.
Call(script, eventInfo);
2366 prepare = !script->_IsDefaultActionPrevented();
2368 script->_FinishScriptCall();
2376 bool handled =
false;
2381 onProc.
Call(script, eventInfo);
2383 handled |= script->_IsDefaultActionPrevented();
2384 script->_FinishScriptCall();
2396 afterProc.
Call(script, eventInfo);
2398 script->_FinishScriptCall();
2410 result &= checkEffectProc.
Call(script, aurEff, eventInfo);
2412 script->_FinishScriptCall();
2420 bool preventDefault =
false;
2426 onEffectProc.
Call(script, aurEff, eventInfo);
2428 if (!preventDefault)
2429 preventDefault = script->_IsDefaultActionPrevented();
2431 script->_FinishScriptCall();
2433 return preventDefault;
2443 afterEffectProc.
Call(script, aurEff, eventInfo);
2445 script->_FinishScriptCall();
2451 std::stringstream sstr;
2452 sstr << std::boolalpha
2506 if (!target && targetPair.first ==
GetUnitOwner()->GetGUID())
2510 targets.emplace(target, targetPair.second);
2515 if (!
HasEffect(spellEffectInfo.EffectIndex))
2529 std::vector<WorldObject*> units;
2532 float radius = spellEffectInfo.CalcRadius(ref);
2533 float extraSearchRadius = 0.0f;
2536 switch (spellEffectInfo.Effect)
2560 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(owner, ref, *condList))
2561 units.push_back(owner);
2567 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(pet, ref, *condList))
2568 units.push_back(pet);
2598 targets[
static_cast<Unit*
>(unit)] |= 1 << spellEffectInfo.EffectIndex;
2608 effMask &= ~(1 << spellEffectInfo.EffectIndex);
2643 if (!
HasEffect(spellEffectInfo.EffectIndex))
2649 selectionType = spellEffectInfo.TargetB.GetCheckType();
2651 std::vector<Unit*> units;
2659 units.erase(std::remove_if(units.begin(), units.end(), [
this](
Unit* unit) { return !unit->IsSelfOrInSameMap(GetDynobjOwner()); }), units.end());
2661 for (
Unit* unit : units)
2662 targets[unit] |= 1 << spellEffectInfo.EffectIndex;
std::vector< Condition > ConditionContainer
@ CONDITION_SOURCE_TYPE_SPELL_PROC
#define MAX_SPELL_EFFECTS
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define ASSERT_NODEBUGINFO
#define ASSERT_NOTNULL(pointer)
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_FATAL(filterType__,...)
#define EXTRA_CELL_SEARCH_RADIUS
@ EQUIPMENT_SLOT_MAINHAND
#define INVENTORY_SLOT_BAG_0
bool roll_chance_f(float chance)
@ SPELL_ATTR11_SCALES_WITH_ITEM_LEVEL
@ SPELL_ATTR7_CAN_PROC_FROM_SUPPRESSED_TARGET_PROCS
@ SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD
@ SPELL_ATTR5_DO_NOT_DISPLAY_DURATION
@ SPELL_ATTR5_AURA_UNIQUE_PER_CASTER
@ SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED_CASTER_FORM
@ SPELL_ATTR2_NO_TARGET_PER_SECOND_COSTS
@ SPELL_ATTR1_AURA_UNIQUE
@ SPELL_ATTR3_SUPPRESS_TARGET_PROCS
@ SPELL_ATTR3_ONLY_PROC_ON_CASTER
@ SPELL_ATTR3_DOT_STACKING_RULE
@ SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT
@ SPELL_ATTR3_CAN_PROC_FROM_PROCS
@ SPELL_ATTR3_ONLY_PROC_OUTDOORS
@ SPELL_ATTR3_SUPPRESS_CASTER_PROCS
@ SPELL_EFFECT_APPLY_AREA_AURA_PARTY
@ SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
@ SPELL_EFFECT_APPLY_AREA_AURA_PARTY_NONRANDOM
@ SPELL_EFFECT_APPLY_AURA_ON_PET
@ SPELL_EFFECT_APPLY_AREA_AURA_PET
@ SPELL_EFFECT_APPLY_AREA_AURA_RAID
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
@ SPELL_EFFECT_APPLY_AREA_AURA_SUMMONS
@ SPELL_EFFECT_APPLY_AURA
@ SPELL_EFFECT_APPLY_AREA_AURA_OWNER
@ SPELL_ATTR0_NOT_SHAPESHIFTED
@ SPELL_ATTR12_ONLY_PROC_FROM_CLASS_ABILITIES
@ SPELL_ATTR12_CAN_PROC_FROM_SUPPRESSED_CASTER_PROCS
@ SPELL_ATTR12_ENABLE_PROCS_FROM_SUPPRESSED_CASTER_PROCS
@ SPELL_ATTR13_ALLOW_CLASS_ABILITY_PROCS
@ SPELL_ATTR13_PERIODIC_REFRESH_EXTENDS_DURATION
@ SPELL_ATTR4_SUPPRESS_WEAPON_PROCS
@ SPELL_ATTR4_ALLOW_PROC_WHILE_SITTING
@ SPELL_ATTR8_HASTE_AFFECTS_DURATION
@ SPELL_ATTR8_AURA_POINTS_ON_CLIENT
@ SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES
@ SPELL_ATTR6_AURA_IS_WEAPON_PROC
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_ENEMY_SPELL
@ SPELL_AURA_PERIODIC_WEAPON_PERCENT_DAMAGE
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_OBS_MOD_HEALTH
@ SPELL_AURA_SHOW_CONFIRMATION_PROMPT_WITH_DIFFICULTY
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_CHARGE_RECOVERY_MOD
@ SPELL_AURA_OBS_MOD_POWER
@ SPELL_AURA_CONTROL_VEHICLE
@ SPELL_AURA_PERIODIC_HEAL
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
@ SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_TRIGGERED
@ SPELL_AURA_MOD_SPELL_CATEGORY_COOLDOWN
@ SPELL_AURA_CHARGE_RECOVERY_MULTIPLIER
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
@ SPELL_AURA_PERIODIC_ENERGIZE
@ SPELL_AURA_PERIODIC_LEECH
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_MOD_MAX_CHARGES
@ SPELL_AURA_SHOW_CONFIRMATION_PROMPT
@ SPELL_AURA_SUPPRESS_ITEM_PASSIVE_EFFECT_BY_SPELL_LABEL
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS
#define UPDATE_TARGET_MAP_INTERVAL
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TARGET_OBJECT_TYPE_UNIT
@ SPELL_ATTR0_CU_ENCHANT_PROC
@ SPELL_ATTR0_CU_DONT_BREAK_STEALTH
@ SPELL_ATTR0_CU_AURA_CANNOT_BE_SAVED
@ SPELL_SPECIFIC_MAGE_POLYMORPH
@ TARGET_REFERENCE_TYPE_DEST
@ PROC_ATTR_CANT_PROC_FROM_ITEM_CAST
@ PROC_ATTR_USE_STACKS_FOR_CHARGES
@ PROC_ATTR_REDUCE_PROC_60
@ PROC_ATTR_TRIGGERED_CAN_PROC
std::pair< SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator > SpellAreaForAreaMapBounds
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE
@ SPELL_GROUP_STACK_RULE_DEFAULT
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST
@ SPELL_AREA_FLAG_AUTOREMOVE
@ SPELL_AREA_FLAG_AUTOCAST
@ AUTO_ATTACK_PROC_FLAG_MASK
@ TAKEN_HIT_PROC_FLAG_MASK
@ AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC
@ AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC
@ AURA_SCRIPT_HOOK_EFFECT_CALC_DAMAGE_AND_HEALING
@ AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT
@ AURA_SCRIPT_HOOK_EFFECT_REMOVE
@ AURA_SCRIPT_HOOK_EFFECT_CALC_CRIT_CHANCE
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD
@ AURA_SCRIPT_HOOK_PREPARE_PROC
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE
@ AURA_SCRIPT_HOOK_AFTER_PROC
@ AURA_SCRIPT_HOOK_CHECK_AREA_TARGET
@ AURA_SCRIPT_HOOK_EFFECT_MANASHIELD
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB
@ AURA_SCRIPT_HOOK_DISPEL
@ AURA_SCRIPT_HOOK_EFFECT_APPLY
@ AURA_SCRIPT_HOOK_EFFECT_PERIODIC
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC
@ AURA_SCRIPT_HOOK_EFFECT_ABSORB
@ AURA_SCRIPT_HOOK_EFFECT_PROC
@ AURA_SCRIPT_HOOK_EFFECT_SPLIT
@ AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD
@ AURA_SCRIPT_HOOK_AFTER_DISPEL
@ AURA_SCRIPT_HOOK_CHECK_PROC
@ AURA_SCRIPT_HOOK_ENTER_LEAVE_COMBAT
@ AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC
std::list< Unit * > UnitList
T RoundToInterval(T &num, T floor, T ceil)
T CalculatePct(T base, U pct)
void BuildUpdatePacket(WorldPackets::Spells::AuraInfo &auraInfo, bool remove)
std::string GetDebugInfo() const
void ClientUpdate(bool remove=false)
void _HandleEffect(uint8 effIndex, bool apply)
void _InitFlags(Unit *caster, uint32 effMask)
AuraApplication(Unit *target, Unit *caster, Aura *base, uint32 effMask)
uint32 GetEffectsToApply() const
void UpdateApplyEffectMask(uint32 newEffMask, bool canHandleNewEffects)
void SetNeedClientUpdate()
uint32 GetEffectMask() const
AuraRemoveMode GetRemoveMode() const
bool HasEffect(uint8 effect) const
AuraType GetAuraType() const
SpellEffIndex GetEffIndex() const
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply, AuraEffect const *triggeredBy=nullptr)
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
bool CheckEffectProc(AuraApplication *aurApp, ProcEventInfo &eventInfo) const
void Call(AuraScript *auraScript, DispelInfo *dispelInfo) const
void Call(AuraScript *auraScript, ProcEventInfo &eventInfo) const
bool Call(AuraScript *auraScript, Unit *target) const
bool Call(AuraScript *auraScript, AuraEffect const *aurEff, ProcEventInfo &eventInfo) const
bool Call(AuraScript *auraScript, ProcEventInfo &eventInfo) const
void Call(AuraScript *auraScript, AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &absorbAmount) const
void Call(AuraScript *auraScript, AuraEffect *aurEff, HealInfo &healInfo, uint32 &absorbAmount) const
void Call(AuraScript *auraScript, AuraEffect const *aurEff, AuraEffectHandleModes mode) const
void Call(AuraScript *auraScript, AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated) const
void Call(AuraScript *auraScript, AuraEffect const *aurEff, Unit const *victim, float &critChance) const
void Call(AuraScript *auraScript, AuraEffect const *aurEff, Unit *victim, int32 &damageOrHealing, int32 &flatMod, float &pctMod) const
void Call(AuraScript *auraScript, AuraEffect const *aurEff, bool &isPeriodic, int32 &periodicTimer) const
void Call(AuraScript *auraScript, AuraEffect const *aurEff, SpellModifier *&spellMod) const
void Call(AuraScript *auraScript, AuraEffect const *aurEff) const
void Call(AuraScript *auraScript, AuraEffect *aurEff, ProcEventInfo &eventInfo) const
void Call(AuraScript *auraScript, AuraEffect *aurEff) const
void Call(AuraScript *auraScript, bool isNowInCombat) const
void HandleAllEffects(AuraApplication *aurApp, uint8 mode, bool apply)
bool HasMoreThanOneEffectForType(AuraType auraType) const
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
void CallScriptEffectCalcCritChanceHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, Unit const *victim, float &critChance)
ObjectGuid GetCastId() const
static Aura * Create(AuraCreateInfo &createInfo)
bool CheckAreaTarget(Unit *target)
int32 GetMaxDuration() const
void CallScriptEffectAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
virtual std::string GetDebugInfo() const
Trinity::unique_trackable_ptr< Aura > m_scriptRef
void DropChargeDelayed(uint32 delay, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
static Aura * TryCreate(AuraCreateInfo &createInfo)
void CallScriptDispel(DispelInfo *dispelInfo)
static Aura * TryRefreshStackOrCreate(AuraCreateInfo &createInfo, bool updateEffectMask=true)
void SetStackAmount(uint8 num)
int32 GetCastItemLevel() const
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
void CallScriptCalcDamageAndHealingHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, Unit *victim, int32 &damageOrHealing, int32 &flatMod, float &pctMod)
AuraEffectVector _effects
Unit * GetUnitOwner() const
void SetLastProcAttemptTime(TimePoint lastProcAttemptTime)
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
bool IsUsingStacks() const
void RefreshDuration(bool withMods=false)
float CalcPPMProcChance(Unit *actor) const
DynamicObject * GetDynobjOwner() const
bool CallScriptCheckAreaTargetHandlers(Unit *target)
bool CallScriptEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
void CallScriptAfterProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
ObjectGuid GetCasterGUID() const
bool HasEffect(uint8 effIndex) const
AuraEffectVector const & GetAuraEffects() const
void SetLoadedState(int32 maxDuration, int32 duration, int32 charges, uint8 stackAmount, uint32 recalculateMask, int32 *amount)
void RefreshTimers(bool resetPeriodicTimer)
void _InitEffects(uint32 effMask, Unit *caster, int32 const *baseAmount)
void PrepareProcToTrigger(AuraApplication *aurApp, ProcEventInfo &eventInfo, TimePoint now)
std::vector< AuraApplication * > _removedApplications
void Update(uint32 diff, Unit *caster)
uint32 GetProcEffectMask(AuraApplication *aurApp, ProcEventInfo &eventInfo, TimePoint now) const
uint8 GetCasterLevel() const
WorldObject * GetOwner() const
bool IsSingleTargetWith(Aura const *aura) const
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
bool CanStackWith(Aura const *existingAura) const
int32 CalcDispelChance(Unit const *auraTarget, bool offensive) const
void GetApplicationVector(std::vector< AuraApplication * > &applications) const
bool IsAppliedOnTarget(ObjectGuid guid) const
void CallScriptAfterEffectProcHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
ApplicationMap m_applications
void AddProcCooldown(SpellProcEntry const *procEntry, TimePoint now)
int32 GetDuration() const
bool IsUsingCharges() const
void UpdateOwner(uint32 diff, WorldObject *owner)
void UnregisterSingleTarget()
bool IsDeathPersistent() const
bool CallScriptPrepareProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void PrepareProcChargeDrop(SpellProcEntry const *procEntry, ProcEventInfo const &eventInfo)
void ConsumeProcCharges(SpellProcEntry const *procEntry)
bool HasEffectType(AuraType type) const
AuraEffect * GetEffect(uint32 index) const
TimePoint m_lastProcSuccessTime
uint32 CalcMaxStackAmount() const
ObjectGuid const m_castItemGuid
void CallScriptAfterEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void SetCharges(uint8 charges)
virtual void FillTargetMap(std::unordered_map< Unit *, uint32 > &targets, Unit *caster)=0
bool CallScriptCheckProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
bool CallScriptEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void CallScriptAfterEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
std::vector< AuraScript * > m_loadedScripts
void UpdateTargetMap(Unit *caster, bool apply=true)
void SetNeedClientUpdateForTargets() const
void CallScriptEnterLeaveCombatHandlers(AuraApplication const *aurApp, bool isNowInCombat)
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool resetPeriodicTimer=true)
int32 CalcMaxDuration() const
void SetDuration(int32 duration, bool withMods=false)
bool CallScriptProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void TriggerProcOnEvent(uint32 procEffectMask, AuraApplication *aurApp, ProcEventInfo &eventInfo)
float CalcProcChance(SpellProcEntry const &procEntry, ProcEventInfo &eventInfo) const
void CallScriptEffectAfterAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
void CallScriptEffectManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
SpellInfo const *const m_spellInfo
TimePoint m_lastProcAttemptTime
void CallScriptEffectSplitHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &splitAmount)
AuraObjectType GetType() const
uint8 GetStackAmount() const
void _ApplyEffectForTargets(uint8 effIndex)
WorldObject *const m_owner
SpellInfo const * GetSpellInfo() const
bool CallScriptEffectProcHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
ObjectGuid GetCastItemGUID() const
uint32 GetEffectMask() const
bool IsRemovedOnShapeLost(Unit *target) const
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &litude)
static bool EffectTypeNeedsSendingAmount(AuraType type)
void SetMaxDuration(int32 duration)
bool CanBeAppliedOn(Unit *target)
WorldObject * GetWorldObjectCaster() const
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
void SetLastProcSuccessTime(TimePoint lastProcSuccessTime)
bool IsProcOnCooldown(TimePoint now) const
void SetIsSingleTarget(bool val)
void _DeleteRemovedApplications()
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
bool CallScriptCheckEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void ModChargesDelayed(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
uint8 CalcMaxCharges() const
static uint32 BuildEffectMaskForOwner(SpellInfo const *spellProto, uint32 availableEffectMask, WorldObject *owner)
void CallScriptEffectUpdatePeriodicHandlers(AuraEffect *aurEff)
void RecalculateAmountOfEffects()
AuraScript * GetScriptByType(std::type_info const &type) const
Aura(AuraCreateInfo const &createInfo)
std::vector< SpellPowerEntry const * > m_periodicCosts
int32 m_updateTargetMapInterval
void CallScriptEffectAfterManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
AuraKey GenerateKey(uint32 &recalculateMask) const
Fills a helper structure containing aura primary key for character_aura, character_aura_effect,...
ChargeDropEvent * m_dropEvent
SpellCastVisual GetSpellVisual() const
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void CallScriptAfterDispel(DispelInfo *dispelInfo)
void _Remove(AuraRemoveMode removeMode)
bool IsSingleTarget() const
ChargeDropEvent(Aura *base, AuraRemoveMode mode)
bool Execute(uint64, uint32) override
WeaponAttackType GetAttackType() const
void FillTargetMap(std::unordered_map< Unit *, uint32 > &targets, Unit *caster) override
DynObjAura(AuraCreateInfo const &createInfo)
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT) override
void AddEvent(BasicEvent *event, Milliseconds e_time, bool set_addtime=true)
Milliseconds CalculateTime(Milliseconds t_offset) const
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
static ObjectGuid const Empty
std::string ToString() const
static Unit * ToUnit(Object *o)
static ObjectGuid GetGUID(Object const *o)
static Player * ToPlayer(Object *o)
static PhaseShift const & GetAlwaysVisiblePhaseShift()
void SetSpellModTakingSpell(Spell *spell, bool apply)
void ApplySpellMod(SpellInfo const *spellInfo, SpellModOp op, T &basevalue, Spell *spell=nullptr) const
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Item * GetItemByGuid(ObjectGuid guid) const
Unit * GetActionTarget() const
Spell const * GetProcSpell() const
SpellInfo const * GetSpellInfo() const
ProcFlagsInit GetTypeMask() const
DamageInfo * GetDamageInfo() const
void AddCooldown(uint32 spellId, uint32 itemId, Duration cooldownDuration)
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool startCooldown=true)
void ResetCooldown(uint32 spellId, bool update=false)
Duration GetRemainingCooldown(SpellInfo const *spellInfo) const
void StartCooldown(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool onHold=false, Optional< Duration > forcedCooldown={})
bool HasCooldown(SpellInfo const *spellInfo, uint32 itemId=0) const
uint32 GetSpellXSpellVisualId(WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
bool IsRankOf(SpellInfo const *spellInfo) const
float CalcProcPPM(Unit *caster, int32 itemLevel) const
bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const *spellInfo) const
bool IsDeathPersistent() const
bool IsCooldownStartedOnEvent() const
bool IsAuraExclusiveBySpecificWith(SpellInfo const *spellInfo) const
SpellSpecificType GetSpellSpecific() const
bool IsMultiSlotAura() const
int32 GetMaxDuration() const
bool HasAttribute(SpellAttr0 attribute) const
SpellDurationEntry const * DurationEntry
int32 GetDuration() const
std::vector< SpellEffectInfo > const & GetEffects() const
bool IsDifferentRankOf(SpellInfo const *spellInfo) const
LocalizedString const * SpellName
bool HasAura(AuraType aura) const
bool IsPositiveEffect(uint8 effIndex) const
bool IsSingleTarget() const
static bool CanSpellTriggerProcOnEvent(SpellProcEntry const &procEntry, ProcEventInfo &eventInfo)
bool IsEffectAffected(SpellInfo const *spellInfo, uint8 effIndex) const
static uint32 GetSearcherTypeMask(SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, SpellTargetObjectTypes objType, ConditionContainer const *condList)
static void SearchTargets(SEARCHER &searcher, uint32 containerMask, WorldObject *referer, Position const *pos, float radius)
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT) override
DiminishingGroup m_AuraDRGroup
void FillTargetMap(std::unordered_map< Unit *, uint32 > &targets, Unit *caster) override
void AddStaticApplication(Unit *target, uint32 effMask)
DiminishingGroup GetDiminishGroup() const
void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *aurApp) override
UnitAura(AuraCreateInfo const &createInfo)
std::unordered_map< ObjectGuid, uint32 > _staticApplications
void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *aurApp) override
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
int64 ModifyHealth(int64 val)
uint32 GetCastSpellXSpellVisualId(SpellInfo const *spellInfo) const override
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
void RemoveVisibleAura(AuraApplication *aurApp)
Aura * AddAura(uint32 spellId, Unit *target)
std::string GetDebugInfo() const override
bool HasVisibleAura(AuraApplication *aurApp) const
int32 GetMaxPower(Powers power) const
bool IsStandState() const
bool IsDuringRemoveFromWorld() const
uint64 GetMaxHealth() const
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
void _AddAura(UnitAura *aura, Unit *caster)
int32 GetPower(Powers power) const
bool IsInFeralForm() const
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
SpellHistory * GetSpellHistory()
void SetVisibleAura(AuraApplication *aurApp)
void SetVisibleAuraUpdate(AuraApplication *aurApp)
void ApplyDiminishingAura(DiminishingGroup group, bool apply)
AuraList & GetSingleCastAuras()
Vehicle * GetVehicleKit() const
Aura * GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
void RemoveAurasWithFamily(SpellFamilyNames family, flag128 const &familyFlag, ObjectGuid casterGUID)
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Aura * _TryStackingOrRefreshingExistingAura(AuraCreateInfo &createInfo)
uint8 GetAvailableSeatCount() const
Gets the available seat count.
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
std::string GetDebugInfo() const override
int32 CalcSpellDuration(SpellInfo const *spellInfo, std::vector< SpellPowerCost > const *powerCosts) const
bool IsSelfOrInSameMap(WorldObject const *obj) const
Player * GetSpellModOwner() const
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
bool IsFriendlyTo(WorldObject const *target) const
WorldPacket const * Write() override
std::vector< AuraInfo > Auras
TC_GAME_API uint32 GetId(std::string_view username)
TC_GAME_API bool GetName(uint32 accountId, std::string &name)
TimePoint Now()
Current chrono steady_clock time point.
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
std::list< T, Alloc >::iterator RemoveUnique(std::list< T, Alloc > &list, T const &value)
decltype(auto) EnsureWritableVectorIndex(std::vector< T > &vec, typename std::vector< T >::size_type i)
auto MapGetValuePtr(M &map, typename M::key_type const &key)
void EraseIf(Container &c, Predicate p)
constexpr std::size_t size()
SpellInfo const * _spellInfo
AuraCreateInfo(ObjectGuid castId, SpellInfo const *spellInfo, Difficulty castDifficulty, uint32 auraEffMask, WorldObject *owner)
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
int32 RequiredAuraSpellID
uint32 DisableEffectsMask
ProcAttributes AttributesMask
PhaseShift const * i_phaseShift
std::vector< float > EstimatedPoints
Optional< int32 > Duration
Optional< ObjectGuid > CastUnit
std::vector< float > Points
Optional< int32 > Remaining
Optional< AuraDataInfo > AuraData