Core/Auras: implement Aura 379 (SPELL_AURA_MOD_MANA_REGEN_PCT)

This commit is contained in:
hondacrx
2018-04-08 18:55:25 -04:00
parent c69c715cc0
commit da61c920b7
4 changed files with 28 additions and 12 deletions
@@ -400,7 +400,7 @@ namespace Framework.Constants
ModCurrencyGainFromSource = 376, // NYI
CastWhileWalking2 = 377, // NYI
Unk378 = 378,
Unk379 = 379,
ModManaRegenPct = 379,
ModGlobalCooldownByHaste = 380, // Allows melee abilities to benefit from haste GCD reduction
Unk381 = 381,
ModPetStatPct = 382, // NYI
+12 -10
View File
@@ -997,19 +997,21 @@ namespace Game.Entities
if (manaIndex == (int)PowerType.Max)
return;
// Mana regen from spirit
float spirit_regen = 0.0f;
// Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
spirit_regen *= GetTotalAuraMultiplierByMiscValue(AuraType.ModPowerRegenPercent, (int)PowerType.Mana);
// Get base of Mana Pool in sBaseMPGameTable
uint basemana;
Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), getLevel(), out basemana);
float base_regen = basemana / 100.0f;
// CombatRegen = 5% of Base Mana
float base_regen = GetCreateMana() * 0.02f + GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)PowerType.Mana) / 5.0f;
base_regen += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)PowerType.Mana);
// Set regen rate in cast state apply only on spirit based regen
int modManaRegenInterrupt = GetTotalAuraModifier(AuraType.ModManaRegenInterrupt);
// Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT
base_regen *= GetTotalAuraMultiplierByMiscValue(AuraType.ModPowerRegenPercent, (int)PowerType.Mana);
SetFloatValue(UnitFields.PowerRegenInterruptedFlatModifier + manaIndex, base_regen + MathFunctions.CalculatePct(spirit_regen, modManaRegenInterrupt));
SetFloatValue(UnitFields.PowerRegenFlatModifier + manaIndex, 0.001f + spirit_regen + base_regen);
// Apply PCT bonus from SPELL_AURA_MOD_MANA_REGEN_PCT
base_regen *= GetTotalAuraMultiplierByMiscValue(AuraType.ModManaRegenPct, (int)PowerType.Mana);
SetFloatValue(UnitFields.PowerRegenInterruptedFlatModifier + manaIndex, base_regen);
SetFloatValue(UnitFields.PowerRegenFlatModifier + manaIndex, base_regen);
}
public void UpdateSpellDamageAndHealingBonus()
+1 -1
View File
@@ -429,7 +429,7 @@ namespace Game.Entities
mask = UnitTypeMask.Minion;
break;
default:
if (properties.Flags.HasAnyFlag<uint>(512)) // Mirror Image, Summon Gargoyle
if (properties.Flags.HasAnyFlag(SummonPropFlags.Unk10)) // Mirror Image, Summon Gargoyle
mask = UnitTypeMask.Guardian;
break;
}
+14
View File
@@ -3343,6 +3343,20 @@ namespace Game.Spells
target.ToPlayer().UpdateManaRegen();
}
[AuraEffectHandler(AuraType.ModManaRegenPct)]
void HandleModManaRegenPct(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat))
return;
Unit target = aurApp.GetTarget();
if (!target.IsPlayer())
return;
target.ToPlayer().UpdateManaRegen();
}
[AuraEffectHandler(AuraType.ModIncreaseHealth)]
[AuraEffectHandler(AuraType.ModIncreaseHealth2)]
[AuraEffectHandler(AuraType.ModMaxHealth)]