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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user