Skip to content

Commit

Permalink
Spell: Add auto break proc script for auras and their respective glyphs
Browse files Browse the repository at this point in the history
Capped with formula for cls because I cant be bothered to research it too hard.
  • Loading branch information
killerwife committed Apr 23, 2024
1 parent 14efb9f commit 53efce2
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(47198,'spell_deaths_embrace'),
(47199,'spell_deaths_embrace'),
(47200,'spell_deaths_embrace'),
(5782,'spell_auto_break_proc'),
(6213,'spell_auto_break_proc'),
(6215,'spell_auto_break_proc'),
(1120,'spell_drain_soul'),
(8288,'spell_drain_soul'),
(8289,'spell_drain_soul'),
Expand Down Expand Up @@ -1574,6 +1577,12 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(29447,'spell_torment_the_weak'),
(55339,'spell_torment_the_weak'),
(55340,'spell_torment_the_weak'),
(122,'spell_auto_break_proc'),
(865,'spell_auto_break_proc'),
(6131,'spell_auto_break_proc'),
(10230,'spell_auto_break_proc'),
(27088,'spell_auto_break_proc'),
(42917,'spell_auto_break_proc'),
(56369,'spell_glyph_of_fire_blast'),
(58838,'spell_inherit_masters_threat_list'),
(59638,'spell_mirror_image_frostbolt');
Expand Down Expand Up @@ -1631,6 +1640,14 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(53227,'spell_typhoon'),
(54845,'spell_glyph_of_starfire'),
(40121,'spell_swift_flight_form_passive'),
(339,'spell_auto_break_proc'),
(1062,'spell_auto_break_proc'),
(5195,'spell_auto_break_proc'),
(5196,'spell_auto_break_proc'),
(9852,'spell_auto_break_proc'),
(9853,'spell_auto_break_proc'),
(26989,'spell_auto_break_proc'),
(53308,'spell_auto_break_proc'),
(467,'spell_thorns_druid'),
(782,'spell_thorns_druid'),
(1075,'spell_thorns_druid'),
Expand Down Expand Up @@ -1743,6 +1760,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(39610,'spell_mana_tide_totem_effect'),
(55440,'spell_glyph_of_healing_wave'),
(63280,'spell_glyph_of_totem_of_wrath'),
(51514,'spell_auto_break_proc'),
(52041,'spell_healing_stream_totem_effect'),
(52046,'spell_healing_stream_totem_effect'),
(52047,'spell_healing_stream_totem_effect'),
Expand Down
65 changes: 65 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/world/spell_scripts_wotlk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,76 @@ struct BloodReserveEnchant : public AuraScript
}
};

// 5782 - Fear, 339 - Entangling Roots, 122 - Frost Nova, 51514 - Hex
struct AutoBreakProc : public AuraScript
{
void OnAuraInit(Aura* aura) const override
{
if (aura->GetEffIndex() == EFFECT_INDEX_1)
{
Unit* caster = aura->GetCaster();
// fear - rank 3 - at 80 - 2600
// not impacted by gear
// not impacted by target level
// not impacted by rank
// asumption - depends on caster level
uint32 damageThreshold = 0;
auto stats = sObjectMgr.GetCreatureClassLvlStats(caster->GetLevel(), CLASS_WARRIOR, EXPANSION_WOTLK);

switch (aura->GetId()) // keeping them separate for future research
{
case 5782: // Fear
case 6213:
case 6215:
damageThreshold = stats->BaseHealth / 4.75;
break;
case 51514: // Hex
damageThreshold = stats->BaseHealth / 4.75;
break;
case 339: // Entangling Roots
case 1062:
case 5195:
case 5196:
case 9852:
case 9853:
case 26989:
case 53308:
damageThreshold = stats->BaseHealth / 4.75;
break;
case 122: // Frost nova
case 865:
case 6131:
case 10230:
case 27088:
case 42917:
damageThreshold = stats->BaseHealth / 4.75;
break;
}
if (Aura* script = aura->GetCaster()->GetOverrideScript(7801)) // Glyph of Fear, Glyph of Hex, Glyph of Entangling Roots, Glyph of Frost Nova
damageThreshold *= script->GetAmount() / 100;
aura->SetScriptValue(damageThreshold);
}
}

SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
if (aura->GetEffIndex() != EFFECT_INDEX_1)
return SPELL_AURA_PROC_OK;

if (int32(aura->GetScriptValue()) - procData.damage <= 0)
return SPELL_AURA_PROC_OK;

aura->SetScriptValue(aura->GetScriptValue() - procData.damage);
return SPELL_AURA_PROC_CANT_TRIGGER;
}
};

void AddSC_spell_scripts_wotlk()
{
RegisterSpellScript<Replenishment>("spell_replenishment");
RegisterSpellScript<RetaliationDummyCreature>("spell_retaliation_dummy_creature");
RegisterSpellScript<Shadowmeld>("spell_shadowmeld");
RegisterSpellScript<StoicismAbsorb>("spell_stoicism");
RegisterSpellScript<BloodReserveEnchant>("spell_blood_reserve_enchant");
RegisterSpellScript<AutoBreakProc>("spell_auto_break_proc");
}

1 comment on commit 53efce2

@pyza666
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably forgot to include:
#include "Globals/ObjectMgr.h"
in
src/game/AI/ScriptDevAI/scripts/world/spell_scripts_wotlk.cpp

src/game/AI/ScriptDevAI/scripts/world/spell_scripts_wotlk.cpp:116:26: error: ‘sObjectMgr’ was not declared in this scope; did you mean ‘ObjectMgr’?
116 | auto stats = sObjectMgr.GetCreatureClassLvlStats(caster->GetLevel(), CLASS_WARRIOR, EXPANSION_WOTLK);

Please sign in to comment.