mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Spells: Remove manual damage adjustment from Arcane Barrage for scaling with arcane charges and use spell cast for mana energize
This commit is contained in:
@@ -3,3 +3,7 @@ DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_mage_arcane_barra
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(44425, 'spell_mage_arcane_barrage'),
|
||||
(1449, 'spell_mage_arcane_explosion');
|
||||
|
||||
DELETE FROM `spell_proc` WHERE `SpellId` IN (36032);
|
||||
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
|
||||
(36032,0,3,0x0,0x8000,0x0,0x0,0,1,1,0x2FFF,0x8,0,0,0,0,0); -- Arcane Charge, drop charges from Arcane Barrage only
|
||||
|
||||
@@ -8636,20 +8636,6 @@ int64 Unit::GetHealthGain(int64 dVal)
|
||||
return gain;
|
||||
}
|
||||
|
||||
// Always return negative value for power reduction (or 0)
|
||||
int32 Unit::ConsumeAllPower(Powers power)
|
||||
{
|
||||
int32 curPower = GetPower(power);
|
||||
int32 minPower = GetMinPower(power);
|
||||
|
||||
if (curPower <= minPower)
|
||||
return 0;
|
||||
|
||||
int32 diff = minPower - curPower;
|
||||
SetPower(power, minPower);
|
||||
return diff;
|
||||
}
|
||||
|
||||
// returns negative amount on power reduction
|
||||
int32 Unit::ModifyPower(Powers power, int32 dVal, bool withPowerUpdate /*= true*/)
|
||||
{
|
||||
|
||||
@@ -940,7 +940,6 @@ class TC_GAME_API Unit : public WorldObject
|
||||
inline void SetFullPower(Powers power) { SetPower(power, GetMaxPower(power)); }
|
||||
// returns the change in power
|
||||
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate = true);
|
||||
int32 ConsumeAllPower(Powers power);
|
||||
|
||||
void ApplyModManaCostMultiplier(float manaCostMultiplier, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ManaCostMultiplier), manaCostMultiplier, apply); }
|
||||
void ApplyModManaCostModifier(SpellSchools school, int32 mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ManaCostModifier, school), mod, apply); }
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
enum MageSpells
|
||||
{
|
||||
SPELL_MAGE_ARCANE_BARRAGE_ENERGIZE = 321529,
|
||||
SPELL_MAGE_ARCANE_BARRAGE_R3 = 321526,
|
||||
SPELL_MAGE_ARCANE_MAGE = 137021,
|
||||
SPELL_MAGE_BLAZING_BARRIER_TRIGGER = 235314,
|
||||
@@ -83,38 +84,41 @@ class spell_mage_arcane_barrage : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_mage_arcane_barrage);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_MAGE_ARCANE_BARRAGE_R3 });
|
||||
return ValidateSpellInfo({ SPELL_MAGE_ARCANE_BARRAGE_R3, SPELL_MAGE_ARCANE_BARRAGE_ENERGIZE })
|
||||
&& spellInfo->GetEffect(EFFECT_1);
|
||||
}
|
||||
|
||||
void ConsumeArcaneCharges()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
// Consume all arcane charges
|
||||
if (int32 arcaneCharges = -caster->ModifyPower(POWER_ARCANE_CHARGES, -caster->GetMaxPower(POWER_ARCANE_CHARGES), false))
|
||||
if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_MAGE_ARCANE_BARRAGE_R3, EFFECT_0, caster->GetGUID()))
|
||||
caster->CastSpell(caster, SPELL_MAGE_ARCANE_BARRAGE_ENERGIZE, { SPELLVALUE_BASE_POINT0, arcaneCharges * auraEffect->GetAmount() / 100 });
|
||||
}
|
||||
|
||||
void HandleEffectHitTarget(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
// Consume all arcane charges; for each charge add 30% additional damage
|
||||
Unit* caster = GetCaster();
|
||||
double charges = double(-caster->ConsumeAllPower(POWER_ARCANE_CHARGES));
|
||||
if (GetHitUnit()->GetGUID() != _primaryTarget)
|
||||
SetHitDamage(CalculatePct(GetHitDamage(), GetEffectInfo(EFFECT_1)->CalcValue(GetCaster())));
|
||||
}
|
||||
|
||||
double currDamage = double(GetHitDamage());
|
||||
double extraDamage = (charges * 0.3) * currDamage;
|
||||
SetHitDamage(int32(currDamage + extraDamage));
|
||||
|
||||
if (Aura const* aura = caster->GetAura(SPELL_MAGE_ARCANE_BARRAGE_R3))
|
||||
{
|
||||
if (AuraEffect const* auraEffect = aura->GetEffect(EFFECT_0))
|
||||
{
|
||||
double pct = charges * (double(auraEffect->GetAmount()) * 0.01);
|
||||
int32 maxMana = caster->GetMaxPower(POWER_MANA);
|
||||
|
||||
int32 extraMana = CalculatePct(double(maxMana), pct);
|
||||
caster->ModifyPower(POWER_MANA, extraMana);
|
||||
}
|
||||
}
|
||||
void MarkPrimaryTarget(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
_primaryTarget = GetHitUnit()->GetGUID();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_mage_arcane_barrage::HandleEffectHitTarget, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_barrage::MarkPrimaryTarget, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
AfterCast += SpellCastFn(spell_mage_arcane_barrage::ConsumeArcaneCharges);
|
||||
}
|
||||
|
||||
ObjectGuid _primaryTarget;
|
||||
};
|
||||
|
||||
// 1449 - Arcane Explosion
|
||||
|
||||
Reference in New Issue
Block a user