Core/Players: Corrected shield block value calculations

Port From (https://github.com/TrinityCore/TrinityCore/commit/31d3080091643d4e348ec53c5bec3caf0e17110f)
This commit is contained in:
hondacrx
2021-02-21 21:44:30 -05:00
parent baa44cc4ee
commit 26c57969fb
5 changed files with 20 additions and 9 deletions
+3 -4
View File
@@ -1710,7 +1710,7 @@ namespace Game.Entities
public void KillSelf(bool durabilityLoss = true) { Kill(this, durabilityLoss); }
public virtual uint GetBlockPercent() { return 30; }
public virtual float GetBlockPercent(uint attackerLevel) { return 30.0f; }
void UpdateReactives(uint p_time)
{
@@ -1981,7 +1981,7 @@ namespace Game.Entities
damageInfo.HitInfo |= HitInfo.Block;
damageInfo.originalDamage = damageInfo.damage;
// 30% damage blocked, double blocked amount if block is critical
damageInfo.blocked_amount = MathFunctions.CalculatePct(damageInfo.damage, damageInfo.target.IsBlockCritical() ? damageInfo.target.GetBlockPercent() * 2 : damageInfo.target.GetBlockPercent());
damageInfo.blocked_amount = MathFunctions.CalculatePct(damageInfo.damage, damageInfo.target.IsBlockCritical() ? damageInfo.target.GetBlockPercent(GetLevel()) * 2 : damageInfo.target.GetBlockPercent(GetLevel()));
damageInfo.damage -= damageInfo.blocked_amount;
damageInfo.cleanDamage += damageInfo.blocked_amount;
break;
@@ -2780,8 +2780,7 @@ namespace Game.Entities
uint attackerLevel = attacker.GetLevelForTarget(victim);
// Expansion and ContentTuningID necessary? Does Player get a ContentTuningID too ?
float armorConstant = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, attackerLevel, -2, 0, attacker.GetClass());
if (armorConstant == 0)
if ((armor + armorConstant) == 0)
return damage;
float mitigation = Math.Min(armor / (armor + armorConstant), 0.85f);
+1 -1
View File
@@ -2418,7 +2418,7 @@ namespace Game.Entities
if (blocked)
{
// double blocked amount if block is critical
uint value = victim.GetBlockPercent();
float value = victim.GetBlockPercent(GetLevel());
if (victim.IsBlockCritical())
value *= 2; // double blocked percent
damageInfo.blocked = (uint)MathFunctions.CalculatePct(damage, value);