Scripts/Spells: Implement hunter talent Wilderness Medicine (#30848)

This commit is contained in:
Aqua Deus
2025-05-04 23:18:37 +02:00
committed by GitHub
parent bec4308385
commit fc362147f9
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_hun_wilderness_medicine';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(136,'spell_hun_wilderness_medicine');

View File

@@ -77,6 +77,8 @@ enum HunterSpells
SPELL_HUNTER_STEADY_SHOT_FOCUS = 77443,
SPELL_HUNTER_T9_4P_GREATNESS = 68130,
SPELL_HUNTER_T29_2P_MARKSMANSHIP_DAMAGE = 394371,
SPELL_HUNTER_WILDERNESS_MEDICINE_TALENT = 343242,
SPELL_HUNTER_WILDERNESS_MEDICINE_DISPEL = 384784,
SPELL_ROAR_OF_SACRIFICE_TRIGGERED = 67481
};
@@ -1004,6 +1006,46 @@ class spell_hun_t29_2p_marksmanship_bonus : public AuraScript
}
};
// Called by 136 - Mend Pet
class spell_hun_wilderness_medicine : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_HUNTER_WILDERNESS_MEDICINE_TALENT, SPELL_HUNTER_WILDERNESS_MEDICINE_DISPEL });
}
bool Load() override
{
Unit const* caster = GetCaster();
if (!caster)
return false;
AuraEffect const* wildernessMedicine = GetCaster()->GetAuraEffect(SPELL_HUNTER_WILDERNESS_MEDICINE_TALENT, EFFECT_1);
if (!wildernessMedicine)
return false;
_dispelChance = wildernessMedicine->GetAmount();
return true;
}
void OnPeriodic(AuraEffect const* aurEff) const
{
if (Unit* caster = GetCaster())
if (roll_chance_i(_dispelChance))
caster->CastSpell(GetTarget(), SPELL_HUNTER_WILDERNESS_MEDICINE_DISPEL, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.TriggeringAura = aurEff
});
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_wilderness_medicine::OnPeriodic, EFFECT_0, SPELL_AURA_OBS_MOD_HEALTH);
}
int32 _dispelChance = 0;
};
void AddSC_hunter_spell_scripts()
{
RegisterSpellScript(spell_hun_a_murder_of_crows);
@@ -1039,4 +1081,5 @@ void AddSC_hunter_spell_scripts()
RegisterSpellScript(spell_hun_tame_beast);
RegisterSpellScript(spell_hun_t9_4p_bonus);
RegisterSpellScript(spell_hun_t29_2p_marksmanship_bonus);
RegisterSpellScript(spell_hun_wilderness_medicine);
}