Scripts/Spells: Implement demon hunter talent "Chaos Theory" (#30552)

This commit is contained in:
Aqua Deus
2025-01-16 22:23:21 +01:00
committed by GitHub
parent e0b1c3b209
commit 7cba45f1d2
2 changed files with 73 additions and 0 deletions
@@ -0,0 +1,10 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dh_chaos_theory';
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dh_chaos_theory_drop_charge';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(210152, 'spell_dh_chaos_theory'),
(188499, 'spell_dh_chaos_theory'),
(390195, 'spell_dh_chaos_theory_drop_charge');
DELETE FROM `spell_proc` WHERE `SpellId` IN (390195);
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
(390195,0x00,107,0x00004040,0x00040000,0x00000000,0x80000000,0x1010,0x0,0x0,0x2,0x0,0xA,0x0,0,100,0,1); -- Chaos Theory
+63
View File
@@ -60,6 +60,8 @@ enum DemonHunterSpells
SPELL_DH_CHAOS_STRIKE_ENERGIZE = 193840,
SPELL_DH_CHAOS_STRIKE_MH = 222031,
SPELL_DH_CHAOS_STRIKE_OH = 199547,
SPELL_DH_CHAOS_THEORY_TALENT = 389687,
SPELL_DH_CHAOS_THEORY_CRIT = 390195,
SPELL_DH_CHAOTIC_TRANSFORMATION = 388112,
SPELL_DH_CHARRED_WARBLADES_HEAL = 213011,
SPELL_DH_COLLECTIVE_ANGUISH = 390152,
@@ -281,6 +283,65 @@ class spell_dh_chaos_strike : public AuraScript
}
};
// Called by 188499 - Blade Dance and 210152 - Death Sweep
class spell_dh_chaos_theory : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!ValidateSpellInfo({ SPELL_DH_CHAOS_THEORY_CRIT })
|| !ValidateSpellEffect({ { SPELL_DH_CHAOS_THEORY_TALENT, EFFECT_1 } }))
return false;
SpellInfo const* chaosTheory = sSpellMgr->AssertSpellInfo(SPELL_DH_CHAOS_THEORY_TALENT, DIFFICULTY_NONE);
return chaosTheory->GetEffect(EFFECT_0).CalcValue() < chaosTheory->GetEffect(EFFECT_1).CalcValue();
}
bool Load() override
{
return GetCaster()->HasAura(SPELL_DH_CHAOS_THEORY_TALENT);
}
void ChaosTheory() const
{
Unit* caster = GetCaster();
Aura const* chaosTheory = caster->GetAura(SPELL_DH_CHAOS_THEORY_TALENT);
if (!chaosTheory)
return;
AuraEffect const* min = chaosTheory->GetEffect(EFFECT_0);
AuraEffect const* max = chaosTheory->GetEffect(EFFECT_1);
if (!min || !max)
return;
int32 critChance = irand(min->GetAmount(), max->GetAmount());
caster->CastSpell(caster, SPELL_DH_CHAOS_THEORY_CRIT, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.SpellValueOverrides = { { SPELLVALUE_BASE_POINT0, critChance } }
});
}
void Register() override
{
AfterCast += SpellCastFn(spell_dh_chaos_theory::ChaosTheory);
}
};
// 390195 - Chaos Theory
class spell_dh_chaos_theory_drop_charge : public AuraScript
{
void Prepare(ProcEventInfo const& /*eventInfo*/)
{
PreventDefaultAction();
// delayed charge drop - this aura must be removed after Chaos Strike does damage and after it procs power refund
GetAura()->DropChargeDelayed(500);
}
void Register() override
{
DoPrepareProc += AuraProcFn(spell_dh_chaos_theory_drop_charge::Prepare);
}
};
// Called by 191427 - Metamorphosis
class spell_dh_chaotic_transformation : public SpellScript
{
@@ -1354,6 +1415,8 @@ void AddSC_demon_hunter_spell_scripts()
RegisterSpellScript(spell_dh_calcified_spikes);
RegisterSpellScript(spell_dh_calcified_spikes_periodic);
RegisterSpellScript(spell_dh_chaos_strike);
RegisterSpellScript(spell_dh_chaos_theory);
RegisterSpellScript(spell_dh_chaos_theory_drop_charge);
RegisterSpellScript(spell_dh_chaotic_transformation);
RegisterSpellScript(spell_dh_charred_warblades);
RegisterSpellScript(spell_dh_collective_anguish);