From 22c05ecc6200ec7985ba4253ad57dcf9d6f74e86 Mon Sep 17 00:00:00 2001 From: LHGemt <32850274+LHGemt@users.noreply.github.com> Date: Wed, 1 Nov 2017 03:28:53 +0100 Subject: [PATCH] Atiesh (#422) * Atiesh implementation * remove unused code * only apply unholy aura during combat * atiesh: added red lightning cast on spawn --- sql/migrations/20173110135101_world.sql | 35 +++++ src/game/Spells/SpellEffects.cpp | 6 + src/scripts/CMakeLists.txt | 1 + src/scripts/ScriptLoader.cpp | 2 + .../stratholme/boss_atiesh.cpp | 134 ++++++++++++++++++ 5 files changed, 178 insertions(+) create mode 100644 sql/migrations/20173110135101_world.sql create mode 100644 src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_atiesh.cpp diff --git a/sql/migrations/20173110135101_world.sql b/sql/migrations/20173110135101_world.sql new file mode 100644 index 000000000..51d2541a2 --- /dev/null +++ b/sql/migrations/20173110135101_world.sql @@ -0,0 +1,35 @@ +DROP PROCEDURE IF EXISTS add_migration; +delimiter ?? +CREATE PROCEDURE `add_migration`() +BEGIN +DECLARE v INT DEFAULT 1; +SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20173110135101'); +IF v=0 THEN +INSERT INTO `migrations` VALUES ('20173110135101'); +-- Add your query below. + +-- ------------------------------- +-- +-- Atiesh +-- +-- ------------------------------- + +-- damage/hp source: bestiary and https://www.youtube.com/watch?v=2KQCzxJU7eg +UPDATE `creature_template` SET `minhealth`=249825, `maxhealth`=249825, `speed_run`='2.54286', `mindmg`=4572, `maxdmg`=5646, `AIName`='', `equipment_id`='16387', `ScriptName`='boss_atiesh' WHERE `entry`=16387; + +-- add his weapons +REPLACE into creature_equip_template (entry,patch,equipentry1,equipentry2,equipentry3) +VALUES(16387, 0, 22738, 22738, 0); + +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`, `ScriptName`) +VALUES (181207, 3, 4175, 'Runed Demonic Blade', 0, 0, 1.5, 1085, 181207, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''); +REPLACE INTO `gameobject_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id`) +VALUES (181207, 22736, 100, 0, 1, 1, 0); + +-- End of migration. +END IF; +END?? +delimiter ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; + diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 351176caf..31fab0bbb 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -4754,6 +4754,12 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) unitTarget->RemoveAurasDueToSpell(28522); // Icebolt stun/damage spell } } + case 28352: // Atiesh - Breath of Sargeras + { + if (unitTarget && m_caster) + m_caster->CastSpell(unitTarget, 28342, true); + return; + } } break; } diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index d87c81392..eaad524a1 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -134,6 +134,7 @@ set (SCRIPTS_SRCS eastern_kingdoms/eastern_plaguelands/stratholme/boss_postmaster_malown.cpp eastern_kingdoms/eastern_plaguelands/stratholme/boss_ramstein_the_gorger.cpp eastern_kingdoms/eastern_plaguelands/stratholme/boss_timmy_the_cruel.cpp + eastern_kingdoms/eastern_plaguelands/stratholme/boss_atiesh.cpp eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp eastern_kingdoms/elwynn_forest/elwynn_forest.cpp diff --git a/src/scripts/ScriptLoader.cpp b/src/scripts/ScriptLoader.cpp index 1b23dd032..59c0c5d07 100644 --- a/src/scripts/ScriptLoader.cpp +++ b/src/scripts/ScriptLoader.cpp @@ -159,6 +159,7 @@ void AddSC_boss_timmy_the_cruel(); void AddSC_boss_postmaster_malown(); void AddSC_boss_baron_rivendare(); void AddSC_boss_dathrohan_balnazzar(); +void AddSC_boss_atiesh(); void AddSC_instance_stratholme(); void AddSC_stratholme(); void AddSC_instance_sunken_temple(); //sunken_temple @@ -428,6 +429,7 @@ void AddScripts() AddSC_boss_postmaster_malown(); AddSC_boss_baron_rivendare(); AddSC_boss_dathrohan_balnazzar(); + AddSC_boss_atiesh(); AddSC_instance_stratholme(); AddSC_stratholme(); AddSC_instance_sunken_temple(); //sunken_temple diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_atiesh.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_atiesh.cpp new file mode 100644 index 000000000..4e416e210 --- /dev/null +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_atiesh.cpp @@ -0,0 +1,134 @@ +/* Copyright (C) 2017 Light's Hope + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "scriptPCH.h" + + +enum eSpells +{ + SPELL_THRASH = 12787, // 35% chance on attack. 8876 for 15%, 3417 for 10% + SPELL_SHADOW_BOLT = 19729, + SPELL_UNHOLY_AURA = 28340, + //SPELL_BREATH_OF_SARGERAS = 28342, // Used by SPELL_BREATH_OF_SARGERAS_SCRIPT script-effect + SPELL_BREATH_OF_SARGERAS_SCRIPT = 28352, + SPELL_REAPER_OF_SOULS_DND = 28355, // summon the sword gobj + //SPELL_ANTIMAGIC_PULSE = 29463, // Can't seem to see this being used in any videos +}; + +enum eEvents +{ + EVENT_UNHOLY_AURA = 1, + EVENT_BREATH_OF_SARGERAS, + EVENT_ANTIMAGIC_PULSE, + EVENT_SHADOW_BOLT, +}; + +struct boss_atiesh : public ScriptedAI +{ + boss_atiesh(Creature* pCreature) : ScriptedAI(pCreature) + { + Reset(); + } + + EventMap events; + bool hasBeenDisarmed; + bool hasDoneSpawnCast; + void Reset() override + { + events.Reset(); + hasBeenDisarmed = false; + hasDoneSpawnCast = false; + m_creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 22738); + } + + void Aggro(Unit* pWho) override + { + events.ScheduleEvent(EVENT_BREATH_OF_SARGERAS, Seconds(15)); + events.ScheduleEvent(EVENT_SHADOW_BOLT, Seconds(1)); + } + + void SpellHit(Unit*, const SpellEntry* spell) override + { + // look for disarm, drop a weapon + if (!hasBeenDisarmed && spell->IsAuraAddedBySpell(SPELL_AURA_MOD_DISARM)) + { + // Summon the gobj with the sword + m_creature->CastSpell(m_creature, SPELL_REAPER_OF_SOULS_DND, true); + m_creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 0); + } + } + + void UpdateAI(const uint32 diff) override + { + if (!hasDoneSpawnCast) + { + m_creature->CastSpell(m_creature, 24240, true); + hasDoneSpawnCast = true; + } + + if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + return; + + if (!m_creature->HasAura(SPELL_UNHOLY_AURA)) + DoCastSpellIfCan(m_creature, SPELL_UNHOLY_AURA); + if (!m_creature->HasAura(SPELL_THRASH)) + DoCastSpellIfCan(m_creature, SPELL_THRASH); + + events.Update(diff); + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_UNHOLY_AURA: + break; + case EVENT_BREATH_OF_SARGERAS: + if (DoCastSpellIfCan(m_creature, SPELL_BREATH_OF_SARGERAS_SCRIPT) == CAST_OK) + events.Repeat(Seconds(urand(15, 25))); + else + events.Repeat(100); + break; + case EVENT_SHADOW_BOLT: + if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_SHADOW_BOLT)) + { + if (DoCastSpellIfCan(pTarget, SPELL_SHADOW_BOLT) == CAST_OK) + { + events.Repeat(Seconds(urand(13, 19))); + break; + } + } + events.Repeat(100); + break; + } + } + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_atiesh(Creature* pCreature) +{ + return new boss_atiesh(pCreature); +} + +void AddSC_boss_atiesh() +{ + Script* newscript; + + newscript = new Script; + newscript->Name = "boss_atiesh"; + newscript->GetAI = &GetAI_boss_atiesh; + newscript->RegisterSelf(); +}