diff options
Diffstat (limited to 'src')
10 files changed, 1065 insertions, 437 deletions
diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am index 8d871dfcf25..466236c3418 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -270,6 +270,12 @@ scripts/zone/naxxramas/boss_sapphiron.cpp \ scripts/zone/naxxramas/boss_thaddius.cpp \ scripts/zone/naxxramas/instance_naxxramas.cpp \ scripts/zone/netherstorm/netherstorm.cpp \ +scripts/zone/nexus/nexus/boss_magus_telestra.cpp \ +scripts/zone/nexus/nexus/boss_anomalus.cpp \ +scripts/zone/nexus/nexus/boss_ormorok.cpp \ +scripts/zone/nexus/nexus/boss_keristrasza.cpp \ +scripts/zone/nexus/nexus/def_nexus.h \ +scripts/zone/nexus/nexus/instance_nexus.cpp \ scripts/zone/onyxias_lair/boss_onyxia.cpp \ scripts/zone/orgrimmar/orgrimmar.cpp \ scripts/zone/razorfen_downs/boss_amnennar_the_coldbringer.cpp \ diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index e98ea3395cb..0a440fb8c10 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -401,6 +401,13 @@ extern void AddSC_instance_naxxramas(); //Netherstorm extern void AddSC_netherstorm(); +//The Nexus +extern void AddSC_boss_magus_telestra(); +extern void AddSC_boss_anomalus(); +extern void AddSC_boss_ormorok(); +extern void AddSC_boss_keristrasza(); +extern void AddSC_instance_nexus(); + //Onyxia's Lair extern void AddSC_boss_onyxia(); @@ -1286,6 +1293,13 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") //Netherstorm AddSC_netherstorm(); + //The Nexus + AddSC_boss_magus_telestra(); + AddSC_boss_anomalus(); + AddSC_boss_ormorok(); + AddSC_boss_keristrasza(); + AddSC_instance_nexus(); + //Onyxia's Lair AddSC_boss_onyxia(); diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index 1a39f5b3947..afe05d56e58 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -2514,22 +2514,30 @@ <Filter Name="Nexus" > - <File - RelativePath="..\scripts\zone\nexus\nexus\boss_anomalus.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\nexus\nexus\boss_keristrasza.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\nexus\nexus\boss_magus_telestra.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\nexus\nexus\boss_ormorok.cpp" - > - </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\boss_magus_telestra.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\boss_anomalus.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\boss_ormorok.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\boss_keristrasza.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\def_nexus.h" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\instance_nexus.cpp" + > + </File> <File RelativePath="..\scripts\zone\nexus\nexus\commander_kolurg.cpp" > @@ -2539,10 +2547,6 @@ > </File> <File - RelativePath="..\scripts\zone\nexus\nexus\def_nexus.h" - > - </File> - <File RelativePath="..\scripts\zone\nexus\nexus\instance_nexus.cpp" > </File> diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index cfcbcc54059..bf6ee205867 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -2513,22 +2513,30 @@ <Filter Name="Nexus" > - <File - RelativePath="..\scripts\zone\nexus\nexus\boss_anomalus.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\nexus\nexus\boss_keristrasza.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\nexus\nexus\boss_magus_telestra.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\nexus\nexus\boss_ormorok.cpp" - > - </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\boss_magus_telestra.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\boss_anomalus.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\boss_ormorok.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\boss_keristrasza.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\def_nexus.h" + > + </File> + <File + RelativePath="..\scripts\zone\nexus\nexus\instance_nexus.cpp" + > + </File> <File RelativePath="..\scripts\zone\nexus\nexus\commander_kolurg.cpp" > @@ -2537,14 +2545,6 @@ RelativePath="..\scripts\zone\nexus\nexus\commander_stoutbeard.cpp" > </File> - <File - RelativePath="..\scripts\zone\nexus\nexus\def_nexus.h" - > - </File> - <File - RelativePath="..\scripts\zone\nexus\nexus\instance_nexus.cpp" - > - </File> </Filter> <Filter Name="Oculus" diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_anomalus.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_anomalus.cpp index 92f276e07d8..3a94d152710 100644 --- a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_anomalus.cpp +++ b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_anomalus.cpp @@ -1,121 +1,256 @@ -/* Script Data Start -SDName: Boss anomalus -SDAuthor: LordVanMartin -SD%Complete: -SDComment: -SDCategory: -Script Data End */ - -/*** SQL START *** -update creature_template set scriptname = '' where entry = ''; -*** SQL END ***/ +/* 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 + */ + +/* ScriptData +SDName: Boss_Anomalus +SD%Complete: +SDComment: +SDCategory: The Nexus, The Nexus +EndScriptData */ + #include "precompiled.h" +#include "def_nexus.h" //Spells -#define SPELL_SPARK_1 47751 -#define SPELL_SPARK_2 57062 +#define SPELL_SPARK_N 47751 +#define SPELL_SPARK_H 57062 #define SPELL_RIFT_SHIELD 47748 -#define SPELL_CHARGE_RIFT 47747 -#define SPELL_ARCANE_ATTRACTION 57063 -#define SPELL_CREATE_RIFT 47743 //Dummy ---> summons (npc 26918) "Chaotic Rift", which spawns "Crazed Mana Wraith"s (npc 26746) +#define SPELL_CHARGE_RIFT 47747 //Works wrong (affect players, not rifts) +#define SPELL_CREATE_RIFT 47743 //Don't work, using WA +#define SPELL_ARCANE_ATTRACTION 57063 //No idea, when it's used -#define MOB_CRAZED_MANA_WRAITH 26746 -#define NPC_CHAOTIC_RIFT 26918 +#define MOB_CRAZED_MANA_WRAITH 26746 +#define MOB_CHAOTIC_RIFT 26918 +#define SPELL_CHAOTIC_ENERGY_BURST 47688 +#define SPELL_CHARGED_CHAOTIC_ENERGY_BURST 47737 +#define SPELL_ARCANEFORM 48019 //Chaotic Rift visual //Yell -#define SAY_AGGRO -1576000 -#define SAY_KILL -1576001 -#define SAY_DEATH -1576002 -#define SAY_RIFT -1576003 -#define SAY_SHIELD -1576004 +#define SAY_AGGRO -1576010 +#define SAY_DEATH -1576011 +#define SAY_RIFT -1576012 +#define SAY_SHIELD -1576013 + +float RiftLocation[6][3]= +{ + {652.64, -273.70, -8.75}, + {634.45, -265.94, -8.44}, + {620.73, -281.17, -9.02}, + {626.10, -304.67, -9.44}, + {639.87, -314.11, -9.49}, + {651.72, -297.44, -9.37} +}; struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI { - boss_anomalusAI(Creature *c) : ScriptedAI(c) {} + boss_anomalusAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + HeroicMode = c->GetMap()->IsHeroic(); + } + + ScriptedInstance* pInstance; + bool HeroicMode; - void Reset() {} - void EnterCombat(Unit* who) + uint8 Phase; + uint32 SPELL_SPARK_Timer; + uint32 SPELL_CREATE_RIFT_Timer; + uint64 ChaoticRiftGUID; + + void Reset() + { + Phase = 0; + SPELL_SPARK_Timer = 5000; + SPELL_CREATE_RIFT_Timer = 25000; + ChaoticRiftGUID = 0; + + if(pInstance) + pInstance->SetData(DATA_ANOMALUS_EVENT, NOT_STARTED); + } + + void Aggro(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) + + void UpdateAI(const uint32 diff) { - //Return since we have no target - if(!UpdateVictim()) + if (!UpdateVictim()) + { return; + } + + if (m_creature->HasAura(SPELL_RIFT_SHIELD)) + { + Unit* Rift; + if (ChaoticRiftGUID) + Rift = Unit::GetUnit((*m_creature), ChaoticRiftGUID); + if (Rift && Rift->isDead()) + { + m_creature->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD); + ChaoticRiftGUID = 0; + } + return; + } else + ChaoticRiftGUID = 0; - //Source DBM - if((((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 80) && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) > 77)) - || (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 55) && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) > 52)) - || (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30) && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) > 27))) + if ((Phase == 0) && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.75)) + { + Phase = 1; + DoScriptText(SAY_SHIELD, m_creature); + DoCast(m_creature, SPELL_RIFT_SHIELD); + + int tmp = rand()%(2); + Creature* Rift = m_creature->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[tmp][0], RiftLocation[tmp][1], RiftLocation[tmp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Rift) + { + //DoCast(Rift, SPELL_CHARGE_RIFT); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Rift->AI()->AttackStart(target); + ChaoticRiftGUID = Rift->GetGUID(); + DoScriptText(SAY_RIFT , m_creature); + } + } + + if ((Phase == 1) && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.50)) + { + Phase = 2; + DoScriptText(SAY_SHIELD , m_creature); + DoCast(m_creature,SPELL_RIFT_SHIELD); + + int tmp = rand()%(2); + Creature* Rift = m_creature->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[tmp][0], RiftLocation[tmp][1], RiftLocation[tmp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Rift) + { + //DoCast(Rift, SPELL_CHARGE_RIFT); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Rift->AI()->AttackStart(target); + ChaoticRiftGUID = Rift->GetGUID(); + DoScriptText(SAY_RIFT , m_creature); + } + } + + if ((Phase == 2) && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25)) + { + Phase = 3; + DoScriptText(SAY_SHIELD , m_creature); + DoCast(m_creature,SPELL_RIFT_SHIELD); + + int tmp = rand()%(2); + Creature* Rift = m_creature->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[tmp][0], RiftLocation[tmp][1], RiftLocation[tmp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Rift) + { + //DoCast(Rift, SPELL_CHARGE_RIFT); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Rift->AI()->AttackStart(target); + ChaoticRiftGUID = Rift->GetGUID(); + DoScriptText(SAY_RIFT , m_creature); + } + } + + if (SPELL_SPARK_Timer < diff) { - //Summon rift at a random location - } + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target, HeroicMode ? SPELL_SPARK_H : SPELL_SPARK_N); + SPELL_SPARK_Timer = 5000; + }else SPELL_SPARK_Timer -=diff; + + if (SPELL_CREATE_RIFT_Timer < diff) + { + DoScriptText(SAY_RIFT , m_creature); - DoMeleeAttackIfReady(); + int tmp = rand()%(2); + Creature* Rift = m_creature->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[tmp][0], RiftLocation[tmp][1], RiftLocation[tmp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Rift) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Rift->AI()->AttackStart(target); + SPELL_CREATE_RIFT_Timer = 25000; + }else SPELL_CREATE_RIFT_Timer -=diff; + + DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) + + void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); - } - void KilledUnit(Unit *victim) - { - if(victim == m_creature) - return; - DoScriptText(SAY_KILL, m_creature); + if (pInstance) + pInstance->SetData(DATA_ANOMALUS_EVENT, DONE); } }; -/*###### -## Crazed Mana Wraiths -######*/ -#define SPELL_ARCANE_MISSILES 33833 - -struct TRINITY_DLL_DECL mob_crazed_mana_wraithAI : public ScriptedAI +struct TRINITY_DLL_DECL mob_chaotic_riftAI : public Scripted_NoMovementAI { - mob_crazed_mana_wraithAI(Creature *c) : ScriptedAI(c) {} + mob_chaotic_riftAI(Creature *c) : Scripted_NoMovementAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - void Reset() {} - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if(!UpdateVictim()) - return; + ScriptedInstance* pInstance; - DoMeleeAttackIfReady(); - } - void JustDied(Unit* killer) {} -}; + uint32 SPELL_CHAOTIC_ENERGY_BURST_Timer; + uint32 SUMMON_CRAZED_MANA_WRAITH_Timer; -/*###### -## Chaotic Rift -######*/ -#define SPELL_CHAOTIC_ENERGY_BURST 47688 -#define SPELL_CHARGED_CHAOTIC_ENERGY_BURST 47737 + void Reset() + { + SPELL_CHAOTIC_ENERGY_BURST_Timer = 1000; + SUMMON_CRAZED_MANA_WRAITH_Timer = 5000; + m_creature->SetDisplayId(25206); //For some reason in DB models for ally and horde are different. + //Model for ally (1126) does not show auras. Horde model works perfect. + //Set model to horde number + DoCast(m_creature, SPELL_ARCANEFORM, false); + } -struct TRINITY_DLL_DECL npc_chaotic_riftAI : public ScriptedAI -{ - npc_chaotic_riftAI(Creature *c) : ScriptedAI(c) {} - - void Reset() {} - void EnterCombat(Unit* who) {} - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 diff) { - //Return since we have no target - if(!UpdateVictim()) + if (!UpdateVictim()) + { return; + } - DoMeleeAttackIfReady(); - } - void JustDied(Unit* killer) {} + if (SPELL_CHAOTIC_ENERGY_BURST_Timer < diff) + { + Unit* Anomalus = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ANOMALUS)); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) + DoCast(target, SPELL_CHARGED_CHAOTIC_ENERGY_BURST); + else + DoCast(target, SPELL_CHAOTIC_ENERGY_BURST); + SPELL_CHAOTIC_ENERGY_BURST_Timer = 1000; + }else SPELL_CHAOTIC_ENERGY_BURST_Timer -=diff; + + if (SUMMON_CRAZED_MANA_WRAITH_Timer < diff) + { + Creature* Wraith = m_creature->SummonCreature(MOB_CRAZED_MANA_WRAITH, m_creature->GetPositionX()+1, m_creature->GetPositionY()+1, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Wraith) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Wraith->AI()->AttackStart(target); + Unit* Anomalus = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ANOMALUS)); + if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) + SUMMON_CRAZED_MANA_WRAITH_Timer = 5000; + else + SUMMON_CRAZED_MANA_WRAITH_Timer = 10000; + }else SUMMON_CRAZED_MANA_WRAITH_Timer -=diff; + } }; -CreatureAI* GetAI_npc_chaotic_rift(Creature *_Creature) +CreatureAI* GetAI_mob_chaotic_rift(Creature *_Creature) { - return new npc_chaotic_riftAI (_Creature); + return new mob_chaotic_riftAI (_Creature); } CreatureAI* GetAI_boss_anomalus(Creature *_Creature) @@ -123,11 +258,6 @@ CreatureAI* GetAI_boss_anomalus(Creature *_Creature) return new boss_anomalusAI (_Creature); } -CreatureAI* GetAI_mob_crazed_mana_wraith(Creature *_Creature) -{ - return new boss_anomalusAI (_Creature); -} - void AddSC_boss_anomalus() { Script *newscript; @@ -136,14 +266,9 @@ void AddSC_boss_anomalus() newscript->Name="boss_anomalus"; newscript->GetAI = &GetAI_boss_anomalus; newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_crazed_mana_wraith"; - newscript->GetAI = &GetAI_mob_crazed_mana_wraith; - newscript->RegisterSelf(); - + newscript = new Script; - newscript->Name="npc_chaotic_rift"; - newscript->GetAI = &GetAI_npc_chaotic_rift; + newscript->Name="mob_chaotic_rift"; + newscript->GetAI = &GetAI_mob_chaotic_rift; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_keristrasza.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_keristrasza.cpp index c2b6d3d4a8b..6866bd11bc5 100644 --- a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_keristrasza.cpp +++ b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_keristrasza.cpp @@ -1,74 +1,152 @@ -/* Script Data Start -SDName: Boss keristrasza -SDAuthor: LordVanMartin -SD%Complete: -SDComment: -SDCategory: -Script Data End */ - -/*** SQL START *** -update creature_template set scriptname = 'boss_maiden_of_grief' where entry = ''; -*** SQL END ***/ +/* 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 + */ + +/* ScriptData +SDName: Boss_Keristrasza +SD%Complete: +SDComment: +SDCategory: The Nexus, The Nexus +EndScriptData */ + #include "precompiled.h" +#include "def_nexus.h" //Spells +#define SPELL_FROZEN_PRISON 47854 #define SPELL_TAIL_SWEEP 50155 -#define SPELL_CRYSTAL_CHAINS 50997 +#define SPELL_CRYSTAL_CHAINS 50997 #define SPELL_ENRAGE 8599 -#define SPELL_CRYSTALFIRE_BREATH_1 48096 -#define SPELL_CRYSTALFIRE_BREATH_2 57091 -#define SPELL_CRYSTALIZE 48179 -#define SPELL_INTENSE_COLD 48095 //stackable debuff +#define SPELL_CRYSTALFIRE_BREATH_N 48096 +#define SPELL_CRYSTALFIRE_BREATH_H 57091 +#define SPELL_CRYSTALIZE 48179 +#define SPELL_INTENSE_COLD 48094 //Yell -#define SAY_AGGRO -1576005 -#define SAY_SLAY -1576006 -#define SAY_ENRAGE -1576007 -#define SAY_DEATH -1576008 -#define SAY_CRYSTAL_NOVA -1576009 +#define SAY_AGGRO -1576040 +#define SAY_SLAY -1576041 +#define SAY_ENRAGE -1576042 +#define SAY_DEATH -1576043 +#define SAY_CRYSTAL_NOVA -1576044 struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI { - boss_keristraszaAI(Creature *c) : ScriptedAI(c) {} + boss_keristraszaAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } + + ScriptedInstance* pInstance; + bool HeroicMode; + + uint32 CRYSTALFIRE_BREATH_Timer; + uint32 CRYSTAL_CHAINS_CRYSTALIZE_Timer; + uint32 TAIL_SWEEP_Timer; + bool Enrage; - bool enraged; + void Reset() + { + CRYSTALFIRE_BREATH_Timer = 14000; + CRYSTAL_CHAINS_CRYSTALIZE_Timer = HeroicMode ? 30000 : 11000; + TAIL_SWEEP_Timer = 5000; + Enrage = false; + m_creature->RemoveAurasDueToSpell(SPELL_INTENSE_COLD); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + if (pInstance && pInstance->GetData(DATA_KERISTRASZA_FREED) == DONE) + { + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + }else{ + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->CastSpell(m_creature, SPELL_FROZEN_PRISON, false); + } + } - void Reset() + void MoveInLineOfSight(Unit *who) { - enraged = false; + if (pInstance && pInstance->GetData(DATA_KERISTRASZA_FREED) != DONE && pInstance->GetData(DATA_MAGUS_TELESTRA_EVENT) == DONE && + pInstance->GetData(DATA_ANOMALUS_EVENT) == DONE && pInstance->GetData(DATA_ORMOROK_EVENT) == DONE && + m_creature->IsHostileTo(who) && m_creature->IsWithinDist(who, 15.0f, false)) + { + pInstance->SetData(DATA_KERISTRASZA_FREED, DONE); + } + if (pInstance->GetData(DATA_KERISTRASZA_FREED) == DONE) + { + m_creature->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + ScriptedAI::MoveInLineOfSight(who); + } } - void EnterCombat(Unit* who) + + void Aggro(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + DoCast(m_creature, SPELL_INTENSE_COLD); } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) + + void UpdateAI(const uint32 diff) { - //Return since we have no target - if(!UpdateVictim()) + if (!UpdateVictim()) + { return; + } + + if (!Enrage && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25)) + { + DoScriptText(SAY_ENRAGE , m_creature); + DoCast(m_creature, SPELL_ENRAGE); + Enrage = true; + } - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) == 10) + if (CRYSTALFIRE_BREATH_Timer < diff) { - if(!enraged) - { - DoScriptText(SAY_ENRAGE, m_creature); - DoCast(m_creature, SPELL_ENRAGE); - enraged = true; - } - } + DoCast(m_creature->getVictim(), HeroicMode ? SPELL_CRYSTALFIRE_BREATH_H : SPELL_CRYSTALFIRE_BREATH_N); + CRYSTALFIRE_BREATH_Timer = 14000; + }else CRYSTALFIRE_BREATH_Timer -=diff; + + if (TAIL_SWEEP_Timer < diff) + { + DoCast(m_creature, SPELL_TAIL_SWEEP); + TAIL_SWEEP_Timer = 5000; + }else TAIL_SWEEP_Timer -=diff; - DoMeleeAttackIfReady(); + if (CRYSTAL_CHAINS_CRYSTALIZE_Timer < diff) + { + DoScriptText(SAY_CRYSTAL_NOVA , m_creature); + if (HeroicMode) + DoCast(m_creature, SPELL_CRYSTALIZE); + else + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_CRYSTAL_CHAINS); + CRYSTAL_CHAINS_CRYSTALIZE_Timer = HeroicMode ? 30000 : 11000; + }else CRYSTAL_CHAINS_CRYSTALIZE_Timer -= diff; + + DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) + + void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); } + void KilledUnit(Unit *victim) { - if(victim == m_creature) - return; DoScriptText(SAY_SLAY, m_creature); } }; diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_magus_telestra.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_magus_telestra.cpp index f3d9e72267f..d9801d8cf4e 100644 --- a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_magus_telestra.cpp +++ b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_magus_telestra.cpp @@ -1,103 +1,278 @@ -/* Script Data Start -SDName: Boss magus_telestra -SDAuthor: LordVanMartin -SD%Complete: -SDComment: -SDCategory: -Script Data End */ - -/*** SQL START *** -update creature_template set scriptname = '' where entry = ''; -*** SQL END ***/ +/* 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 + */ + +/* ScriptData +SDName: Boss_Magus_Telestra +SD%Complete: +SDComment: +SDCategory: The Nexus, The Nexus +EndScriptData */ + #include "precompiled.h" #include "def_nexus.h" - //Spells -//phase 1 -#define SPELL_ICE_NOVA 47772 -#define SPELL_ICE_NOVA 56935 -#define SPELL_FIREBOMB 47773 -#define SPELL_FIREBOMB 56934 -#define SPELL_GAVITY_WELL 47756 - -//Phase 2 -->50% HP (3 clones, Frost, Fire, Arcane) -//Frost Magus (npc 26930) -#define FROST_MAGUS_VISUAL 47706 //Dummy -#define SPELL_BLIZZARD_N 47727 -#define SPELL_ICE_BARB_N 47729 -//heroic -#define SPELL_BLIZZARD_H 56936 -#define SPELL_ICE_BARB_H 56937 - -//Fire Magus (npc 26928) -#define FIRE_MAGUS_VISUAL 47705 //Dummy -#define SPELL_FIRE_BLAST 47721 -#define SPELL_SCORCH 47723 -//heroic -#define SPELL_FIRE_BLAST_H 56939 -#define SPELL_SCORCH_H 56938 - -//Arcane Magus (npc 26929) -#define ARCANE_MAGUS_VISUAL 47704 //Dummy -#define SPELL_CRITTER 47731 -#define SPELL_TIME_STOP 47736 +#define SPELL_ICE_NOVA_N 47772 +#define SPELL_ICE_NOVA_H 56935 +#define SPELL_FIREBOMB_N 47773 +#define SPELL_FIREBOMB_H 56934 +#define SPELL_GRAVITY_WELL 47756 +#define SPELL_TELESTRA_BACK 47714 + +float CenterOfRoom[1][4] = +{ + {504.80, 89.07, -16.12, 6.27} +}; + +//At 50% HP - 3 clones, Frost, Fire, Arcane (and in 10% HP in Heroic) +#define MOB_FIRE_MAGUS 26928 +#define MOB_FROST_MAGUS 26930 +#define MOB_ARCANE_MAGUS 26929 + +#define SPELL_FIRE_MAGUS_VISUAL 47705 +#define SPELL_FROST_MAGUS_VISUAL 47706 +#define SPELL_ARCANE_MAGUS_VISUAL 47704 //Yell -#define SAY_AGGRO -1576010 -#define SAY_KILL -1576011 -#define SAY_DEATH -1576012 -#define SAY_MERGE -1576013 -#define SAY_SPLIT_1 -1576014 -#define SAY_SPLIT_2 -1576015 +#define SAY_AGGRO -1576000 +#define SAY_KILL -1576001 +#define SAY_DEATH -1576002 +#define SAY_MERGE -1576003 +#define SAY_SPLIT_1 -1576004 +#define SAY_SPLIT_2 -1576005 struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI { - boss_magus_telestraAI(Creature *c) : ScriptedAI(c) {} + boss_magus_telestraAI(Creature* c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + HeroicMode = c->GetMap()->IsHeroic(); + } + + ScriptedInstance* pInstance; + bool HeroicMode; - bool splited; - uint64 Magus_frost, - Magus_fire, - Magus_arcane; + uint64 FireMagusGUID; + uint64 FrostMagusGUID; + uint64 ArcaneMagusGUID; + bool FireMagusDead; + bool FrostMagusDead; + bool ArcaneMagusDead; + + uint32 AppearDelay_Timer; + bool AppearDelay; + + uint8 Phase; + + uint32 SPELL_ICE_NOVA_Timer; + uint32 SPELL_FIREBOMB_Timer; + uint32 SPELL_GRAVITY_WELL_Timer; void Reset() { - splited = false; + Phase = 0; + //These times are probably wrong + SPELL_ICE_NOVA_Timer = 7000; + SPELL_FIREBOMB_Timer = 0; + SPELL_GRAVITY_WELL_Timer = 15000; + + FireMagusGUID = 0; + FrostMagusGUID = 0; + ArcaneMagusGUID = 0; + + AppearDelay = false; + + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetVisibility(VISIBILITY_ON); + + if(pInstance) + pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, NOT_STARTED); } - void EnterCombat(Unit* who) + + void Aggro(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) + + uint64 SplitPersonality(uint32 entry) + { + Creature* Summoned = m_creature->SummonCreature(entry, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Summoned) + { + switch (entry) + { + case MOB_FIRE_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_FIRE_MAGUS_VISUAL, false); + break; + } + case MOB_FROST_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_FROST_MAGUS_VISUAL, false); + break; + } + case MOB_ARCANE_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_ARCANE_MAGUS_VISUAL, false); + break; + } + } + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Summoned->AI()->AttackStart(target); + return Summoned->GetGUID(); + } + return 0; + } + + void UpdateAI(const uint32 diff) { //Return since we have no target - if(!UpdateVictim()) + if (!UpdateVictim()) + { return; + } - if(!splited) + if (AppearDelay) { - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 50) + m_creature->StopMoving(); + m_creature->AttackStop(); + if (AppearDelay_Timer < diff) { - DoScriptText(SAY_SPLIT_1, m_creature); - //HandleSplit - splited = true; - } + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + AppearDelay = false; + }else AppearDelay_Timer -= diff; + return; } - DoMeleeAttackIfReady(); + + if ((Phase == 1)||(Phase == 3)) + { + Unit* FireMagus; + Unit* FrostMagus; + Unit* ArcaneMagus; + if (FireMagusGUID) + FireMagus = Unit::GetUnit((*m_creature), FireMagusGUID); + if (FrostMagusGUID) + FrostMagus = Unit::GetUnit((*m_creature), FrostMagusGUID); + if (ArcaneMagusGUID) + ArcaneMagus = Unit::GetUnit((*m_creature), ArcaneMagusGUID); + if (FireMagus && FireMagus->isDead()) + FireMagusDead = true; + if (FrostMagus && FrostMagus->isDead()) + FrostMagusDead = true; + if (ArcaneMagus && ArcaneMagus->isDead()) + ArcaneMagusDead = true; + if (FireMagusDead && FrostMagusDead && ArcaneMagusDead) + { + m_creature->GetMotionMaster()->Clear(); + m_creature->Relocate(CenterOfRoom[0][0], CenterOfRoom[0][1], CenterOfRoom[0][2], CenterOfRoom[0][3]); + DoCast(m_creature, SPELL_TELESTRA_BACK); + m_creature->SetVisibility(VISIBILITY_ON); + if (Phase == 1) + Phase = 2; + if (Phase == 3) + Phase = 4; + FireMagusGUID = 0; + FrostMagusGUID = 0; + ArcaneMagusGUID = 0; + AppearDelay = true; + AppearDelay_Timer = 4000; + DoScriptText(SAY_MERGE, m_creature); + }else + return; + } + + if ((Phase == 0) && (m_creature->GetHealth() <= (m_creature->GetMaxHealth() * 0.5))) + { + Phase = 1; + m_creature->CastStop(); + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + FireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); + FrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); + ArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); + FireMagusDead = false; + FrostMagusDead = false; + ArcaneMagusDead = false; + switch(rand()%2) + { + case 0: DoScriptText(SAY_SPLIT_1, m_creature); break; + case 1: DoScriptText(SAY_SPLIT_2, m_creature); break; + } + return; + } + + if (HeroicMode && (Phase == 2) && (m_creature->GetHealth() <= (m_creature->GetMaxHealth() * 0.1))) + { + Phase = 3; + m_creature->CastStop(); + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + FireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); + FrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); + ArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); + FireMagusDead = false; + FrostMagusDead = false; + ArcaneMagusDead = false; + switch(rand()%2) + { + case 0: DoScriptText(SAY_SPLIT_1, m_creature); break; + case 1: DoScriptText(SAY_SPLIT_2, m_creature); break; + } + return; + } + + if (SPELL_ICE_NOVA_Timer < diff) + { + m_creature->CastStop(); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target, HeroicMode ? SPELL_ICE_NOVA_H : SPELL_ICE_NOVA_N); + SPELL_ICE_NOVA_Timer = 15000; + }else SPELL_ICE_NOVA_Timer -=diff; + + if (SPELL_GRAVITY_WELL_Timer < diff) + { + m_creature->CastStop(); + if (Unit* target = m_creature->getVictim()) + DoCast(target, SPELL_GRAVITY_WELL); + SPELL_GRAVITY_WELL_Timer = 15000; + }else SPELL_GRAVITY_WELL_Timer -=diff; + + if (SPELL_FIREBOMB_Timer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target, HeroicMode ? SPELL_FIREBOMB_H : SPELL_FIREBOMB_N); + SPELL_FIREBOMB_Timer = 2000; + }else SPELL_FIREBOMB_Timer -=diff; + + DoMeleeAttackIfReady(); } + void JustDied(Unit* killer) - { + { DoScriptText(SAY_DEATH, m_creature); - } + if (pInstance) + pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, DONE); + } + void KilledUnit(Unit *victim) { - if(victim == m_creature) - return; DoScriptText(SAY_KILL, m_creature); } }; diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_ormorok.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_ormorok.cpp index eacaf771071..d317828439c 100644 --- a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_ormorok.cpp +++ b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_ormorok.cpp @@ -1,79 +1,288 @@ -/* Script Data Start -SDName: Boss ormorok -SDAuthor: LordVanMartin -SD%Complete: -SDComment: -SDCategory: -Script Data End */ - -/*** SQL START *** -update creature_template set scriptname = '' where entry = ''; -*** SQL END ***/ +/* 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 + */ + +/* ScriptData +SDName: Boss_Ormorok +SD%Complete: +SDComment: +SDCategory: The Nexus, The Nexus +EndScriptData */ + #include "precompiled.h" +#include "def_nexus.h" //Spells -#define SPELL_CRYSTAL_SPIKES_1 47958 -#define SPELL_CRYSTAL_SPIKES_2 57082 -#define SPELL_CRYSTAL_SPIKES_3 57083 +#define SPELL_CRYSTAL_SPIKES_N 47958 //Don't work, using walkaround +#define SPELL_CRYSTAL_SPIKES_H 57082 //Don't work, using walkaround +//Walkaround for spells Crystal Spikes ----------------- +#define SPELL_CRYSTALL_SPIKE_DAMAGE_N 47944 +#define SPELL_CRYSTALL_SPIKE_DAMAGE_H 57067 +#define SPELL_CRYSTAL_SPIKE_PREVISUAL 50442 +#define MOB_CRYSTAL_SPIKE 27099 +//------------------------------------------------------ #define SPELL_SPELL_REFLECTION 47981 #define SPELL_TRAMPLE_N 48016 #define SPELL_TRAMPLE_H 57066 -#define SPELL_FRENZY_N 48017 -#define SPELL_FRENZY_H 57086 +#define SPELL_FRENZY 48017 #define SPELL_SUMMON_CRYSTALLINE_TANGLER 61564 //summons npc 32665 +#define MOB_CRYSTALLINE_TANGLER 32665 +#define SPELL_ROOTS 28858 //proper spell id is unknown //Yell -#define SAY_AGGRO -1576016 -#define SAY_KILL -1576017 -#define SAY_DEATH -1576018 -#define SAY_REFLECT -1576019 -#define SAY_ICE_SPIKES -1576020 +#define SAY_AGGRO -1576020 +#define SAY_DEATH -1576021 +#define SAY_REFLECT -1576022 +#define SAY_CRYSTAL_SPIKES -1576023 +#define SAY_KILL -1576024 + +#define SPIKE_DISTANCE 5.0f struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI { - boss_ormorokAI(Creature *c) : ScriptedAI(c) {} + boss_ormorokAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + HeroicMode = c->GetMap()->IsHeroic(); + } - bool frenzy; + ScriptedInstance* pInstance; + bool HeroicMode; + bool Frenzy; + bool CrystalSpikes; + uint8 CrystalSpikes_Count; + float BaseX; + float BaseY; + float BaseZ; + float BaseO; + float SpikeXY[4][2]; - void Reset() - { - frenzy = false; - } - void EnterCombat(Unit* who) + uint32 SPELL_CRYSTAL_SPIKES_Timer; + uint32 CRYSTAL_SPIKES_Timer; + uint32 SPELL_TRAMPLE_Timer; + uint32 SPELL_FRENZY_Timer; + uint32 SPELL_SPELL_REFLECTION_Timer; + uint32 SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer; + + void Reset() + { + SPELL_CRYSTAL_SPIKES_Timer = 12000; + SPELL_TRAMPLE_Timer = 10000; + SPELL_SPELL_REFLECTION_Timer = 30000; + SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer = 17000; + Frenzy = false; + CrystalSpikes = false; + if(pInstance) + pInstance->SetData(DATA_ORMOROK_EVENT, NOT_STARTED); + } + + void Aggro(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(const uint32 diff) + + void UpdateAI(const uint32 diff) { - //Return since we have no target - if(!UpdateVictim()) + if (!UpdateVictim()) + { return; + } + if (CrystalSpikes) + if (CRYSTAL_SPIKES_Timer < diff) + { + SpikeXY[0][0] = BaseX+(SPIKE_DISTANCE*CrystalSpikes_Count*cos(BaseO)); + SpikeXY[0][1] = BaseY+(SPIKE_DISTANCE*CrystalSpikes_Count*sin(BaseO)); + SpikeXY[1][0] = BaseX-(SPIKE_DISTANCE*CrystalSpikes_Count*cos(BaseO)); + SpikeXY[1][1] = BaseY-(SPIKE_DISTANCE*CrystalSpikes_Count*sin(BaseO)); + SpikeXY[2][0] = BaseX+(SPIKE_DISTANCE*CrystalSpikes_Count*cos(BaseO-(M_PI/2))); + SpikeXY[2][1] = BaseY+(SPIKE_DISTANCE*CrystalSpikes_Count*sin(BaseO-(M_PI/2))); + SpikeXY[3][0] = BaseX-(SPIKE_DISTANCE*CrystalSpikes_Count*cos(BaseO-(M_PI/2))); + SpikeXY[3][1] = BaseY-(SPIKE_DISTANCE*CrystalSpikes_Count*sin(BaseO-(M_PI/2))); + for (uint8 i = 0; i < 4; i++) + Creature* Spike = m_creature->SummonCreature(MOB_CRYSTAL_SPIKE, SpikeXY[i][0], SpikeXY[i][1], BaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7000); + if (++CrystalSpikes_Count >= 13) + CrystalSpikes = false; + CRYSTAL_SPIKES_Timer = 200; + }else CRYSTAL_SPIKES_Timer -= diff; - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) == 25) + if (!Frenzy && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25)) { - if(!frenzy) - { - DoCast(m_creature, SPELL_FRENZY_N); - frenzy = true; - } - } + DoCast(m_creature, SPELL_FRENZY); + Frenzy = true; + } - DoMeleeAttackIfReady(); + if (SPELL_TRAMPLE_Timer < diff) + { + DoCast(m_creature, HeroicMode ? SPELL_TRAMPLE_H : SPELL_TRAMPLE_N); + SPELL_TRAMPLE_Timer = 10000; + }else SPELL_TRAMPLE_Timer -= diff; + + if (SPELL_SPELL_REFLECTION_Timer < diff) + { + DoScriptText(SAY_REFLECT, m_creature); + DoCast(m_creature, SPELL_SPELL_REFLECTION); + SPELL_SPELL_REFLECTION_Timer = 30000; + }else SPELL_SPELL_REFLECTION_Timer -= diff; + + if (SPELL_CRYSTAL_SPIKES_Timer < diff) + { + DoScriptText(SAY_CRYSTAL_SPIKES, m_creature); + CrystalSpikes = true; + CrystalSpikes_Count = 1; + CRYSTAL_SPIKES_Timer = 0; + BaseX = m_creature->GetPositionX(); + BaseY = m_creature->GetPositionY(); + BaseZ = m_creature->GetPositionZ(); + BaseO = m_creature->GetOrientation(); + SPELL_CRYSTAL_SPIKES_Timer = 20000; + }else SPELL_CRYSTAL_SPIKES_Timer -=diff; + + if (HeroicMode && (SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer < diff)) + { + Creature* Crystalline_Tangler = m_creature->SummonCreature(MOB_CRYSTALLINE_TANGLER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Crystalline_Tangler) + { + Unit* target = NULL; + uint8 Healer = 0; + for (uint8 j = 1; j<=4; j++) + { + switch (j) + { + case 1: Healer = CLASS_PRIEST; break; + case 2: Healer = CLASS_PALADIN; break; + case 3: Healer = CLASS_DRUID; break; + case 4: Healer = CLASS_SHAMAN; break; + } + std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); + for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) + { + Unit* pTemp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()); + if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER && pTemp->getClass() == Healer) + { + target = pTemp; + break; + } + } + if (target) + break; + } + if (!target) + target = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (target) + { + Crystalline_Tangler->AI()->AttackStart(target); + Crystalline_Tangler->getThreatManager().addThreat(target, 1000000000.0f); + } + } + SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer = 17000; + }else SPELL_SUMMON_CRYSTALLINE_TANGLER_Timer -=diff; + + DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) + + void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); + if (pInstance) + pInstance->SetData(DATA_ORMOROK_EVENT, DONE); } - void KilledUnit(Unit *victim) + + void KilledUnit(Unit *victim) { - if(victim == m_creature) - return; DoScriptText(SAY_KILL, m_creature); } + }; +struct TRINITY_DLL_DECL mob_crystal_spikeAI : public Scripted_NoMovementAI +{ + mob_crystal_spikeAI(Creature *c) : Scripted_NoMovementAI(c) + { + Reset(); + HeroicMode = c->GetMap()->IsHeroic(); + } + + bool HeroicMode; + + uint32 SPELL_CRYSTALL_SPIKE_DAMAGE_Timer; + uint32 SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer; + + void Reset() + { + SPELL_CRYSTALL_SPIKE_DAMAGE_Timer = 3700; + SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer = 1000; + m_creature->SetLevel(80); // + m_creature->setFaction(16); //Walkaround to be independent from data in DB + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // + } + + void UpdateAI(const uint32 diff) + { + if (SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer < diff) + { + DoCast(m_creature, SPELL_CRYSTAL_SPIKE_PREVISUAL); + SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer = 10000; + }else SPELL_CRYSTAL_SPIKE_PREVISUAL_Timer -=diff; + + if (SPELL_CRYSTALL_SPIKE_DAMAGE_Timer < diff) + { + DoCast(m_creature, HeroicMode ? SPELL_CRYSTALL_SPIKE_DAMAGE_H : SPELL_CRYSTALL_SPIKE_DAMAGE_N); + SPELL_CRYSTALL_SPIKE_DAMAGE_Timer = 10000; + }else SPELL_CRYSTALL_SPIKE_DAMAGE_Timer -=diff; + } +}; + +struct TRINITY_DLL_DECL mob_crystalline_tanglerAI : public ScriptedAI +{ + mob_crystalline_tanglerAI(Creature *c) : ScriptedAI(c) + { + Reset(); + } + + uint32 SPELL_ROOTS_Timer; + + void Reset() + { + SPELL_ROOTS_Timer = 1000; + } + + void UpdateAI(const uint32 diff) + { + if (SPELL_ROOTS_Timer < diff) + { + if (m_creature->IsWithinDist(m_creature->getVictim(), 5.0f, false)) + { + DoCast(m_creature->getVictim(), SPELL_ROOTS); + SPELL_ROOTS_Timer = 15000; + } + }else SPELL_ROOTS_Timer -=diff; + } +}; + +CreatureAI* GetAI_mob_crystal_spike(Creature *_Creature) +{ + return new mob_crystal_spikeAI (_Creature); +} + +CreatureAI* GetAI_mob_crystalline_tangler(Creature *_Creature) +{ + return new mob_crystalline_tanglerAI (_Creature); +} + CreatureAI* GetAI_boss_ormorok(Creature *_Creature) { return new boss_ormorokAI (_Creature); @@ -85,6 +294,16 @@ void AddSC_boss_ormorok() newscript = new Script; newscript->Name="boss_ormorok"; - newscript->GetAI = &GetAI_boss_ormorok; + newscript->GetAI = GetAI_boss_ormorok; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_crystal_spike"; + newscript->GetAI = &GetAI_mob_crystal_spike; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_crystalline_tangler"; + newscript->GetAI = &GetAI_mob_crystalline_tangler; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/def_nexus.h b/src/bindings/scripts/scripts/zone/nexus/nexus/def_nexus.h index d868c72adf6..59fb3528f69 100644 --- a/src/bindings/scripts/scripts/zone/nexus/nexus/def_nexus.h +++ b/src/bindings/scripts/scripts/zone/nexus/nexus/def_nexus.h @@ -1,35 +1,11 @@ #ifndef DEF_NEXUS_H #define DEF_NEXUS_H -#define DATA_ANOMALUSDEAD 1 -#define DATA_ANOMALUS_DEATH 2 -#define DATA_ORMOROKDDEAD 3 -#define DATA_ORMOROK_DEATH 4 +#define DATA_MAGUS_TELESTRA_EVENT 1 +#define DATA_ANOMALUS_EVENT 2 +#define DATA_ORMOROK_EVENT 3 +#define DATA_KERISTRASZA_FREED 4 -#define DATA_MAGUSTELESTRADEAD 5 -#define DATA_MAGUSTELESTRA_DEATH 6 -#define DATA_MAGUSTELESTRA_A_DEAD 7 -#define DATA_MAGUSTELESTRA_A_DEATH 8 -#define DATA_MAGUSTELESTRA_F_DEAD 9 -#define DATA_MAGUSTELESTRA_F_DEATH 10 -#define DATA_MAGUSTELESTRA_FI_DEAD 11 -#define DATA_MAGUSTELESTRA_FI_DEATH 12 +#define DATA_ANOMALUS 5 -#define DATA_KERISTRASZADEAD 13 -#define DATA_KERISTRASZA_DEATH 14 -#define DATA_COMMANDER_KOLURGDEAD 15 -#define DATA_COMMANDER_KOLURG_DEATH 16 -#define DATA_COMMANDER_STOUTBEARDDEAD 17 -#define DATA_COMMANDER_STOUTBEARD_DEATH 18 -#define DATA_ANOMALUS 19 -#define DATA_ORMOROK 20 - -#define DATA_MAGUSTELESTRA 21 -#define DATA_MAGUSTELESTRA_A 22 -#define DATA_MAGUSTELESTRA_F 23 -#define DATA_MAGUSTELESTRA_FI 24 - -#define DATA_KERISTRASZA 25 -#define DATA_COMMANDER_KOLURG 26 -#define DATA_COMMANDER_STOUTBEARD 27 #endif diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/instance_nexus.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/instance_nexus.cpp index 01d0ade1e25..785f7b1c7bb 100644 --- a/src/bindings/scripts/scripts/zone/nexus/nexus/instance_nexus.cpp +++ b/src/bindings/scripts/scripts/zone/nexus/nexus/instance_nexus.cpp @@ -1,145 +1,176 @@ +/* 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 + */ + +/* ScriptData +SDName: Instance_Nexus +SD%Complete: +SDComment: +SDCategory: The Nexus, The Nexus +EndScriptData */ + #include "precompiled.h" #include "def_nexus.h" +#define NUMBER_OF_ENCOUNTERS 4 + struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance { instance_nexus(Map *Map) : ScriptedInstance(Map) {Initialize();}; - uint64 Anomalus, - Ormorok, - Magus_telestra, - Magus_frost, - Magus_fire, - Magus_arcane, - keristrasza, - Commander_kolurg, - Commander_stoutbeard; - bool IsBossDied[9]; + std::string strInstData; + uint64 Anomalus; + uint32 Encounters[NUMBER_OF_ENCOUNTERS]; void Initialize() { - Anomalus = 0; - Ormorok = 0; - Magus_telestra =0; - Magus_frost =0; - Magus_fire =0; - Magus_arcane =0; - keristrasza =0; - Commander_kolurg = 0; - Commander_stoutbeard = 0; - IsBossDied[0] = false; - IsBossDied[1] = false; - IsBossDied[2] = false; - IsBossDied[3] = false; - IsBossDied[4] = false; - IsBossDied[5] = false; - IsBossDied[6] = false; - IsBossDied[7] = false; - IsBossDied[8] = false; + Anomalus = 0; + for(uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; i++) + Encounters[i] = NOT_STARTED; } - bool IsEncounterInProgress() const + void OnCreatureCreate(Creature* pCreature) { - //not active - return false; + Map::PlayerList const& players = instance->GetPlayers(); + uint32 TeamInInstance; + + if (!players.isEmpty()) + { + if (Player* pPlayer = players.begin()->getSource()) + { + TeamInInstance = pPlayer->GetTeam(); + } + } + switch(pCreature->GetEntry()) + { + case 26763: Anomalus = pCreature->GetGUID(); break; + case 26800: + { + //26799 + pCreature->setFaction(16); + if (TeamInInstance == ALLIANCE) + pCreature->SetDisplayId(24358); + break; + } + case 26802: + { + //26801 + pCreature->setFaction(16); + if (TeamInInstance == ALLIANCE) + pCreature->SetDisplayId(24354); + break; + } + case 26805: + { + //26803 + pCreature->setFaction(16); + if (TeamInInstance == ALLIANCE) + pCreature->SetDisplayId(24357); + break; + } + case 27949: + { + //27947 + pCreature->setFaction(16); + if (TeamInInstance == ALLIANCE) + pCreature->SetDisplayId(24352); + break; + } + case 26796: + { + //26798 + pCreature->setFaction(16); + if (TeamInInstance == ALLIANCE) + pCreature->SetDisplayId(24352); + break; + } + } } - void OnCreatureCreate(Creature *creature, uint32 creature_entry) + + uint64 GetData64(uint32 uiIdentifier) { - switch(creature->GetEntry()) + switch(uiIdentifier) { - case 26763: Anomalus = creature->GetGUID(); break; - case 26794: Ormorok = creature->GetGUID(); break; - case 26731: Magus_telestra = creature->GetGUID(); break; - case 26930: Magus_frost = creature->GetGUID(); break; - case 26928: Magus_fire = creature->GetGUID(); break; - case 26926: Magus_arcane = creature->GetGUID(); break; - case 26723: keristrasza = creature->GetGUID(); break; - case 26798: Commander_kolurg = creature->GetGUID(); break; - case 26796: Commander_stoutbeard = creature->GetGUID(); break; + case DATA_ANOMALUS: + return Anomalus; } + return 0; } - uint32 GetData(uint32 type) + + uint32 GetData(uint32 identifier) { - switch(type) + switch(identifier) { - case DATA_ANOMALUSDEAD: - if(IsBossDied[0]) - return 1; - break; - case DATA_ORMOROKDDEAD: - if(IsBossDied[1]) - return 1; - break; - case DATA_MAGUSTELESTRADEAD: - if(IsBossDied[2]) - return 1; - break; - case DATA_MAGUSTELESTRA_A_DEAD: - if(IsBossDied[3]) - return 1; - break; - case DATA_MAGUSTELESTRA_F_DEAD: - if(IsBossDied[4]) - return 1; - break; - case DATA_MAGUSTELESTRA_FI_DEAD: - if(IsBossDied[5]) - return 1; - break; - case DATA_KERISTRASZADEAD: - if(IsBossDied[6]) - return 1; - break; - case DATA_COMMANDER_KOLURGDEAD: - if(IsBossDied[7]) - return 1; - break; - case DATA_COMMANDER_STOUTBEARDDEAD: - if(IsBossDied[8]) - return 1; - break; + case DATA_MAGUS_TELESTRA_EVENT: return Encounters[0]; + case DATA_ANOMALUS_EVENT: return Encounters[1]; + case DATA_ORMOROK_EVENT: return Encounters[2]; + case DATA_KERISTRASZA_FREED: return Encounters[3]; } - return 0; } - uint64 GetData64 (uint32 identifier) + void SetData(uint32 identifier, uint32 data) { - return 0; + switch(identifier) + { + case DATA_MAGUS_TELESTRA_EVENT: Encounters[0] = data; break; + case DATA_ANOMALUS_EVENT: Encounters[1] = data; break; + case DATA_ORMOROK_EVENT: Encounters[2] = data; break; + case DATA_KERISTRASZA_FREED: Encounters[3] = data; break; + } + + if (data == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " + << Encounters[3]; + + strInstData = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } + } + + const char* Save() + { + return strInstData.c_str(); } - void SetData(uint32 type, uint32 data) + void Load(const char* chrIn) { - switch(type) + if (!chrIn) { - case DATA_ANOMALUS_DEATH: - IsBossDied[0] = true; - break; - case DATA_ORMOROK_DEATH: - IsBossDied[1] = true; - break; - case DATA_MAGUSTELESTRA_DEATH: - IsBossDied[2] = true; - break; - case DATA_MAGUSTELESTRA_A_DEATH: - IsBossDied[3] = true; - break; - case DATA_MAGUSTELESTRA_F_DEATH: - IsBossDied[4] = true; - break; - case DATA_MAGUSTELESTRA_FI_DEAD: - IsBossDied[5] = true; - break; - case DATA_KERISTRASZA_DEATH: - IsBossDied[6] = true; - break; - case DATA_COMMANDER_KOLURG_DEATH: - IsBossDied[7] = true; - break; - case DATA_COMMANDER_STOUTBEARD_DEATH: - IsBossDied[8] = true; - break; + OUT_LOAD_INST_DATA_FAIL; + return; } + + OUT_LOAD_INST_DATA(chrIn); + + std::istringstream loadStream(chrIn); + loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3]; + + for(uint8 i = 1; i < NUMBER_OF_ENCOUNTERS; ++i) + { + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; + } + + OUT_LOAD_INST_DATA_COMPLETE; } }; |