forked from cmangos/mangos-tbc
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathboss_doomwalker.cpp
175 lines (149 loc) · 5.24 KB
/
boss_doomwalker.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* 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_Doomwalker
SD%Complete: 100
SDComment:
SDCategory: Shadowmoon Valley
EndScriptData */
#include "precompiled.h"
enum
{
SAY_AGGRO = -1000159,
SAY_EARTHQUAKE_1 = -1000160,
SAY_EARTHQUAKE_2 = -1000161,
SAY_OVERRUN_1 = -1000162,
SAY_OVERRUN_2 = -1000163,
SAY_SLAY_1 = -1000164,
SAY_SLAY_2 = -1000165,
SAY_SLAY_3 = -1000166,
SAY_DEATH = -1000167,
SPELL_EARTHQUAKE = 32686,
SPELL_CRUSH_ARMOR = 33661,
SPELL_LIGHTNING_WRATH = 33665,
SPELL_OVERRUN = 32636,
SPELL_ENRAGE = 33653,
SPELL_MARK_OF_DEATH_PLAYER = 37128,
SPELL_MARK_OF_DEATH_AURA = 37125, // triggers 37131 on target if it has aura 37128
};
struct boss_doomwalkerAI : public ScriptedAI
{
boss_doomwalkerAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
uint32 m_uiChainTimer;
uint32 m_uiOverrunTimer;
uint32 m_uiQuakeTimer;
uint32 m_uiArmorTimer;
bool m_bHasEnrage;
void Reset() override
{
m_uiArmorTimer = urand(5000, 13000);
m_uiChainTimer = urand(10000, 30000);
m_uiQuakeTimer = urand(25000, 35000);
m_uiOverrunTimer = urand(30000, 45000);
m_bHasEnrage = false;
}
void KilledUnit(Unit* pVictim) override
{
if (pVictim->GetTypeId() != TYPEID_PLAYER)
return;
pVictim->CastSpell(pVictim, SPELL_MARK_OF_DEATH_PLAYER, true, nullptr, nullptr, m_creature->GetObjectGuid());
if (urand(0, 4))
return;
switch (urand(0, 2))
{
case 0: DoScriptText(SAY_SLAY_1, m_creature); break;
case 1: DoScriptText(SAY_SLAY_2, m_creature); break;
case 2: DoScriptText(SAY_SLAY_3, m_creature); break;
}
}
void JustDied(Unit* /*pKiller*/) override
{
DoScriptText(SAY_DEATH, m_creature);
}
void Aggro(Unit* /*pWho*/) override
{
DoCastSpellIfCan(m_creature, SPELL_MARK_OF_DEATH_AURA, CAST_TRIGGERED);
DoScriptText(SAY_AGGRO, m_creature);
}
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
// Spell Enrage, when hp <= 20% gain enrage
if (m_creature->GetHealthPercent() <= 20.0f && !m_bHasEnrage)
{
if (DoCastSpellIfCan(m_creature, SPELL_ENRAGE) == CAST_OK)
m_bHasEnrage = true;
}
// Spell Overrun
if (m_uiOverrunTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_OVERRUN) == CAST_OK)
{
DoScriptText(urand(0, 1) ? SAY_OVERRUN_1 : SAY_OVERRUN_2, m_creature);
m_uiOverrunTimer = urand(25000, 40000);
}
}
else
m_uiOverrunTimer -= uiDiff;
// Spell Earthquake
if (m_uiQuakeTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_EARTHQUAKE) == CAST_OK)
{
DoScriptText(urand(0, 1) ? SAY_EARTHQUAKE_1 : SAY_EARTHQUAKE_2, m_creature);
m_uiQuakeTimer = urand(30000, 55000);
}
}
else
m_uiQuakeTimer -= uiDiff;
// Spell Chain Lightning
if (m_uiChainTimer < uiDiff)
{
Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1);
if (!pTarget)
pTarget = m_creature->getVictim();
if (pTarget)
{
if (DoCastSpellIfCan(pTarget, SPELL_LIGHTNING_WRATH) == CAST_OK)
m_uiChainTimer = urand(7000, 27000);
}
}
else
m_uiChainTimer -= uiDiff;
// Spell Sunder Armor
if (m_uiArmorTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CRUSH_ARMOR) == CAST_OK)
m_uiArmorTimer = urand(10000, 25000);
}
else
m_uiArmorTimer -= uiDiff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_doomwalker(Creature* pCreature)
{
return new boss_doomwalkerAI(pCreature);
}
void AddSC_boss_doomwalker()
{
Script* pNewScript;
pNewScript = new Script;
pNewScript->Name = "boss_doomwalker";
pNewScript->GetAI = &GetAI_boss_doomwalker;
pNewScript->RegisterSelf();
}