Files
TCPlayerbotCore/src/server/scripts/Outland/boss_doomwalker.cpp
T

183 lines
5.2 KiB
C++
Raw Normal View History

/*
2011-01-01 15:01:13 +01:00
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
* 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 (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, see <http://www.gnu.org/licenses/>.
*/
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
#include "ScriptPCH.h"
2009-10-17 15:51:44 -07:00
2010-02-14 19:13:14 -07:00
#define SAY_AGGRO -1000159
2010-04-07 18:09:10 +02:00
#define SAY_EARTHQUAKE_1 -1000160
#define SAY_EARTHQUAKE_2 -1000161
2010-02-14 19:13:14 -07:00
#define SAY_OVERRUN_1 -1000162
2010-04-07 18:09:10 +02:00
#define SAY_OVERRUN_2 -1000163
2010-02-14 19:13:14 -07:00
#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
class boss_doomwalker : public CreatureScript
{
2010-08-08 22:54:58 +06:00
public:
boss_doomwalker() : CreatureScript("boss_doomwalker") { }
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
CreatureAI* GetAI(Creature* pCreature) const
{
2010-08-08 22:54:58 +06:00
return new boss_doomwalkerAI (pCreature);
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
struct boss_doomwalkerAI : public ScriptedAI
{
2010-08-08 22:54:58 +06:00
boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
uint32 Chain_Timer;
uint32 Enrage_Timer;
uint32 Overrun_Timer;
uint32 Quake_Timer;
uint32 Armor_Timer;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
bool InEnrage;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void Reset()
{
Enrage_Timer = 0;
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
2010-08-08 22:54:58 +06:00
InEnrage = false;
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void KilledUnit(Unit* Victim)
2009-06-18 10:47:39 +02:00
{
2011-04-29 20:47:02 +02:00
Victim->CastSpell(Victim, SPELL_MARK_DEATH, 0);
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
if (rand()%5)
return;
2011-04-29 20:47:02 +02:00
DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
2010-08-08 22:54:58 +06:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void JustDied(Unit* /*Killer*/)
{
2010-08-08 22:54:58 +06:00
DoScriptText(SAY_DEATH, me);
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void EnterCombat(Unit * /*who*/)
{
2010-08-08 22:54:58 +06:00
DoScriptText(SAY_AGGRO, me);
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void MoveInLineOfSight(Unit *who)
{
if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who))
{
2011-04-29 20:47:02 +02:00
if (who->HasAura(SPELL_MARK_DEATH, 0))
2010-08-08 22:54:58 +06:00
{
2011-04-29 20:47:02 +02:00
who->CastSpell(who, SPELL_AURA_DEATH, 1);
2010-08-08 22:54:58 +06:00
}
}
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void UpdateAI(const uint32 diff)
{
2010-08-08 22:54:58 +06:00
if (!UpdateVictim())
return;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Spell Enrage, when hp <= 20% gain enrage
2010-08-26 01:20:57 +06:00
if (!HealthAbovePct(20))
2010-08-08 22:54:58 +06:00
{
if (Enrage_Timer <= diff)
{
DoCast(me, SPELL_ENRAGE);
Enrage_Timer = 6000;
InEnrage = true;
} else Enrage_Timer -= diff;
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Spell Overrun
if (Overrun_Timer <= diff)
{
2011-04-29 20:47:02 +02:00
DoScriptText(RAND(SAY_OVERRUN_1, SAY_OVERRUN_2), me);
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
DoCast(me->getVictim(), SPELL_OVERRUN);
Overrun_Timer = 25000 + rand()%15000;
} else Overrun_Timer -= diff;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Spell Earthquake
if (Quake_Timer <= diff)
{
if (rand()%2)
return;
2009-10-17 15:51:44 -07:00
2011-04-29 20:47:02 +02:00
DoScriptText(RAND(SAY_EARTHQUAKE_1, SAY_EARTHQUAKE_2), me);
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
if (InEnrage)
me->RemoveAura(SPELL_ENRAGE);
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
DoCast(me, SPELL_EARTHQUAKE);
Quake_Timer = 30000 + rand()%25000;
} else Quake_Timer -= diff;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Spell Chain Lightning
if (Chain_Timer <= diff)
{
Unit *pTarget = NULL;
2011-04-29 20:47:02 +02:00
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1);
2010-08-08 22:54:58 +06:00
if (!pTarget)
pTarget = me->getVictim();
if (pTarget)
DoCast(pTarget, SPELL_CHAIN_LIGHTNING);
Chain_Timer = 7000 + rand()%20000;
} else Chain_Timer -= diff;
//Spell Sunder Armor
if (Armor_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SUNDER_ARMOR);
Armor_Timer = 10000 + rand()%15000;
} else Armor_Timer -= diff;
DoMeleeAttackIfReady();
}
};
2009-10-17 15:51:44 -07:00
};
2009-10-17 15:51:44 -07:00
void AddSC_boss_doomwalker()
{
2010-08-08 22:54:58 +06:00
new boss_doomwalker();
}