Scripts/Spells: Fixed arcane barrage + explosion
Port From (https://github.com/TrinityCore/TrinityCore/commit/be8cbab4b3cd9623c42bf89d1bf1d6b40e0ae4fd)
This commit is contained in:
@@ -186,6 +186,20 @@ namespace Game.Entities
|
||||
|
||||
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
|
||||
public int ModifyPower(PowerType power, int dVal, bool withPowerUpdate = true)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Scripts.Spells.Mage
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint ArcaneBarrageR3 = 321526;
|
||||
public const uint BlazingBarrierTrigger = 235314;
|
||||
public const uint Cauterized = 87024;
|
||||
public const uint CauterizeDot = 87023;
|
||||
@@ -60,7 +61,6 @@ namespace Scripts.Spells.Mage
|
||||
public const uint IcyVeins = 12472;
|
||||
public const uint ChainReactionDummy = 278309;
|
||||
public const uint ChainReaction = 278310;
|
||||
public const uint TouchOfTheMagiAura = 210824;
|
||||
public const uint TouchOfTheMagiExplode = 210833;
|
||||
|
||||
//Misc
|
||||
@@ -70,6 +70,78 @@ namespace Scripts.Spells.Mage
|
||||
public const uint PetNetherwindsFatigued = 160455;
|
||||
}
|
||||
|
||||
[Script] // 44425 - Arcane Barrage
|
||||
class spell_mage_arcane_barrage : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ArcaneBarrageR3);
|
||||
}
|
||||
|
||||
void HandleEffectHitTarget(uint effIndex)
|
||||
{
|
||||
// Consume all arcane charges; for each charge add 30% additional damage
|
||||
Unit caster = 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleEffectHitTarget, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 1449 - Arcane Explosion
|
||||
class spell_mage_arcane_explosion : SpellScript
|
||||
{
|
||||
bool _once = true;
|
||||
|
||||
void PreventEnergize(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
}
|
||||
|
||||
void HandleTargetHit(uint effIndex)
|
||||
{
|
||||
if (_once)
|
||||
{
|
||||
SpellEffectInfo effInfo = GetEffectInfo(0);
|
||||
if (effInfo != null)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
int value = effInfo.CalcValue(caster);
|
||||
caster.ModifyPower((PowerType)effInfo.MiscValue, value);
|
||||
}
|
||||
_once = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(PreventEnergize, 0, SpellEffectName.Energize));
|
||||
OnEffectHitTarget.Add(new EffectHandler(PreventEnergize, 2, SpellEffectName.Energize));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleTargetHit, 1, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 235313 - Blazing Barrier
|
||||
class spell_mage_blazing_barrier : AuraScript
|
||||
{
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
-- Mage Spells
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_mage_arcane_barrage', 'spell_mage_arcane_explosion', 'spell_mage_arcane_charge_clear');
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(44425, 'spell_mage_arcane_barrage'),
|
||||
(195302, 'spell_mage_arcane_charge_clear'),
|
||||
(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
|
||||
Reference in New Issue
Block a user