From d0cd4358072ec3e1ae3c8aebfb3504f82e4be934 Mon Sep 17 00:00:00 2001 From: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Date: Sat, 6 Jul 2024 14:02:35 -0400 Subject: [PATCH] fix(Scripts/HyjalSummit): Add damage over time component to Doomfire debuff. (#19317) * Init. https: //github.com/mangostwo/server/commit/6a2e23cac09a88d7ec1221393ba96482d71187f6 Co-Authored-By: Miroslav Drbal [ApoC] * Don't forget the query. * Add spell attribute. * Adjust tick script. More dynamically calculates damage from ticks. Co-Authored-By: avarishd <46330494+avarishd@users.noreply.github.com> * Remove unnecessary `aurEff` Co-Authored-By: avarishd <46330494+avarishd@users.noreply.github.com> * #include --------- Co-authored-by: Miroslav Drbal [ApoC] Co-authored-by: avarishd <46330494+avarishd@users.noreply.github.com> --- .../updates/pending_db_world/doomfire-dot.sql | 5 ++++ .../BattleForMountHyjal/boss_archimonde.cpp | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 data/sql/updates/pending_db_world/doomfire-dot.sql diff --git a/data/sql/updates/pending_db_world/doomfire-dot.sql b/data/sql/updates/pending_db_world/doomfire-dot.sql new file mode 100644 index 000000000..994dcd3de --- /dev/null +++ b/data/sql/updates/pending_db_world/doomfire-dot.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = 31944; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (31944, 'spell_doomfire'); + +DELETE FROM `spell_custom_attr` WHERE `spell_id` = 31944; +INSERT INTO `spell_custom_attr` (`spell_id`, `attributes`) VALUES (31944, 4194304); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index eea967559..6b5fae927 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -18,6 +18,7 @@ #include "CreatureScript.h" #include "Player.h" #include "ScriptedCreature.h" +#include "SpellAuraEffects.h" #include "SpellAuras.h" #include "SpellScript.h" #include "SpellScriptLoader.h" @@ -51,6 +52,7 @@ enum ArchiSpells SPELL_DOOMFIRE_STRIKE = 31903, //summons two creatures SPELL_DOOMFIRE_SPAWN = 32074, SPELL_DOOMFIRE = 31945, + SPELL_DOOMFIRE_DOT = 31969, SPELL_SOUL_CHARGE_YELLOW = 32045, SPELL_SOUL_CHARGE_GREEN = 32051, SPELL_SOUL_CHARGE_RED = 32052, @@ -484,10 +486,38 @@ class spell_air_burst : public SpellScript } }; +class spell_doomfire : public AuraScript +{ + PrepareAuraScript(spell_doomfire); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DOOMFIRE_DOT }); + } + + void PeriodicTick(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + if (!target) + return; + + int32 bp = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + float tickCoef = (static_cast(aurEff->GetTickNumber() - 1) / aurEff->GetTotalTicks()); // Tick moved back to ensure proper damage on each tick + int32 damage = bp - (bp*tickCoef); + SpellCastResult result = target->CastCustomSpell(target, SPELL_DOOMFIRE_DOT, &damage, &damage, &damage, true, nullptr, nullptr, target->GetGUID()); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_doomfire::PeriodicTick, EFFECT_ALL, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + void AddSC_boss_archimonde() { RegisterSpellScript(spell_red_sky_effect); RegisterSpellScript(spell_air_burst); + RegisterSpellScript(spell_doomfire); RegisterHyjalAI(boss_archimonde); RegisterHyjalAI(npc_ancient_wisp); RegisterHyjalAI(npc_doomfire_spirit);