Skip to content

Commit

Permalink
fix(Scripts/HyjalSummit): Add damage over time component to Doomfire …
Browse files Browse the repository at this point in the history
…debuff. (azerothcore#19317)

* Init.

https: //github.com/mangostwo/server/commit/6a2e23cac09a88d7ec1221393ba96482d71187f6
Co-Authored-By: Miroslav Drbal [ApoC] <apoc@nymfe.net>

* 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] <apoc@nymfe.net>
Co-authored-by: avarishd <46330494+avarishd@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 6, 2024
1 parent ebf5f67 commit d0cd435
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions data/sql/updates/pending_db_world/doomfire-dot.sql
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<float>(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);
Expand Down

0 comments on commit d0cd435

Please sign in to comment.