Core/Players: Implemented item level based armor damage reduction diminishing for pvp

Port From (https://github.com/TrinityCore/TrinityCore/commit/255082782cef48f68ec4ad041202be8e8693071c)
This commit is contained in:
Hondacrx
2025-08-12 21:28:31 -04:00
parent 896f1077c2
commit 5934ef9cd9
3 changed files with 27 additions and 3 deletions
+3 -1
View File
@@ -436,8 +436,9 @@ namespace Game.DataStorage
BattlePetXPGameTable = ReadGameTable<GtBattlePetXPRecord>("BattlePetXP.txt");
CombatRatingsGameTable = ReadGameTable<GtCombatRatingsRecord>("CombatRatings.txt");
CombatRatingsMultByILvlGameTable = ReadGameTable<GtGenericMultByILvlRecord>("CombatRatingsMultByILvl.txt");
ItemSocketCostPerLevelGameTable = ReadGameTable<GtItemSocketCostPerLevelRecord>("ItemSocketCostPerLevel.txt");
HpPerStaGameTable = ReadGameTable<GtHpPerStaRecord>("HpPerSta.txt");
ItemLevelByLevelTable = ReadGameTable<GtItemLevelByLevelRecord>("ItemLevelByLevel.txt");
ItemSocketCostPerLevelGameTable = ReadGameTable<GtItemSocketCostPerLevelRecord>("ItemSocketCostPerLevel.txt");
NpcManaCostScalerGameTable = ReadGameTable<GtNpcManaCostScalerRecord>("NPCManaCostScaler.txt");
SpellScalingGameTable = ReadGameTable<GtSpellScalingRecord>("SpellScaling.txt");
StaminaMultByILvlGameTable = ReadGameTable<GtGenericMultByILvlRecord>("StaminaMultByILvl.txt");
@@ -807,6 +808,7 @@ namespace Game.DataStorage
public static GameTable<GtCombatRatingsRecord> CombatRatingsGameTable;
public static GameTable<GtGenericMultByILvlRecord> CombatRatingsMultByILvlGameTable;
public static GameTable<GtHpPerStaRecord> HpPerStaGameTable;
public static GameTable<GtItemLevelByLevelRecord> ItemLevelByLevelTable;
public static GameTable<GtItemSocketCostPerLevelRecord> ItemSocketCostPerLevelGameTable;
public static GameTable<GtNpcManaCostScalerRecord> NpcManaCostScalerGameTable;
public static GameTable<GtSpellScalingRecord> SpellScalingGameTable;
@@ -92,6 +92,11 @@ namespace Game.DataStorage
public float Health;
}
public sealed class GtItemLevelByLevelRecord
{
public float ItemLevel;
}
public sealed class GtItemSocketCostPerLevelRecord
{
public float SocketCost;
+19 -2
View File
@@ -3888,15 +3888,32 @@ namespace Game.Entities
if (MathFunctions.fuzzyLe(armor, 0.0f))
return damage;
Class attackerClass = Class.Warrior;
Class attackerClass = Class.None;
float? attackerItemLevel = null;
if (attacker != null)
{
attackerLevel = attacker.GetLevelForTarget(victim);
attackerClass = attacker.GetClass();
Player ownerPlayer = attacker.GetCharmerOrOwnerPlayerOrPlayerItself();
if (ownerPlayer != null)
attackerItemLevel = ownerPlayer.m_playerData.AvgItemLevel[(int)AvgItemLevelCategory.EquippedBase];
else
attackerClass = attacker.GetClass();
}
// Expansion and ContentTuningID necessary? Does Player get a ContentTuningID too ?
float armorConstant = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, attackerLevel, -2, 0, attackerClass, 0);
if (attackerItemLevel.HasValue)
{
uint maxLevelForExpansion = Global.ObjectMgr.GetMaxLevelForExpansion((Expansion)WorldConfig.GetUIntValue(WorldCfg.Expansion));
if (attackerLevel == maxLevelForExpansion)
{
float itemLevelDelta = attackerItemLevel.Value - CliDB.ItemLevelByLevelTable.GetRow(maxLevelForExpansion).ItemLevel;
uint curveId = Global.DB2Mgr.GetGlobalCurveId(GlobalCurve.ArmorItemLevelDiminishing);
if (curveId != 0)
armorConstant *= Global.DB2Mgr.GetCurveValueAt(curveId, itemLevelDelta);
}
}
if ((armor + armorConstant) == 0)
return damage;