diff options
author | offl <11556157+offl@users.noreply.github.com> | 2022-02-17 23:35:08 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-03-26 15:01:35 +0100 |
commit | 00f002b68c4caeaf319dc57cc154341f6279cb6d (patch) | |
tree | 95208a40ec12d89d107a885f56b0e56cc87db1c6 /src | |
parent | eb1da698ebb098d8acdb8559bb06f630644ee857 (diff) |
Scripts/Spells: Script A Mysterious Voice from Ahn'kahet (#27779)
Closes #25683
(cherry picked from commit 75db924e91ec52661151040bf2aa8f69a312238a)
Diffstat (limited to 'src')
4 files changed, 146 insertions, 69 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..27c64a0df1c --- /dev/null +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.cpp @@ -0,0 +1,144 @@ +/* + * 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 "DB2Stores.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "SpellInfo.h" +#include "SpellScript.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, + SPELL_SHADOW_SICKLE_TRIGGERED_H = 59104, +}; + +// 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 = 0; + + switch (GetId()) + { + case 56702: + spellId = SPELL_SHADOW_SICKLE_TRIGGERED; + break; + case 59103: + spellId = SPELL_SHADOW_SICKLE_TRIGGERED_H; + break; + default: + 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 sBroadcastTextStore.HasRecord(uint32(spellInfo->GetEffect(EFFECT_0).CalcValue())) && + sSoundKitStore.HasRecord(uint32(spellInfo->GetEffect(EFFECT_1).CalcValue())); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetHitPlayer()) + GetCaster()->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 830975a8fcd..e0b70b3fa36 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h @@ -78,12 +78,6 @@ enum AKGameObjectIds GO_SPHERE_2 = 193094 }; -enum AKSpellIds -{ - SPELL_SHADOW_SICKLE_TRIGGERED = 56701, - SPELL_SHADOW_SICKLE_TRIGGERED_H = 59104, -}; - 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 419e907665c..3880fc32de2 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp @@ -17,14 +17,10 @@ #include "ahnkahet.h" #include "AreaBoundary.h" -#include "Creature.h" #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" #include "ScriptMgr.h" -#include "SpellInfo.h" -#include "SpellScript.h" -#include "UnitAI.h" #include <sstream> DoorData const doorData[] = @@ -153,66 +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); - } -}; - -// 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, SPELL_SHADOW_SICKLE_TRIGGERED_H }); - } - - void HandlePeriodic(AuraEffect const* aurEff) - { - Unit* owner = GetUnitOwner(); - - uint32 spellId = 0; - - switch (GetId()) - { - case 56702: - spellId = SPELL_SHADOW_SICKLE_TRIGGERED; - break; - case 59103: - spellId = SPELL_SHADOW_SICKLE_TRIGGERED_H; - break; - default: - 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_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(); |