aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2021-02-20 15:21:38 +0100
committerjackpoz <giacomopoz@gmail.com>2021-02-20 15:21:38 +0100
commit8014fa1a2f49d7f81fa91ec9c7bd5c460f4a08fe (patch)
tree8905a66cb07420bf5f209edc91c1257aa90d334c /src
parentc3165dce316d4dc3ecb49e4227ff6789bdbf14f6 (diff)
Revert "Core/Unit: Improve Glancing Blow calculation (#26100)"
This reverts commit c3165dce316d4dc3ecb49e4227ff6789bdbf14f6.
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 0149cfea607..b2fa0d64bf1 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -1316,15 +1316,13 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
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;
// against boss-level targets - 24% chance of 25% average damage reduction (damage reduction range : 20-30%)
// against level 82 elites - 18% chance of 15% average damage reduction (damage reduction range : 10-20%)
int32 const reductionMax = leveldif * 10;
- int32 const reductionMin = std::max(1, reductionMax - 10);
+ int32 const reductionMin = reductionMax - 10;
float reducePercent = 1.f - irand(reductionMin, reductionMax) / 100.0f;
for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
@@ -2171,10 +2169,10 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
}
// 4. GLANCING
- // Max 40% chance to score a glancing blow against mobs that are 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 = attackerWeaponSkill;