From c1c7ae2a3912ea972378ba506a4e8185bd75d547 Mon Sep 17 00:00:00 2001 From: killerwife Date: Thu, 28 Sep 2023 14:36:24 +0200 Subject: [PATCH] Spell/Unit: Implement rest of crit script handling --- sql/scriptdev2/spell.sql | 25 ++++++++- src/game/Entities/Unit.cpp | 5 -- .../Scripts/Scripting/ClassScripts/Druid.cpp | 23 ++++++++ .../Scripts/Scripting/ClassScripts/Mage.cpp | 15 ++++++ .../Scripting/ClassScripts/Paladin.cpp | 27 ++++++++++ .../Scripts/Scripting/ClassScripts/Priest.cpp | 54 +++++++++++++++++++ .../Scripts/Scripting/ClassScripts/Shaman.cpp | 11 ++++ .../Scripting/ClassScripts/Warlock.cpp | 15 ++++++ 8 files changed, 168 insertions(+), 7 deletions(-) diff --git a/sql/scriptdev2/spell.sql b/sql/scriptdev2/spell.sql index 7e2c6856484..4db81a3a437 100644 --- a/sql/scriptdev2/spell.sql +++ b/sql/scriptdev2/spell.sql @@ -1103,6 +1103,12 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (55673,'spell_glyph_of_lightwell'), (60123,'spell_lightwell_relay'), (47788,'spell_guardian_spirit_priest'), +(57470,'spell_renewed_hope'), +(57472,'spell_renewed_hope'), +(63944,'spell_renewed_hope_damage_taken'), +(63504,'spell_improved_flash_heal'), +(63505,'spell_improved_flash_heal'), +(63506,'spell_improved_flash_heal'), (34861,'spell_circle_of_healing'), (34863,'spell_circle_of_healing'), (34864,'spell_circle_of_healing'), @@ -1126,6 +1132,16 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (70769,'spell_divine_storm_cooldown'), (31789,'spell_righteous_defense'), (40470,'spell_paladin_tier_6_trinket'), +(58597,'spell_sacred_shield_crit'), +(879,'spell_exorcism_paladin'), +(5614,'spell_exorcism_paladin'), +(5615,'spell_exorcism_paladin'), +(10312,'spell_exorcism_paladin'), +(10313,'spell_exorcism_paladin'), +(10314,'spell_exorcism_paladin'), +(27138,'spell_exorcism_paladin'), +(48800,'spell_exorcism_paladin'), +(48801,'spell_exorcism_paladin'), (31850,'spell_ardent_defender'), (31851,'spell_ardent_defender'), (31852,'spell_ardent_defender'); @@ -1199,6 +1215,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (54052,'spell_shadow_bite'), (54053,'spell_shadow_bite'), (63108,'spell_siphon_life_wotlk'), +(56229,'spell_glyph_of_shadowburn'), (48018,'spell_demonic_circle_summon'), (48020,'spell_demonic_circle_teleport'); @@ -1304,8 +1321,6 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (11170,'spell_shatter_mage'), (12982,'spell_shatter_mage'), (12983,'spell_shatter_mage'), -(12984,'spell_shatter_mage'), -(12985,'spell_shatter_mage'), (42208,'spell_blizzard'), (42209,'spell_blizzard'), (42210,'spell_blizzard'), @@ -1334,6 +1349,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (28609,'spell_frost_warding'), (32796,'spell_frost_warding'), (43012,'spell_frost_warding'), +(56369,'spell_glyph_of_fire_blast'), (58838,'spell_inherit_masters_threat_list'), (59638,'spell_mirror_image_frostbolt'); @@ -1375,6 +1391,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (33851,'spell_primal_tenacity'), (33852,'spell_primal_tenacity'), (33957,'spell_primal_tenacity'), +(57849,'spell_improved_insect_swarm'), +(57850,'spell_improved_insect_swarm'), +(57851,'spell_improved_insect_swarm'), (69366,'spell_moonkin_form_passive'), (40121,'spell_swift_flight_form_passive'); @@ -1456,6 +1475,8 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (51474,'spell_astral_shift_shaman'), (51478,'spell_astral_shift_shaman'), (51479,'spell_astral_shift_shaman'), +(51505,'spell_lava_burst'), +(60043,'spell_lava_burst'), (2825,'spell_heroism_bloodlust'), (32182,'spell_heroism_bloodlust'); diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 79dd8eac348..40af3eeb123 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -8482,11 +8482,6 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellEntry const* spellInfo, in case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind DoneAdvertisedBenefit += i->GetModifier()->m_amount; break; - case 7997: // Renewed Hope - case 7998: - if (victim->HasAura(6788)) - DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f; - break; case 21: // Test of Faith case 6935: case 6918: diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Druid.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Druid.cpp index 5b449420e55..64af18df24f 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Druid.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Druid.cpp @@ -193,6 +193,28 @@ struct MoonkinFormPassive : public AuraScript } }; +// 57849 - Improved Insect Swarm +struct ImprovedInsectSwarm : public AuraScript +{ + void OnApply(Aura* aura, bool apply) const override + { + if (aura->GetEffIndex() == EFFECT_INDEX_0) + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_SPELL_DAMAGE_DONE, apply); + if (aura->GetEffIndex() == EFFECT_INDEX_1) + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_CRIT_CHANCE, apply); + } + + void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance, SpellEntry const* /*spellInfo*/) const override + { + if (target->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, uint64(0x000000000000002), 0, aura->GetTarget()->GetObjectGuid())) chance += aura->GetModifier()->m_amount; // Weakened Soul + } + + void OnDamageCalculate(Aura* aura, Unit* victim, int32& /*advertisedBenefit*/, float& totalMod) const override + { + if (victim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, uint64(0x00200000), 0, aura->GetTarget()->GetObjectGuid())) totalMod *= (aura->GetModifier()->m_amount + 100.0f) / 100.0f; + } +}; + void LoadDruidScripts() { RegisterSpellScript("spell_regrowth"); @@ -205,4 +227,5 @@ void LoadDruidScripts() RegisterSpellScript("spell_swift_flight_form_passive"); RegisterSpellScript("spell_primal_tenacity"); RegisterSpellScript("spell_moonkin_form_passive"); + RegisterSpellScript("spell_improved_insect_swarm"); } \ No newline at end of file diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp index 643bf5f9c7f..c5cfa05a624 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp @@ -191,6 +191,20 @@ struct FrostWarding : public AuraScript } }; +// 56369 - Glyph of Fire Blast +struct GlyphOfFireBlast : public AuraScript +{ + void OnApply(Aura* aura, bool apply) const override + { + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_CRIT_CHANCE, apply); + } + + void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance, SpellEntry const* spellInfo) const override + { + if (target->IsStunned()) chance += aura->GetModifier()->m_amount; + } +}; + void LoadMageScripts() { RegisterSpellScript("spell_arcane_concentration"); @@ -203,4 +217,5 @@ void LoadMageScripts() RegisterSpellScript("spell_deep_freeze_immunity_state"); RegisterSpellScript("spell_polymorph"); RegisterSpellScript("spell_frost_warding"); + RegisterSpellScript("spell_glyph_of_fire_blast"); } \ No newline at end of file diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp index 8b23fc65dd4..e648588f451 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp @@ -269,6 +269,31 @@ struct ArdentDefender : public AuraScript } }; +// 58597 - Sacred Shield +struct SacredShieldCrit : public AuraScript +{ + void OnApply(Aura* aura, bool apply) const override + { + if (aura->GetEffIndex() == EFFECT_INDEX_1) + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_CRIT_CHANCE, apply); + } + + void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance, SpellEntry const* spellInfo) const override + { + if (aura->GetCasterGuid() == target->GetObjectGuid()) chance += aura->GetModifier()->m_amount; // Weakened Soul + } +}; + +// 879 - Exorcism +struct ExorcismPaladin : public SpellScript +{ + void OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const override + { + if (spell->GetUnitTarget()->GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD) + spell->SetGuaranteedCrit(); + } +}; + void LoadPaladinScripts() { RegisterSpellScript("spell_increased_holy_light_healing"); @@ -281,4 +306,6 @@ void LoadPaladinScripts() RegisterSpellScript("spell_judgements_of_the_wise"); RegisterSpellScript("spell_judgements_of_the_wise_energize"); RegisterSpellScript("spell_ardent_defender"); + RegisterSpellScript("spell_sacred_shield_crit"); + RegisterSpellScript("spell_exorcism_paladin"); } \ No newline at end of file diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Priest.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Priest.cpp index 03fbcda02c5..54abf2309b2 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Priest.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Priest.cpp @@ -355,6 +355,57 @@ struct GuardianSpiritPriest : public AuraScript } }; +// 57470 - Renewed Hope +struct RenewedHope : public AuraScript +{ + void OnApply(Aura* aura, bool apply) const override + { + if (aura->GetEffIndex() == EFFECT_INDEX_0) + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_CRIT_CHANCE, apply); + } + + void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance, SpellEntry const* spellInfo) const override + { + if (target->HasAura(6788)) chance += aura->GetModifier()->m_amount; // Weakened Soul + } + + SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override + { + procData.cooldown = aura->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_2); + return SPELL_AURA_PROC_OK; + } +}; + +// 63944 - RenewedHope +struct RenewedHopeDamageTaken : public AuraScript +{ + void OnApply(Aura* aura, bool apply) const override + { + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_MELEE_DAMAGE_TAKEN, apply); + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_SPELL_DAMAGE_TAKEN, apply); + } + + void OnDamageCalculate(Aura* aura, Unit* /*victim*/, int32& /*advertisedBenefit*/, float& totalMod) const override + { + totalMod *= (aura->GetAmount() + 100) / 100; + } +}; + +// 63504 - Improved Flash Heal +struct ImprovedFlashHeal : public AuraScript +{ + void OnApply(Aura* aura, bool apply) const override + { + if (aura->GetEffIndex() == EFFECT_INDEX_0) + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_CRIT_CHANCE, apply); + } + + void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance, SpellEntry const* spellInfo) const override + { + if (target->GetHealthPercent() <= 50.f) chance += aura->GetModifier()->m_amount; + } +}; + void LoadPriestScripts() { RegisterSpellScript("spell_power_infusion"); @@ -374,4 +425,7 @@ void LoadPriestScripts() RegisterSpellScript("spell_glyph_of_shadow_word_death"); RegisterSpellScript("spell_shadow_affinity_dots"); RegisterSpellScript("spell_guardian_spirit_priest"); + RegisterSpellScript("spell_renewed_hope"); + RegisterSpellScript("spell_renewed_hope_damage_taken"); + RegisterSpellScript("spell_improved_flash_heal"); } diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp index 093a6bda167..55ba9f94d74 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp @@ -310,6 +310,16 @@ struct AstralShiftShaman : public AuraScript } }; +// 51505 - Lava Burst +struct LavaBurst : public SpellScript +{ + void OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const override + { + if (spell->GetUnitTarget()->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, uint64(0x0000000010000000), 0, spell->GetCaster()->GetObjectGuid())) + spell->SetGuaranteedCrit(); + } +}; + void LoadShamanScripts() { Script* pNewScript = new Script; @@ -329,4 +339,5 @@ void LoadShamanScripts() RegisterSpellScript("spell_heroism_bloodlust"); RegisterSpellScript("spell_fire_nova_shaman"); RegisterSpellScript("spell_astral_shift_shaman"); + RegisterSpellScript("spell_lava_burst"); } \ No newline at end of file diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Warlock.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Warlock.cpp index 04648cadae3..c4c999eb39b 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Warlock.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Warlock.cpp @@ -425,6 +425,20 @@ struct DemonicCircleSummon : public AuraScript } }; +// 56229 - Glyph of Shadowburn +struct GlyphOfShadowburn : public AuraScript +{ + void OnApply(Aura* aura, bool apply) const override + { + aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_CRIT_CHANCE, apply); + } + + void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance, SpellEntry const* spellInfo) const override + { + if (target->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) chance += aura->GetModifier()->m_amount; + } +}; + void LoadWarlockScripts() { RegisterSpellScript("spell_unstable_affliction"); @@ -442,4 +456,5 @@ void LoadWarlockScripts() RegisterSpellScript("spell_shadow_bite"); RegisterSpellScript("spell_demonic_circle_teleport"); RegisterSpellScript("spell_demonic_circle_summon"); + RegisterSpellScript("spell_glyph_of_shadowburn"); }