63 _castId(castId), _spellInfo(spellInfo), _castDifficulty(castDifficulty), _auraEffectMask(auraEffMask), _owner(owner)
74_flags(
AFLAG_NONE), _effectsToApply(effMask), _needClientUpdate(false), _effectMask(0)
83 if (slot < visibleAura->
GetSlot())
122 bool negativeFound =
false;
127 negativeFound =
true;
137 bool positiveFound =
false;
142 positiveFound =
true;
149 auto effectNeedsAmount = [
this](
AuraEffect const* effect)
155 || std::ranges::any_of(
GetBase()->GetAuraEffects(), effectNeedsAmount))
164 TC_LOG_ERROR(
"spells",
"Aura {} has no effect at effectIndex {} but _HandleEffect was called",
GetBase()->GetSpellInfo()->Id,
uint32(effIndex));
205 if (
HasEffect(i) && (removeEffMask & (1 << i)))
210 if (canHandleNewEffects)
212 if (addEffMask & (1 << i))
279 bool hasEstimatedAmounts =
false;
285 if (effect->GetEstimatedAmount())
286 hasEstimatedAmounts =
true;
289 if (hasEstimatedAmounts)
295 auraData.
EstimatedPoints[effect->GetEffIndex()] = effect->GetEstimatedAmount().value_or(effect->GetAmount());
314 std::stringstream sstr;
331 if (spellEffectInfo.IsUnitOwnedAuraEffect())
332 effMask |= 1 << spellEffectInfo.EffectIndex;
339 effMask |= 1 << spellEffectInfo.EffectIndex;
347 return effMask & availableEffectMask;
371 if (foundAura->IsRemoved())
381 if (updateEffectMask)
383 aurApp->UpdateApplyEffectMask(effMask,
false);
387 return Create(createInfo);
400 return Create(createInfo);
416 else if (createInfo.
Caster)
421 if (!ownerUnit->IsInWorld() || ownerUnit->IsDuringRemoveFromWorld())
426 Aura* aura =
nullptr;
477m_spellInfo(createInfo._spellInfo), m_castDifficulty(createInfo._castDifficulty), m_castId(createInfo._castId), m_casterGuid(createInfo.CasterGUID),
478m_castItemGuid(createInfo.CastItemGUID), m_castItemId(createInfo.CastItemId),
479m_castItemLevel(createInfo.CastItemLevel), m_spellVisual(createInfo.CalcSpellVisual()),
480m_applyTime(
GameTime::GetGameTime()), m_owner(createInfo._owner), m_timeCla(0), m_updateTargetMapInterval(0),
481m_casterLevel(createInfo.
Caster ? createInfo.
Caster->GetLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(createInfo.StackAmount),
482m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr),
489 if (power && (power->ManaPerSecond != 0 || power->PowerPctPerSecond > 0.0f))
506 if (
typeid(*script) == type)
517 if (effMask & (1 << spellEffectInfo.EffectIndex))
518 m_effects[spellEffectInfo.EffectIndex] =
new AuraEffect(
this, spellEffectInfo, baseAmount ? baseAmount + spellEffectInfo.EffectIndex :
nullptr, caster);
617 TC_LOG_ERROR(
"spells",
"Aura::_UnapplyForTarget, target: {}, caster: {}, spell:{} was not found in owners application map!",
623 ASSERT(itr->second == auraApp);
629 if (caster &&
GetSpellInfo()->IsCooldownStartedOnEvent())
667 std::unordered_map<Unit*, uint32> targets;
671 std::vector<Unit*> targetsToRemove;
676 auto itr = targets.find(applicationPair.second->GetTarget());
678 if (itr == targets.end())
679 targetsToRemove.push_back(applicationPair.second->GetTarget());
686 targetsToRemove.push_back(applicationPair.second->GetTarget());
692 if (itr->first->IsImmunedToSpellEffect(
GetSpellInfo(), spellEffectInfo, caster,
true))
693 itr->second &= ~(1 << spellEffectInfo.EffectIndex);
696 if (applicationPair.second->GetEffectMask() != itr->second)
706 for (
auto itr = targets.begin(); itr != targets.end();)
714 if (itr->first->IsImmunedToSpellEffect(
GetSpellInfo(), spellEffectInfo, caster))
715 itr->second &= ~(1 << spellEffectInfo.EffectIndex);
721 if (addUnit && !itr->first->IsHighestExclusiveAura(
this,
true))
736 for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
738 Aura const* aura = iter->second->GetBase();
749 itr = targets.erase(itr);
756 TC_LOG_FATAL(
"spells",
"Aura {}: Owner {} (map {}) is not in the same map as target {} (map {}).",
GetSpellInfo()->Id,
758 itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() :
uint32(-1));
765 itr = targets.erase(itr);
769 itr->first->_CreateAuraApplication(
this, itr->second);
776 for (
Unit* unit : targetsToRemove)
784 for (
auto itr = targets.begin(); itr!= targets.end(); ++itr)
790 itr->first->_ApplyAura(aurApp, itr->second);
802 if ((appIter->second->GetEffectsToApply() & (1 << effIndex)) && !appIter->second->HasEffect(effIndex))
803 targetList.push_back(appIter->second->GetTarget());
807 for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
813 (*itr)->_ApplyAuraEffect(
this, effIndex);
824 Spell* modSpell =
nullptr;
825 Player* modOwner =
nullptr;
846 effect->Update(diff, caster);
876 if (power->RequiredAuraSpellID && !caster->
HasAura(power->RequiredAuraSpellID))
879 int32 manaPerSecond = power->ManaPerSecond;
895 else if (
int32(caster->
GetPower(powertype)) >= manaPerSecond)
914 Player* modOwner =
nullptr;
929 if (maxDuration != -1)
955 if (withMods && caster)
973 aurEff->ResetTicks();
984 resetPeriodicTimer =
false;
991 aurEff->CalculatePeriodic(caster, resetPeriodicTimer,
false);
1008 maxProcCharges = procEntry->Charges;
1014 return uint8(maxProcCharges);
1025 if ((num > 0) && (charges >
int32(maxCharges)))
1026 charges = maxCharges;
1028 else if (charges <= 0)
1061 std::vector<AuraApplication*> applications;
1065 if (!aurApp->GetRemoveMode())
1069 aurEff->ChangeAmount(aurEff->CalculateAmount(caster),
false,
true);
1072 if (!aurApp->GetRemoveMode())
1090 return maxStackAmount;
1099 if ((num > 0) && (stackAmount > maxStackAmount))
1105 stackAmount = maxStackAmount;
1108 else if (stackAmount <= 0)
1135 if (
HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.ApplyAuraName == auraType)
1144 if (
HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.IsAreaAuraEffect())
1182 if (!spellEffectInfo.IsEffect())
1185 if (spellEffectInfo.IsTargetingArea() || spellEffectInfo.IsAreaAuraEffect())
1241 int32 resistChance = 0;
1249 return 100 - resistChance;
1259 recalculateMask = 0;
1265 if (effect->CanBeRecalculated())
1266 recalculateMask |= 1 << i;
1282 effect->SetAmount(amount[effect->GetEffIndex()]);
1283 effect->SetCanBeRecalculated((recalculateMask & (1 << effect->GetEffIndex())) != 0);
1284 effect->CalculatePeriodic(caster,
false,
true);
1285 effect->CalculateSpellMod();
1286 effect->RecalculateAmount(caster);
1293 if (effect->GetAuraType() == type)
1323 effect->RecalculateAmount(caster);
1331 effect->HandleEffect(aurApp, mode, apply);
1338 effMask |= 1 << aurEff->GetEffIndex();
1346 if (!applicationPair.second->GetEffectMask())
1349 applications.push_back(applicationPair.second);
1371 appIter->second->SetNeedClientUpdate();
1381 if (saBounds.first != saBounds.second)
1386 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1394 if (!target->
HasAura(itr->second->spellId))
1409 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1414 caster->
AddAura(*itr, target);
1423 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1435 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1450 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1453 triggeredAura->ModStackAmount(
GetStackAmount() - triggeredAura->GetStackAmount());
1534 if (
AuraEffect const* aurEff = aura->GetEffect(0))
1547 if (
GetId() == 1784)
1564 if (owner->HasAura(34692))
1567 owner->CastSpell(owner, 34471,
GetEffect(0));
1569 owner->RemoveAurasDueToSpell(34471);
1597 ai->OnAuraApplied(aurApp);
1603 ai->OnAuraRemoved(aurApp);
1636 if (
this == existingAura)
1657 if (spellEffectInfo.TriggerSpell ==
GetId())
1664 if (spellEffectInfo.TriggerSpell == existingAura->
GetId())
1702 auto hasPeriodicNonAreaEffect = [](
SpellInfo const* spellInfo)
1704 for (
SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
1706 switch (spellEffectInfo.ApplyAuraName)
1723 if (spellEffectInfo.IsTargetingArea())
1733 if (hasPeriodicNonAreaEffect(
m_spellInfo) && hasPeriodicNonAreaEffect(existingSpellInfo))
1891 if (!spell->m_appliedMods.contains(
const_cast<Aura*
>(
this)))
1914 if (procEffectMask & (1u << aurEff->GetEffIndex()))
1915 if ((procEntry->
DisableEffectsMask & (1u << aurEff->GetEffIndex())) || !aurEff->CheckEffectProc(aurApp, eventInfo))
1916 procEffectMask &= ~(1u << aurEff->GetEffIndex());
1918 if (!procEffectMask)
1934 Item* item =
nullptr;
1942 if (damageInfo->GetAttackType() !=
OFF_ATTACK)
1976 return procEffectMask;
1983 float chance = procEntry.
Chance;
2005 chance = std::max(0.f, (1.f - ((eventInfo.
GetActor()->
GetLevel() - 60) * 1.f / 30.f)) * chance);
2019 if (!(procEffectMask & (1 << i)))
2038 float averageProcInterval = 60.0f / ppm;
2041 float secondsSinceLastAttempt = std::min(duration_cast<FloatSeconds>(currentTime -
m_lastProcAttemptTime).count(), 10.0);
2042 float secondsSinceLastProc = std::min(duration_cast<FloatSeconds>(currentTime -
m_lastProcSuccessTime).count(), 1000.0);
2044 float chance = std::max(1.0f, 1.0f + ((secondsSinceLastProc / averageProcInterval - 1.5f) * 3.0f)) * ppm * secondsSinceLastAttempt / 60.0f;
2046 return chance * 100.0f;
2062 TC_LOG_DEBUG(
"spells",
"Aura::LoadScripts: Script `{}` for aura `{}` is loaded now", script->GetScriptName(),
m_spellInfo->
Id);
2074 result &= checkAreaTarget.Call(script, target);
2076 script->_FinishScriptCall();
2087 onDispel.Call(script, dispelInfo);
2089 script->_FinishScriptCall();
2099 afterDispel.Call(script, dispelInfo);
2101 script->_FinishScriptCall();
2111 onHeartbeat.Call(script);
2113 script->_FinishScriptCall();
2119 bool preventDefault =
false;
2125 onEffectApply.Call(script, aurEff, mode);
2127 if (!preventDefault)
2128 preventDefault = script->_IsDefaultActionPrevented();
2130 script->_FinishScriptCall();
2133 return preventDefault;
2138 bool preventDefault =
false;
2144 onEffectRemove.Call(script, aurEff, mode);
2146 if (!preventDefault)
2147 preventDefault = script->_IsDefaultActionPrevented();
2149 script->_FinishScriptCall();
2151 return preventDefault;
2161 afterEffectApply.Call(script, aurEff, mode);
2163 script->_FinishScriptCall();
2174 afterEffectRemove.Call(script, aurEff, mode);
2176 script->_FinishScriptCall();
2182 bool preventDefault =
false;
2188 onEffectPeriodic.Call(script, aurEff);
2190 if (!preventDefault)
2191 preventDefault = script->_IsDefaultActionPrevented();
2193 script->_FinishScriptCall();
2196 return preventDefault;
2206 onEffectUpdatePeriodic.Call(script, aurEff);
2208 script->_FinishScriptCall();
2219 effectCalcAmount.Call(script, aurEff, amount, canBeRecalculated);
2221 script->_FinishScriptCall();
2232 effectCalcPeriodic.Call(script, aurEff, isPeriodic, amplitude);
2234 script->_FinishScriptCall();
2245 effectCalcSpellMod.Call(script, aurEff, spellMod);
2247 script->_FinishScriptCall();
2258 effectCalcCritChance.Call(script, aurEff, victim, critChance);
2260 script->_FinishScriptCall();
2271 effectCalcDamageAndHealing.Call(script, aurEff, victim, damageOrHealing, flatMod, pctMod);
2273 script->_FinishScriptCall();
2284 onEffectAbsorb.Call(script, aurEff, dmgInfo, absorbAmount);
2286 if (!defaultPrevented)
2287 defaultPrevented = script->_IsDefaultActionPrevented();
2289 script->_FinishScriptCall();
2300 afterEffectAbsorb.Call(script, aurEff, dmgInfo, absorbAmount);
2302 script->_FinishScriptCall();
2313 onEffectAbsorbHeal.Call(script, aurEff, healInfo, absorbAmount);
2315 if (!defaultPrevented)
2316 defaultPrevented = script->_IsDefaultActionPrevented();
2318 script->_FinishScriptCall();
2329 afterEffectAbsorbHeal.Call(script, aurEff, healInfo, absorbAmount);
2331 script->_FinishScriptCall();
2342 onEffectManaShield.Call(script, aurEff, dmgInfo, absorbAmount);
2344 if (!defaultPrevented)
2345 defaultPrevented = script->_IsDefaultActionPrevented();
2347 script->_FinishScriptCall();
2358 afterEffectManaShield.Call(script, aurEff, dmgInfo, absorbAmount);
2360 script->_FinishScriptCall();
2371 effectSplit.Call(script, aurEff, dmgInfo, splitAmount);
2373 script->_FinishScriptCall();
2383 onEnterLeaveCombat.Call(script, isNowInCombat);
2385 script->_FinishScriptCall();
2396 result &= checkProc.Call(script, eventInfo);
2398 script->_FinishScriptCall();
2406 bool prepare =
true;
2411 prepareProc.Call(script, eventInfo);
2414 prepare = !script->_IsDefaultActionPrevented();
2416 script->_FinishScriptCall();
2424 bool handled =
false;
2429 onProc.Call(script, eventInfo);
2431 handled |= script->_IsDefaultActionPrevented();
2432 script->_FinishScriptCall();
2444 afterProc.Call(script, eventInfo);
2446 script->_FinishScriptCall();
2458 result &= checkEffectProc.Call(script, aurEff, eventInfo);
2460 script->_FinishScriptCall();
2468 bool preventDefault =
false;
2474 onEffectProc.Call(script, aurEff, eventInfo);
2476 if (!preventDefault)
2477 preventDefault = script->_IsDefaultActionPrevented();
2479 script->_FinishScriptCall();
2481 return preventDefault;
2491 afterEffectProc.Call(script, aurEff, eventInfo);
2493 script->_FinishScriptCall();
2499 std::stringstream sstr;
2500 sstr << std::boolalpha
2555 if (!target && targetGuid == unitOwner->
GetGUID())
2559 targets.emplace(target, effectMask);
2571 if (!
HasEffect(spellEffectInfo.EffectIndex))
2578 std::vector<Unit*> units;
2581 SpellRange radius = spellEffectInfo.CalcRadius(ref);
2582 float extraSearchRadius = 0.0f;
2585 switch (spellEffectInfo.Effect)
2602 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(unitOwner, ref, *condList))
2603 units.push_back(unitOwner);
2609 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(owner, ref, *condList))
2610 units.push_back(owner);
2616 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(pet, ref, *condList))
2617 units.push_back(pet);
2622 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(unitOwner, ref, *condList))
2623 units.push_back(unitOwner);
2645 for (
Unit* unit : units)
2646 targets[unit] |= 1 << spellEffectInfo.EffectIndex;
2656 effMask &= ~(1 << spellEffectInfo.EffectIndex);
2713 float radius = dynObjOwner->
GetRadius();
2717 if (!
HasEffect(spellEffectInfo.EffectIndex))
2723 selectionType = spellEffectInfo.TargetB.GetCheckType();
2725 std::vector<Unit*> units;
2735 for (
Unit* unit : units)
2736 targets[unit] |= 1 << spellEffectInfo.EffectIndex;
std::vector< Condition > ConditionContainer
@ CONDITION_SOURCE_TYPE_SPELL_PROC
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
#define ASSERT_NODEBUGINFO
#define ASSERT_NOTNULL(pointer)
#define TC_LOG_DEBUG(filterType__, message__,...)
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_FATAL(filterType__, message__,...)
#define EXTRA_CELL_SEARCH_RADIUS
@ EQUIPMENT_SLOT_MAINHAND
constexpr uint8 INVENTORY_SLOT_BAG_0
bool roll_chance(float chance, PseudoRandomDistributionState &state)
@ SPELL_ATTR11_SCALES_WITH_ITEM_LEVEL
@ SPELL_ATTR7_CAN_PROC_FROM_SUPPRESSED_TARGET_PROCS
@ SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD
@ 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_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_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_PERIODIC_CAN_CRIT
@ 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
double SpellEffectValue
This is a double instead of float to be able to store full range of int32.
@ 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
@ SPELL_SPECIFIC_FOOD_AND_DRINK
@ 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_ON_HEARTBEAT
@ 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
#define SPELL_EMPOWER_HOLD_TIME_AT_MAX
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)
void AddEffectToApplyEffectMask(SpellEffIndex spellEffectIndex)
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)
SpellEffectValue GetAmount() const
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
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
SpellCastVisual m_spellVisual
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)
Unit * GetUnitOwner() const
void SetLastProcAttemptTime(TimePoint lastProcAttemptTime)
Trinity::IteratorPair< DBStorageIterator< AuraEffect * > > GetAuraEffects()
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)
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
void CallScriptAfterProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
ObjectGuid GetCasterGUID() const
bool HasEffect(uint8 effIndex) const
void RefreshTimers(bool resetPeriodicTimer)
bool CanPeriodicTickCrit() const
void CallScriptOnHeartbeat()
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 SetSpellVisual(SpellCastVisual const &spellVisual)
void AddProcCooldown(SpellProcEntry const *procEntry, TimePoint now)
int32 GetDuration() const
bool IsUsingCharges() const
void UpdateOwner(uint32 diff, WorldObject *owner)
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, SpellEffectValue &amount, bool &canBeRecalculated)
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
AuraEffectVector m_effects
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)
std::size_t GetAuraEffectCount() const
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)
void _InitEffects(uint32 effMask, Unit *caster, SpellEffectValue const *baseAmount)
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)
void SetLoadedState(int32 maxDuration, int32 duration, int32 charges, uint32 recalculateMask, SpellEffectValue const *amount)
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
void CallScriptAfterDispel(DispelInfo *dispelInfo)
void _Remove(AuraRemoveMode removeMode)
bool IsSingleTarget() const
ObjectGuid const & GetGUID() 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 AddEventAtOffset(BasicEvent *event, Milliseconds offset)
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
static ObjectGuid const Empty
std::string ToString() const
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
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
uint32 GetSpellXSpellVisualId(WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
bool IsRankOf(SpellInfo const *spellInfo) const
std::unordered_set< uint32 > Labels
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 IsEmpowerSpell() 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)
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 HandlePeriodicFoodSpellVisualKit()
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)
void Heartbeat() override
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
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
Unit * GetCharmerOrOwner() 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)
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
UF::UpdateField< UF::UnitData, int32(WowCS::EntityFragment::CGObject), TYPEID_UNIT > m_unitData
int32 GetPower(Powers power) const
bool IsInFeralForm() const
void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) 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)
VisibleAuraContainer const & GetVisibleAuras() const
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Aura * _TryStackingOrRefreshingExistingAura(AuraCreateInfo &createInfo)
ObjectGuid GetPetGUID() const
uint8 GetAvailableSeatCount() const
Gets the available seat count.
bool InSamePhase(PhaseShift const &phaseShift) const
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
bool IsInRange3d(Position const *pos, float minRange, float maxRange) const
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
bool IsFriendlyTo(WorldObject const *target) const
bool IsInMap(WorldObject const *obj) const
WorldPacket const * Write() override
std::vector< AuraInfo > Auras
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, std::type_identity_t< T > const &value)
constexpr void EraseIf(Container &c, Predicate p)
constexpr decltype(auto) EnsureWritableVectorIndex(std::vector< T > &vec, typename std::vector< T >::size_type i)
auto MapGetValuePtr(M &map, typename M::key_type const &key)
SpellInfo const * _spellInfo
AuraCreateInfo(ObjectGuid castId, SpellInfo const *spellInfo, Difficulty castDifficulty, uint32 auraEffMask, WorldObject *owner)
Optional< SpellCastVisual > _spellVisual
SpellEffectValue const * BaseAmount
SpellCastVisual CalcSpellVisual() const
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius)
uint32 DisableEffectsMask
ProcAttributes AttributesMask
std::vector< float > EstimatedPoints
Optional< ObjectGuid > CastItem
Optional< int32 > Duration
Optional< ObjectGuid > CastUnit
std::vector< float > Points
Optional< int32 > Remaining
Optional< AuraDataInfo > AuraData