diff --git a/sql/updates/world/4.3.4/2020_04_17_00_world.sql b/sql/updates/world/4.3.4/2020_04_17_00_world.sql new file mode 100644 index 0000000000..e4548c591e --- /dev/null +++ b/sql/updates/world/4.3.4/2020_04_17_00_world.sql @@ -0,0 +1,23 @@ +DELETE FROM `spell_proc` WHERE `SpellId` IN (96981, 97143, 96887, 97119, 92234); +INSERT INTO `spell_proc` (`SpellId`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`, `ProcsPerMinute`, `Charges`, `Cooldown`) VALUES +(96981, 0, 1, 2, 0x2, 0, 0, 0, 0), +(97143, 0, 1, 2, 0x2, 0, 0, 0, 0), +(96887, 0, 1, 2, 0x2, 0, 0, 0, 2500), +(97119, 0, 1, 2, 0x2, 0, 0, 0, 2500), +(92234, 0, 0, 0, 0, 0, 0, 0, 30000); + +DELETE FROM `spell_bonus_data` WHERE `entry`= 96891; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(96891, 0, 0, 0, 0, 'Variable Pulse Lightning Capacitor - Lightning Bolt'); + +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_item_variable_pulse_lightning_capacitor', +'spell_item_proc_dodge_below_35', +'spell_item_loom_of_fate'); + +INSERT INTO `spell_script_names` (`spell_Id`, `ScriptName`) VALUES +(96887, 'spell_item_variable_pulse_lightning_capacitor'), +(97119, 'spell_item_variable_pulse_lightning_capacitor'), +(96947, 'spell_item_loom_of_fate'), +(97130, 'spell_item_loom_of_fate'), +(92234, 'spell_item_proc_dodge_below_35'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index a913187e63..06eef63177 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5225,6 +5225,8 @@ void AddSC_generic_spell_scripts() new spell_gen_proc_below_pct_damaged("spell_item_petrified_twilight_scale_heroic"); new spell_gen_proc_below_pct_damaged("spell_item_proc_armor"); new spell_gen_proc_below_pct_damaged("spell_item_proc_mastery_below_35"); + new spell_gen_proc_below_pct_damaged("spell_item_proc_dodge_below_35"); + new spell_gen_proc_below_pct_damaged("spell_item_loom_of_fate"); new spell_gen_proc_charge_drop_only(); new spell_gen_parachute(); new spell_gen_pet_summoned(); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 2d4b194656..37d77f7b04 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -5084,6 +5084,59 @@ class spell_item_blind_spot : public SpellScript } }; +enum VariablePulseLightningCapacitor +{ + SPELL_LIGHTNING_BOLT = 96891, + SPELL_ELECTRICAL_CHARGE = 96890 +}; + +// 96887 - Variable Pulse Lightning Capacitor +// 97119 - Variable Pulse Lightning Capacitor +class spell_item_variable_pulse_lightning_capacitor : public AuraScript +{ + PrepareAuraScript(spell_item_variable_pulse_lightning_capacitor); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_LIGHTNING_BOLT, + SPELL_ELECTRICAL_CHARGE + }); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + Player* target = GetTarget()->ToPlayer(); + if (!target) + return; + ObjectGuid itemGUID = aurEff->GetBase()->GetCastItemGUID(); + if (!itemGUID) + return; + + AuraEffect const* chargeEffect = target->GetAuraEffect(SPELL_ELECTRICAL_CHARGE, EFFECT_0); + if (Item* castItem = target->GetItemByGuid(itemGUID)) + { + if (!chargeEffect || roll_chance_i(60)) + target->CastSpell(target, SPELL_ELECTRICAL_CHARGE, true, castItem, aurEff); + else + { + int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue(target); + bp *= chargeEffect->GetBase()->GetStackAmount(); + chargeEffect->GetBase()->Remove(); + target->CastCustomSpell(SPELL_LIGHTNING_BOLT, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, castItem, aurEff); + } + } + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_variable_pulse_lightning_capacitor::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } +}; + void AddSC_item_spell_scripts() { // 23074 Arcanite Dragonling @@ -5212,4 +5265,5 @@ void AddSC_item_spell_scripts() RegisterAuraScript(spell_item_weight_of_a_feather); RegisterSpellScript(spell_item_tipping_of_the_scales); RegisterSpellScript(spell_item_blind_spot); + RegisterAuraScript(spell_item_variable_pulse_lightning_capacitor); }