Core/Spells: Damage and healing bonus calculation fixes
* Spells with SPELL_DAMAGE_CLASS_NONE are now allowed to benefit from spellmods * Fixed SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE and SPELL_AURA_MOD_HEALING_DONE_PCT_VERSUS_TARGET_HEALTH not working for players Port From (https://github.com/TrinityCore/TrinityCore/commit/ac1c0419441a6c0b1a049a3197a35c754e00ea6e)
This commit is contained in:
@@ -123,17 +123,11 @@ namespace Game.Entities
|
|||||||
APbonus += GetTotalAttackPowerValue(attType);
|
APbonus += GetTotalAttackPowerValue(attType);
|
||||||
DoneTotal += (int)(stack * ApCoeffMod * APbonus);
|
DoneTotal += (int)(stack * ApCoeffMod * APbonus);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// No bonus damage for SPELL_DAMAGE_CLASS_NONE class spells by default
|
|
||||||
if (spellProto.DmgClass == SpellDmgClass.None)
|
|
||||||
return (int)Math.Max(pdamage * DoneTotalMod, 0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default calculation
|
// Default calculation
|
||||||
float coeff = spellEffectInfo.BonusCoefficient;
|
|
||||||
if (DoneAdvertisedBenefit != 0)
|
if (DoneAdvertisedBenefit != 0)
|
||||||
{
|
{
|
||||||
|
float coeff = spellEffectInfo.BonusCoefficient;
|
||||||
Player modOwner1 = GetSpellModOwner();
|
Player modOwner1 = GetSpellModOwner();
|
||||||
if (modOwner1)
|
if (modOwner1)
|
||||||
{
|
{
|
||||||
@@ -448,7 +442,6 @@ namespace Game.Entities
|
|||||||
DoneAdvertisedBenefit += (uint)((Guardian)this).GetBonusDamage();
|
DoneAdvertisedBenefit += (uint)((Guardian)this).GetBonusDamage();
|
||||||
|
|
||||||
// Check for table values
|
// Check for table values
|
||||||
float coeff = spellEffectInfo.BonusCoefficient;
|
|
||||||
if (spellEffectInfo.BonusCoefficientFromAP > 0.0f)
|
if (spellEffectInfo.BonusCoefficientFromAP > 0.0f)
|
||||||
{
|
{
|
||||||
WeaponAttackType attType = (spellProto.IsRangedWeaponSpell() && spellProto.DmgClass != SpellDmgClass.Melee) ? WeaponAttackType.RangedAttack : WeaponAttackType.BaseAttack;
|
WeaponAttackType attType = (spellProto.IsRangedWeaponSpell() && spellProto.DmgClass != SpellDmgClass.Melee) ? WeaponAttackType.RangedAttack : WeaponAttackType.BaseAttack;
|
||||||
@@ -457,16 +450,11 @@ namespace Game.Entities
|
|||||||
|
|
||||||
DoneTotal += (int)(spellEffectInfo.BonusCoefficientFromAP * stack * APbonus);
|
DoneTotal += (int)(spellEffectInfo.BonusCoefficientFromAP * stack * APbonus);
|
||||||
}
|
}
|
||||||
else if (coeff <= 0.0f) // no AP and no SP coefs, skip
|
|
||||||
{
|
|
||||||
// No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
|
|
||||||
if (spellProto.DmgClass == SpellDmgClass.None)
|
|
||||||
return (int)Math.Max(healamount * DoneTotalMod, 0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default calculation
|
// Default calculation
|
||||||
if (DoneAdvertisedBenefit != 0)
|
if (DoneAdvertisedBenefit != 0)
|
||||||
{
|
{
|
||||||
|
float coeff = spellEffectInfo.BonusCoefficient;
|
||||||
Player modOwner = GetSpellModOwner();
|
Player modOwner = GetSpellModOwner();
|
||||||
if (modOwner)
|
if (modOwner)
|
||||||
{
|
{
|
||||||
@@ -529,6 +517,9 @@ namespace Game.Entities
|
|||||||
if (spellProto.SpellFamilyName == SpellFamilyNames.Potion)
|
if (spellProto.SpellFamilyName == SpellFamilyNames.Potion)
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
|
||||||
|
float DoneTotalMod = 1.0f;
|
||||||
|
|
||||||
|
// Healing done percent
|
||||||
Player thisPlayer = ToPlayer();
|
Player thisPlayer = ToPlayer();
|
||||||
if (thisPlayer != null)
|
if (thisPlayer != null)
|
||||||
{
|
{
|
||||||
@@ -537,10 +528,10 @@ namespace Game.Entities
|
|||||||
if (((int)spellProto.GetSchoolMask() & (1 << i)) != 0)
|
if (((int)spellProto.GetSchoolMask() & (1 << i)) != 0)
|
||||||
maxModDamagePercentSchool = Math.Max(maxModDamagePercentSchool, thisPlayer.m_activePlayerData.ModHealingDonePercent[i]);
|
maxModDamagePercentSchool = Math.Max(maxModDamagePercentSchool, thisPlayer.m_activePlayerData.ModHealingDonePercent[i]);
|
||||||
|
|
||||||
return maxModDamagePercentSchool;
|
DoneTotalMod *= maxModDamagePercentSchool;
|
||||||
}
|
}
|
||||||
|
else // SPELL_AURA_MOD_HEALING_DONE_PERCENT is included in m_activePlayerData->ModHealingDonePercent for players
|
||||||
float DoneTotalMod = 1.0f;
|
DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModHealingDonePercent);
|
||||||
|
|
||||||
// bonus against aurastate
|
// bonus against aurastate
|
||||||
DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModDamageDoneVersusAurastate, aurEff =>
|
DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModDamageDoneVersusAurastate, aurEff =>
|
||||||
@@ -548,9 +539,6 @@ namespace Game.Entities
|
|||||||
return victim.HasAuraState((AuraStateType)aurEff.GetMiscValue());
|
return victim.HasAuraState((AuraStateType)aurEff.GetMiscValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Healing done percent
|
|
||||||
DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModHealingDonePercent);
|
|
||||||
|
|
||||||
// bonus from missing health of target
|
// bonus from missing health of target
|
||||||
float healthPctDiff = 100.0f - victim.GetHealthPct();
|
float healthPctDiff = 100.0f - victim.GetHealthPct();
|
||||||
foreach (AuraEffect healingDonePctVsTargetHealth in GetAuraEffectsByType(AuraType.ModHealingDonePctVersusTargetHealth))
|
foreach (AuraEffect healingDonePctVsTargetHealth in GetAuraEffectsByType(AuraType.ModHealingDonePctVersusTargetHealth))
|
||||||
|
|||||||
Reference in New Issue
Block a user