Scripts/Spells: Implement warrior talent Bloodsurge (#31546)

This commit is contained in:
MoltenCrystal
2026-02-14 22:15:16 +01:00
committed by GitHub
parent 84d8adbd3e
commit 4c27b085cc
2 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_warr_bloodsurge');
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(384361, 'spell_warr_bloodsurge');

View File

@@ -22,6 +22,8 @@
*/
#include "ScriptMgr.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "Map.h"
#include "MoveSpline.h"
#include "ObjectAccessor.h"
@@ -38,6 +40,7 @@ enum WarriorSpells
SPELL_WARRIOR_AVATAR = 107574,
SPELL_WARRIOR_BLADESTORM = 227847,
SPELL_WARRIOR_BLADESTORM_PERIODIC_WHIRLWIND = 50622,
SPELL_WARRIOR_BLOODSURGE_ENERGIZE = 384362,
SPELL_WARRIOR_BLOODTHIRST_HEAL = 117313,
SPELL_WARRIOR_BOUNDING_STRIDE_AURA = 202163,
SPELL_WARRIOR_BOUNDING_STRIDE = 202164,
@@ -264,6 +267,42 @@ class spell_warr_avatar : public SpellScript
}
};
// 384361 - Bloodsurge
class spell_warr_bloodsurge : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_WARRIOR_BLOODSURGE_ENERGIZE });
}
void HandlePeriodic(AuraEffect const* aurEff) const
{
Unit* caster = GetTarget();
float rends = 0.0f;
auto work = [&rends, warrior = caster->GetGUID()](Unit const* target)
{
if (target->HasAuraEffect(SPELL_WARRIOR_REND_AURA, EFFECT_0, warrior))
rends += 1.0f;
};
Trinity::UnitWorker worker(caster, work);
Cell::VisitAllObjects(caster, worker, 50.0f);
float chance = std::sqrt(rends) * aurEff->GetAmount();
if (!roll_chance_f(chance))
return;
caster->CastSpell(caster, SPELL_WARRIOR_BLOODSURGE_ENERGIZE, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.TriggeringAura = aurEff
});
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_warr_bloodsurge::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
// 23881 - Bloodthirst
// 335096 - Bloodbath
class spell_warr_bloodthirst : public SpellScript
@@ -1794,6 +1833,7 @@ void AddSC_warrior_spell_scripts()
RegisterSpellScript(spell_warr_anger_management_proc);
RegisterSpellScript(spell_warr_ashen_juggernaut);
RegisterSpellScript(spell_warr_avatar);
RegisterSpellScript(spell_warr_bloodsurge);
RegisterSpellScript(spell_warr_bloodthirst);
RegisterSpellScript(spell_warr_brutal_vitality);
RegisterSpellScript(spell_warr_charge);