42 _spellInfo(spellInfo), _auraEffectMask(auraEffMask), _owner(owner)
53_flags(
AFLAG_NONE), _effectsToApply(effMask), _needClientUpdate(false)
57 if (
GetBase()->CanBeSentToClient())
65 slot = foundAura->GetSlot();
71 Unit::VisibleAuraMap::const_iterator itr = visibleAuras.find(0);
74 if (itr == visibleAuras.end() || itr->first != freeSlot)
107 if (slot == foundAura->GetSlot())
109 if (
GetTarget()->GetVisibleAura(slot) ==
this)
112 foundAura->SetNeedClientUpdate();
136 bool negativeFound =
false;
141 negativeFound =
true;
151 bool positiveFound =
false;
156 positiveFound =
true;
207 if (
HasEffect(i) && (removeEffMask & (1 << i)))
212 if (canHandleNewEffects)
214 if (addEffMask & (1 << i))
264 std::stringstream sstr;
281 if (spellEffectInfo.IsUnitOwnedAuraEffect())
282 effMask |= 1 << spellEffectInfo.EffectIndex;
289 effMask |= 1 << spellEffectInfo.EffectIndex;
297 return effMask & availableEffectMask;
321 if (foundAura->IsRemoved())
331 if (updateEffectMask)
333 aurApp->UpdateApplyEffectMask(effMask,
false);
337 return Create(createInfo);
350 return Create(createInfo);
362 createInfo.
Caster =
nullptr;
373 else if (createInfo.
Caster)
378 if (!ownerUnit->IsInWorld() || ownerUnit->IsDuringRemoveFromWorld())
383 Aura* aura =
nullptr;
426m_spellInfo(createInfo._spellInfo), m_casterGuid(createInfo.CasterGUID),
427m_castItemGuid(createInfo.CastItemGUID), m_applyTime(
GameTime::GetGameTime()),
428m_owner(createInfo._owner), m_timeCla(0), m_updateTargetMapInterval(0),
429_casterInfo(), m_procCharges(0), m_stackAmount(1),
430m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr),
455 if ((*itr)->_GetScriptName()->compare(scriptName) == 0)
464 if (effMask & (
uint8(1) << spellEffectInfo.EffectIndex))
465 m_effects[spellEffectInfo.EffectIndex] =
new AuraEffect(
this, spellEffectInfo, baseAmount ? baseAmount + spellEffectInfo.EffectIndex :
nullptr, caster);
490 return std::max(0.f, critChance);
507 switch (spellEffectInfo.ApplyAuraName)
584 TC_LOG_ERROR(
"spells",
"Aura::_UnapplyForTarget, target: {}, caster: {}, spell:{} was not found in owners application map!",
590 ASSERT(itr->second == auraApp);
596 if (caster &&
GetSpellInfo()->IsCooldownStartedOnEvent())
634 std::unordered_map<Unit*, uint8> targets;
637 std::vector<Unit*> targetsToRemove;
642 auto itr = targets.find(applicationPair.second->GetTarget());
644 if (itr == targets.end())
645 targetsToRemove.push_back(applicationPair.second->GetTarget());
652 targetsToRemove.push_back(applicationPair.second->GetTarget());
658 if (itr->first->IsImmunedToSpellEffect(
GetSpellInfo(), spellEffectInfo, caster,
true))
659 itr->second &= ~(1 << spellEffectInfo.EffectIndex);
662 if (applicationPair.second->GetEffectMask() != itr->second)
672 for (
auto itr = targets.begin(); itr != targets.end();)
680 if (itr->first->IsImmunedToSpellEffect(
GetSpellInfo(), spellEffectInfo, caster))
681 itr->second &= ~(1 << spellEffectInfo.EffectIndex);
687 if (addUnit && !itr->first->IsHighestExclusiveAura(
this,
true))
702 for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
704 Aura const* aura = iter->second->GetBase();
715 itr = targets.erase(itr);
722 TC_LOG_FATAL(
"spells",
"Aura {}: Owner {} (map {}) is not in the same map as target {} (map {}).",
GetSpellInfo()->Id,
724 itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() :
uint32(-1));
731 itr = targets.erase(itr);
735 itr->first->_CreateAuraApplication(
this, itr->second);
742 for (
Unit* unit : targetsToRemove)
750 for (
auto itr = targets.begin(); itr!= targets.end(); ++itr)
756 itr->first->_ApplyAura(aurApp, itr->second);
768 if ((appIter->second->GetEffectsToApply() & (1<<effIndex)) && !appIter->second->HasEffect(effIndex))
769 targetList.push_back(appIter->second->GetTarget());
773 for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
779 (*itr)->_ApplyAuraEffect(
this, effIndex);
790 Spell* modSpell =
nullptr;
791 Player* modOwner =
nullptr;
849 else if (
int32(caster->
GetPower(powertype)) >= manaPerSecond)
866 Player* modOwner =
nullptr;
881 if (maxDuration != -1 && modOwner)
901 if (withMods && caster)
920 aurEff->ResetTicks();
931 aurEff->CalculatePeriodic(caster, resetPeriodicTimer,
false);
948 maxProcCharges = procEntry->Charges;
954 return uint8(maxProcCharges);
965 if ((num > 0) && (charges >
int32(maxCharges)))
966 charges = maxCharges;
968 else if (charges <= 0)
1005 std::vector<AuraApplication*> applications;
1009 if (!aurApp->GetRemoveMode())
1014 aurEff->ChangeAmount(aurEff->CalculateAmount(caster),
false,
true);
1017 if (!aurApp->GetRemoveMode())
1037 else if (stackAmount <= 0)
1064 if (
HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.ApplyAuraName == auraType)
1073 if (
HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.IsAreaAuraEffect())
1111 if (!spellEffectInfo.IsEffect())
1114 if (spellEffectInfo.IsTargetingArea() || spellEffectInfo.IsAreaAuraEffect())
1176 int32 resistChance = 0;
1185 if (offensive && auraTarget)
1189 return 100 - resistChance;
1206 aurEff->SetAmount(amount[i]);
1207 aurEff->SetCanBeRecalculated((recalculateMask & (1 << i)) != 0);
1208 aurEff->CalculatePeriodic(caster,
false,
true);
1209 aurEff->CalculateSpellMod();
1210 aurEff->RecalculateAmount(caster);
1246 if (!applicationPair.second->GetEffectMask())
1249 applicationList.push_back(applicationPair.second);
1256 appIter->second->SetNeedClientUpdate();
1266 if (saBounds.first != saBounds.second)
1271 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1274 if (!itr->second->IsFitToRequirements(target->
ToPlayer(), zone, area))
1277 else if (itr->second->autocast)
1279 if (!target->
HasAura(itr->second->spellId))
1280 target->
CastSpell(target, itr->second->spellId,
true);
1293 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1298 caster->
AddAura(*itr, target);
1305 if (std::vector<int32>
const* spellTriggered =
sSpellMgr->GetSpellLinked(-(
int32)
GetId()))
1307 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1317 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1332 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1335 triggeredAura->ModStackAmount(
GetStackAmount() - triggeredAura->GetStackAmount());
1388 else if (
GetSpellInfo()->SpellFamilyFlags[0] & 0x01000000)
1407 target->
CastSpell(
nullptr, 74396, args);
1422 if (!devouringPlague)
1436 caster->
CastSpell(
nullptr, 75999, args2);
1473 for (Unit::AuraEffectList::const_iterator itr = TalentAuras.begin(); itr != TalentAuras.end(); ++itr)
1475 if ((*itr)->GetMiscValue() == 7282)
1479 if ((*itr)->GetSpellInfo()->SpellIconID == 1766)
1486 switch (aurEff->
GetId())
1489 case 51161: spellId = 51735;
break;
1490 case 51160: spellId = 51734;
break;
1491 case 51099: spellId = 51726;
break;
1493 case 49632: spellId = 50510;
break;
1494 case 49631: spellId = 50509;
break;
1495 case 49032: spellId = 50508;
break;
1497 TC_LOG_ERROR(
"spells",
"Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague ({}) found", aurEff->
GetId());
1546 std::list<Unit*> PartyMembers;
1548 for (std::list<Unit*>::iterator itr = PartyMembers.begin(); itr != PartyMembers.end(); ++itr)
1550 if ((*itr)!= target)
1566 switch (aurEff->GetId())
1568 case 53759: spellId = 60947;
break;
1569 case 53754: spellId = 60946;
break;
1571 TC_LOG_ERROR(
"spells",
"Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear ({}) found", aurEff->GetId());
1574 caster->
CastSpell(target, spellId,
true);
1614 if (
AuraEffect const* aurEff = aura->GetEffect(0))
1616 float multiplier = (float)aurEff->GetAmount();
1617 if (aurEff->GetId() == 47535)
1619 else if (aurEff->GetId() == 47537)
1627 if (
AuraEffect const* aurEff = aura->GetEffect(1))
1632 int32 triggeredSpellId = 0;
1642 case POWER_RAGE: triggeredSpellId = 63653;
break;
1648 if (triggeredSpellId)
1649 caster->
CastSpell(target, triggeredSpellId,
true);
1680 if (
GetId() == 1784)
1708 if (caster && caster->
HasAura(56845))
1760 if (owner->HasAura(34692))
1763 owner->CastSpell(owner, 34471,
GetEffect(0));
1765 owner->RemoveAurasDueToSpell(34471);
1792 ai->OnAuraApplied(aurApp);
1798 ai->OnAuraRemoved(aurApp);
1827 if (
this == existingAura)
1848 if (spellEffectInfo.TriggerSpell ==
GetId())
1855 if (spellEffectInfo.TriggerSpell == existingAura->
GetId())
1902 auto hasPeriodicNonAreaEffect = [](
SpellInfo const* spellInfo)
1904 for (
SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
1906 switch (spellEffectInfo.ApplyAuraName)
1921 if (spellEffectInfo.IsTargetingArea())
1931 if (hasPeriodicNonAreaEffect(
m_spellInfo) && hasPeriodicNonAreaEffect(existingSpellInfo))
2040 if (!spell->m_appliedMods.count(
const_cast<Aura*
>(
this)))
2064 if (procEffectMask & (1u << i))
2066 procEffectMask &= ~(1u << i);
2068 if (!procEffectMask)
2084 Item* item =
nullptr;
2092 switch (damageInfo->GetAttackType())
2118 return procEffectMask;
2125 float chance = procEntry.
Chance;
2143 chance = std::max(0.f, (1.f - ((eventInfo.
GetActor()->
GetLevel() - 60) * 1.f / 30.f)) * chance);
2155 if (!(procEffectMask & (1 << i)))
2184 TC_LOG_DEBUG(
"spells",
"Aura::LoadScripts: Script `{}` for aura `{}` is loaded now", (*itr)->_GetScriptName()->c_str(),
m_spellInfo->
Id);
2195 auto hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
2196 for (; hookItr != hookItrEnd; ++hookItr)
2197 result &= hookItr->Call(*scritr, target);
2199 (*scritr)->_FinishScriptCall();
2209 auto hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
2210 for (; hookItr != hookItrEnd; ++hookItr)
2211 hookItr->Call(*scritr, dispelInfo);
2213 (*scritr)->_FinishScriptCall();
2222 auto hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
2223 for (; hookItr != hookItrEnd; ++hookItr)
2224 hookItr->Call(*scritr, dispelInfo);
2226 (*scritr)->_FinishScriptCall();
2232 bool preventDefault =
false;
2236 auto effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
2237 for (; effItr != effEndItr; ++effItr)
2239 effItr->Call(*scritr, aurEff, mode);
2241 if (!preventDefault)
2242 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2244 (*scritr)->_FinishScriptCall();
2247 return preventDefault;
2252 bool preventDefault =
false;
2256 auto effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
2257 for (; effItr != effEndItr; ++effItr)
2259 effItr->Call(*scritr, aurEff, mode);
2261 if (!preventDefault)
2262 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2264 (*scritr)->_FinishScriptCall();
2266 return preventDefault;
2274 auto effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
2275 for (; effItr != effEndItr; ++effItr)
2277 effItr->Call(*scritr, aurEff, mode);
2279 (*scritr)->_FinishScriptCall();
2288 auto effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
2289 for (; effItr != effEndItr; ++effItr)
2291 effItr->Call(*scritr, aurEff, mode);
2293 (*scritr)->_FinishScriptCall();
2299 bool preventDefault =
false;
2303 auto effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
2304 for (; effItr != effEndItr; ++effItr)
2306 effItr->Call(*scritr, aurEff);
2308 if (!preventDefault)
2309 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2311 (*scritr)->_FinishScriptCall();
2314 return preventDefault;
2322 auto effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
2323 for (; effItr != effEndItr; ++effItr)
2325 effItr->Call(*scritr, aurEff);
2327 (*scritr)->_FinishScriptCall();
2336 auto effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
2337 for (; effItr != effEndItr; ++effItr)
2339 effItr->Call(*scritr, aurEff, amount, canBeRecalculated);
2341 (*scritr)->_FinishScriptCall();
2350 auto effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
2351 for (; effItr != effEndItr; ++effItr)
2353 effItr->Call(*scritr, aurEff, isPeriodic, amplitude);
2355 (*scritr)->_FinishScriptCall();
2364 auto effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
2365 for (; effItr != effEndItr; ++effItr)
2367 effItr->Call(*scritr, aurEff, spellMod);
2369 (*scritr)->_FinishScriptCall();
2378 auto effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
2379 for (; effItr != effEndItr; ++effItr)
2382 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2384 if (!defaultPrevented)
2385 defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
2387 (*scritr)->_FinishScriptCall();
2396 auto effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
2397 for (; effItr != effEndItr; ++effItr)
2399 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2401 (*scritr)->_FinishScriptCall();
2410 auto effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
2411 for (; effItr != effEndItr; ++effItr)
2413 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2415 (*scritr)->_FinishScriptCall();
2424 auto effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
2425 for (; effItr != effEndItr; ++effItr)
2427 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2429 (*scritr)->_FinishScriptCall();
2438 auto effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin();
2439 for (; effItr != effEndItr; ++effItr)
2441 effItr->Call(*scritr, aurEff, dmgInfo, splitAmount);
2443 (*scritr)->_FinishScriptCall();
2453 auto hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin();
2454 for (; hookItr != hookItrEnd; ++hookItr)
2455 result &= hookItr->Call(*scritr, eventInfo);
2457 (*scritr)->_FinishScriptCall();
2465 bool prepare =
true;
2469 auto effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin();
2470 for (; effItr != effEndItr; ++effItr)
2471 effItr->Call(*scritr, eventInfo);
2474 prepare = !(*scritr)->_IsDefaultActionPrevented();
2476 (*scritr)->_FinishScriptCall();
2484 bool handled =
false;
2488 auto hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin();
2489 for (; hookItr != hookItrEnd; ++hookItr)
2490 hookItr->Call(*scritr, eventInfo);
2492 handled |= (*scritr)->_IsDefaultActionPrevented();
2493 (*scritr)->_FinishScriptCall();
2504 auto hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin();
2505 for (; hookItr != hookItrEnd; ++hookItr)
2506 hookItr->Call(*scritr, eventInfo);
2508 (*scritr)->_FinishScriptCall();
2518 auto hookItrEnd = (*scritr)->DoCheckEffectProc.end(), hookItr = (*scritr)->DoCheckEffectProc.begin();
2519 for (; hookItr != hookItrEnd; ++hookItr)
2521 result &= hookItr->Call(*scritr, aurEff, eventInfo);
2523 (*scritr)->_FinishScriptCall();
2531 bool preventDefault =
false;
2535 auto effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin();
2536 for (; effItr != effEndItr; ++effItr)
2538 effItr->Call(*scritr, aurEff, eventInfo);
2540 if (!preventDefault)
2541 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2543 (*scritr)->_FinishScriptCall();
2545 return preventDefault;
2553 auto effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin();
2554 for (; effItr != effEndItr; ++effItr)
2556 effItr->Call(*scritr, aurEff, eventInfo);
2558 (*scritr)->_FinishScriptCall();
2564 std::stringstream sstr;
2565 sstr << std::boolalpha
2619 if (!target && targetPair.first ==
GetUnitOwner()->GetGUID())
2623 targets.emplace(target, targetPair.second);
2628 if (!
HasEffect(spellEffectInfo.EffectIndex))
2642 std::vector<Unit*> units;
2645 float radius = spellEffectInfo.CalcRadius(ref);
2646 float extraSearchRadius = 0.0f;
2649 switch (spellEffectInfo.Effect)
2672 if (!condList ||
sConditionMgr->IsObjectMeetToConditions(owner, ref, *condList))
2673 units.push_back(owner);
2687 for (
Unit* unit : units)
2688 targets[unit] |= 1 << spellEffectInfo.EffectIndex;
2698 effMask &= ~(1 << spellEffectInfo.EffectIndex);
2733 if (!
HasEffect(spellEffectInfo.EffectIndex))
2739 selectionType = spellEffectInfo.TargetB.GetCheckType();
2741 std::vector<Unit*> units;
2748 for (
Unit* unit : units)
2749 targets[unit] |= 1 << spellEffectInfo.EffectIndex;
@ CONDITION_SOURCE_TYPE_SPELL_PROC
std::vector< Condition * > ConditionContainer
#define MAX_SPELL_EFFECTS
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define ASSERT_NODEBUGINFO
#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)
bool roll_chance_i(int chance)
@ SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD
@ SPELL_EFFECT_APPLY_AREA_AURA_PARTY
@ SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
@ 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_AURA
@ SPELL_EFFECT_APPLY_AREA_AURA_OWNER
@ SPELL_ATTR5_HASTE_AFFECT_DURATION
@ SPELL_ATTR5_HIDE_DURATION
@ SPELL_ATTR2_NOT_NEED_SHAPESHIFT
@ SPELL_ATTR1_DONT_REFRESH_DURATION_ON_RECAST
@ SPELL_ATTR3_STACK_FOR_DIFF_CASTERS
@ SPELL_ATTR3_CAN_PROC_FROM_PROCS
@ SPELL_ATTR3_IGNORE_PROC_SUBCLASS_MASK
@ SPELLFAMILY_DEATHKNIGHT
@ SPELL_ATTR0_NOT_SHAPESHIFT
@ SPELL_ATTR6_DONT_CONSUME_PROC_CHARGES
@ AURA_REMOVE_BY_ENEMY_SPELL
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PERIODIC_HASTE
@ SPELL_AURA_TRACK_RESOURCES
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
@ SPELL_AURA_OBS_MOD_HEALTH
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_OBS_MOD_POWER
@ SPELL_AURA_CONTROL_VEHICLE
@ SPELL_AURA_PERIODIC_HEAL
@ SPELL_AURA_ABILITY_PERIODIC_CRIT
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
@ SPELL_AURA_PERIODIC_ENERGIZE
@ SPELL_AURA_PERIODIC_LEECH
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELL_AURA_MOD_DISPEL_RESIST
#define UPDATE_TARGET_MAP_INTERVAL
@ SPELLMOD_CHANCE_OF_SUCCESS
@ SPELLMOD_RESIST_DISPEL_CHANCE
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELL_COOLDOWN_FLAG_NONE
@ SPELL_ATTR0_CU_ENCHANT_PROC
@ SPELL_ATTR0_CU_DONT_BREAK_STEALTH
@ SPELL_ATTR0_CU_AURA_CANNOT_BE_SAVED
@ SPELL_SPECIFIC_JUDGEMENT
@ SPELL_SPECIFIC_MAGE_POLYMORPH
@ TARGET_REFERENCE_TYPE_DEST
std::pair< SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator > SpellAreaForAreaMapBounds
@ PROC_ATTR_CANT_PROC_FROM_ITEM_CAST
@ PROC_ATTR_REDUCE_PROC_60
@ PROC_ATTR_TRIGGERED_CAN_PROC
@ 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
@ AUTO_ATTACK_PROC_FLAG_MASK
@ AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC
@ AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC
@ AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT
@ AURA_SCRIPT_HOOK_EFFECT_REMOVE
@ 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_EFFECT_UPDATE_PERIODIC
std::list< Unit * > UnitList
T RoundToInterval(T &num, T floor, T ceil)
T CalculatePct(T base, U pct)
std::string GetDebugInfo() const
void ClientUpdate(bool remove=false)
void BuildUpdatePacket(ByteBuffer &data, bool remove) const
uint8 GetEffectMask() const
void _HandleEffect(uint8 effIndex, bool apply)
void _InitFlags(Unit *caster, uint8 effMask)
void UpdateApplyEffectMask(uint8 newEffMask, bool canHandleNewEffects)
AuraApplication(Unit *target, Unit *caster, Aura *base, uint8 effMask)
void SetNeedClientUpdate()
AuraRemoveMode GetRemoveMode() const
bool HasEffect(uint8 effect) const
AuraType GetAuraType() const
SpellEffIndex GetEffIndex() const
void Update(uint32 diff, Unit *caster)
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
uint32 GetTotalTicks() const
void CleanupTriggeredSpells(Unit *target)
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
bool CheckEffectProc(AuraApplication *aurApp, ProcEventInfo &eventInfo) const
void HandleAllEffects(AuraApplication *aurApp, uint8 mode, bool apply)
bool HasMoreThanOneEffectForType(AuraType auraType) const
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
void GetApplicationVector(std::vector< AuraApplication * > &applicationVector) 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
AuraEffect * m_effects[MAX_SPELL_EFFECTS]
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 SetCritChance(float val)
void SetStackAmount(uint8 num)
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Unit * GetUnitOwner() const
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
void RefreshDuration(bool withMods=false)
bool CanBeSentToClient() 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
void RefreshTimers(bool resetPeriodicTimer)
void PrepareProcToTrigger(AuraApplication *aurApp, ProcEventInfo &eventInfo, TimePoint now)
std::vector< AuraApplication * > _removedApplications
void Update(uint32 diff, Unit *caster)
uint8 GetCasterLevel() const
void TriggerProcOnEvent(uint8 procEffectMask, AuraApplication *aurApp, ProcEventInfo &eventInfo)
WorldObject * GetOwner() const
uint8 GetProcEffectMask(AuraApplication *aurApp, ProcEventInfo &eventInfo, TimePoint now) 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 SaveCasterInfo(Unit *caster)
void SetCanApplyResilience(bool val)
bool IsAppliedOnTarget(ObjectGuid guid) const
ApplicationMap m_applications
int32 GetDuration() const
bool IsUsingCharges() const
void UpdateOwner(uint32 diff, WorldObject *owner)
void UnregisterSingleTarget()
bool IsDeathPersistent() const
bool CallScriptPrepareProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
bool HasEffectType(AuraType type) const
AuraEffect * GetEffect(uint8 effIndex) const
ObjectGuid const m_castItemGuid
void CallScriptAfterEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
float CalcPeriodicCritChance(Unit const *caster) const
void SetCharges(uint8 charges)
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
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool resetPeriodicTimer=true)
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
int32 CalcMaxDuration() const
void _InitEffects(uint8 effMask, Unit *caster, int32 const *baseAmount)
void SetDuration(int32 duration, bool withMods=false)
bool CallScriptProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void AddProcCooldown(TimePoint cooldownEnd)
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
void CallScriptEffectSplitHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &splitAmount)
AuraObjectType GetType() const
uint8 GetStackAmount() const
void _ApplyEffectForTargets(uint8 effIndex)
AuraScript * GetScriptByName(std::string const &scriptName) const
WorldObject *const m_owner
SpellInfo const * GetSpellInfo() const
ObjectGuid GetCastItemGUID() const
bool IsRemovedOnShapeLost(Unit *target) const
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &litude)
void SetMaxDuration(int32 duration)
bool CanBeAppliedOn(Unit *target)
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
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
void CallScriptEffectUpdatePeriodicHandlers(AuraEffect *aurEff)
void RecalculateAmountOfEffects()
bool CanPeriodicTickCrit(Unit const *caster) const
virtual void FillTargetMap(std::unordered_map< Unit *, uint8 > &targets, Unit *caster)=0
Aura(AuraCreateInfo const &createInfo)
static uint8 BuildEffectMaskForOwner(SpellInfo const *spellProto, uint8 availableEffectMask, WorldObject *owner)
int32 m_updateTargetMapInterval
void SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, float critChance, bool applyResilience, int32 *amount)
void CallScriptEffectAfterManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
ChargeDropEvent * m_dropEvent
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void CallScriptAfterDispel(DispelInfo *dispelInfo)
void _Remove(AuraRemoveMode removeMode)
bool IsSingleTarget() const
bool Execute(uint64, uint32) override
WeaponAttackType GetAttackType() const
void FillTargetMap(std::unordered_map< Unit *, uint8 > &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
PackedGuidWriter WriteAsPacked() const
std::string ToString() const
bool IsGameObject() const
static Creature * ToCreature(Object *o)
PackedGuid const & GetPackGUID() const
static Unit * ToUnit(Object *o)
float GetFloatValue(uint16 index) const
static ObjectGuid GetGUID(Object const *o)
static Player * ToPlayer(Object *o)
void SetSpellModTakingSpell(Spell *spell, bool apply)
void RemoveRunesByAuraEffect(AuraEffect const *aura)
void SendDirectMessage(WorldPacket const *data) const
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr) const
Item * GetItemByGuid(ObjectGuid guid) const
Unit * GetActionTarget() const
Spell const * GetProcSpell() const
uint32 GetTypeMask() const
SpellInfo const * GetSpellInfo() const
DamageInfo * GetDamageInfo() const
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool startCooldown=true)
void ResetCooldown(uint32 spellId, bool update=false)
void AddCooldown(uint32 spellId, uint32 itemId, std::chrono::duration< Type, Period > cooldownDuration)
uint32 GetRemainingCooldown(SpellInfo const *spellInfo) const
bool HasCooldown(SpellInfo const *spellInfo, uint32 itemId=0, bool ignoreCategoryCooldown=false) const
void StartCooldown(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool onHold=false)
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown) const
bool IsRankOf(SpellInfo const *spellInfo) const
bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const *spellInfo) const
uint32 ManaPerSecondPerLevel
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
bool HasAreaAuraEffect() const
bool IsDifferentRankOf(SpellInfo const *spellInfo) const
bool HasAura(AuraType aura) const
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > const & GetEffects() const
std::array< char const *, 16 > SpellName
bool IsPositiveEffect(uint8 effIndex) const
bool IsSingleTarget() const
static bool CanSpellTriggerProcOnEvent(SpellProcEntry const &procEntry, ProcEventInfo &eventInfo)
void AddStaticApplication(Unit *target, uint8 effMask)
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT) override
void FillTargetMap(std::unordered_map< Unit *, uint8 > &targets, Unit *caster) override
DiminishingGroup m_AuraDRGroup
DiminishingGroup GetDiminishGroup() const
void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *aurApp) override
std::unordered_map< ObjectGuid, uint8 > _staticApplications
UnitAura(AuraCreateInfo const &createInfo)
void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *aurApp) override
int32 ModifyHealth(int32 val)
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
AuraApplication * GetVisibleAura(uint8 slot) const
Aura * GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Powers GetPowerType() const
void RemoveVisibleAura(uint8 slot)
void RemoveAurasWithFamily(SpellFamilyNames family, flag96 const &familyFlag, ObjectGuid casterGUID)
Aura * AddAura(uint32 spellId, Unit *target)
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
float SpellDamagePctDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype) const
std::string GetDebugInfo() const override
virtual bool CanApplyResilience() const
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
std::map< uint8, AuraApplication * > VisibleAuraMap
float SpellCritChanceDone(SpellInfo const *spellInfo, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK, bool isPeriodic=false) const
bool IsDuringRemoveFromWorld() const
Unit * GetCharmerOrOwner() const
uint32 GetMaxPower(Powers power) const
void _AddAura(UnitAura *aura, Unit *caster)
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
VisibleAuraMap const & GetVisibleAuras() const
int32 GetTotalAuraModifier(AuraType auraType) const
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
bool HasUnitState(const uint32 f) const
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
bool IsInFeralForm() const
void SetVisibleAura(uint8 slot, AuraApplication *aurApp)
SpellHistory * GetSpellHistory()
float SpellHealingPctDone(Unit *victim, SpellInfo const *spellProto) const
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
void GetPartyMembers(std::list< Unit * > &units)
uint32 GetPower(Powers power) const
bool HasAuraTypeWithAffectMask(AuraType auraType, SpellInfo const *affectedSpell) const
std::list< AuraEffect * > AuraEffectList
uint32 GetCreateMana() const
void ApplyDiminishingAura(DiminishingGroup group, bool apply)
AuraList & GetSingleCastAuras()
Vehicle * GetVehicleKit() const
Aura * _TryStackingOrRefreshingExistingAura(AuraCreateInfo &createInfo)
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype) const
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
bool IsSelfOrInSameMap(WorldObject const *obj) const
int32 CalcSpellDuration(SpellInfo const *spellInfo) const
Player * GetSpellModOwner() const
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
bool IsFriendlyTo(WorldObject const *target) const
@ CONFIG_ALLOW_TRACK_BOTH_RESOURCES
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
SpellInfo const * _spellInfo
AuraCreateInfo(SpellInfo const *spellInfo, uint8 auraEffMask, WorldObject *owner)
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
uint32 DisableEffectsMask