Revert "Core/Unit: Improve Glancing Blow calculation"

This reverts commit 3d2013e168.
This commit is contained in:
Ovahlord
2021-02-20 19:11:30 +01:00
parent cf2267af3f
commit c288745598

View File

@@ -1373,14 +1373,9 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
damageInfo->HitInfo |= HITINFO_GLANCING;
damageInfo->TargetState = VICTIMSTATE_HIT;
int32 leveldif = int32(victim->getLevel()) - int32(getLevel());
if (leveldif == 0)
leveldif = 1;
if (leveldif > 3)
leveldif = 3;
int32 const reductionMax = leveldif * 10;
int32 const reductionMin = std::max(1, reductionMax - 10);
float reducePercent = 1.f - irand(reductionMin, reductionMax) / 100.0f;
float reducePercent = 1 - leveldif * 0.1f;
damageInfo->cleanDamage += damageInfo->damage - uint32(reducePercent * damageInfo->damage);
damageInfo->damage = uint32(reducePercent * damageInfo->damage);
break;
@@ -2194,10 +2189,10 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy
}
// 4. GLANCING
// Max 40% chance to score a glancing blow against mobs that are the same or higher level (can do only players and pets and not with ranged weapon)
// Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
if ((GetTypeId() == TYPEID_PLAYER || IsPet()) &&
victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet() &&
getLevel() <= victim->getLevelForTarget(this))
getLevel() < victim->getLevelForTarget(this))
{
// cap possible value (with bonuses > max skill)
int32 skill = attackerMaxSkillValueForLevel;