Core/Units: Implemented versatility

This commit is contained in:
hondacrx
2018-04-29 19:40:29 -04:00
parent 3d6c47336c
commit 9c33d9c20e
6 changed files with 96 additions and 4 deletions
+37 -2
View File
@@ -928,6 +928,7 @@ namespace Game.Entities
UpdateRating(combatRating);
}
public override void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, out float min_damage, out float max_damage)
{
UnitMods unitMod;
@@ -956,6 +957,10 @@ namespace Game.Entities
float weaponMinDamage = GetWeaponDamageRange(attType, WeaponDamageRange.MinDamage);
float weaponMaxDamage = GetWeaponDamageRange(attType, WeaponDamageRange.MaxDamage);
float versaDmgMod = 1.0f;
MathFunctions.AddPct(ref versaDmgMod, GetRatingBonusValue(CombatRating.VersatilityDamageDone) + (float)GetTotalAuraModifier(AuraType.ModVersatility));
SpellShapeshiftFormRecord shapeshift = CliDB.SpellShapeshiftFormStorage.LookupByKey(GetShapeshiftForm());
if (shapeshift != null && shapeshift.CombatRoundTime != 0)
{
@@ -975,9 +980,10 @@ namespace Game.Entities
weaponMaxDamage = SharedConst.BaseMaxDamage;
}
min_damage = ((baseValue + weaponMinDamage) * basePct + totalValue) * totalPct;
max_damage = ((baseValue + weaponMaxDamage) * basePct + totalValue) * totalPct;
min_damage = ((baseValue + weaponMinDamage) * basePct + totalValue) * totalPct * versaDmgMod;
max_damage = ((baseValue + weaponMaxDamage) * basePct + totalValue) * totalPct * versaDmgMod;
}
void UpdateAllCritPercentages()
{
float value = 5.0f;
@@ -1296,6 +1302,12 @@ namespace Game.Entities
case CombatRating.Mastery:
UpdateMastery();
break;
case CombatRating.VersatilityDamageDone:
UpdateVersatilityDamageDone();
break;
case CombatRating.VersatilityHealingDone:
UpdateHealingDonePercentMod();
break;
}
}
public void UpdateMastery()
@@ -1334,6 +1346,29 @@ namespace Game.Entities
}
}
public void UpdateVersatilityDamageDone()
{
// No proof that CR_VERSATILITY_DAMAGE_DONE is allways = PLAYER_VERSATILITY
SetUInt32Value(PlayerFields.Versatility, GetUInt32Value(PlayerFields.CombatRating1 + (int)CombatRating.VersatilityDamageDone));
if (GetClass() == Class.Hunter)
UpdateDamagePhysical(WeaponAttackType.RangedAttack);
else
UpdateDamagePhysical(WeaponAttackType.BaseAttack);
}
public void UpdateHealingDonePercentMod()
{
float value = 1.0f;
MathFunctions.AddPct(ref value, GetRatingBonusValue(CombatRating.VersatilityHealingDone) + GetTotalAuraModifier(AuraType.ModVersatility));
foreach (AuraEffect auraEffect in GetAuraEffectsByType(AuraType.ModHealingDonePercent))
MathFunctions.AddPct(ref value, auraEffect.GetAmount());
SetStatFloatValue(PlayerFields.ModHealingDonePct, value);
}
void UpdateArmorPenetration(int amount)
{
// Store Rating Value