/* Copyright 2006,2007 ScriptDev2 * 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_muru_entropius SD%Complete: 60 SDComment: Needs Test XD EndScriptData */ #include "precompiled.h" #include "def_sunwell_plateau.h" // Boss spells #define ENRAGE 26662 #define DARKNESS 45996 #define SHADOW_PORTAL 40280 #define SUMMON_BERSERK 46037 #define NEGATIVE_ENERGY 46008 #define ENTROPIUS_EFFECT 46223 #define SUMMON_ENTROPIUS 46217 #define SUMMON_FURY_MAGE 46038 #define SUMMON_VOID_SENTINEL 45988 #define ENTROPIUS_DARKNESS 46269 //Need's core support #define ENTROPIUS_NEGATIVE_ENERGY 46289 //Need's core support //Spells casting time (in msecs) #define ENRAGE_TIMER 360000 #define DARKNESS_TIMER 45000 #define NEGATIVE_ENERGY_TIMER 1000 #define SUMMON_HUMANOIDS_TIMER 60000 #define SUMMON_VOID_SENTINEL_TIMER 30000 #define SINGULARITY_TIMER 60000 //Boss Summons #define ID_SWB 25799 #define ID_SWM 25798 #define ID_DARK_FIEND 25744 #define ID_VOID_SENTINEL 25772 #define ID_SINGULARITY 25855 //Distance of Mob Spawn #define MIN 5 #define MAX 10 //Boss sounds #define SOUND_CHANGE_PHASE 12560 //Shadow Portal Spawns #define SP_SPAWN_Z 78 #define ID_WORLD_TRIGGER 12999 float ShadowPortalSpawn[5][3] = { {1797.644,613.744,0.56290}, {1822.956,646.437,4.40262}, {1794.275,626.539,6.23522}, {1809.726,646.494,5.01348}, {1798.854,638.952,5.62435} }; Creature* WayPoint[5] = {NULL, NULL, NULL, NULL, NULL}; /* --- Global Var/Functions --- */ uint32 EnrageTimer; uint32 DarknessTimer; uint32 NegativeEnergyTimer; float GetRandom() { float r = MIN + rand()%(MAX-MIN+1); switch(rand()%2) { case 0: r = -r; break; default: break; } return r; } //Kills target void KillMob(Creature* Mob) { if(Mob && Mob->isAlive()) Mob->DealDamage(Mob, Mob->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } /* --- M'uru AI --- */ struct MANGOS_DLL_DECL boss_muruAI : public Scripted_NoMovementAI { boss_muruAI(Creature *c) : Scripted_NoMovementAI(c) { Reset(); } uint8 ShadowPortalN; uint32 SummonHumanoidsTimer; uint32 SummonVoidSentinelTimer; void Reset() { ShadowPortalN = 0; EnrageTimer = ENRAGE_TIMER; DarknessTimer = DARKNESS_TIMER; m_creature->SetVisibility(VISIBILITY_ON); NegativeEnergyTimer = NEGATIVE_ENERGY_TIMER; SummonHumanoidsTimer = SUMMON_HUMANOIDS_TIMER; SummonVoidSentinelTimer = SUMMON_VOID_SENTINEL_TIMER; if(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); for (uint8 i = 0; i < 5; i++) { KillMob(WayPoint[i]); WayPoint[i] = NULL; } FreezeMob(m_creature); } void Aggro(Unit *who) { FreezeMob(m_creature); } void JustDied(Unit* Killer) { m_creature->SetHealth(1); //Temporarily ress M'uru allowing him to summon entropius m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->CastSpell(m_creature, ENTROPIUS_EFFECT, true); m_creature->CastSpell(m_creature, SUMMON_ENTROPIUS, true); DoPlaySoundToSet(m_creature, SOUND_CHANGE_PHASE); m_creature->SetVisibility(VISIBILITY_OFF); KillMob(m_creature); for (uint8 i = 0; i < 5; i++) { KillMob(WayPoint[i]); WayPoint[i] = NULL; } ShadowPortalN = 0; } void KilledUnit(Unit *Victim) {} void UpdateAI(const uint32 diff) { //Return since we have no target if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; //Goes in enrage if(EnrageTimer < diff) { m_creature->CastSpell(m_creature, ENRAGE, true); EnrageTimer = 20000; } else EnrageTimer -= diff; //Cast Darkness if(DarknessTimer < diff) { m_creature->CastSpell(m_creature, DARKNESS, false); for(uint8 i = 0; i < 8; i++) { Creature* DarkFiend = m_creature->SummonCreature(ID_DARK_FIEND, m_creature->GetPositionX()+GetRandom(), m_creature->GetPositionY()+GetRandom(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); if(DarkFiend) { DarkFiend->CastSpell(DarkFiend, 45934, true); //Dark Fiend Aura DarkFiend->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } } DarknessTimer = DARKNESS_TIMER; } else DarknessTimer -= diff; //Cast negative energy on 4-5 random targets if(NegativeEnergyTimer < diff) { Unit* target; Unit* last_target = NULL; uint8 NumVictims = 4+rand()%2; for(uint8 i = 0; i < NumVictims; i++) { //select a random enemy unit target = SelectUnit(SELECT_TARGET_RANDOM, 0); //not cast two times on the same target if(target != last_target) { m_creature->CastSpell(target, NEGATIVE_ENERGY, true); last_target = target; } } last_target = NULL; NegativeEnergyTimer = NEGATIVE_ENERGY_TIMER; } else NegativeEnergyTimer -= diff; //Spawns Shadow portals and then one Void Sentinel if(SummonVoidSentinelTimer < diff) { float SP_SPAWN_X, SP_SPAWN_Y, SP_SPAWN_O = 0; if(ShadowPortalN < 5) //Not every portal is spawned { SP_SPAWN_X = ShadowPortalSpawn[ShadowPortalN][0]; SP_SPAWN_Y = ShadowPortalSpawn[ShadowPortalN][1]; SP_SPAWN_O = ShadowPortalSpawn[ShadowPortalN][2]; WayPoint[ShadowPortalN] = m_creature->SummonCreature(ID_WORLD_TRIGGER, SP_SPAWN_X, SP_SPAWN_Y, SP_SPAWN_Z, SP_SPAWN_O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); if(WayPoint[ShadowPortalN]) { WayPoint[ShadowPortalN]->StopMoving(); WayPoint[ShadowPortalN]->GetMotionMaster()->Clear(false); // No moving! WayPoint[ShadowPortalN]->CastSpell(WayPoint[ShadowPortalN], SHADOW_PORTAL, true); } ShadowPortalN++; } else // Choose 1 random portal in wich spawn Void Sentinel { uint8 RandSpwn = rand()%5; SP_SPAWN_X = ShadowPortalSpawn[RandSpwn][0]; SP_SPAWN_Y = ShadowPortalSpawn[RandSpwn][1]; SP_SPAWN_O = ShadowPortalSpawn[RandSpwn][2]; } Creature* VoidSentinel = m_creature->SummonCreature(ID_VOID_SENTINEL, SP_SPAWN_X, SP_SPAWN_Y, m_creature->GetPositionZ(), SP_SPAWN_O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); if(VoidSentinel) VoidSentinel->AI()->AttackStart(m_creature->getVictim()); SummonVoidSentinelTimer = SUMMON_VOID_SENTINEL_TIMER + rand()%15000; } else SummonVoidSentinelTimer -= diff; //Summon 6 humanoids every min (1mage & 2berserkers) if(SummonHumanoidsTimer < diff) { for(uint8 i = 0; i < 6; i++) { Creature* MobSpawn; if((i == 2) | (i == 5)) MobSpawn = m_creature->SummonCreature(ID_SWM, m_creature->GetPositionX()+GetRandom(), m_creature->GetPositionY()+GetRandom(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); else MobSpawn = m_creature->SummonCreature(ID_SWB, m_creature->GetPositionX()+GetRandom(), m_creature->GetPositionY()+GetRandom(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); if(MobSpawn) MobSpawn->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } SummonHumanoidsTimer = SUMMON_HUMANOIDS_TIMER; } else SummonHumanoidsTimer -= diff; } }; /* --- Entropius AI --- */ struct MANGOS_DLL_DECL boss_entropiusAI : public ScriptedAI { boss_entropiusAI(Creature *c) : ScriptedAI(c) { Reset(); } uint32 SingularityTimer; void Reset() { //EnrageTimer = ENRAGE_TIMER; DarknessTimer = DARKNESS_TIMER; SingularityTimer = SINGULARITY_TIMER; NegativeEnergyTimer = NEGATIVE_ENERGY_TIMER+9000; } void Aggro(Unit *who) {} void JustDied(Unit* Killer) {} void KilledUnit(Unit *Victim) {} void UpdateAI(const uint32 diff) { //Return since we have no target if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; //Goes in enrage if(EnrageTimer < diff) { m_creature->CastSpell(m_creature,ENRAGE, true); EnrageTimer = 20000; } else EnrageTimer -= diff; if(NegativeEnergyTimer < diff) { Unit* target; Unit* last_target = NULL; uint8 NumVictims = 4+rand()%2; for(uint8 i = 0; i < NumVictims; i++) { //select a random enemy unit target = SelectUnit(SELECT_TARGET_RANDOM, 0); //not cast two times on the same target if(target != last_target) { m_creature->CastSpell(target, ENTROPIUS_NEGATIVE_ENERGY, true); last_target = target; } } last_target = NULL; NegativeEnergyTimer = NEGATIVE_ENERGY_TIMER+9000; } else NegativeEnergyTimer -= diff; //Cast Darkness if(DarknessTimer < diff) { Unit* dTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); m_creature->CastSpell(dTarget, ENTROPIUS_DARKNESS, false); //actually not working m_creature->CastSpell(dTarget, DARKNESS, false); //Temporarily replaced with M'uru Darkness Creature* DarkFiend = m_creature->SummonCreature(ID_DARK_FIEND, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); if(DarkFiend) { DarkFiend->CastSpell(DarkFiend, 45934, true); DarkFiend->AI()->AttackStart(dTarget); } DarknessTimer = DARKNESS_TIMER; } else DarknessTimer -= diff; //Summons Singularity if(SingularityTimer < diff) { Unit* sTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); Creature* Singularity = m_creature->SummonCreature(ID_SINGULARITY, sTarget->GetPositionX(), sTarget->GetPositionY(), sTarget->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, SINGULARITY_TIMER-5000); if(Singularity) { Singularity->CastSpell(Singularity, 46228, true); //Sigularity aura Singularity->AI()->AttackStart(sTarget); } SingularityTimer = SINGULARITY_TIMER; } else SingularityTimer -= diff; DoMeleeAttackIfReady(); } }; /* Adding Scripts */ CreatureAI* GetAI_boss_muru(Creature *_Creature) { return new boss_muruAI(_Creature); } CreatureAI* GetAI_boss_entropius(Creature *_Creature) { return new boss_entropiusAI(_Creature); } void AddSC_boss_muru_entropius() { Script *newscript; newscript = new Script; newscript->Name="boss_muru"; newscript->GetAI = GetAI_boss_muru; m_scripts[nrscripts++] = newscript; newscript = new Script; newscript->Name="boss_entropius"; newscript->GetAI = GetAI_boss_entropius; m_scripts[nrscripts++] = newscript; }