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
@@ -492,7 +492,7 @@ namespace Framework.Constants
TriggerSpellOnHealthPct = 468, TriggerSpellOnHealthPct = 468,
ShowConfirmationPromptWithDifficulty = 469, ShowConfirmationPromptWithDifficulty = 469,
Unk470 = 470, Unk470 = 470,
ModVersatility = 471, // NYI ModVersatility = 471,
Unk472 = 472, Unk472 = 472,
PreventDurabilityLossFromCombat = 473, PreventDurabilityLossFromCombat = 473,
Unk474 = 474, Unk474 = 474,
@@ -866,6 +866,12 @@ namespace Game.Entities
ApplyRatingMod(CombatRating.Mastery, (int)enchant_amount, apply); ApplyRatingMod(CombatRating.Mastery, (int)enchant_amount, apply);
Log.outDebug(LogFilter.Player, "+ {0} MASTERY", enchant_amount); Log.outDebug(LogFilter.Player, "+ {0} MASTERY", enchant_amount);
break; break;
case ItemModType.Versatility:
ApplyRatingMod(CombatRating.VersatilityDamageDone, (int)enchant_amount, apply);
ApplyRatingMod(CombatRating.VersatilityHealingDone, (int)enchant_amount, apply);
ApplyRatingMod(CombatRating.VersatilityDamageTaken, (int)enchant_amount, apply);
Log.outDebug(LogFilter.Player, "+ {0} VERSATILITY", enchant_amount);
break;
default: default:
break; break;
} }
+37 -2
View File
@@ -928,6 +928,7 @@ namespace Game.Entities
UpdateRating(combatRating); UpdateRating(combatRating);
} }
public override void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, out float min_damage, out float max_damage) public override void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, out float min_damage, out float max_damage)
{ {
UnitMods unitMod; UnitMods unitMod;
@@ -956,6 +957,10 @@ namespace Game.Entities
float weaponMinDamage = GetWeaponDamageRange(attType, WeaponDamageRange.MinDamage); float weaponMinDamage = GetWeaponDamageRange(attType, WeaponDamageRange.MinDamage);
float weaponMaxDamage = GetWeaponDamageRange(attType, WeaponDamageRange.MaxDamage); 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()); SpellShapeshiftFormRecord shapeshift = CliDB.SpellShapeshiftFormStorage.LookupByKey(GetShapeshiftForm());
if (shapeshift != null && shapeshift.CombatRoundTime != 0) if (shapeshift != null && shapeshift.CombatRoundTime != 0)
{ {
@@ -975,9 +980,10 @@ namespace Game.Entities
weaponMaxDamage = SharedConst.BaseMaxDamage; weaponMaxDamage = SharedConst.BaseMaxDamage;
} }
min_damage = ((baseValue + weaponMinDamage) * basePct + totalValue) * totalPct; min_damage = ((baseValue + weaponMinDamage) * basePct + totalValue) * totalPct * versaDmgMod;
max_damage = ((baseValue + weaponMaxDamage) * basePct + totalValue) * totalPct; max_damage = ((baseValue + weaponMaxDamage) * basePct + totalValue) * totalPct * versaDmgMod;
} }
void UpdateAllCritPercentages() void UpdateAllCritPercentages()
{ {
float value = 5.0f; float value = 5.0f;
@@ -1296,6 +1302,12 @@ namespace Game.Entities
case CombatRating.Mastery: case CombatRating.Mastery:
UpdateMastery(); UpdateMastery();
break; break;
case CombatRating.VersatilityDamageDone:
UpdateVersatilityDamageDone();
break;
case CombatRating.VersatilityHealingDone:
UpdateHealingDonePercentMod();
break;
} }
} }
public void UpdateMastery() 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) void UpdateArmorPenetration(int amount)
{ {
// Store Rating Value // Store Rating Value
+9
View File
@@ -2782,6 +2782,15 @@ namespace Game.Entities
else else
TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModRangedDamageTakenPct); TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModRangedDamageTakenPct);
// Versatility
Player modOwner = GetSpellModOwner();
if (modOwner)
{
// only 50% of SPELL_AURA_MOD_VERSATILITY for damage reduction
float versaBonus = modOwner.GetTotalAuraModifier(AuraType.ModVersatility) / 2.0f;
MathFunctions.AddPct(ref TakenTotalMod, -(modOwner.GetRatingBonusValue(CombatRating.VersatilityDamageTaken) + versaBonus));
}
float tmpDamage = 0.0f; float tmpDamage = 0.0f;
if (TakenTotalCasterMod != 0) if (TakenTotalCasterMod != 0)
+17 -1
View File
@@ -180,6 +180,11 @@ namespace Game.Entities
if (IsTypeId(TypeId.Unit) && !IsPet()) if (IsTypeId(TypeId.Unit) && !IsPet())
DoneTotalMod *= ToCreature().GetSpellDamageMod(ToCreature().GetCreatureTemplate().Rank); DoneTotalMod *= ToCreature().GetSpellDamageMod(ToCreature().GetCreatureTemplate().Rank);
// Versatility
Player modOwner = GetSpellModOwner();
if (modOwner)
MathFunctions.AddPct(ref DoneTotalMod, modOwner.GetRatingBonusValue(CombatRating.VersatilityDamageDone) + modOwner.GetTotalAuraModifier(AuraType.ModVersatility));
float maxModDamagePercentSchool = 0.0f; float maxModDamagePercentSchool = 0.0f;
if (IsTypeId(TypeId.Player)) if (IsTypeId(TypeId.Player))
{ {
@@ -270,6 +275,15 @@ namespace Game.Entities
// get all auras from caster that allow the spell to ignore resistance (sanctified wrath) // get all auras from caster that allow the spell to ignore resistance (sanctified wrath)
TakenTotalCasterMod += GetTotalAuraModifierByMiscMask(AuraType.ModIgnoreTargetResist, (int)spellProto.GetSchoolMask()); TakenTotalCasterMod += GetTotalAuraModifierByMiscMask(AuraType.ModIgnoreTargetResist, (int)spellProto.GetSchoolMask());
// Versatility
Player modOwner = GetSpellModOwner();
if (modOwner)
{
// only 50% of SPELL_AURA_MOD_VERSATILITY for damage reduction
float versaBonus = modOwner.GetTotalAuraModifier(AuraType.ModVersatility) / 2.0f;
MathFunctions.AddPct(ref TakenTotalMod, -(modOwner.GetRatingBonusValue(CombatRating.VersatilityDamageTaken) + versaBonus));
}
// from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
// multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(AuraType.ModDamagePercentTaken, (uint)spellProto.GetSchoolMask()); TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(AuraType.ModDamagePercentTaken, (uint)spellProto.GetSchoolMask());
@@ -291,7 +305,6 @@ namespace Game.Entities
if (TakenAdvertisedBenefit != 0) if (TakenAdvertisedBenefit != 0)
{ {
// level penalty still applied on Taken bonus - is it blizzlike? // level penalty still applied on Taken bonus - is it blizzlike?
Player modOwner = GetSpellModOwner();
if (modOwner) if (modOwner)
{ {
coeff *= 100.0f; coeff *= 100.0f;
@@ -490,6 +503,9 @@ namespace Game.Entities
if (spellProto.SpellFamilyName == SpellFamilyNames.Potion) if (spellProto.SpellFamilyName == SpellFamilyNames.Potion)
return 1.0f; return 1.0f;
if (IsPlayer())
return GetFloatValue(PlayerFields.ModHealingDonePct);
float DoneTotalMod = 1.0f; float DoneTotalMod = 1.0f;
// Healing done percent // Healing done percent
+26
View File
@@ -3136,6 +3136,17 @@ namespace Game.Spells
target.ToPlayer().UpdateSpellDamageAndHealingBonus(); target.ToPlayer().UpdateSpellDamageAndHealingBonus();
} }
[AuraEffectHandler(AuraType.ModHealingDonePercent)]
void HandleModHealingDonePct(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat))
return;
Player player = aurApp.GetTarget().ToPlayer();
if (player)
player.UpdateHealingDonePercentMod();
}
[AuraEffectHandler(AuraType.ModTotalStatPercentage)] [AuraEffectHandler(AuraType.ModTotalStatPercentage)]
void HandleModTotalPercentStat(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) void HandleModTotalPercentStat(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{ {
@@ -3286,6 +3297,21 @@ namespace Game.Spells
target.UpdateAttackPowerAndDamage(true); target.UpdateAttackPowerAndDamage(true);
} }
[AuraEffectHandler(AuraType.ModVersatility)]
void HandleModVersatilityByPct(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat))
return;
Player target = aurApp.GetTarget().ToPlayer();
if (target)
{
target.SetStatFloatValue(PlayerFields.VersatilityBonus, target.GetTotalAuraModifier(AuraType.ModVersatility));
target.UpdateHealingDonePercentMod();
target.UpdateVersatilityDamageDone();
}
}
[AuraEffectHandler(AuraType.ModMaxPower)] [AuraEffectHandler(AuraType.ModMaxPower)]
void HandleAuraModMaxPower(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) void HandleAuraModMaxPower(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{ {