Core/Players: Corrected shield block value calculations
Port From (https://github.com/TrinityCore/TrinityCore/commit/31d3080091643d4e348ec53c5bec3caf0e17110f)
This commit is contained in:
@@ -89,8 +89,6 @@ namespace Game.Entities
|
|||||||
SendPacket(packet);
|
SendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override uint GetBlockPercent() { return m_activePlayerData.ShieldBlock; }
|
|
||||||
|
|
||||||
bool CanTitanGrip() { return m_canTitanGrip; }
|
bool CanTitanGrip() { return m_canTitanGrip; }
|
||||||
|
|
||||||
float GetRatingMultiplier(CombatRating cr)
|
float GetRatingMultiplier(CombatRating cr)
|
||||||
@@ -344,6 +342,17 @@ namespace Game.Entities
|
|||||||
UpdateDamagePhysical(attType);
|
UpdateDamagePhysical(attType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override float GetBlockPercent(uint attackerLevel)
|
||||||
|
{
|
||||||
|
float blockArmor = (float)m_activePlayerData.ShieldBlock;
|
||||||
|
float armorConstant = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, attackerLevel, -2, 0, Class.None);
|
||||||
|
|
||||||
|
if ((blockArmor + armorConstant) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return Math.Min(blockArmor / (blockArmor + armorConstant), 0.85f);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetCanParry(bool value)
|
public void SetCanParry(bool value)
|
||||||
{
|
{
|
||||||
if (m_canParry == value)
|
if (m_canParry == value)
|
||||||
|
|||||||
@@ -4239,7 +4239,11 @@ namespace Game.Entities
|
|||||||
|
|
||||||
uint armor = proto.GetArmor(itemLevel);
|
uint armor = proto.GetArmor(itemLevel);
|
||||||
if (armor != 0)
|
if (armor != 0)
|
||||||
|
{
|
||||||
HandleStatFlatModifier(UnitMods.Armor, UnitModifierFlatType.Base, (float)armor, apply);
|
HandleStatFlatModifier(UnitMods.Armor, UnitModifierFlatType.Base, (float)armor, apply);
|
||||||
|
if (proto.GetClass() == ItemClass.Armor && (ItemSubClassArmor)proto.GetSubClass() == ItemSubClassArmor.Shield)
|
||||||
|
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ShieldBlock), apply ? (uint)(armor * 2.5f) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
WeaponAttackType attType = GetAttackBySlot(slot, proto.GetInventoryType());
|
WeaponAttackType attType = GetAttackBySlot(slot, proto.GetInventoryType());
|
||||||
if (attType != WeaponAttackType.Max && CanUseAttackType(attType))
|
if (attType != WeaponAttackType.Max && CanUseAttackType(attType))
|
||||||
|
|||||||
@@ -5761,8 +5761,7 @@ namespace Game.Entities
|
|||||||
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ParryPercentage), 0.0f);
|
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ParryPercentage), 0.0f);
|
||||||
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.BlockPercentage), 0.0f);
|
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.BlockPercentage), 0.0f);
|
||||||
|
|
||||||
// Static 30% damage blocked
|
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ShieldBlock), 0u);
|
||||||
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ShieldBlock), 30u);
|
|
||||||
|
|
||||||
// Dodge percentage
|
// Dodge percentage
|
||||||
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.DodgePercentage), 0.0f);
|
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.DodgePercentage), 0.0f);
|
||||||
|
|||||||
@@ -1710,7 +1710,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void KillSelf(bool durabilityLoss = true) { Kill(this, durabilityLoss); }
|
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)
|
void UpdateReactives(uint p_time)
|
||||||
{
|
{
|
||||||
@@ -1981,7 +1981,7 @@ namespace Game.Entities
|
|||||||
damageInfo.HitInfo |= HitInfo.Block;
|
damageInfo.HitInfo |= HitInfo.Block;
|
||||||
damageInfo.originalDamage = damageInfo.damage;
|
damageInfo.originalDamage = damageInfo.damage;
|
||||||
// 30% damage blocked, double blocked amount if block is critical
|
// 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.damage -= damageInfo.blocked_amount;
|
||||||
damageInfo.cleanDamage += damageInfo.blocked_amount;
|
damageInfo.cleanDamage += damageInfo.blocked_amount;
|
||||||
break;
|
break;
|
||||||
@@ -2780,8 +2780,7 @@ namespace Game.Entities
|
|||||||
uint attackerLevel = attacker.GetLevelForTarget(victim);
|
uint attackerLevel = attacker.GetLevelForTarget(victim);
|
||||||
// Expansion and ContentTuningID necessary? Does Player get a ContentTuningID too ?
|
// Expansion and ContentTuningID necessary? Does Player get a ContentTuningID too ?
|
||||||
float armorConstant = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, attackerLevel, -2, 0, attacker.GetClass());
|
float armorConstant = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, attackerLevel, -2, 0, attacker.GetClass());
|
||||||
|
if ((armor + armorConstant) == 0)
|
||||||
if (armorConstant == 0)
|
|
||||||
return damage;
|
return damage;
|
||||||
|
|
||||||
float mitigation = Math.Min(armor / (armor + armorConstant), 0.85f);
|
float mitigation = Math.Min(armor / (armor + armorConstant), 0.85f);
|
||||||
|
|||||||
@@ -2418,7 +2418,7 @@ namespace Game.Entities
|
|||||||
if (blocked)
|
if (blocked)
|
||||||
{
|
{
|
||||||
// double blocked amount if block is critical
|
// double blocked amount if block is critical
|
||||||
uint value = victim.GetBlockPercent();
|
float value = victim.GetBlockPercent(GetLevel());
|
||||||
if (victim.IsBlockCritical())
|
if (victim.IsBlockCritical())
|
||||||
value *= 2; // double blocked percent
|
value *= 2; // double blocked percent
|
||||||
damageInfo.blocked = (uint)MathFunctions.CalculatePct(damage, value);
|
damageInfo.blocked = (uint)MathFunctions.CalculatePct(damage, value);
|
||||||
|
|||||||
Reference in New Issue
Block a user