Public feed
#890228
#include "../../sc_defines.h"
#define SPELL_BELLOWING_ROAR 39427 // Bellowing Roar1.5 sec cast 8 sec cooldown - Fleeing in fear. 4 seconds remaining
#define SPELL_CHARRED_EARTH 30129 // Chars the ground, setting it flame, dealing 21880 to the inflamed area over 30 sec. - auch 30209
#define SPELL_DISTRACTING_ASH 30130 // Reduces the chance to hit with spells and abilities by 30%.
#define SPELL_SMOLDERING_BREATH 30210 // Inflicts 3700 to 4300 Fire damage to enemies in a cone in front of the caster.
#define SPELL_TAIL_SWEEP 25653 // Inflicts 450 damage on enemies in a cone behind the caster, knocking them back.
#define SPELL_RAIN_OF_BONES 37098 // Bombards the target and nearby allies with bone fragments, summoning 3 skeletons in the process.
#define SPELL_SMOKING_BLAST 37057 // Deals 1850 to 2150 physical damage to the target and additional fire damage over time.
#define SPELL_FIREBALL_BARRAGE 30282 // Throws fireballs at any enemies farther than 40 yards away.
#define SOUND_ATTACK 9451 // When should he say this?
#define SOUND_WOUND 9452 // When should he say this?
#define SOUND_WOUND_CRIT 9453 // When should he say this?
#define SOUND_DEATH 9454
#define SOUND_PRE_AGGRO 9455
#define SOUND_AGGRO 9456
#define SOUND_LOOP 9457 // When should he say this?
struct MANGOS_DLL_DECL boss_nightbaneAI : public ScriptedAI
{
boss_nightbaneAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();}
uint32 Bellowing_Timer;
uint32 Charred_Timer;
uint32 Distracting_Timer;
uint32 Smoldering_Timer;
uint32 Tail_Timer;
uint32 Rain_Timer;
uint32 Smoking_Timer;
uint32 Fireball_Timer;
bool InCombat;
int Phase;
int RandTime(int time) {return ((100+rand()%time)*1000);}
void EnterEvadeMode()
{
Bellowing_Timer = 50000;
Distracting_Timer = 70000;
Charred_Timer = 90000;
Tail_Timer = 110000;
Rain_Timer = 50000;
Smoldering_Timer = 70000;
Smoking_Timer = 90000;
Fireball_Timer = 110000;
InCombat = false;
Phase = 1;
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
DoPlaySoundToSet(m_creature, SOUND_PRE_AGGRO);
}
void JustDied(Unit* Killer)
{
DoPlaySoundToSet(m_creature, SOUND_DEATH);
}
void AttackStart(Unit *who)
{
if (!who) return;
if (who->isTargetableForAttack() && who!= m_creature)
{
if (!InCombat)
{
DoPlaySoundToSet(m_creature, SOUND_AGGRO);
InCombat = true;
}
DoStartMeleeAttack(who);
}
}
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);
if (!InCombat)
{
DoPlaySoundToSet(m_creature, SOUND_AGGRO);
InCombat = true;
}
DoStartMeleeAttack(who);
}
}
}
void UpdateAI(const uint32 diff)
{
if (!m_creature->SelectHostilTarget()) return;
if( m_creature->getVictim() && m_creature->isAlive())
{
if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 75) &&
(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 50)) Phase = 2;
if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50) &&
(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 25)) Phase = 1;
if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 25) &&
(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 0)) Phase = 2;
if (Phase == 1)
{
if (Bellowing_Timer < diff)
{
DoCast(m_creature,SPELL_BELLOWING_ROAR);
Bellowing_Timer = RandTime(120);
}else Bellowing_Timer -= diff;
if (Distracting_Timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_DISTRACTING_ASH);
Distracting_Timer = RandTime(120);
}else Distracting_Timer -= diff;
if (Charred_Timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
if (target)
DoCast(target,SPELL_CHARRED_EARTH);
else
DoCast(m_creature->getVictim(),SPELL_CHARRED_EARTH);
Charred_Timer = RandTime(120);
}else Charred_Timer -= diff;
if (Tail_Timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_TAIL_SWEEP);
Tail_Timer = RandTime(120);
}else Tail_Timer -= diff;
}
if (Phase == 2)
{ // Random player - is correct!
if (Rain_Timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
if (target)
DoCast(target,SPELL_RAIN_OF_BONES);
else
DoCast(m_creature->getVictim(),SPELL_RAIN_OF_BONES);
Rain_Timer = RandTime(120);
}else Rain_Timer -= diff;
if (Smoldering_Timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
if (target)
DoCast(target,SPELL_SMOLDERING_BREATH);
else
DoCast(m_creature->getVictim(),SPELL_SMOLDERING_BREATH);
Smoldering_Timer = RandTime(120);
}else Smoldering_Timer -= diff;
if (Smoking_Timer < diff)
{ // Sould be casted on the first aggro rang healer
// I see no option to do that!?
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
if (target)
DoCast(target,SPELL_SMOKING_BLAST);
else
DoCast(m_creature->getVictim(),SPELL_SMOKING_BLAST);
Smoking_Timer = RandTime(120);
}else Smoking_Timer -= diff;
if (Fireball_Timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_FIREBALL_BARRAGE);
Fireball_Timer = RandTime(120);
}else Fireball_Timer -= diff;
}
DoMeleeAttackIfReady();
}
}
};
CreatureAI* GetAI_boss_nightbane(Creature *_Creature)
{
return new boss_nightbaneAI (_Creature);
}
void AddSC_boss_nightbane()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_nightbane";
newscript->GetAI = GetAI_boss_nightbane;
m_scripts[nrscripts++] = newscript;
}