Scripts/Spells: Remove manual damage adjustment from Arcane Barrage for scaling with arcane charges and use spell cast for mana energize
Port From (https://github.com/TrinityCore/TrinityCore/commit/331c7ec7c268d522ead3229247a4c37db4393226)
This commit is contained in:
@@ -186,20 +186,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
int GetMinPower(PowerType power) { return power == PowerType.LunarPower ? -100 : 0; }
|
int GetMinPower(PowerType power) { return power == PowerType.LunarPower ? -100 : 0; }
|
||||||
|
|
||||||
// Always return negative value for power reduction (or 0)
|
|
||||||
public int ConsumeAllPower(PowerType power)
|
|
||||||
{
|
|
||||||
int curPower = GetPower(power);
|
|
||||||
int minPower = GetMinPower(power);
|
|
||||||
|
|
||||||
if (curPower <= minPower)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int diff = minPower - curPower;
|
|
||||||
SetPower(power, minPower);
|
|
||||||
return diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns negative amount on power reduction
|
// returns negative amount on power reduction
|
||||||
public int ModifyPower(PowerType power, int dVal, bool withPowerUpdate = true)
|
public int ModifyPower(PowerType power, int dVal, bool withPowerUpdate = true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace Scripts.Spells.Mage
|
|||||||
{
|
{
|
||||||
struct SpellIds
|
struct SpellIds
|
||||||
{
|
{
|
||||||
|
public const uint ArcaneBarrageEnergize = 321529;
|
||||||
public const uint ArcaneBarrageR3 = 321526;
|
public const uint ArcaneBarrageR3 = 321526;
|
||||||
public const uint ArcaneMage = 137021;
|
public const uint ArcaneMage = 137021;
|
||||||
public const uint BlazingBarrierTrigger = 235314;
|
public const uint BlazingBarrierTrigger = 235314;
|
||||||
@@ -75,39 +76,43 @@ namespace Scripts.Spells.Mage
|
|||||||
[Script] // 44425 - Arcane Barrage
|
[Script] // 44425 - Arcane Barrage
|
||||||
class spell_mage_arcane_barrage : SpellScript
|
class spell_mage_arcane_barrage : SpellScript
|
||||||
{
|
{
|
||||||
|
ObjectGuid _primaryTarget;
|
||||||
|
|
||||||
public override bool Validate(SpellInfo spellInfo)
|
public override bool Validate(SpellInfo spellInfo)
|
||||||
{
|
{
|
||||||
return ValidateSpellInfo(SpellIds.ArcaneBarrageR3);
|
return ValidateSpellInfo(SpellIds.ArcaneBarrageR3, SpellIds.ArcaneBarrageEnergize) && spellInfo.GetEffect(1) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsumeArcaneCharges()
|
||||||
|
{
|
||||||
|
Unit caster = GetCaster();
|
||||||
|
|
||||||
|
// Consume all arcane charges
|
||||||
|
int arcaneCharges = -caster.ModifyPower(PowerType.ArcaneCharges, -caster.GetMaxPower(PowerType.ArcaneCharges), false);
|
||||||
|
if (arcaneCharges != 0)
|
||||||
|
{
|
||||||
|
AuraEffect auraEffect = caster.GetAuraEffect(SpellIds.ArcaneBarrageR3, 0, caster.GetGUID());
|
||||||
|
if (auraEffect != null)
|
||||||
|
caster.CastSpell(caster, SpellIds.ArcaneBarrageEnergize, new CastSpellExtraArgs(SpellValueMod.BasePoint0, arcaneCharges * auraEffect.GetAmount() / 100));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleEffectHitTarget(uint effIndex)
|
void HandleEffectHitTarget(uint effIndex)
|
||||||
{
|
{
|
||||||
// Consume all arcane charges; for each charge add 30% additional damage
|
if (GetHitUnit().GetGUID() != _primaryTarget)
|
||||||
Unit caster = GetCaster();
|
SetHitDamage(MathFunctions.CalculatePct(GetHitDamage(), GetEffectInfo(1).CalcValue(GetCaster())));
|
||||||
float charges = -caster.ConsumeAllPower(PowerType.ArcaneCharges);
|
|
||||||
|
|
||||||
float currDamage = GetHitDamage();
|
|
||||||
float extraDamage = (charges * 0.3f) * currDamage;
|
|
||||||
SetHitDamage((int)(currDamage + extraDamage));
|
|
||||||
|
|
||||||
Aura aura = caster.GetAura(SpellIds.ArcaneBarrageR3);
|
|
||||||
if (aura != null)
|
|
||||||
{
|
|
||||||
AuraEffect auraEffect = aura.GetEffect(0);
|
|
||||||
if (auraEffect != null)
|
|
||||||
{
|
|
||||||
float pct = charges * (auraEffect.GetAmount() * 0.01f);
|
|
||||||
int maxMana = caster.GetMaxPower(PowerType.Mana);
|
|
||||||
|
|
||||||
int extraMana = MathFunctions.CalculatePct(maxMana, pct);
|
|
||||||
caster.ModifyPower(PowerType.Mana, extraMana);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MarkPrimaryTarget(uint effIndex)
|
||||||
|
{
|
||||||
|
_primaryTarget = GetHitUnit().GetGUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Register()
|
public override void Register()
|
||||||
{
|
{
|
||||||
OnEffectHitTarget.Add(new EffectHandler(HandleEffectHitTarget, 0, SpellEffectName.SchoolDamage));
|
OnEffectHitTarget.Add(new EffectHandler(HandleEffectHitTarget, 0, SpellEffectName.SchoolDamage));
|
||||||
|
OnEffectLaunchTarget.Add(new EffectHandler(MarkPrimaryTarget, 1, SpellEffectName.Dummy));
|
||||||
|
AfterCast.Add(new CastHandler(ConsumeArcaneCharges));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user