124 _aura(aura), _chance(dispelChance), _charges(dispelCharges)
136 : m_attacker(attacker), m_victim(victim), m_damage(damage), m_originalDamage(damage), m_spellInfo(spellInfo), m_schoolMask(schoolMask), m_damageType(damageType), m_attackType(attackType),
137 m_absorb(0), m_resist(0), m_block(0), m_hitMask(
PROC_HIT_NONE)
142 : m_attacker(dmgInfo.Attacker), m_victim(dmgInfo.Target), m_damage(dmgInfo.
Damage), m_originalDamage(dmgInfo.
Damage), m_spellInfo(nullptr), m_schoolMask(
SpellSchoolMask(dmgInfo.DamageSchoolMask)),
143 m_damageType(
DIRECT_DAMAGE), m_attackType(dmgInfo.AttackType), m_absorb(dmgInfo.Absorb), m_resist(dmgInfo.Resist), m_block(dmgInfo.Blocked), m_hitMask(
PROC_HIT_NONE)
184 if (!damageNullified)
188 if (!damageNullified)
195 : m_attacker(spellNonMeleeDamage.attacker), m_victim(spellNonMeleeDamage.target), m_damage(spellNonMeleeDamage.damage), m_originalDamage(spellNonMeleeDamage.originalDamage),
196 m_spellInfo(spellNonMeleeDamage.
Spell), m_schoolMask(
SpellSchoolMask(spellNonMeleeDamage.schoolMask)), m_damageType(damageType),
197 m_attackType(attackType), m_absorb(spellNonMeleeDamage.absorb), m_resist(spellNonMeleeDamage.resist), m_block(spellNonMeleeDamage.blocked), m_hitMask(hitMask)
199 if (spellNonMeleeDamage.
blocked)
201 if (spellNonMeleeDamage.
absorb)
250 : _healer(healer), _target(target), _heal(heal), _originalHeal(heal), _effectiveHeal(0), _absorb(0), _spellInfo(spellInfo), _schoolMask(schoolMask), _hitMask(0)
256 amount = std::min(amount,
GetHeal());
274 _actor(actor), _actionTarget(actionTarget), _procTarget(procTarget),
275 _typeMask(typeMask), _spellTypeMask(spellTypeMask),
276 _spellPhaseMask(spellPhaseMask), _hitMask(hitMask), _spell(spell),
277 _damageInfo(damageInfo), _healInfo(healInfo)
303 : target(_target), attacker(_attacker), castId(_castId),
Spell(_spellInfo), SpellVisual(spellVisual), damage(0), originalDamage(0),
304 schoolMask(_schoolMask), absorb(0), resist(0), periodicLog(false), blocked(0),
HitInfo(0), cleanDamage(0), fullBlock(false), preHitHealth(_target->GetHealth())
309 WorldObject(isWorldObject), m_lastSanctuaryTime(0), LastCharmerGUID(), movespline(
std::make_unique<
Movement::MoveSpline>()),
310 m_ControlledByPlayer(false), m_procDeep(0), m_procChainLength(0), m_transformSpell(0),
312 m_unitMovedByMe(nullptr), m_playerMovingMe(nullptr), m_charmer(nullptr), m_charmed(nullptr),
313 i_motionMaster(
std::make_unique<
MotionMaster>(this)), m_regenTimer(0), m_vehicle(nullptr),
314 m_unitTypeMask(
UNIT_MASK_NONE), m_Diminishing(), m_combatManager(this),
315 m_threatManager(this), m_aiLocked(false), _playHoverAnim(false), _aiAnimKitId(0), _movementAnimKitId(0), _meleeAnimKitId(0),
446 uint32 count = itr->second;
518 auraApplication->GetBase()->Heartbeat();
526 return player->GetWeaponForAttack(
OFF_ATTACK,
true) !=
nullptr;
535 init.MoveTo(x, y, z, generatePath, forceDestination);
536 init.SetVelocity(speed);
619 transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.
orientation);
670 float distsq = dx * dx + dy * dy + dz * dz;
673 float maxdist = dist2compare + sizefactor;
675 return distsq < maxdist * maxdist;
686 float distsq = dx*dx + dy*dy + dz*dz;
690 return distsq <= maxdist * maxdist;
706 return IsInDist(obj, objBoundaryRadius);
729 m_interruptMask |= aurApp->GetBase()->GetSpellInfo()->AuraInterruptFlags;
746 if (aura->GetSpellInfo()->SpellFamilyName == familyName && aura->GetSpellInfo()->SpellFamilyFlags & familyFlags)
754 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
755 if ((!excludeAura || excludeAura != (*itr)->GetSpellInfo()->Id) &&
765 excludeAura = currentChanneledSpell->GetSpellInfo()->Id;
792 std::copy(list.begin(), list.end(), std::back_inserter(effects));
798 uint32 damageDone = damage;
799 uint32 damageTaken = damage;
805 uint32 tmpDamage = damageTaken;
809 tmpDamage = victimCreature->CalculateDamageForSparring(attacker, tmpDamage);
812 victimAI->DamageTaken(attacker, tmpDamage, damagetype, spellProto);
814 if (
UnitAI* attackerAI = attacker ? attacker->
GetAI() :
nullptr)
815 attackerAI->DamageDealt(victim, tmpDamage, damagetype);
818 sScriptMgr->OnDamage(attacker, victim, tmpDamage);
821 if (tmpDamage != damageTaken)
826 damageDone = tmpDamage;
828 damageTaken = tmpDamage;
833 if (attacker != victim && damagetype !=
DOT)
837 if (
CreatureAI* controlledAI = cControlled->AI())
838 controlledAI->OwnerAttackedBy(attacker);
866 for (
auto i = vCopyDamageCopy.begin(); i != vCopyDamageCopy.end(); ++i)
869 if (!((*i)->GetBase()->IsAppliedOnTarget(victim->
GetGUID())))
872 if (((*i)->GetMiscValue() & damageSchoolMask) == 0)
875 Unit* shareDamageTarget = (*i)->GetCaster();
876 if (!shareDamageTarget)
878 SpellInfo const* spell = (*i)->GetSpellInfo();
903 bool duel_hasEnded =
false;
904 bool duel_wasMounted =
false;
912 damageTaken = health - 1;
914 duel_hasEnded =
true;
918 damageTaken = health - 1;
924 victimAI->OnHealthDepleted(attacker,
false);
931 if (victimRider && victimRider->
duel && victimRider->
duel->IsMounted)
938 damageTaken = health - 1;
940 duel_wasMounted =
true;
941 duel_hasEnded =
true;
946 damageTaken = health - 1;
948 if (attacker && attacker != victim)
974 bool skipSettingDeathState =
false;
976 if (health <= damageTaken)
986 DamageInfo damageInfo =
DamageInfo(attacker, victim, damageTaken, spellProto, damageSchoolMask, damagetype,
988 for (
AuraEffect* absorbAurEff : vAbsorbOverkill)
990 Aura* base = absorbAurEff->GetBase();
995 if (!(absorbAurEff->GetMiscValue() & damageInfo.
GetSchoolMask()))
1007 bool deathFullyPrevented =
false;
1009 absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, damageInfo, currentAbsorb, deathFullyPrevented);
1012 currentAbsorb = std::min(currentAbsorb, damageInfo.
GetDamage());
1020 if (deathFullyPrevented)
1023 skipSettingDeathState =
true;
1033 absorbLog.
Absorbed = currentAbsorb;
1045 durabilityLoss =
false;
1048 Unit::Kill(attacker, victim, durabilityLoss, skipSettingDeathState);
1096 auto isCastInterrupted = [&]()
1110 auto isCastDelayed = [&]()
1124 if (isCastInterrupted())
1126 else if (isCastDelayed())
1131 if (damageTaken && victim->
IsPlayer())
1134 spell->DelayedChannel();
1145 if (duel_wasMounted)
1150 he->
duel->Opponent->CombatStopWithPets(
true);
1178 if (!victim || !victim->
IsAlive())
1201 uint32 crit_bonus = damage;
1205 damage += crit_bonus;
1210 if (critPctDamageMod != 0)
1211 AddPct(damage, critPctDamageMod);
1231 damage -= damageInfo->
blocked;
1266 damageInfo->
damage = damage;
1294 if (!damageInfo->
Spell)
1296 TC_LOG_DEBUG(
"entities.unit",
"Unit::DealSpellDamage has no spell");
1309 damageInfo->
Target = victim;
1376 damageInfo->
Damage = damage;
1457 float reducePercent = 1.f - leveldif * 0.1f;
1480 resilienceReduction = damageInfo->
Damage - resilienceReduction;
1481 damageInfo->
Damage -= resilienceReduction;
1524 float percent60 = 3.0f * percent20;
1525 if (offtime > percent20 && offtime <= percent60)
1527 else if (offtime > percent60)
1529 offtime -= 2.0f * percent20;
1536 float percent60 = 3.0f * percent20;
1537 if (basetime > percent20 && basetime <= percent60)
1539 else if (basetime > percent60)
1541 basetime -= 2.0f * percent20;
1557 float chance = 20.0f;
1566 chance *= attackerMeleeSkill / float(victimDefense) * 0.16f;
1586 for (
AuraEffect const* aurEff : vDamageShieldsCopy)
1588 SpellInfo const* spellInfo = aurEff->GetSpellInfo();
1605 uint32 damage = aurEff->GetAmount();
1606 if (
Unit* caster = aurEff->GetCaster())
1608 damage = caster->SpellDamageBonusDone(
this, spellInfo, damage,
SPELL_DIRECT_DAMAGE, aurEff->GetSpellEffectInfo());
1664 float armor = float(victim->
GetArmor());
1671 int32 armorBypassPct = 0;
1673 for (AuraEffectList::const_iterator i = reductionAuras.begin(); i != reductionAuras.end(); ++i)
1674 if ((*i)->GetCasterGUID() == attacker->
GetGUID())
1675 armorBypassPct += (*i)->GetAmount();
1676 armor =
CalculatePct(armor, 100 - std::min(armorBypassPct, 100));
1686 for (
AuraEffect const* aurEff : resIgnoreAuras)
1689 armor = std::floor(
AddPct(armor, -aurEff->GetAmount()));
1700 float maxArmorPen = 0.f;
1707 maxArmorPen = std::min((armor + maxArmorPen) / 3.f, armor);
1713 if (G3D::fuzzyLe(armor, 0.0f))
1726 if (!(armor + armorConstant))
1729 float mitigation = std::min(armor / (armor + armorConstant), 0.85f);
1730 return uint32(std::max(damage * (1.0f - mitigation), 0.0f));
1744 float discreteResistProbability[11] = { };
1745 if (averageResist <= 0.1f)
1747 discreteResistProbability[0] = 1.0f - 7.5f * averageResist;
1748 discreteResistProbability[1] = 5.0f * averageResist;
1749 discreteResistProbability[2] = 2.5f * averageResist;
1753 for (
uint32 i = 0; i < 11; ++i)
1754 discreteResistProbability[i] = std::max(0.5f - 2.5f * std::fabs(0.1f * i - averageResist), 0.0f);
1758 float probabilitySum = 0.0f;
1761 for (; resistance < 11; ++resistance)
1762 if (roll < (probabilitySum += discreteResistProbability[resistance]))
1765 float damageResisted = damage * resistance / 10.f;
1766 if (damageResisted > 0.0f)
1768 int32 ignoredResistance = 0;
1773 ignoredResistance = std::min<int32>(ignoredResistance, 100);
1774 ApplyPct(damageResisted, 100 - ignoredResistance);
1780 float armorReduction = damage - damageAfterArmor;
1783 damageResisted = std::min(damageResisted, armorReduction);
1787 damageResisted = std::max(damageResisted, 0.f);
1788 return uint32(damageResisted);
1793 float victimResistance = float(victim->
GetResistance(schoolMask));
1800 victimResistance -= float(player->GetSpellPenetrationItemMod());
1802 else if (
Unit const* unitCaster = caster->
ToUnit())
1808 victimResistance = 0.0f;
1812 victimResistance = 0.0f;
1814 victimResistance = std::max(victimResistance, 0.0f);
1821 static uint32 const bossLevel = 83;
1822 static float const bossResistanceConstant = 510.0f;
1824 float resistanceConstant = 0.0f;
1826 if (level == bossLevel)
1827 resistanceConstant = bossResistanceConstant;
1829 resistanceConstant = level * 5.0f;
1831 return victimResistance / (victimResistance + resistanceConstant);
1842 float auraAbsorbMod = 0.f;
1861 for (
auto itr = vSchoolAbsorbCopy.begin(); (itr != vSchoolAbsorbCopy.end()) && (damageInfo.
GetDamage() > 0); ++itr)
1874 if (currentAbsorb < 0)
1882 bool defaultPrevented =
false;
1885 currentAbsorb = tempAbsorb;
1887 if (!defaultPrevented)
1894 tempAbsorb = currentAbsorb;
1919 absorbLog.
Absorbed = currentAbsorb;
1928 for (
auto itr = vManaShieldCopy.begin(); (itr != vManaShieldCopy.end()) && (damageInfo.
GetDamage() > 0); ++itr)
1942 if (currentAbsorb < 0)
1948 uint32 tempAbsorb = currentAbsorb;
1950 bool defaultPrevented =
false;
1953 currentAbsorb = tempAbsorb;
1955 if (!defaultPrevented)
1960 int32 manaReduction = currentAbsorb;
1964 manaReduction =
int32(
float(manaReduction) * manaMultiplier);
1969 currentAbsorb = currentAbsorb ?
int32(
float(currentAbsorb) * (
float(manaTaken) /
float(manaReduction))) : 0;
1973 tempAbsorb = currentAbsorb;
1996 absorbLog.
Absorbed = currentAbsorb;
2009 for (
auto itr = vSplitDamagePctCopy.begin(); itr != vSplitDamagePctCopy.end() && damageInfo.
GetDamage() > 0; ++itr)
2021 Unit* caster = (*itr)->GetCaster();
2027 (*itr)->GetBase()->CallScriptEffectSplitHandlers((*itr), aurApp, damageInfo, splitDamage);
2047 if (victimCreature->ShouldFakeDamageFrom(damageInfo.
GetAttacker()))
2054 log.
damage = splitDamage;
2056 log.
absorb = split_absorb;
2071 for (
auto i = vHealAbsorb.begin(); i != vHealAbsorb.end() && healInfo.
GetHeal() > 0; ++i)
2084 if (currentAbsorb < 0)
2089 bool defaultPrevented =
false;
2092 currentAbsorb = tempAbsorb;
2094 if (!defaultPrevented)
2101 tempAbsorb = currentAbsorb;
2123 absorbLog.
Absorbed = currentAbsorb;
2167 if (!autoAttackError)
2182 attackerPlayer->SetAttackSwingError(autoAttackError);
2188 if (!autoAttackError)
2238 uint32 meleeAttackSpellId = 0;
2241 if (!meleeAttackOverrides.empty())
2242 meleeAttackSpellId = meleeAttackOverrides.front()->GetSpellEffectInfo().TriggerSpell;
2246 auto itr = std::find_if(meleeAttackOverrides.begin(), meleeAttackOverrides.end(), [&](
AuraEffect const* aurEff)
2248 return aurEff->GetSpellEffectInfo().MiscValue != 0;
2250 if (itr != meleeAttackOverrides.end())
2251 meleeAttackSpellId = (*itr)->GetSpellEffectInfo().MiscValue;
2254 if (!meleeAttackSpellId)
2264 if (victimCreature->ShouldFakeDamageFrom(damageInfo.
Attacker))
2277 TC_LOG_DEBUG(
"entities.unit",
"AttackerStateUpdate: {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2282 CastSpell(victim, meleeAttackSpellId,
true);
2309 targetGUID = selection;
2337 int32 sum = 0, tmp = 0;
2353 canParryOrBlock =
false;
2358 if (tmp > 0 && roll < (sum += tmp))
2370 && roll < (sum += tmp))
2375 if (canParryOrBlock)
2379 && roll < (sum += tmp))
2387 attackerLevel + 3 < victimLevel)
2390 tmp = (10 + 10 * (victimLevel - attackerLevel)) * 100;
2391 if (tmp > 0 && roll < (sum += tmp))
2396 if (canParryOrBlock)
2400 && roll < (sum += tmp))
2406 if (tmp > 0 && roll < (sum += tmp))
2411 if (attackerLevel >= victimLevel + 4 &&
2417 tmp = attackerLevel - victimLevel * 1000 - 1500;
2418 if (roll < (sum += tmp))
2420 TC_LOG_DEBUG(
"entities.unit",
"RollMeleeOutcomeAgainst: CRUSHING <{}, {})", sum-tmp, sum);
2431 float minDamage = 0.0f;
2432 float maxDamage = 0.0f;
2434 if (normalized || !addTotalPct)
2439 float minOffhandDamage = 0.0f;
2440 float maxOffhandDamage = 0.0f;
2442 minDamage += minOffhandDamage;
2443 maxDamage += maxOffhandDamage;
2472 minDamage = std::max(0.f, minDamage);
2473 maxDamage = std::max(0.f, maxDamage);
2475 if (minDamage > maxDamage)
2476 std::swap(minDamage, maxDamage);
2511 int32 resistMech = 0;
2514 if (!effect.IsEffect())
2521 if (resistMech < temp)
2526 return std::max(resistMech, 0);
2568 tmp += resist_chance;
2598 tmp += deflect_chance;
2627 if (!aurEff->IsAffectingSpell(spellInfo))
2630 switch (aurEff->GetMiscValue())
2642 TC_LOG_DEBUG(
"entities.unit",
"Spell {} SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state {}", aurEff->GetId(), aurEff->GetMiscValue());
2651 if (dodgeChance < 0)
2654 if (roll < (tmp += dodgeChance))
2662 if (parryChance < 0)
2673 if (blockChance < 0)
2688 float chance = 0.0f;
2689 float levelBonus = 0.0f;
2691 chance = playerVictim->m_activePlayerData->DodgePercentage;
2700 levelBonus = 1.5f * levelDiff;
2704 chance += levelBonus;
2717 return std::max(chance, 0.0f);
2724 float chance = 0.0f;
2725 float levelBonus = 0.0f;
2728 if (playerVictim->CanParry())
2732 tmpitem = playerVictim->GetWeaponForAttack(
OFF_ATTACK,
true);
2735 chance = playerVictim->m_activePlayerData->ParryPercentage;
2746 levelBonus = 1.5f * levelDiff;
2750 chance += levelBonus;
2757 return std::max(chance, 0.0f);
2762 float miss_chance = 5.0f;
2771 float chance = 0.0f;
2772 float levelBonus = 0.0f;
2775 if (playerVictim->CanBlock())
2779 chance = playerVictim->m_activePlayerData->BlockPercentage;
2790 levelBonus = 1.5f * levelDiff;
2794 chance += levelBonus;
2795 return std::max(chance, 0.0f);
2800 float chance = 0.0f;
2806 chance = thisPlayer->m_activePlayerData->CritPercentage;
2809 chance = thisPlayer->m_activePlayerData->OffhandCritPercentage;
2812 chance = thisPlayer->m_activePlayerData->RangedCritPercentage;
2835 float chance = critDone;
2855 return aurEff->
GetCasterGUID() == tempSummon->GetSummonerGUID();
2861 return std::max(chance, 0.0f);
2910 if (i->second->IsExpired())
2919 visibleAura->ClientUpdate();
2927 GameObjectList::iterator itr;
2930 if (!(*itr)->isSpawned())
2933 (*itr)->SetRespawnTime(0);
2952 if (autoRepeatSpellInfo->
Id != 75)
2964 if (autoRepeatSpellInfo->
Id != 75)
3154 return spell->GetCastTime();
3314 AuraEffect const* auraEff = foundAura->GetEffect(spellEffectInfo.EffectIndex);
3320 bp = *(createInfo.
BaseAmount + spellEffectInfo.EffectIndex);
3322 bp =
int32(spellEffectInfo.BasePoints);
3332 if (castItemGUID != foundAura->GetCastItemGUID())
3335 *oldGUID = castItemGUID;
3336 uint32* oldItemId =
const_cast<uint32*
>(&foundAura->m_castItemId);
3338 int32* oldItemLevel =
const_cast<int32*
>(&foundAura->m_castItemLevel);
3370 std::vector<Aura*> aurasSharingLimit;
3373 if (scAura->IsSingleTargetWith(aura))
3374 aurasSharingLimit.push_back(scAura);
3380 while (aurasSharingLimit.size() > maxOtherAuras)
3382 aurasSharingLimit.back()->Remove();
3383 aurasSharingLimit.pop_back();
3399 TC_LOG_ERROR(
"spells",
"Unit::_CreateAuraApplication() called with a removed aura. Check if OnEffectHitTarget() is triggering any spell with apply aura effect (that's not allowed!)\nUnit: {}\nAura: {}",
GetDebugInfo(), aura->
GetDebugInfo());
3417 m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
3458 uint32 aStateMask = (1 << (aState - 1));
3490 player->UpdateVisibleObjectInteractions(
false,
true,
false,
false);
3508 TC_LOG_DEBUG(
"spells",
"Aura {} now is remove mode {}", aura->
GetId(), removeMode);
3526 bool auraStateFound =
false;
3530 bool canBreak =
false;
3532 for (AuraStateAurasMap::iterator itr =
m_auraStateAuras.lower_bound(auraState); itr !=
m_auraStateAuras.upper_bound(auraState) && !(auraStateFound && canBreak);)
3534 if (itr->second == aurApp)
3541 auraStateFound =
true;
3569 if (!auraStateFound)
3574 uint32 aStateMask = (1 << (auraState - 1));
3585 player->UpdateVisibleObjectInteractions(
false,
true,
false,
false);
3601 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
3603 if (iter->second == aurApp)
3652 Aura* aura = i->second;
3674 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
3692 TC_LOG_ERROR(
"spells",
"Unit::RemoveOwnedAura() called with unallowed removeMode AURA_REMOVE_NONE, spellId {}", aura->
GetId());
3699 for (AuraMap::iterator itr = range.first; itr != range.second; ++itr)
3701 if (itr->second == aura)
3714 for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
3716 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask)
3717 && (!casterGUID || itr->second->GetCasterGUID() == casterGUID)
3718 && (!itemCasterGUID || itr->second->GetCastItemGUID() == itemCasterGUID)
3719 && (!except || except != itr->second))
3743 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
3745 Aura const* aura = iter->second->GetBase();
3780 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
3782 if (aurApp == iter->second)
3804 if (check(iter->second))
3817 if (check(iter->second))
3830 if (check(iter->second))
3844 if (check(iter->second))
3856 for (AuraEffectList::iterator iter =
m_modAuras[auraType].begin(); iter !=
m_modAuras[auraType].end();)
3858 Aura* aura = (*iter)->GetBase();
3877 Aura const* aura = iter->second->GetBase();
3892 for (AuraMap::iterator iter = range.first; iter != range.second;)
3894 Aura* aura = iter->second;
3909 for (AuraMap::iterator iter = range.first; iter != range.second;)
3911 Aura* aura = iter->second;
3914 DispelInfo dispelInfo(dispeller, dispellerSpellId, chargesRemoved);
3937 for (AuraMap::iterator iter = range.first; iter != range.second;)
3939 Aura* aura = iter->second;
3945 uint32 recalculateMask = 0;
3955 recalculateMask |= 1 << i;
3973 oldAura->ModCharges(stolenCharges);
3975 oldAura->ModStackAmount(stolenCharges);
3976 oldAura->SetDuration(
int32(dur));
3992 if (newAura->IsSingleTarget())
3994 newAura->UnregisterSingleTarget();
4000 newAura->SetLoadedState(aura->
GetMaxDuration(),
int32(dur), stealCharge ? stolenCharges : aura->
GetCharges(), stolenCharges, recalculateMask, &damage[0]);
4001 newAura->ApplyForTargets();
4022 if (iter->second->GetBase()->GetCastItemGUID() == castItemGuid)
4034 for (AuraEffectList::iterator iter =
m_modAuras[auraType].begin(); iter !=
m_modAuras[auraType].end();)
4036 Aura* aura = (*iter)->GetBase();
4041 if (aura != except && (!casterGUID || aura->
GetCasterGUID() == casterGUID)
4056 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
4077 Aura const* aura = iter->second;
4098 for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
4104 iter = scAuras.begin();
4111template<
typename InterruptFlag>
4126 if (interruptSource)
4145template <
typename InterruptFlags>
4154 Aura* aura = (*iter)->GetBase();
4157 && (!source || aura->
GetId() != source->
Id)
4170 && spell->GetSpellInfo()->HasChannelInterruptFlag(flag)
4171 && (!source || spell->GetSpellInfo()->
Id != source->
Id)
4185 Aura const* aura = iter->second->GetBase();
4209 std::vector<Aura*> aurasToUpdateTargets;
4213 if (exceptSpellId && aura->
GetId() == exceptSpellId)
4217 if (!(appliedMechanicMask & mechanicMaskToRemove))
4225 aurasToUpdateTargets.push_back(aura);
4229 for (
Aura* aura : aurasToUpdateTargets)
4231 aura->UpdateTargetMap(aura->GetCaster());
4234 if (!aura->IsPassive() && aura->GetOwner() ==
this && !aura->GetApplicationOfTarget(
GetGUID()))
4235 aura->Remove(removeMode);
4244 Aura const* aura = iter->second->GetBase();
4259 Aura* aura = iter->second;
4262 for (Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr!= appMap.end();)
4278 if (iter->second->GetBase()->GetOwner() !=
this)
4293 AuraApplicationMap::iterator aurAppIter;
4297 AuraMap::iterator aurIter;
4301 const int maxIteration = 50;
4303 if (counter >= maxIteration)
4305 std::stringstream sstr;
4306 sstr <<
"Unit::RemoveAllAuras() iterated " << maxIteration <<
" times already but there are still "
4312 sstr <<
"m_appliedAuras:" <<
"\n";
4314 for (std::pair<uint32 const, AuraApplication*>& auraAppPair :
m_appliedAuras)
4315 sstr << auraAppPair.second->GetDebugInfo() <<
"\n";
4320 sstr <<
"m_ownedAuras:" <<
"\n";
4323 sstr << aura->GetDebugInfo() <<
"\n";
4355 auto evadeAuraCheck = [](
Aura const* aura)
4369 auto evadeAuraApplicationCheck = [&evadeAuraCheck](
AuraApplication const* aurApp)
4371 return evadeAuraCheck(aurApp->
GetBase());
4384 Aura const* aura = iter->second->GetBase();
4393 Aura* aura = iter->second;
4405 Aura const* aura = iter->second->GetBase();
4414 Aura* aura = iter->second;
4426 Aura const* aura = iter->second->GetBase();
4435 Aura* aura = iter->second;
4447 Aura const* aura = iter->second->GetBase();
4456 Aura* aura = iter->second;
4468 Aura* aura = iter->second;
4481 for (; range.first != range.second; ++range.first)
4483 Aura* aura = range.first->second;
4512 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
4514 if (itr->second->HasEffect(effIndex)
4515 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
4517 return itr->second->GetBase()->GetEffect(effIndex);
4530 rankSpell =
sSpellMgr->GetNextSpellInChain(rankSpell);
4538 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
4540 SpellInfo const* spell = (*i)->GetSpellInfo();
4543 if (!casterGUID.
IsEmpty() && (*i)->GetCasterGUID() != casterGUID)
4560 && (!except || except != app))
4572 if (predicate(pair.second))
4581 if (predicate(pair.second->GetBase()))
4589 for (AuraApplicationMap::value_type
const& pair :
m_appliedAuras)
4590 if (predicate(pair.second))
4598 for (AuraApplicationMap::value_type
const& pair :
m_appliedAuras)
4599 if (predicate(pair.second->GetBase()))
4608 return aurApp ? aurApp->
GetBase() :
nullptr;
4614 return aurApp ? aurApp->
GetBase() :
nullptr;
4620 return aurApp ? aurApp->
GetBase() :
nullptr;
4630 rankSpell =
sSpellMgr->GetNextSpellInChain(rankSpell);
4638 return aurApp ? aurApp->
GetBase() :
nullptr;
4644 for (
auto itr = auras.begin(); itr != auras.end(); ++itr)
4646 Aura* aura = itr->second;