Core/Auras: implement mana cost modification aura
Port From (https://github.com/TrinityCore/TrinityCore/commit/a76c08843fc1695241b7246c4014322ee07a6453)
This commit is contained in:
@@ -444,7 +444,7 @@ namespace Framework.Constants
|
|||||||
ModBattlePetXpPct = 420,
|
ModBattlePetXpPct = 420,
|
||||||
ModAbsorbEffectsDonePct = 421, // NYI
|
ModAbsorbEffectsDonePct = 421, // NYI
|
||||||
ModAbsorbEffectsTakenPct = 422, //NYI
|
ModAbsorbEffectsTakenPct = 422, //NYI
|
||||||
Unk423 = 423,
|
ModManaCostPct = 423,
|
||||||
CasterIgnoreLos = 424, //NYI
|
CasterIgnoreLos = 424, //NYI
|
||||||
Unk425 = 425,
|
Unk425 = 425,
|
||||||
Unk426 = 426,
|
Unk426 = 426,
|
||||||
|
|||||||
@@ -932,6 +932,8 @@ namespace Game.Entities
|
|||||||
return Math.Max(resistMech, 0);
|
return Math.Max(resistMech, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ApplyModManaCostMultiplier(float manaCostMultiplier, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.ManaCostMultiplier), manaCostMultiplier, apply); }
|
||||||
|
|
||||||
public void ApplyModManaCostModifier(SpellSchools school, int mod, bool apply) { ApplyModUpdateFieldValue(ref m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.ManaCostModifier, (int)school), mod, apply); }
|
public void ApplyModManaCostModifier(SpellSchools school, int mod, bool apply) { ApplyModUpdateFieldValue(ref m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.ManaCostModifier, (int)school), mod, apply); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3461,6 +3461,15 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AuraEffectHandler(AuraType.ModManaCostPct)]
|
||||||
|
void HandleModManaCostPct(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||||
|
{
|
||||||
|
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat))
|
||||||
|
return;
|
||||||
|
|
||||||
|
aurApp.GetTarget().ApplyModManaCostMultiplier(GetAmount() / 100.0f, apply);
|
||||||
|
}
|
||||||
|
|
||||||
[AuraEffectHandler(AuraType.ModPowerDisplay)]
|
[AuraEffectHandler(AuraType.ModPowerDisplay)]
|
||||||
void HandleAuraModPowerDisplay(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
void HandleAuraModPowerDisplay(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2773,9 +2773,6 @@ namespace Game.Spells
|
|||||||
flatMod += eff.GetAmount();
|
flatMod += eff.GetAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (power.PowerType == PowerType.Mana)
|
|
||||||
flatMod *= (int)(1.0f + caster.m_unitData.ManaCostMultiplier); // this is wrong
|
|
||||||
|
|
||||||
powerCost += flatMod;
|
powerCost += flatMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2842,7 +2839,9 @@ namespace Game.Spells
|
|||||||
powerCost += MathFunctions.CalculatePct(powerCost, eff.GetAmount());
|
powerCost += MathFunctions.CalculatePct(powerCost, eff.GetAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (power.PowerType == PowerType.Health)
|
if (power.PowerType == PowerType.Mana)
|
||||||
|
powerCost = (int)((float)powerCost * (1.0f + caster.m_unitData.ManaCostMultiplier));
|
||||||
|
else if (power.PowerType == PowerType.Health)
|
||||||
{
|
{
|
||||||
healthCost += powerCost;
|
healthCost += powerCost;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user