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());
310 update.
Auras.push_back(auraInfo);
317 std::stringstream sstr;
334 if (spellEffectInfo.IsUnitOwnedAuraEffect())
335 effMask |= 1 << spellEffectInfo.EffectIndex;
342 effMask |= 1 << spellEffectInfo.EffectIndex;
350 return effMask & availableEffectMask;
374 if (foundAura->IsRemoved())
384 if (updateEffectMask)
386 aurApp->UpdateApplyEffectMask(effMask,
false);
390 return Create(createInfo);
403 return Create(createInfo);
419 else if (createInfo.
Caster)
424 if (!ownerUnit->IsInWorld() || ownerUnit->IsDuringRemoveFromWorld())
429 Aura* aura =
nullptr;
480m_spellInfo(createInfo._spellInfo), m_castDifficulty(createInfo._castDifficulty), m_castId(createInfo._castId), m_casterGuid(createInfo.CasterGUID),
481m_castItemGuid(createInfo.CastItemGUID), m_castItemId(createInfo.CastItemId),
482m_castItemLevel(createInfo.CastItemLevel), m_spellVisual(createInfo.CalcSpellVisual()),
483m_applyTime(
GameTime::GetGameTime()), m_owner(createInfo._owner), m_timeCla(0), m_updateTargetMapInterval(0),
484m_casterLevel(createInfo.
Caster ? createInfo.
Caster->GetLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(createInfo.StackAmount),
485m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr),
492 if (power && (power->ManaPerSecond != 0 || power->PowerPctPerSecond > 0.0f))
509 if (
typeid(*script) == type)
520 if (effMask & (1 << spellEffectInfo.EffectIndex))
521 _effects[spellEffectInfo.EffectIndex] =
new AuraEffect(
this, spellEffectInfo, baseAmount ? baseAmount + spellEffectInfo.EffectIndex :
nullptr, caster);
620 TC_LOG_ERROR(
"spells",
"Aura::_UnapplyForTarget, target: {}, caster: {}, spell:{} was not found in owners application map!",
626 ASSERT(itr->second == auraApp);
632 if (caster &&
GetSpellInfo()->IsCooldownStartedOnEvent())
670 std::unordered_map<Unit*, uint32> targets;
674 std::vector<Unit*> targetsToRemove;
679 auto itr = targets.find(applicationPair.second->GetTarget());
681 if (itr == targets.end())
682 targetsToRemove.push_back(applicationPair.second->GetTarget());
689 targetsToRemove.push_back(applicationPair.second->GetTarget());
695 if (itr->first->IsImmunedToSpellEffect(
GetSpellInfo(), spellEffectInfo, caster,
true))
696 itr->second &= ~(1 << spellEffectInfo.EffectIndex);
699 if (applicationPair.second->GetEffectMask() != itr->second)
709 for (
auto itr = targets.begin(); itr != targets.end();)
717 if (itr->first->IsImmunedToSpellEffect(
GetSpellInfo(), spellEffectInfo, caster))
718 itr->second &= ~(1 << spellEffectInfo.EffectIndex);
724 if (addUnit && !itr->first->IsHighestExclusiveAura(
this,
true))
739 for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
741 Aura const* aura = iter->second->GetBase();
752 itr = targets.erase(itr);
759 TC_LOG_FATAL(
"spells",
"Aura {}: Owner {} (map {}) is not in the same map as target {} (map {}).",
GetSpellInfo()->Id,
761 itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() :
uint32(-1));
768 itr = targets.erase(itr);
772 itr->first->_CreateAuraApplication(
this, itr->second);
779 for (
Unit* unit : targetsToRemove)
787 for (
auto itr = targets.begin(); itr!= targets.end(); ++itr)
793 itr->first->_ApplyAura(aurApp, itr->second);
805 if ((appIter->second->GetEffectsToApply() & (1 << effIndex)) && !appIter->second->HasEffect(effIndex))
806 targetList.push_back(appIter->second->GetTarget());
810 for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
816 (*itr)->_ApplyAuraEffect(
this, effIndex);
827 Spell* modSpell =
nullptr;
828 Player* modOwner =
nullptr;
849 effect->Update(diff, caster);
879 if (power->RequiredAuraSpellID && !caster->
HasAura(power->RequiredAuraSpellID))
882 int32 manaPerSecond = power->ManaPerSecond;
898 else if (
int32(caster->
GetPower(powertype)) >= manaPerSecond)
917 Player* modOwner =
nullptr;
932 if (maxDuration != -1)
958 if (withMods && caster)
976 aurEff->ResetTicks();
987 resetPeriodicTimer =
false;
994 aurEff->CalculatePeriodic(caster, resetPeriodicTimer,
false);
1011 maxProcCharges = procEntry->Charges;
1017 return uint8(maxProcCharges);
1028 if ((num > 0) && (charges >
int32(maxCharges)))
1029 charges = maxCharges;
1031 else if (charges <= 0)
1064 std::vector<AuraApplication*> applications;
1068 if (!aurApp->GetRemoveMode())
1072 aurEff->ChangeAmount(aurEff->CalculateAmount(caster),
false,
true);
1075 if (!aurApp->GetRemoveMode())
1093 return maxStackAmount;
1102 if ((num > 0) && (stackAmount > maxStackAmount))
1108 stackAmount = maxStackAmount;
1111 else if (stackAmount <= 0)
1138 if (
HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.ApplyAuraName == auraType)
1147 if (
HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.IsAreaAuraEffect())
1185 if (!spellEffectInfo.IsEffect())
1188 if (spellEffectInfo.IsTargetingArea() || spellEffectInfo.IsAreaAuraEffect())
1244 int32 resistChance = 0;
1252 return 100 - resistChance;
1262 recalculateMask = 0;
1268 if (effect->CanBeRecalculated())
1269 recalculateMask |= 1 << i;
1285 effect->SetAmount(amount[effect->GetEffIndex()]);
1286 effect->SetCanBeRecalculated((recalculateMask & (1 << effect->GetEffIndex())) != 0);
1287 effect->CalculatePeriodic(caster,
false,
true);
1288 effect->CalculateSpellMod();
1289 effect->RecalculateAmount(caster);
1296 if (effect->GetAuraType() == type)
1326 effect->RecalculateAmount(caster);
1334 effect->HandleEffect(aurApp, mode, apply);
1341 effMask |= 1 << aurEff->GetEffIndex();
1349 if (!applicationPair.second->GetEffectMask())
1352 applications.push_back(applicationPair.second);
1374 appIter->second->SetNeedClientUpdate();
1384 if (saBounds.first != saBounds.second)
1389 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1397 if (!target->
HasAura(itr->second->spellId))
1412 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1417 caster->
AddAura(*itr, target);
1426 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1438 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1453 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1456 triggeredAura->ModStackAmount(
GetStackAmount() - triggeredAura->GetStackAmount());
1542 if (
AuraEffect const* aurEff = aura->GetEffect(0))
1555 if (
GetId() == 1784)
1572 if (owner->HasAura(34692))
1575 owner->CastSpell(owner, 34471,
GetEffect(0));
1577 owner->RemoveAurasDueToSpell(34471);
1605 ai->OnAuraApplied(aurApp);
1611 ai->OnAuraRemoved(aurApp);
1644 if (
this == existingAura)
1665 if (spellEffectInfo.TriggerSpell ==
GetId())
1672 if (spellEffectInfo.TriggerSpell == existingAura->
GetId())
1710 auto hasPeriodicNonAreaEffect = [](
SpellInfo const* spellInfo)
1712 for (
SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
1714 switch (spellEffectInfo.ApplyAuraName)
1731 if (spellEffectInfo.IsTargetingArea())
1741 if (hasPeriodicNonAreaEffect(
m_spellInfo) && hasPeriodicNonAreaEffect(existingSpellInfo))
1899 if (!spell->m_appliedMods.contains(
const_cast<Aura*
>(
this)))
1922 if (procEffectMask & (1u << aurEff->GetEffIndex()))
1923 if ((procEntry->
DisableEffectsMask & (1u << aurEff->GetEffIndex())) || !aurEff->CheckEffectProc(aurApp, eventInfo))
1924 procEffectMask &= ~(1u << aurEff->GetEffIndex());
1926 if (!procEffectMask)
1942 Item* item =
nullptr;
1950 if (damageInfo->GetAttackType() !=
OFF_ATTACK)
1984 return procEffectMask;
1991 float chance = procEntry.
Chance;
2013 chance = std::max(0.f, (1.f - ((eventInfo.
GetActor()->
GetLevel() - 60) * 1.f / 30.f)) * chance);
2027 if (!(procEffectMask & (1 << i)))
2046 float averageProcInterval = 60.0f / ppm;
2049 float secondsSinceLastAttempt = std::min(duration_cast<FloatSeconds>(currentTime -
m_lastProcAttemptTime).count(), 10.0);
2050 float secondsSinceLastProc = std::min(duration_cast<FloatSeconds>(currentTime -
m_lastProcSuccessTime).count(), 1000.0);
2052 float chance = std::max(1.0f, 1.0f + ((secondsSinceLastProc / averageProcInterval - 1.5f) * 3.0f)) * ppm * secondsSinceLastAttempt / 60.0f;
2054 return chance * 100.0f;
2070 TC_LOG_DEBUG(
"spells",
"Aura::LoadScripts: Script `{}` for aura `{}` is loaded now", script->GetScriptName(),
m_spellInfo->
Id);
2082 result &= checkAreaTarget.Call(script, target);
2084 script->_FinishScriptCall();
2095 onDispel.Call(script, dispelInfo);
2097 script->_FinishScriptCall();
2107 afterDispel.Call(script, dispelInfo);
2109 script->_FinishScriptCall();
2119 onHeartbeat.Call(script);
2121 script->_FinishScriptCall();
2127 bool preventDefault =
false;
2133 onEffectApply.Call(script, aurEff, mode);
2135 if (!preventDefault)
2136 preventDefault = script->_IsDefaultActionPrevented();
2138 script->_FinishScriptCall();
2141 return preventDefault;
2146 bool preventDefault =
false;
2152 onEffectRemove.Call(script, aurEff, mode);
2154 if (!preventDefault)
2155 preventDefault = script->_IsDefaultActionPrevented();
2157 script->_FinishScriptCall();
2159 return preventDefault;
2169 afterEffectApply.Call(script, aurEff, mode);
2171 script->_FinishScriptCall();
2182 afterEffectRemove.Call(script, aurEff, mode);
2184 script->_FinishScriptCall();
2190 bool preventDefault =
false;
2196 onEffectPeriodic.Call(script, aurEff);
2198 if (!preventDefault)
2199 preventDefault = script->_IsDefaultActionPrevented();
2201 script->_FinishScriptCall();
2204 return preventDefault;
2214 onEffectUpdatePeriodic.Call(script, aurEff);
2216 script->_FinishScriptCall();
2227 effectCalcAmount.Call(script, aurEff, amount, canBeRecalculated);
2229 script->_FinishScriptCall();
2240 effectCalcPeriodic.Call(script, aurEff, isPeriodic, amplitude);
2242 script->_FinishScriptCall();
2253 effectCalcSpellMod.Call(script, aurEff, spellMod);
2255 script->_FinishScriptCall();
2266 effectCalcCritChance.Call(script, aurEff, victim, critChance);
2268 script->_FinishScriptCall();
2279 effectCalcDamageAndHealing.Call(script, aurEff, victim, damageOrHealing, flatMod, pctMod);
2281 script->_FinishScriptCall();
2292 onEffectAbsorb.Call(script, aurEff, dmgInfo, absorbAmount);
2294 if (!defaultPrevented)
2295 defaultPrevented = script->_IsDefaultActionPrevented();
2297 script->_FinishScriptCall();
2308 afterEffectAbsorb.Call(script, aurEff, dmgInfo, absorbAmount);
2310 script->_FinishScriptCall();
2321 onEffectAbsorbHeal.Call(script, aurEff, healInfo, absorbAmount);
2323 if (!defaultPrevented)
2324 defaultPrevented = script->_IsDefaultActionPrevented();
2326 script->_FinishScriptCall();
2337 afterEffectAbsorbHeal.Call(script, aurEff, healInfo, absorbAmount);
2339 script->_FinishScriptCall();
2350 onEffectManaShield.Call(script, aurEff, dmgInfo, absorbAmount);
2352 if (!defaultPrevented)
2353 defaultPrevented = script->_IsDefaultActionPrevented();
2355 script->_FinishScriptCall();
2366 afterEffectManaShield.Call(script, aurEff, dmgInfo, absorbAmount);
2368 script->_FinishScriptCall();
2379 effectSplit.Call(script, aurEff, dmgInfo, splitAmount);
2381 script->_FinishScriptCall();
2391 onEnterLeaveCombat.Call(script, isNowInCombat);
2393 script->_FinishScriptCall();
2404 result &= checkProc.Call(script, eventInfo);
2406 script->_FinishScriptCall();
2414 bool prepare =
true;
2419 prepareProc.Call(script, eventInfo);
2422 prepare = !script->_IsDefaultActionPrevented();
2424 script->_FinishScriptCall();
2432 bool handled =
false;
2437 onProc.Call(script, eventInfo);
2439 handled |= script->_IsDefaultActionPrevented();
2440 script->_FinishScriptCall();
2452 afterProc.Call(script, eventInfo);
2454 script->_FinishScriptCall();
2466 result &= checkEffectProc.Call(script, aurEff, eventInfo);
2468 script->_FinishScriptCall();
2476 bool preventDefault =
false;
2482 onEffectProc.Call(script, aurEff, eventInfo);
2484 if (!preventDefault)
2485 preventDefault = script->_IsDefaultActionPrevented();
2487 script->_FinishScriptCall();
2489 return preventDefault;
2499 afterEffectProc.Call(script, aurEff, eventInfo);
2501 script->_FinishScriptCall();
2507 std::stringstream sstr;
2508 sstr << std::boolalpha
2563 if (!target && targetGuid == unitOwner->
GetGUID())
2567 targets.emplace(target, effectMask);
2579 if (!
HasEffect(spellEffectInfo.EffectIndex))
2586 std::vector<Unit*> units;
2589 SpellRange radius = spellEffectInfo.CalcRadius(ref);
2590 float extraSearchRadius = 0.0f;
2593 switch (spellEffectInfo.Effect)
2610 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(unitOwner, ref, *condList))
2611 units.push_back(unitOwner);
2617 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(owner, ref, *condList))
2618 units.push_back(owner);
2624 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(pet, ref, *condList))
2625 units.push_back(pet);
2630 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(unitOwner, ref, *condList))
2631 units.push_back(unitOwner);
2653 for (
Unit* unit : units)
2654 targets[unit] |= 1 << spellEffectInfo.EffectIndex;
2664 effMask &= ~(1 << spellEffectInfo.EffectIndex);
2721 float radius = dynObjOwner->
GetRadius();
2725 if (!
HasEffect(spellEffectInfo.EffectIndex))
2731 selectionType = spellEffectInfo.TargetB.GetCheckType();
2733 std::vector<Unit*> units;
2743 for (
Unit* unit : units)
2744 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
#define INVENTORY_SLOT_BAG_0
bool roll_chance(T 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_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)
AuraEffectVector _effects
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
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, bool dont_load=true)
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