From 1c5000b5d7eae6e9ac00db33265a26e84eeccf2f Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 8 Feb 2019 19:31:21 +0100 Subject: [PATCH] Scripts/ZG: scripted Zandalari Hierophant and Zandalari Archon *corrected Glory of the Zandalari condition for Zandalari Juggernaut --- .../custom/custom_2019_02_08_00_world.sql | 51 +++++++++ src/server/game/Spells/SpellMgr.cpp | 18 ++++ .../EasternKingdoms/ZulGurub/zulgurub.cpp | 100 ++++++++++++++++++ 3 files changed, 169 insertions(+) create mode 100644 sql/updates/world/custom/custom_2019_02_08_00_world.sql diff --git a/sql/updates/world/custom/custom_2019_02_08_00_world.sql b/sql/updates/world/custom/custom_2019_02_08_00_world.sql new file mode 100644 index 00000000000..0e64e627262 --- /dev/null +++ b/sql/updates/world/custom/custom_2019_02_08_00_world.sql @@ -0,0 +1,51 @@ +-- Creature Zandalari Juggernaut 52956 SAI +SET @ENTRY := 52956; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 25, 0, 100, 0, 0, 0, 0, 0, 11, 97987, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "On reset (e.g. after reaching home) - Self: Cast spell 97987 on Self // "), +(@ENTRY, 0, 1, 2, 2, 0, 100, 1, 0, 50, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When health between 0% and 50% (check every 0 - 0 ms) - Self: Talk 0 // "), +(@ENTRY, 0, 2, 3, 61, 0, 100, 0, 0, 0, 0, 0, 11, 97977, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Cast spell 97977 on Self // "), +(@ENTRY, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 11, 97970, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Cast spell 97970 on Self // "), +(@ENTRY, 0, 4, 0, 0, 2, 100, 0, 500, 500, 6000, 6000, 11, 98000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 500 and 500 ms (and later repeats every 6000 and 6000 ms) - Self: Cast spell 98000 on Self // "), +(@ENTRY, 0, 5, 0, 8, 0, 100, 0, 97970, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "On spell 97970 hit - Self: Set event phase to 2 // "); + +-- Creature Zandalari Hierophant 52958 SAI +SET @ENTRY := 52958; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 3000, 4000, 5000, 6000, 11, 97962, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 3000 and 4000 ms (and later repeats every 5000 and 6000 ms) - Self: Cast spell 97962 on Random hostile // "), +(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 12000, 13000, 22000, 23000, 11, 97973, 0, 0, 0, 0, 0, 26, 20, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 12000 and 13000 ms (and later repeats every 22000 and 23000 ms) - Self: Cast spell 97973 on Closest friendly creature in 20 yards // "), +(@ENTRY, 0, 2, 3, 2, 0, 100, 1, 0, 50, 0, 0, 11, 97977, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When health between 0% and 50% (check every 0 - 0 ms) - Self: Cast spell 97977 on Self // "), +(@ENTRY, 0, 3, 4, 61, 0, 100, 0, 0, 0, 0, 0, 11, 97969, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Cast spell 97969 on Self // "), +(@ENTRY, 0, 4, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Talk 0 // "), +(@ENTRY, 0, 5, 0, 8, 0, 100, 0, 97969, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "On spell 97969 hit - Self: Set event phase to 2 // "), +(@ENTRY, 0, 6, 0, 0, 2, 100, 0, 500, 500, 30000, 31000, 11, 97978, 0, 0, 0, 0, 0, 26, 20, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 500 and 500 ms (and later repeats every 30000 and 31000 ms) - Self: Cast spell 97978 on Closest friendly creature in 20 yards // "); + +-- Creature Zandalari Archon 52962 SAI +SET @ENTRY := 52962; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 1, 2, 0, 100, 1, 0, 50, 0, 0, 11, 97977, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When health between 0% and 50% (check every 0 - 0 ms) - Self: Cast spell 97977 on Self // "), +(@ENTRY, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 11, 97972, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Cast spell 97972 on Self // "), +(@ENTRY, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Talk 0 // "), +(@ENTRY, 0, 3, 0, 0, 0, 100, 0, 3000, 3000, 5000, 5000, 11, 98016, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 3000 and 3000 ms (and later repeats every 5000 and 5000 ms) - Self: Cast spell 98016 on Random hostile // "), +(@ENTRY, 0, 4, 0, 0, 0, 100, 0, 4000, 5000, 5000, 5000, 11, 98014, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 4000 and 5000 ms (and later repeats every 5000 and 5000 ms) - Self: Cast spell 98014 on Random hostile // "), +(@ENTRY, 0, 5, 0, 0, 0, 100, 0, 15000, 15000, 16000, 16000, 11, 98024, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 15000 and 15000 ms (and later repeats every 16000 and 16000 ms) - Self: Cast spell 98024 on Self // "), +(@ENTRY, 0, 6, 0, 8, 0, 100, 0, 97972, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "On spell 97972 hit - Self: Set event phase to 2 // "), +(@ENTRY, 0, 7, 0, 0, 2, 100, 0, 600, 600, 30000, 30000, 11, 98019, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 600 and 600 ms (and later repeats every 30000 and 30000 ms) - Self: Cast spell 98019 on Self // "); + +DELETE FROM `creature_text` WHERE `CreatureID` IN (52958, 52962); +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `comment`) VALUES +(52958, 0, 0, 'Ancestors be beside me, let \'dem hear yo\' voice!', 14, 14, 100, 0, 0, 0, 51611, 'Zandalari Hierophant - Glory of the Zandalari'), +(52962, 0, 0, 'Ancients of Zandalar, mark ''dem for de black road.', 14, 14, 100, 0, 0, 0, 51630, 'Zandalari Archon - - Glory of the Zandalari'); + +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_zulgurub_sigil_shatter', +'spell_zulgurub_ancient_guardian'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(98024, 'spell_zulgurub_sigil_shatter'), +(97978, 'spell_zulgurub_ancient_guardian'); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index c011851bff8..3eca47aa8a3 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -4877,6 +4877,24 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->MaxAffectedTargets = 1; }); + // Sigil Shatter + ApplySpellFix({ 98033 }, [](SpellInfo* spellInfo) + { + spellInfo->Effects[EFFECT_1].TriggerSpell = 98014; + }); + + // Sigil Shatter + ApplySpellFix({ 98038 }, [](SpellInfo* spellInfo) + { + spellInfo->Effects[EFFECT_2].TriggerSpell = 98016; + }); + + // Sigil Shatter + ApplySpellFix({ 98040 }, [](SpellInfo* spellInfo) + { + spellInfo->Effects[EFFECT_1].TriggerSpell = 98019; + }); + // ENDOF ZUL'GURUB SPELLS // diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.cpp index 55ef5a6f2a7..3c3ce3892a4 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.cpp @@ -22,6 +22,7 @@ #include "MoveSplineInit.h" #include "Spell.h" #include "SpellAuraEffects.h" +#include "SpellMgr.h" #include "SpellScript.h" #include "Vehicle.h" @@ -463,6 +464,103 @@ private: EventMap _events; }; +enum SigilShatter +{ + SPELL_SIGIL_OF_FLAME = 98006, + SPELL_SIGIL_OF_FROST = 98015, + SPELL_SIGIL_OF_DEATH = 98018 +}; + +class spell_zulgurub_sigil_shatter : public SpellScript +{ + PrepareSpellScript(spell_zulgurub_sigil_shatter); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_SIGIL_OF_FLAME, + SPELL_SIGIL_OF_FROST, + SPELL_SIGIL_OF_DEATH + }); + } + + void FilterSigilOfFlameTargets(std::list& targets) + { + if (targets.empty()) + return; + + uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SIGIL_OF_FLAME, GetCaster()); + + targets.remove_if(Trinity::UnitAuraCheck(true, spellId)); + } + + void FilterSigilOfFrostTargets(std::list& targets) + { + if (targets.empty()) + return; + + uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SIGIL_OF_FROST, GetCaster()); + + targets.remove_if(Trinity::UnitAuraCheck(true, spellId)); + } + + void FilterSigilOfDeathTargets(std::list& targets) + { + if (targets.empty()) + return; + + uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SIGIL_OF_DEATH, GetCaster()); + + targets.remove_if(Trinity::UnitAuraCheck(true, spellId)); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_zulgurub_sigil_shatter::FilterSigilOfFlameTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_zulgurub_sigil_shatter::FilterSigilOfFrostTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_zulgurub_sigil_shatter::FilterSigilOfDeathTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); + } +}; + +enum AncientGuardian +{ + SPELL_ANCIENT_GUARDIAN_HEAL = 97980 +}; + +class spell_zulgurub_ancient_guardian : public AuraScript +{ + PrepareAuraScript(spell_zulgurub_ancient_guardian); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_ANCIENT_GUARDIAN_HEAL }); + } + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + amount = -1; + } + + void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) + { + Unit* target = GetTarget(); + if (dmgInfo.GetDamage() >= target->GetHealth()) + { + absorbAmount = dmgInfo.GetDamage(); + int32 health = target->CountPctFromMaxHealth(50) - absorbAmount; + target->CastCustomSpell(SPELL_ANCIENT_GUARDIAN_HEAL, SPELLVALUE_BASE_POINT0, health, target, true, nullptr, aurEff); + Remove(); + } + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_zulgurub_ancient_guardian::CalculateAmount, EFFECT_1, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_zulgurub_ancient_guardian::Absorb, EFFECT_1); + } +}; + void AddSC_zulgurub() { RegisterZulGurubCreatureAI(npc_zulgurub_berserking_boulder_roller); @@ -470,4 +568,6 @@ void AddSC_zulgurub() RegisterZulGurubCreatureAI(npc_zulgurub_tiki_lord_mu_loa); RegisterZulGurubCreatureAI(npc_zulgurub_tiki_lord_zim_wae); RegisterAuraScript(spell_zulgurub_rolling_boulders); + RegisterSpellScript(spell_zulgurub_sigil_shatter); + RegisterAuraScript(spell_zulgurub_ancient_guardian); }