/* Copyright (C) 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_Anetheron SD%Complete: 60 SDComment: EndScriptData */ #include "../scripts/sc_defines.h" #include "../scripts/creature/simple_ai.h" #include "../../../game/Player.h" #include "../../../game/Spell.h" #include "../../../game/SpellAuras.h" #include "../../../shared/Database/DBCStores.h" #include "../../../game/ObjectAccessor.h" // Yells // Enter #define SAY_ENTER "Hello I R DREADLORD!" #define SOUND_ENTER 10977 // Sleep #define SAY_SLEEP "I cast sleep, seriously." #define SOUND_SLEEP 10978 // Carrion Swarm #define SAY_CARRION "I cast carrion swarm." #define SOUND_CARRION 10979 // Inferno #define SAY_INFERNO "I summon big fat infernal from teh sky." #define SOUND_INFERNO 10980 // Slay #define SAY_SLAY "Die" #define SOUND_SLAY 10981 // Death #define SAY_DEATH "I died :(" #define SOUND_DEATH 10982 // Anetheron's spells #define SPELL_CARRION_SWARM 31306 // Cone AoE damage at random target. 4-5.5 Shadow damage and -75% healing DONE for 20 seconds. #define SPELL_VAMPIRIC_AURA 38196 // While under effect of this aura, Anetheron heals 300% of his melee damage done (Hardcoded) #define SPELL_SLEEP 31548 // 2 random targets put to sleep every minute, using ApplyAura instead of DoCast. #define SPELL_INFERNO 31299 // Animation of a falling infernal #define NPC_INFERNO 17818 // Summon - Towering infernal #define SPELL_IMMOLATION 7 // Infernal's fiery aura struct MANGOS_DLL_DECL boss_anetheronAI : public ScriptedAI { boss_anetheronAI(Creature *c) : ScriptedAI(c) { if(c->GetInstanceData()) pInstance = ((ScriptedInstance*)c->GetInstanceData()); pInstance = NULL; SetVariables(); } ScriptedInstance* pInstance; // Fight timers uint32 CarrionSwarmTimer; uint32 VampiricAuraTimer; uint32 SleepTimer; uint32 InfernoTimer; // uint32 InfernalFallTimer; TODO: Make animation appear before Infernal spawning. bool InCombat; void SetVariables() { // Immunities m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISARM, true); m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, true); m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DAZE, true); m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR, true); m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SILENCE, true); m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, true); CarrionSwarmTimer = 10000; VampiricAuraTimer = 1000; SleepTimer = 60000; InfernoTimer = 30000; // InfernalFallTimer = 32000; InCombat = false; } void EnterEvadeMode() { SetVariables(); m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(); DoGoHome(); } void KilledUnit(Unit *victim) { DoYell(SAY_SLAY,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(m_creature, SOUND_SLAY); } void JustDied(Unit *victim) { DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature,SOUND_DEATH); } void AttackStart(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) { if(who->HasStealthAura()) who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); DoStartMeleeAttack(who); if(!InCombat) } } void UpdateAI(const uint32 diff) { // Do not do anything unless we got a current target. Winterchill has to be dead! if(!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; // Carrion Swarm if(CarrionSwarmTimer < diff) { DoCast((SELECT_TARGET_RANDOM, 0), SPELL_CARRION_SWARM, true); CarrionSwarmTimer = 45000; DoYell(SAY_CARRION, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_CARRION); }else CarrionSwarmTimer -= diff; // Vampiric Aura if(m_creature->GetMaxHealth() * 0.7 < m_creature->GetHealth()) // Over 70% { if(VampiricAuraTimer < diff) { DoCast(m_creature, SPELL_VAMPIRIC_AURA); VampiricAuraTimer = 4000; }else VampiricAuraTimer -= diff; } // Sleep if(SleepTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SLEEP, true); DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SLEEP, true); DoYell(SAY_SLEEP, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_SLEEP); SleepTimer = 60000; }else SleepTimer -= diff; // Inferno if(InfernoTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_INFERNO, true); DoYell(SAY_INFERNO, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_INFERNO); // TODO: SummonCreature InfernoTimer = 60000; }else InfernoTimer -= diff; DoMeleeAttackIfReady(); // TODO: Add Vampirism to this place } }; CreatureAI* GetAI_boss_anetheron(Creature *_Creature) { return new boss_anetheronAI (_Creature); } void AddSC_boss_anetheron() { Script *newscript; newscript = new Script; newscript->Name="boss_anetheron"; newscript->GetAI = GetAI_boss_anetheron; m_scripts[nrscripts++] = newscript; }