Scripts/Spells: Implement monk talent Song of Chi-ji (#30952)

This commit is contained in:
Aqua Deus
2025-05-29 00:08:33 +02:00
committed by GitHub
parent bd87381eab
commit ab972a9e97
2 changed files with 41 additions and 0 deletions

View File

@@ -21,7 +21,10 @@
*/
#include "ScriptMgr.h"
#include "AreaTrigger.h"
#include "AreaTriggerAI.h"
#include "DB2Stores.h"
#include "PathGenerator.h"
#include "Player.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
@@ -49,6 +52,7 @@ enum MonkSpells
SPELL_MONK_ROLL_BACKWARD = 109131,
SPELL_MONK_ROLL_FORWARD = 107427,
SPELL_MONK_SAVE_THEM_ALL_HEAL_BONUS = 390105,
SPELL_MONK_SONG_OF_CHI_JI_STUN = 198909,
SPELL_MONK_SOOTHING_MIST = 115175,
SPELL_MONK_STANCE_OF_THE_SPIRITED_CRANE = 154436,
SPELL_MONK_STAGGER_DAMAGE_AURA = 124255,
@@ -432,6 +436,37 @@ class spell_monk_save_them_all : public AuraScript
}
};
// 198898 - Song of Chi-Ji
struct at_monk_song_of_chi_ji : AreaTriggerAI
{
using AreaTriggerAI::AreaTriggerAI;
void OnInitialize() override
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(at->GetSpellId(), DIFFICULTY_NONE);
if (!spellInfo)
return;
Unit* caster = at->GetCaster();
if (!caster)
return;
Position destPos = at->GetFirstCollisionPosition(spellInfo->GetMaxRange(false, caster), 0.0f);
PathGenerator path(at);
path.CalculatePath(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ(), false);
at->InitSplines(path.GetPath());
}
void OnUnitEnter(Unit* unit) override
{
if (Unit* caster = at->GetCaster())
if (caster->IsValidAttackTarget(unit))
caster->CastSpell(unit, SPELL_MONK_SONG_OF_CHI_JI_STUN, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
}
};
// Utility for stagger scripts
Aura* FindExistingStaggerEffect(Unit* unit)
{
@@ -678,6 +713,7 @@ void AddSC_monk_spell_scripts()
RegisterSpellScript(spell_monk_roll);
RegisterSpellScript(spell_monk_roll_aura);
RegisterSpellScript(spell_monk_save_them_all);
RegisterAreaTriggerAI(at_monk_song_of_chi_ji);
RegisterSpellScript(spell_monk_stagger);
RegisterSpellScript(spell_monk_stagger_damage_aura);
RegisterSpellScript(spell_monk_stagger_debuff_aura);