Files
TCPlayerbotCore/src/scripts/outland/boss_doomwalker.cpp
T

179 lines
5.0 KiB
C++
Raw Normal View History

2009-02-17 18:08:26 +01:00
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2008-11-13 17:12:54 -06:00
* 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
*/
2009-10-17 15:51:44 -07:00
/* ScriptData
SDName: Boss_Doomwalker
SD%Complete: 100
SDComment:
SDCategory: Shadowmoon Valley
EndScriptData */
2009-10-17 15:51:44 -07:00
2010-01-19 11:36:05 +01:00
#include "ScriptedPch.h"
2009-10-17 15:51:44 -07:00
2010-02-14 19:13:14 -07:00
#define SAY_AGGRO -1000159
#define SAY_EARTHQUAKE_1 -1000160
#define SAY_EARTHQUAKE_2 -1000161
#define SAY_OVERRUN_1 -1000162
#define SAY_OVERRUN_2 -1000163
#define SAY_SLAY_1 -1000164
#define SAY_SLAY_2 -1000165
#define SAY_SLAY_3 -1000166
#define SAY_DEATH -1000167
2009-10-17 15:51:44 -07:00
#define SPELL_EARTHQUAKE 32686
#define SPELL_SUNDER_ARMOR 33661
#define SPELL_CHAIN_LIGHTNING 33665
#define SPELL_OVERRUN 32636
2008-11-13 17:12:54 -06:00
#define SPELL_ENRAGE 33653
#define SPELL_MARK_DEATH 37128
2009-06-18 10:47:39 +02:00
#define SPELL_AURA_DEATH 37131
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct boss_doomwalkerAI : public ScriptedAI
{
boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {}
2009-10-17 15:51:44 -07:00
uint32 Chain_Timer;
uint32 Enrage_Timer;
uint32 Overrun_Timer;
uint32 Quake_Timer;
uint32 Armor_Timer;
2009-10-17 15:51:44 -07:00
bool InEnrage;
2009-10-17 15:51:44 -07:00
void Reset()
{
Enrage_Timer = 0;
2008-11-13 17:12:54 -06:00
Armor_Timer = 5000 + rand()%8000;
Chain_Timer = 10000 + rand()%20000;
Quake_Timer = 25000 + rand()%10000;
Overrun_Timer = 30000 + rand()%15000;
2009-10-17 15:51:44 -07:00
InEnrage = false;
}
2009-10-17 15:51:44 -07:00
void KilledUnit(Unit* Victim)
{
2009-06-18 10:47:39 +02:00
Victim->CastSpell(Victim,SPELL_MARK_DEATH,0);
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (rand()%5)
return;
2009-10-17 15:51:44 -07:00
DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature);
}
2009-10-17 15:51:44 -07:00
void JustDied(Unit* Killer)
{
DoScriptText(SAY_DEATH, m_creature);
}
2009-10-17 15:51:44 -07:00
2009-04-27 21:23:42 -05:00
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
}
2009-10-17 15:51:44 -07:00
2009-06-18 10:47:39 +02:00
void MoveInLineOfSight(Unit *who)
{
if (who && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsHostileTo(who))
{
if (who->HasAura(SPELL_MARK_DEATH,0))
{
who->CastSpell(who,SPELL_AURA_DEATH,1);
}
}
}
2009-10-17 15:51:44 -07:00
void UpdateAI(const uint32 diff)
{
2009-01-30 18:10:05 -06:00
if (!UpdateVictim())
return;
2009-10-17 15:51:44 -07:00
//Spell Enrage, when hp <= 20% gain enrage
if (((m_creature->GetHealth()*100)/ m_creature->GetMaxHealth()) <= 20)
{
2009-10-27 21:28:20 -07:00
if (Enrage_Timer <= diff)
{
DoCast(m_creature, SPELL_ENRAGE);
Enrage_Timer = 6000;
InEnrage = true;
2009-10-27 21:28:20 -07:00
} else Enrage_Timer -= diff;
}
2009-10-17 15:51:44 -07:00
//Spell Overrun
2009-10-27 21:28:20 -07:00
if (Overrun_Timer <= diff)
{
DoScriptText(RAND(SAY_OVERRUN_1,SAY_OVERRUN_2), m_creature);
2009-10-17 15:51:44 -07:00
DoCast(m_creature->getVictim(), SPELL_OVERRUN);
Overrun_Timer = 25000 + rand()%15000;
2009-10-27 21:28:20 -07:00
} else Overrun_Timer -= diff;
2009-10-17 15:51:44 -07:00
//Spell Earthquake
2009-10-27 21:28:20 -07:00
if (Quake_Timer <= diff)
{
if (rand()%2)
return;
2009-10-17 15:51:44 -07:00
DoScriptText(RAND(SAY_EARTHQUAKE_1,SAY_EARTHQUAKE_2), m_creature);
2009-10-17 15:51:44 -07:00
//remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
if (InEnrage)
2009-04-06 13:31:14 +02:00
m_creature->RemoveAura(SPELL_ENRAGE);
2009-10-17 15:51:44 -07:00
DoCast(m_creature, SPELL_EARTHQUAKE);
Quake_Timer = 30000 + rand()%25000;
2009-10-27 21:28:20 -07:00
} else Quake_Timer -= diff;
2009-10-17 15:51:44 -07:00
//Spell Chain Lightning
2009-10-27 21:28:20 -07:00
if (Chain_Timer <= diff)
{
2009-10-27 21:28:20 -07:00
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
if (!pTarget)
pTarget = m_creature->getVictim();
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
if (pTarget)
DoCast(pTarget, SPELL_CHAIN_LIGHTNING);
2009-10-17 15:51:44 -07:00
2009-06-18 10:47:39 +02:00
Chain_Timer = 7000 + rand()%20000;
2009-10-27 21:28:20 -07:00
} else Chain_Timer -= diff;
2009-10-17 15:51:44 -07:00
//Spell Sunder Armor
2009-10-27 21:28:20 -07:00
if (Armor_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SUNDER_ARMOR);
Armor_Timer = 10000 + rand()%15000;
2009-10-27 21:28:20 -07:00
} else Armor_Timer -= diff;
2009-10-17 15:51:44 -07:00
DoMeleeAttackIfReady();
}
};
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_boss_doomwalker(Creature* pCreature)
{
2009-08-14 00:39:07 +02:00
return new boss_doomwalkerAI (pCreature);
}
2009-10-17 15:51:44 -07:00
void AddSC_boss_doomwalker()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_doomwalker";
newscript->GetAI = &GetAI_boss_doomwalker;
newscript->RegisterSelf();
}
2009-02-17 20:07:49 -06:00