Scripts/Spells: Script A Mysterious Voice from Ahn'kahet (#27779)

Closes #25683

(cherry picked from commit 75db924e91)
This commit is contained in:
offl
2022-02-17 23:35:08 +02:00
committed by Shauren
parent eb1da698eb
commit 00f002b68c
5 changed files with 169 additions and 69 deletions

View File

@@ -0,0 +1,23 @@
--
UPDATE `spell_script_names` SET `ScriptName` = 'spell_ahnkahet_combined_toxins' WHERE `ScriptName` = 'spell_combined_toxins';
UPDATE `spell_script_names` SET `ScriptName` = 'spell_ahnkahet_shadow_blast' WHERE `ScriptName` = 'spell_shadow_blast';
UPDATE `spell_script_names` SET `ScriptName` = 'spell_ahnkahet_shadow_sickle' WHERE `ScriptName` = 'spell_shadow_sickle';
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_ahnkahet_yogg_saron_whisper';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(58906,'spell_ahnkahet_yogg_saron_whisper'),
(58908,'spell_ahnkahet_yogg_saron_whisper'),
(58909,'spell_ahnkahet_yogg_saron_whisper'),
(58910,'spell_ahnkahet_yogg_saron_whisper');
DELETE FROM `creature_text` WHERE `CreatureID` = 31264;
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 31264;
DELETE FROM `smart_scripts` WHERE `entryorguid` = 31264 AND `source_type` = 0;
DELETE FROM `smart_scripts` WHERE `entryorguid` BETWEEN 3126400 AND 3126403 AND `source_type` = 9;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`event_param5`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_param4`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(31264,0,0,0,60,0,100,0,300000,600000,300000,600000,0,88,3126400,3126403,0,0,0,0,1,0,0,0,0,0,0,0,0,"A Mysterious Voice - On Update - Run Random Script"),
(3126400,9,0,0,0,0,100,0,0,0,0,0,0,11,58906,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"A Mysterious Voice - On Script - Cast 'Creature - Yogg-Saron Whisper'"),
(3126401,9,0,0,0,0,100,0,0,0,0,0,0,11,58908,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"A Mysterious Voice - On Script - Cast 'Creature - Yogg-Saron Whisper'"),
(3126402,9,0,0,0,0,100,0,0,0,0,0,0,11,58909,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"A Mysterious Voice - On Script - Cast 'Creature - Yogg-Saron Whisper'"),
(3126403,9,0,0,0,0,100,0,0,0,0,0,0,11,58910,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"A Mysterious Voice - On Script - Cast 'Creature - Yogg-Saron Whisper'");

View File

@@ -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);
}

View File

@@ -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)
{

View File

@@ -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);
}

View File

@@ -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();