diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp | 207 |
1 files changed, 181 insertions, 26 deletions
diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp index 0b19ee205bd..3f3f230dccf 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp @@ -1,42 +1,52 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * 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 + */ + /* Script Data Start SDName: Boss xevozz -SDAuthor: LordVanMartin SD%Complete: SDComment: SDCategory: Script Data End */ -/*** SQL START *** -update creature_template set scriptname = '' where entry = ''; -*** SQL END ***/ #include "precompiled.h" #include "violet_hold.h" enum Spells { - SPELL_ARCANE_BARRAGE_VOLLEY = 54202, - H_SPELL_ARCANE_BARRAGE_VOLLEY = 59483, - SPELL_ARCANE_BUFFET = 54226, - H_SPELL_ARCANE_BUFFET = 59485, - SPELL_SUMMON_ETHEREAL_SPHERE_1 = 54102, - H_SPELL_SUMMON_ETHEREAL_SPHERE_1 = 61337, - SPELL_SUMMON_ETHEREAL_SPHERE_2 = 54137, - H_SPELL_SUMMON_ETHEREAL_SPHERE_2 = 61338, - SPELL_SUMMON_ETHEREAL_SPHERE_3 = 54138, - H_SPELL_SUMMON_ETHEREAL_SPHERE_3 = 61339 + SPELL_ARCANE_BARRAGE_VOLLEY = 54202, + SPELL_ARCANE_BARRAGE_VOLLEY_H = 59483, + SPELL_ARCANE_BUFFET = 54226, + SPELL_ARCANE_BUFFET_H = 59485, + SPELL_SUMMON_ETHEREAL_SPHERE_1 = 54102, + SPELL_SUMMON_ETHEREAL_SPHERE_2 = 54137, + SPELL_SUMMON_ETHEREAL_SPHERE_3 = 54138, }; -enum Creatures +enum NPCs { - CREATURE_ETHEREAL_SPHERE = 29271, - H_CREATURE_ETHEREAL_SPHERE = 32582 + NPC_ETHEREAL_SPHERE = 29271, + //NPC_ETHEREAL_SPHERE2 = 32582, // heroic only? }; enum CreatureSpells { SPELL_ARCANE_POWER = 54160, H_SPELL_ARCANE_POWER = 59474, - SPELL_SUMMON_PLAYERS = 54164 + SPELL_SUMMON_PLAYERS = 54164, + SPELL_POWER_BALL_VISUAL = 54141, }; //not in db @@ -56,13 +66,20 @@ enum Yells struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI { - boss_xevozzAI(Creature *c) : ScriptedAI(c) + boss_xevozzAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = c->GetInstanceData(); + pInstance = pCreature->GetInstanceData(); + bHeroicMode = pCreature->GetMap()->IsHeroic(); } ScriptedInstance* pInstance; + bool bHeroicMode; + + uint32 m_uiSummonEtherealSphere_Timer; + uint32 m_uiArcaneBarrageVolley_Timer; + uint32 m_uiArcaneBuffet_Timer; + void Reset() { if (pInstance) @@ -72,9 +89,39 @@ struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); } + + m_uiSummonEtherealSphere_Timer = urand(10000, 12000); + m_uiArcaneBarrageVolley_Timer = urand(20000, 22000); + m_uiArcaneBuffet_Timer = m_uiSummonEtherealSphere_Timer + urand(5000, 6000); + DespawnSphere(); + } + + void DespawnSphere() + { + std::list<Creature*> assistList; + GetCreatureListWithEntryInGrid(assistList,m_creature, NPC_ETHEREAL_SPHERE ,150.0f); + + if (assistList.empty()) + return; + + for(std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter) + { + if (Creature* pSphere = *iter) + pSphere->Kill(pSphere, false); + } + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->SetSpeed(MOVE_RUN, 0.5f); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + pSummoned->AddThreat(pTarget, 0.00f); + pSummoned->AI()->AttackStart(pTarget); + } } - void EnterCombat(Unit* who) + void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); if (pInstance) @@ -86,20 +133,50 @@ struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI } } - void MoveInLineOfSight(Unit* who) {} + void MoveInLineOfSight(Unit* pWho) {} - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; + if (m_uiArcaneBarrageVolley_Timer < uiDiff) + { + DoCast(m_creature, bHeroicMode ? SPELL_ARCANE_BARRAGE_VOLLEY_H : SPELL_ARCANE_BARRAGE_VOLLEY); + m_uiArcaneBarrageVolley_Timer = urand(20000, 22000); + } + else m_uiArcaneBarrageVolley_Timer -= uiDiff; + + if (m_uiArcaneBuffet_Timer) + if (m_uiArcaneBuffet_Timer < uiDiff) + { + DoCast(m_creature->getVictim(), bHeroicMode ? SPELL_ARCANE_BUFFET_H : SPELL_ARCANE_BUFFET); + m_uiArcaneBuffet_Timer = 0; + } + else m_uiArcaneBuffet_Timer -= uiDiff; + + if (m_uiSummonEtherealSphere_Timer < uiDiff) + { + DoScriptText(SAY_SPAWN, m_creature); + DoCast(m_creature, SPELL_SUMMON_ETHEREAL_SPHERE_1); + if (bHeroicMode) // extra one for heroic + m_creature->SummonCreature(NPC_ETHEREAL_SPHERE, m_creature->GetPositionX()-5+rand()%10, m_creature->GetPositionY()-5+rand()%10, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 40000); + + m_uiSummonEtherealSphere_Timer = urand(45000, 47000); + m_uiArcaneBuffet_Timer = urand(5000, 6000); + } + else m_uiSummonEtherealSphere_Timer -= uiDiff; + DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) + void JustDied(Unit* pKiller) { DoScriptText(SAY_DEATH, m_creature); + + DespawnSphere(); + if (pInstance) { if (pInstance->GetData(DATA_WAVE_COUNT) == 6) @@ -114,10 +191,11 @@ struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI } } } - void KilledUnit(Unit *victim) + void KilledUnit(Unit* pVictim) { - if (victim == m_creature) + if (pVictim == m_creature) return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; @@ -127,6 +205,78 @@ CreatureAI* GetAI_boss_xevozz(Creature* pCreature) return new boss_xevozzAI (pCreature); } +struct TRINITY_DLL_DECL mob_ethereal_sphereAI : public ScriptedAI +{ + mob_ethereal_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData()); + bHeroicMode = pCreature->GetMap()->IsHeroic(); + } + + ScriptedInstance* m_pInstance; + bool bHeroicMode; + + uint32 m_uiSummonPlayers_Timer; + uint32 m_uiRangeCheck_Timer; + + void Reset() + { + m_uiSummonPlayers_Timer = urand(33000, 35000); + m_uiRangeCheck_Timer = 1000; + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!m_creature->HasAura(SPELL_POWER_BALL_VISUAL)) + DoCast(m_creature, SPELL_POWER_BALL_VISUAL); + + if (m_uiRangeCheck_Timer < uiDiff) + { + if (m_pInstance) + { + if (Creature* pXevozz = ((Creature*)Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_XEVOZZ)))) + { + float fDistance = m_creature->GetDistance2d(pXevozz); + if (fDistance <= 3) + DoCast(pXevozz, bHeroicMode ? H_SPELL_ARCANE_POWER : SPELL_ARCANE_POWER); + else + DoCast(m_creature, 35845); //Is it blizzlike? + } + } + m_uiRangeCheck_Timer = 1000; + } + else m_uiRangeCheck_Timer -= uiDiff; + + if (m_uiSummonPlayers_Timer < uiDiff) + { + DoCast(m_creature, SPELL_SUMMON_PLAYERS); // not working right + + Map* pMap = m_creature->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource()->isAlive()) + DoTeleportPlayer(i->getSource(), m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), i->getSource()->GetOrientation()); + } + + m_uiSummonPlayers_Timer = urand(33000, 35000); + } + else m_uiSummonPlayers_Timer -= uiDiff; + } +}; + +CreatureAI* GetAI_mob_ethereal_sphere(Creature* pCreature) +{ + return new mob_ethereal_sphereAI (pCreature); +} + void AddSC_boss_xevozz() { Script *newscript; @@ -135,4 +285,9 @@ void AddSC_boss_xevozz() newscript->Name = "boss_xevozz"; newscript->GetAI = &GetAI_boss_xevozz; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "mob_ethereal_sphere"; + newscript->GetAI = &GetAI_mob_ethereal_sphere; + newscript->RegisterSelf(); } |
