/* Copyright (C) 2006 - 2008 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
* (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_Princess_Thunderaan
Scirpt by Bucu - www.bloodworld.eu - Bloodworld DevTeam (c) 2008
Based on SD2 Princess Theradras script.
EndScriptData */
#include "../../sc_defines.h"
#define SPELL_DUSTFIELD 21909
#define SPELL_BOULDER 21832
#define SPELL_KNOCKDOWN 19128
#define SPELL_THUNDERFURY 21992
struct MANGOS_DLL_DECL boss_pthunderaanAI : public ScriptedAI
{
boss_pthunderaanAI(Creature *c) : ScriptedAI(c) {Reset();}
uint32 Dustfield_Timer;
uint32 Boulder_Timer;
uint32 Knockdown_Timer;
uint32 Thunderfury_Timer;
bool InCombat;
void Reset()
{
Dustfield_Timer = 8000;
Boulder_Timer = 2000;
Knockdown_Timer = 18000;
Thunderfury_Timer = 23000;
InCombat = false;
//m_creature->RemoveAllAuras();
//m_creature->DeleteThreatList();
//m_creature->CombatStop();
//DoGoHome();
//m_creature->CastSpell(m_creature,SPELL_ICEARMOR,true);
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (who->isTargetableForAttack() && who!= m_creature)
{
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
InCombat = true;
}
}
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);
DoStartMeleeAttack(who);
InCombat = true;
}
}
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
return;
//Dustfield_Timer
if (Dustfield_Timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_DUSTFIELD);
//14 seconds
Dustfield_Timer = 14000;
}else Dustfield_Timer -= diff;
//Boulder_Timer
if (Boulder_Timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_BOULDER);
//10 seconds until we should cast this agian
Boulder_Timer = 10000;
}else Boulder_Timer -= diff;
//Knockdown_Timer
if (Knockdown_Timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_KNOCKDOWN);
//12 seconds until we should cast this agian
Knockdown_Timer = 12000;
}else Knockdown_Timer -= diff;
//Thunderfury_Timer
if (Thunderfury_Timer < diff)
{
//Cast Thunderfury on a Random target
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
if (target)DoCast(target,SPELL_THUNDERFURY);
//60 seconds until we should cast this agian
Thunderfury_Timer = 60000;
}else Thunderfury_Timer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_pthunderaan(Creature *_Creature)
{
return new boss_pthunderaanAI (_Creature);
}
void AddSC_boss_pthunderaan()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_prince_thunderaan";
newscript->GetAI = GetAI_boss_pthunderaan;
m_scripts[nrscripts++] = newscript;
}