Core/Auras: periodics refactor part 1:

Port From (https://github.com/TrinityCore/TrinityCore/commit/5f9e0d92d563c983c229db1569414916b3dce51e)
This commit is contained in:
hondacrx
2021-03-17 16:08:17 -04:00
parent f2317c2bdf
commit 1d8bab3b58
6 changed files with 112 additions and 58 deletions
+7 -1
View File
@@ -455,9 +455,15 @@ namespace Scripts.Spells.Druid
{
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
{
if (aurEff.GetTotalTicks() == 0)
{
amount = 0;
return;
}
Unit caster = GetCaster();
if (caster)
amount = MathFunctions.CalculatePct(caster.GetCreatePowers(PowerType.Mana), amount) / aurEff.GetTotalTicks();
amount = MathFunctions.CalculatePct(caster.GetCreatePowers(PowerType.Mana), amount) / (int)aurEff.GetTotalTicks();
else
amount = 0;
}
+1 -1
View File
@@ -1321,7 +1321,7 @@ namespace Scripts.Spells.Generic
{
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
{
if (!GetCaster())
if (!GetCaster() || aurEff.GetTotalTicks() == 0)
return;
float heal = 0.0f;