fix(Core/Unit): spell_group leftovers (#23995)

Co-authored-by: ariel- <ariel-@users.noreply.github.com>
This commit is contained in:
Tereneckla
2025-12-01 00:52:47 +00:00
committed by GitHub
parent 9d74401b67
commit a8c05b236c
6 changed files with 33 additions and 18 deletions

View File

@@ -7647,7 +7647,7 @@ void Player::_ApplyAllItemMods()
if (!proto)
continue;
ApplyItemDependentAuras(m_items[i], false);
ApplyItemDependentAuras(m_items[i], true);
_ApplyItemBonuses(proto, i, true);
WeaponAttackType const attackType = Player::GetAttackBySlot(i);

View File

@@ -157,7 +157,7 @@ bool Player::UpdateStats(Stats stat)
mask |= (*i)->GetMiscValue();
if (mask)
{
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
if (mask & (1 << rating))
ApplyRatingMod(CombatRating(rating), 0, true);
}
@@ -272,7 +272,7 @@ void Player::UpdateArmor()
float value = GetFlatModifierValue(unitMod, BASE_VALUE); // base armor (from items)
value *= GetPctModifierValue(unitMod, BASE_PCT); // armor percent from items
value += GetStat(STAT_AGILITY) * 2.0f; // armor bonus from stats
value += GetStat(STAT_AGILITY) * 2.0f; // armor bonus from stats
value += GetFlatModifierValue(unitMod, TOTAL_VALUE);
//add dynamic flat mods

View File

@@ -13465,7 +13465,12 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
if (mechanicMask)
{
TakenTotalMod *= GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, mechanicMask);
TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, [mechanicMask](AuraEffect const* aurEff) -> bool
{
if (mechanicMask & uint32(1 << (aurEff->GetMiscValue())))
return true;
return false;
});
}
}

View File

@@ -219,7 +219,7 @@ enum WeaponAttackType : uint8
MAX_ATTACK
};
enum CombatRating
enum CombatRating : uint8
{
CR_WEAPON_SKILL = 0,
CR_DEFENSE_SKILL = 1,

View File

@@ -726,9 +726,12 @@ void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply)
std::list<AuraApplication*> effectApplications;
GetApplicationList(effectApplications);
for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
if ((*apptItr)->HasEffect(GetEffIndex()))
HandleEffect(*apptItr, handleMask, false);
for (AuraApplication* aurApp : effectApplications)
if (aurApp->HasEffect(GetEffIndex()))
{
aurApp->GetTarget()->_RegisterAuraEffect(this, false);
HandleEffect(aurApp, handleMask, false);
}
if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
{
@@ -739,9 +742,15 @@ void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply)
CalculateSpellMod();
}
for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
if ((*apptItr)->HasEffect(GetEffIndex()))
HandleEffect(*apptItr, handleMask, true);
for (AuraApplication* aurApp : effectApplications)
if (aurApp->HasEffect(GetEffIndex()))
{
if (aurApp->GetRemoveMode() != AURA_REMOVE_NONE)
continue;
aurApp->GetTarget()->_RegisterAuraEffect(this, true);
HandleEffect(aurApp, handleMask, true);
}
}
void AuraEffect::HandleEffect(AuraApplication* aurApp, uint8 mode, bool apply)
@@ -5105,7 +5114,7 @@ void AuraEffect::HandleModRating(AuraApplication const* aurApp, uint8 mode, bool
if (!target->IsPlayer())
return;
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
if (GetMiscValue() & (1 << rating))
target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
}
@@ -5121,7 +5130,7 @@ void AuraEffect::HandleModRatingFromStat(AuraApplication const* aurApp, uint8 mo
return;
// Just recalculate ratings
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
if (GetMiscValue() & (1 << rating))
target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
}

View File

@@ -443,15 +443,16 @@ class spell_dru_enrage : public AuraScript
void RecalculateBaseArmor()
{
// Recalculate modifies the list while we're iterating through it, so let's copy it instead
Unit::AuraEffectList const& auras = GetTarget()->GetAuraEffectsByType(SPELL_AURA_MOD_BASE_RESISTANCE_PCT);
for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
std::vector<AuraEffect*> aurEffs(auras.begin(), auras.end());
for (AuraEffect* aurEff : aurEffs)
{
SpellInfo const* spellInfo = (*i)->GetSpellInfo();
SpellInfo const* spellInfo = aurEff->GetSpellInfo();
// Dire- / Bear Form (Passive)
if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && spellInfo->SpellFamilyFlags.HasFlag(0x0, 0x0, 0x2))
{
(*i)->RecalculateAmount();
}
aurEff->RecalculateAmount();
}
}