Index: ScriptMgr.cpp =================================================================== --- ScriptMgr.cpp (revision 275) +++ ScriptMgr.cpp (working copy) @@ -91,6 +91,7 @@ // -- GO -- extern void AddSC_go_scripts(); +extern void AddSC_go_transpolyporter(); // -- Guard -- extern void AddSC_guards(); @@ -235,6 +236,7 @@ extern void AddSC_hyjal(); extern void AddSC_boss_archimonde(); extern void AddSC_instance_mount_hyjal(); +extern void AddSC_boss_azgalor(); //--Old Hillsbrad extern void AddSC_boss_captain_skarloc(); Index: scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp =================================================================== --- scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp (revision 0) +++ scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp (revision 0) @@ -0,0 +1,295 @@ +/* Copyright (C) 2006 - 2008 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 +*/ + +#include "../../../sc_defines.h" +#include "../../../../../../game/Player.h" +#include "../../../../../../game/Spell.h" +#include "../../../../../../game/SpellAuras.h" +#include "../../../../../../shared/Database/DBCStores.h" +#include "../../../../../../game/ObjectAccessor.h" + +#define SPELL_HOWL_OF_AZGALOR 31344 +#define SPELL_RAIN_OF_FIRE 31340 +#define SPELL_UNQUENCHABLE_FLAMES 31341 +#define SPELL_CLEAVE 40505 +#define SPELL_DOOM 31347 + +#define DOOMGUARD 17864 + +#define SAY_AGGRO "Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!" +#define SOUND_AGGRO 10999 + +#define SAY_DEATH "Your time is almost... up." +#define SOUND_DEATH 11002 + +#define SAY_DOOM1 "Suffer you despicable insect!" +#define SOUND_DOOM1 11000 +#define SAY_DOOM2 "Just a taste... of what awaits you." +#define SOUND_DOOM2 11046 + +#define SAY_KILL1 "Reesh, hokta!" +#define SOUND_KILL1 11001 +#define SAY_KILL2 "No one is going to save you." +#define SOUND_KILL2 11047 +#define SAY_KILL3 "Don't fight it." +#define SOUND_KILL3 11048 + +class CustomAura:public Aura +{ +public: + CustomAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL):Aura(spellproto, eff, currentBasePoints, target,caster, castItem) + {}; +}; + +struct MANGOS_DLL_DECL boss_azgalorAI : public ScriptedAI +{ + boss_azgalorAI(Creature *c) : ScriptedAI(c) + { + pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL; + EnterEvadeMode(); + } + + ScriptedInstance *pInstance; + + uint32 Rain_of_Fire_Timer; + uint32 Doom_Timmer; + uint32 Doom_Expire_Timer; + uint32 Cleave_Timer; + uint32 Enrage_Timer; + + bool InCombat; + uint64 DoomVictim_Guid; + + void EnterEvadeMode() + { + Rain_of_Fire_Timer=35000; + Doom_Timmer=40000; + Doom_Expire_Timer=20000; + Cleave_Timer=9000; + Enrage_Timer=600000; + + InCombat = false; + + m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SILENCE, true); + m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISARM, true); + m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CONFUSED, true); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); + + m_creature->RemoveAllAuras(); + m_creature->DeleteThreatList(); + m_creature->CombatStop(); + DoGoHome(); + DoomVictim_Guid=0; + + // + } + + void JustDied(Unit* Killer) + { + DoYell(SAY_DEATH,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(m_creature, SOUND_DEATH); + } + + void KilledUnit(Unit *victim) + { + if(victim!=NULL) + if(victim->GetGUID()==DoomVictim_Guid) + DoomVictim_Guid=0; + + if(InCombat) + { + if(victim->GetTypeId() == TYPEID_PLAYER) + { + switch(rand()%3) + { + case 0: + DoYell(SAY_KILL1,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(m_creature, SOUND_KILL1); + break; + case 1: + DoYell(SAY_KILL2,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(m_creature, SOUND_KILL2); + break; + case 2: + DoYell(SAY_KILL3,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(m_creature, SOUND_KILL3); + break; + default: + break; + } + } + } + + + } + + void AttackStart(Unit *who) + { + if (!who) + return; + + if (who->isTargetableForAttack() && who != m_creature) + { + //Begin attack + DoStartMeleeAttack(who); + + if (!InCombat) + { + DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL); + InCombat = true; + DoPlaySoundToSet(m_creature, SOUND_AGGRO); + // + } + } + } + + void MoveInLineOfSight(Unit *who) + { + if (!who || m_creature->getVictim()) + return; + + if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who)) + { + float attackRadius = m_creature->GetAttackDistance(who); + if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who)) + { + if(who->HasStealthAura()) + who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); + + //Begin attack + DoStartMeleeAttack(who); + + if (!InCombat) + { + DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL); + InCombat = true; + DoPlaySoundToSet(m_creature, SOUND_AGGRO); + // + } + } + } + } + + void UpdateAI(const uint32 diff) + { + Unit* target; + //Return since we have no target + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) + return; + + // Cleave + if (Cleave_Timer < diff ) + { + //Cast + m_creature->CastSpell(m_creature->getVictim(), SPELL_CLEAVE, true); + Cleave_Timer = 9000; + }else Cleave_Timer -= diff; + + // Rain of Fire + if (Rain_of_Fire_Timer < diff ) + { + target=SelectUnit(SELECT_TARGET_RANDOM, 1); + if(target!=NULL) + { + //Cast + DoCast(target, SPELL_RAIN_OF_FIRE); + } + + Rain_of_Fire_Timer = 35000; + }else Rain_of_Fire_Timer -= diff; + + //Doom + if (Doom_Timmer < diff ) + { + target=SelectUnit(SELECT_TARGET_RANDOM, 1); + if(target!=NULL) + { + SpellEntry const *spellInfo = GetSpellStore()->LookupEntry( SPELL_DOOM ); + if(spellInfo) + { + for(uint32 i = 0;i<3;i++) + { + uint8 eff = spellInfo->Effect[i]; + if (eff>=TOTAL_SPELL_EFFECTS) + continue; + if(eff == SPELL_EFFECT_APPLY_AURA ) + { + Aura *Aur = new CustomAura(spellInfo, i, NULL, target); + target->AddAura(Aur); + } + } + } + + switch(rand()%3) + { + case 0: + DoYell(SAY_DOOM1,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(m_creature, SOUND_DOOM1); + break; + case 1: + DoYell(SAY_DOOM2,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(m_creature, SOUND_DOOM2); + break; + default: + break; + } + + DoomVictim_Guid=target->GetGUID(); + Doom_Expire_Timer=20000; + } + Doom_Timmer = 45000; + }else Doom_Timmer -= diff; + + //Doom expire + if(DoomVictim_Guid!=0) + if (Doom_Expire_Timer < diff ) + { + Unit* currentUnit1=Unit::GetUnit((*m_creature),DoomVictim_Guid); + if(currentUnit1!=NULL) + { + //kill victim + if(currentUnit1->isAlive()&&(m_creature!=NULL)) + m_creature->DealDamage(currentUnit1, currentUnit1->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false); + + //summon doomguard + //DoCast(currentUnit1,31350); + m_creature->SummonCreature(DOOMGUARD, currentUnit1->GetPositionX(), currentUnit1->GetPositionY(), currentUnit1->GetPositionZ(), 2.2540, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); + + } + + DoomVictim_Guid=0; + + }else Doom_Expire_Timer -= diff; + + DoMeleeAttackIfReady(); + } + +}; + +CreatureAI* GetAI_boss_azgalor(Creature *_Creature) +{ + return new boss_azgalorAI (_Creature); +} + + +void AddSC_boss_azgalor() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_azgalor"; + newscript->GetAI = GetAI_boss_azgalor; + m_scripts[nrscripts++] = newscript; +}