diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp | 172 |
1 files changed, 105 insertions, 67 deletions
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp index 8061785c16a..195f93532aa 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +/* 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 @@ -16,8 +16,8 @@ /* ScriptData SDName: Boss_Murmur -SD%Complete: 75 -SDComment: Database should have `RegenHealth`=0 to prevent regen. Also, his shockwave triggered after magnetic pull may be incorrect. Murmur's Touch does not work properly. +SD%Complete: 90 +SDComment: Timers may be incorrect SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ @@ -25,118 +25,156 @@ EndScriptData */ #define EMOTE_SONIC_BOOM -1555036 -#define SPELL_MAGNETIC_PULL 33689 -#define SPELL_SONIC_BOOM_PRE 33923 -#define SPELL_SONIC_BOOM_CAST 38795 -#define SPELL_MURMURS_TOUCH 33711 +#define SPELL_SONIC_BOOM_CAST (HeroicMode?38796:33923) +#define SPELL_SONIC_BOOM_EFFECT (HeroicMode?38795:33666) #define SPELL_RESONANCE 33657 -#define SPELL_SHOCKWAVE 33686 +#define SPELL_MURMURS_TOUCH (HeroicMode?38794:33711) +#define SPELL_MURMURS_TOUCH_VISUAL 33760 +#define SPELL_MAGNETIC_PULL 33689 +#define SPELL_SONIC_SHOCK 38797 +#define SPELL_THUNDERING_STORM 39365 struct TRINITY_DLL_DECL boss_murmurAI : public Scripted_NoMovementAI { - boss_murmurAI(Creature *c) : Scripted_NoMovementAI(c) {Reset();} + boss_murmurAI(Creature *c) : Scripted_NoMovementAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + + // need core fix + if(SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_MURMURS_TOUCH)) + { + TempSpell->EffectTriggerSpell[0] = SPELL_MURMURS_TOUCH_VISUAL; + TempSpell->MaxAffectedTargets = 1; + } + } uint32 SonicBoom_Timer; uint32 MurmursTouch_Timer; uint32 Resonance_Timer; uint32 MagneticPull_Timer; - bool CanSonicBoom; - bool CanShockWave; - uint64 pTarget; + uint32 SonicShock_Timer; + uint32 ThunderingStorm_Timer; + bool HeroicMode; + bool SonicBoom; void Reset() { SonicBoom_Timer = 30000; MurmursTouch_Timer = 20000; Resonance_Timer = 10000; - MagneticPull_Timer = 45000; - CanSonicBoom = false; - CanShockWave = false; - pTarget = 0; + MagneticPull_Timer = 20000; + ThunderingStorm_Timer = 15000; + SonicShock_Timer = 10000; + SonicBoom = false; //database should have `RegenHealth`=0 to prevent regen uint32 hp = (m_creature->GetMaxHealth()*40)/100; - if (hp) - m_creature->SetHealth(hp); + if (hp) m_creature->SetHealth(hp); } void Aggro(Unit *who) { } + // Sonic Boom instant damage (needs core fix instead of this) + void SpellHitTarget(Unit *target, const SpellEntry *spell) + { + if(target && target->isAlive() && spell && spell->Id == SPELL_SONIC_BOOM_EFFECT) + m_creature->DealDamage(target,(target->GetHealth()*90)/100,NULL,SPELL_DIRECT_DAMAGE,SPELL_SCHOOL_MASK_NATURE,spell); + } + void UpdateAI(const uint32 diff) { - //Return since we have no target - if (!UpdateVictim() ) + //Return since we have no target or casting + if (!UpdateVictim() || m_creature->IsNonMeleeSpellCasted(false)) return; - //SonicBoom_Timer + // Sonic Boom + if(SonicBoom) + { + DoCast(m_creature, SPELL_SONIC_BOOM_EFFECT, true); + SonicBoom = false; + Resonance_Timer = 1500; + } if (SonicBoom_Timer < diff) { - if (CanSonicBoom) - { - DoCast(m_creature, SPELL_SONIC_BOOM_CAST,true); - CanSonicBoom = false; - SonicBoom_Timer = 30000; - } - else - { - DoScriptText(EMOTE_SONIC_BOOM, m_creature); - DoCast(m_creature,SPELL_SONIC_BOOM_PRE); - CanSonicBoom = true; - SonicBoom_Timer = 5000; - } + DoScriptText(EMOTE_SONIC_BOOM, m_creature); + DoCast(m_creature, SPELL_SONIC_BOOM_CAST); + SonicBoom_Timer = 30000; + SonicBoom = true; + return; }else SonicBoom_Timer -= diff; - //MurmursTouch_Timer + // Murmur's Touch if (MurmursTouch_Timer < diff) { - /*Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if(target) - DoCast(target, SPELL_MURMURS_TOUCH);*/ - DoCast(m_creature, SPELL_MURMURS_TOUCH); + if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0,80,true)) + DoCast(target, SPELL_MURMURS_TOUCH); MurmursTouch_Timer = 30000; }else MurmursTouch_Timer -= diff; - //Resonance_Timer + // Resonance if (Resonance_Timer < diff) { - if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) - DoCast(m_creature->getVictim(), SPELL_RESONANCE); + if (!m_creature->IsWithinMeleeRange(SelectUnit(SELECT_TARGET_NEAREST,0,20,true))) + DoCast(m_creature, SPELL_RESONANCE); Resonance_Timer = 5000; }else Resonance_Timer -= diff; - //MagneticPull_Timer + // Magnetic Pull if (MagneticPull_Timer < diff) { - if (!CanShockWave) - { - if (Unit* temp = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) { - if (temp->GetTypeId() == TYPEID_PLAYER) - { - DoCast(temp, SPELL_MAGNETIC_PULL); - pTarget = temp->GetGUID(); - CanShockWave = true; - } - MagneticPull_Timer = 2500; + DoCast(target, SPELL_MAGNETIC_PULL); + MagneticPull_Timer = 20000+rand()%15000; + return; } - } - else - { - if (Unit* target = Unit::GetUnit(*m_creature,pTarget)) - target->CastSpell(target,SPELL_SHOCKWAVE,true); - - MagneticPull_Timer = 35000; - CanShockWave = false; - pTarget = 0; - } + MagneticPull_Timer = 500; }else MagneticPull_Timer -= diff; - //no meele if preparing for sonic boom - if (!CanSonicBoom) - DoMeleeAttackIfReady(); + if(HeroicMode) + { + // Thundering Storm + if(ThunderingStorm_Timer < diff) + { + std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); + for(std::list<HostilReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + if(Unit* target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) + if(target->isAlive() && m_creature->GetDistance2d(target) > 35) + DoCast(target, SPELL_THUNDERING_STORM, true); + ThunderingStorm_Timer = 15000; + }else ThunderingStorm_Timer -= diff; + + // Sonic Shock + if(SonicShock_Timer < diff) + { + if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0,20,false)) + if(target->isAlive()) + DoCast(target, SPELL_SONIC_SHOCK); + SonicShock_Timer = 10000+rand()%10000; + }else SonicShock_Timer -= diff; + } + + // Select nearest most aggro target if top aggro too far + if(!m_creature->isAttackReady()) + return; + if(!m_creature->IsWithinMeleeRange(m_creature->getVictim())) + { + std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); + for(std::list<HostilReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + if(Unit* target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) + if(target->isAlive() && m_creature->IsWithinMeleeRange(target)) + { + m_creature->TauntApply(target); + break; + } + } + + DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_murmur(Creature *_Creature) { return new boss_murmurAI (_Creature); |