fix(Core): Small improvements for weapon/defence skill handling (#12253)

* Improve weaponskill handling

* replace pvp check TYPEID_PLAYER with IsCharmedOwnedByPlayerOrPlayer

* remove no longer needed pvp checks

* move pvp check back to ProcDamageAndSpellFor()

* rename plevel -> playerLevel, add LOG to verify increase chances

* fix issue due to negative value in uint

* revert change which allowed blocked attacks to increase weapon skill

Co-authored-by: schell244 <>
This commit is contained in:
schell244
2022-09-21 15:09:26 +02:00
committed by GitHub
parent d8598c764e
commit f75aceb9a9
2 changed files with 37 additions and 26 deletions

View File

@@ -15742,21 +15742,18 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
// Update skills here for players
// only when you are not fighting other players or their pets/totems (pvp)
if (GetTypeId() == TYPEID_PLAYER &&
target->GetTypeId() != TYPEID_PLAYER &&
!(target->IsTotem() && target->ToTotem()->GetOwner()->IsPlayer()) &&
!target->IsPet()
)
if (IsPlayer() && !target->IsCharmedOwnedByPlayerOrPlayer())
{
// On melee based hit/miss/resist/parry/dodge need to update skill (for victim and attacker)
if (procExtra & (PROC_EX_NORMAL_HIT | PROC_EX_MISS | PROC_EX_RESIST | PROC_EX_PARRY | PROC_EX_DODGE))
{
if (target->GetTypeId() != TYPEID_PLAYER)
ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
}
// Update defence if player is victim and we block
// Update defence if player is victim and we block - TODO: confirm that blocked attacks only have a chance to increase defence skill
else if (isVictim && procExtra & (PROC_EX_BLOCK))
{
ToPlayer()->UpdateCombatSkills(target, attType, true);
}
}
// If exist crit/parry/dodge/block need update aura state (for victim and attacker)
if (procExtra & (PROC_EX_CRITICAL_HIT | PROC_EX_PARRY | PROC_EX_DODGE | PROC_EX_BLOCK))