diff options
author | offl <11556157+offl@users.noreply.github.com> | 2022-02-17 23:35:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-17 23:35:08 +0200 |
commit | 75db924e91ec52661151040bf2aa8f69a312238a (patch) | |
tree | 35ccbd26b1ac78b0cfe2b0ddb698d12969cc8204 /src | |
parent | 951d7d3a58ceab286a903a4a68185fd045deb33a (diff) |
Scripts/Spells: Script A Mysterious Voice from Ahn'kahet (#27779)
Closes #25683
Diffstat (limited to 'src')
4 files changed, 139 insertions, 79 deletions
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.cpp new file mode 100644 index 00000000000..39a23e0c98b --- /dev/null +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.cpp @@ -0,0 +1,137 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "DBCStores.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellInfo.h" +#include "SpellScript.h" +#include "SpellMgr.h" +#include "UnitAI.h" + +// 56584 - Combined Toxins +class spell_ahnkahet_combined_toxins : public AuraScript +{ + PrepareAuraScript(spell_ahnkahet_combined_toxins); + + bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + { + // only procs on poisons (damage class check to exclude stuff like Envenom) + SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); + return (spellInfo && spellInfo->Dispel == DISPEL_POISON && spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE); + } + + void Register() override + { + DoCheckEffectProc += AuraCheckEffectProcFn(spell_ahnkahet_combined_toxins::CheckProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_DAMAGE); + } +}; + +// 56698, 59102 - Shadow Blast +class spell_ahnkahet_shadow_blast : public SpellScript +{ + PrepareSpellScript(spell_ahnkahet_shadow_blast); + + void HandleDamageCalc(SpellEffIndex /*effIndex*/) + { + Unit* target = GetHitUnit(); + if (!target) + return; + + SetHitDamage(target->GetMaxHealth() * GetEffectInfo().BasePoints / 100); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_ahnkahet_shadow_blast::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } +}; + +enum ShadowSickle +{ + SPELL_SHADOW_SICKLE_TRIGGERED = 56701 +}; + +// 56702, 59103 - Shadow Sickle +class spell_ahnkahet_shadow_sickle : public AuraScript +{ + PrepareAuraScript(spell_ahnkahet_shadow_sickle); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SHADOW_SICKLE_TRIGGERED }); + } + + void HandlePeriodic(AuraEffect const* aurEff) + { + Unit* owner = GetUnitOwner(); + + uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SHADOW_SICKLE_TRIGGERED, owner); + if (!spellId) + return; + + if (owner->IsAIEnabled()) + if (Unit* target = owner->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 40.f)) + owner->CastSpell(target, spellId, CastSpellExtraArgs(aurEff).SetTriggerFlags(TriggerCastFlags::TRIGGERED_FULL_MASK)); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_ahnkahet_shadow_sickle::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + +// 58906, 58908, 58909, 58910 - Creature - Yogg-Saron Whisper +class spell_ahnkahet_yogg_saron_whisper : public SpellScript +{ + PrepareSpellScript(spell_ahnkahet_yogg_saron_whisper); + + bool Validate(SpellInfo const* spellInfo) override + { + return sObjectMgr->GetBroadcastText(uint32(spellInfo->GetEffect(EFFECT_0).CalcValue())) && + sSoundEntriesStore.LookupEntry(uint32(spellInfo->GetEffect(EFFECT_1).CalcValue())); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Creature* caster = GetCaster()->ToCreature()) + if (Player* player = GetHitPlayer()) + caster->Unit::Whisper(uint32(GetEffectValue()), player, false); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetHitPlayer()) + player->PlayDistanceSound(uint32(GetEffectValue()), player); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_ahnkahet_yogg_saron_whisper::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_ahnkahet_yogg_saron_whisper::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + } +}; + +void AddSC_ahnkahet() +{ + RegisterSpellScript(spell_ahnkahet_combined_toxins); + RegisterSpellScript(spell_ahnkahet_shadow_blast); + RegisterSpellScript(spell_ahnkahet_shadow_sickle); + RegisterSpellScript(spell_ahnkahet_yogg_saron_whisper); +} diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h index 38c8724a6f0..e0b70b3fa36 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h @@ -78,11 +78,6 @@ enum AKGameObjectIds GO_SPHERE_2 = 193094 }; -enum AKSpellIds -{ - SPELL_SHADOW_SICKLE_TRIGGERED = 56701, -}; - template <class AI, class T> inline AI* GetAhnKahetAI(T* obj) { diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp index 7de7b3144a6..db1ba1b3242 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp @@ -22,10 +22,6 @@ #include "InstanceScript.h" #include "Map.h" #include "ScriptMgr.h" -#include "SpellInfo.h" -#include "SpellScript.h" -#include "SpellMgr.h" -#include "UnitAI.h" DoorData const doorData[] = { @@ -153,77 +149,7 @@ class instance_ahnkahet : public InstanceMapScript } }; -// 56584 - Combined Toxins -class spell_combined_toxins : public AuraScript -{ - PrepareAuraScript(spell_combined_toxins); - - bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) - { - // only procs on poisons (damage class check to exclude stuff like Envenom) - SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - return (spellInfo && spellInfo->Dispel == DISPEL_POISON && spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE); - } - - void Register() override - { - DoCheckEffectProc += AuraCheckEffectProcFn(spell_combined_toxins::CheckProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_DAMAGE); - } -}; - -// 56698, 59102 - Shadow Blast -class spell_shadow_blast : public SpellScript -{ - PrepareSpellScript(spell_shadow_blast); - - void HandleDamageCalc(SpellEffIndex /*effIndex*/) - { - Unit* target = GetHitUnit(); - if (!target) - return; - - SetHitDamage(target->GetMaxHealth() * GetEffectInfo().BasePoints / 100); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_shadow_blast::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - } -}; - -// 56702, 59103 - Shadow Sickle -class spell_shadow_sickle : public AuraScript -{ - PrepareAuraScript(spell_shadow_sickle); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_SHADOW_SICKLE_TRIGGERED }); - } - - void HandlePeriodic(AuraEffect const* aurEff) - { - Unit* owner = GetUnitOwner(); - - uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SHADOW_SICKLE_TRIGGERED, owner); - if (!spellId) - return; - - if (owner->IsAIEnabled()) - if (Unit* target = owner->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 40.f)) - owner->CastSpell(target, spellId, CastSpellExtraArgs(aurEff).SetTriggerFlags(TriggerCastFlags::TRIGGERED_FULL_MASK)); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadow_sickle::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } -}; - void AddSC_instance_ahnkahet() { new instance_ahnkahet(); - RegisterSpellScript(spell_combined_toxins); - RegisterSpellScript(spell_shadow_blast); - RegisterSpellScript(spell_shadow_sickle); } diff --git a/src/server/scripts/Northrend/northrend_script_loader.cpp b/src/server/scripts/Northrend/northrend_script_loader.cpp index 78d3b00c213..3b7a84ba5e4 100644 --- a/src/server/scripts/Northrend/northrend_script_loader.cpp +++ b/src/server/scripts/Northrend/northrend_script_loader.cpp @@ -35,6 +35,7 @@ void AddSC_boss_amanitar(); void AddSC_boss_jedoga_shadowseeker(); void AddSC_boss_volazj(); void AddSC_instance_ahnkahet(); +void AddSC_ahnkahet(); // Drak'Tharon Keep void AddSC_boss_trollgore(); void AddSC_boss_novos(); @@ -227,6 +228,7 @@ void AddNorthrendScripts() AddSC_boss_jedoga_shadowseeker(); AddSC_boss_volazj(); AddSC_instance_ahnkahet(); + AddSC_ahnkahet(); // Azjol-Nerub - Azjol-Nerub AddSC_boss_krik_thir(); AddSC_boss_hadronox(); |