Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_doomwalker.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#include "
ScriptMgr.h
"
7
#include "
ScriptedCreature.h
"
8
9
enum
Texts
10
{
11
SAY_AGGRO
= 0,
12
SAY_EARTHQUAKE
= 1,
13
SAY_OVERRUN
= 2,
14
SAY_SLAY
= 3,
15
SAY_DEATH
= 4
16
};
17
18
enum
Spells
19
{
20
SPELL_EARTHQUAKE
= 32686,
21
SPELL_SUNDER_ARMOR
= 33661,
22
SPELL_CHAIN_LIGHTNING
= 33665,
23
SPELL_OVERRUN
= 32636,
24
SPELL_ENRAGE
= 33653,
25
SPELL_MARK_DEATH
= 37128,
26
SPELL_AURA_DEATH
= 37131
27
};
28
29
enum
Events
30
{
31
EVENT_ENRAGE
= 1,
32
EVENT_ARMOR
= 2,
33
EVENT_CHAIN
= 3,
34
EVENT_QUAKE
= 4,
35
EVENT_OVERRUN
= 5
36
};
37
38
class
boss_doomwalker
:
public
CreatureScript
39
{
40
public
:
41
boss_doomwalker
() :
CreatureScript
(
"boss_doomwalker"
) { }
42
43
struct
boss_doomwalkerAI
:
public
ScriptedAI
44
{
45
boss_doomwalkerAI
(
Creature
* creature) :
ScriptedAI
(creature)
46
{
47
}
48
49
void
Reset
()
OVERRIDE
50
{
51
_events
.Reset();
52
_events
.ScheduleEvent(
EVENT_ENRAGE
, 0);
53
_events
.ScheduleEvent(
EVENT_ARMOR
, std::rand() % 13000 + 5000);
54
_events
.ScheduleEvent(
EVENT_CHAIN
, std::rand() % 30000 + 10000);
55
_events
.ScheduleEvent(
EVENT_QUAKE
, std::rand() % 35000 + 25000);
56
_events
.ScheduleEvent(
EVENT_OVERRUN
, std::rand() % 45000 + 30000);
57
_inEnrage
=
false
;
58
}
59
60
void
KilledUnit
(
Unit
* victim)
OVERRIDE
61
{
62
victim->CastSpell(victim,
SPELL_MARK_DEATH
, 0);
63
64
if
(std::rand() % 4)
65
return
;
66
67
Talk
(
SAY_SLAY
);
68
}
69
70
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
71
{
72
Talk
(
SAY_DEATH
);
73
}
74
75
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
76
{
77
Talk
(
SAY_AGGRO
);
78
}
79
80
void
MoveInLineOfSight
(
Unit
* who)
OVERRIDE
81
82
{
83
if
(who && who->GetTypeId() ==
TypeID::TYPEID_PLAYER
&&
me
->IsValidAttackTarget(who))
84
if
(who->HasAura(
SPELL_MARK_DEATH
, 0))
85
who->CastSpell(who,
SPELL_AURA_DEATH
, 1);
86
}
87
88
void
UpdateAI
(
uint32
diff)
OVERRIDE
89
{
90
if
(!
UpdateVictim
())
91
return
;
92
93
_events
.Update(diff);
94
95
if
(
me
->HasUnitState(
UNIT_STATE_CASTING
))
96
return
;
97
98
while
(
uint32
eventId =
_events
.ExecuteEvent())
99
{
100
switch
(eventId)
101
{
102
case
EVENT_ENRAGE
:
103
if
(!
HealthAbovePct
(20))
104
{
105
DoCast
(
me
,
SPELL_ENRAGE
);
106
_events
.ScheduleEvent(
EVENT_ENRAGE
, 6000);
107
_inEnrage
=
true
;
108
}
109
break
;
110
case
EVENT_OVERRUN
:
111
Talk
(
SAY_OVERRUN
);
112
DoCastVictim
(
SPELL_OVERRUN
);
113
_events
.ScheduleEvent(
EVENT_OVERRUN
, std::rand() % 40000 + 25000);
114
break
;
115
case
EVENT_QUAKE
:
116
if
(std::rand() % 1)
117
return
;
118
119
Talk
(
SAY_EARTHQUAKE
);
120
121
//remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
122
if
(
_inEnrage
)
123
me
->RemoveAurasDueToSpell(
SPELL_ENRAGE
);
124
125
DoCast
(
me
,
SPELL_EARTHQUAKE
);
126
_events
.ScheduleEvent(
EVENT_QUAKE
, std::rand() % 55000 + 30000);
127
break
;
128
case
EVENT_CHAIN
:
129
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 1, 0.0f,
true
))
130
DoCast
(target,
SPELL_CHAIN_LIGHTNING
);
131
_events
.ScheduleEvent(
EVENT_CHAIN
, std::rand() % 27000 + 7000);
132
break
;
133
case
EVENT_ARMOR
:
134
DoCastVictim
(
SPELL_SUNDER_ARMOR
);
135
_events
.ScheduleEvent(
EVENT_ARMOR
, std::rand() % 25000 + 10000);
136
break
;
137
default
:
138
break
;
139
}
140
}
141
DoMeleeAttackIfReady
();
142
}
143
144
private
:
145
EventMap
_events
;
146
bool
_inEnrage
;
147
};
148
149
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
150
{
151
return
new
boss_doomwalkerAI
(creature);
152
}
153
};
154
155
void
AddSC_boss_doomwalker
()
156
{
157
new
boss_doomwalker
();
158
}
Spells
Spells
Definition
BattlegroundIC.h:645
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
TypeID::TYPEID_PLAYER
@ TYPEID_PLAYER
Definition
Object.h:55
ScriptMgr.h
ScriptedCreature.h
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:527
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
SPELL_ENRAGE
@ SPELL_ENRAGE
Definition
alterac_valley.cpp:14
Events
Events
Definition
alterac_valley.cpp:40
EVENT_ENRAGE
@ EVENT_ENRAGE
Definition
alterac_valley.cpp:45
Texts
Texts
Definition
boss_alizabal.cpp:13
SAY_SLAY
@ SAY_SLAY
Definition
boss_alizabal.cpp:20
SAY_DEATH
#define SAY_DEATH
Definition
boss_commander_kolurg.cpp:30
SAY_AGGRO
#define SAY_AGGRO
Definition
boss_commander_kolurg.cpp:28
SPELL_ENRAGE
@ SPELL_ENRAGE
Definition
boss_doomwalker.cpp:24
SPELL_EARTHQUAKE
@ SPELL_EARTHQUAKE
Definition
boss_doomwalker.cpp:20
SPELL_MARK_DEATH
@ SPELL_MARK_DEATH
Definition
boss_doomwalker.cpp:25
SPELL_SUNDER_ARMOR
@ SPELL_SUNDER_ARMOR
Definition
boss_doomwalker.cpp:21
SPELL_AURA_DEATH
@ SPELL_AURA_DEATH
Definition
boss_doomwalker.cpp:26
SPELL_CHAIN_LIGHTNING
@ SPELL_CHAIN_LIGHTNING
Definition
boss_doomwalker.cpp:22
SPELL_OVERRUN
@ SPELL_OVERRUN
Definition
boss_doomwalker.cpp:23
SAY_DEATH
@ SAY_DEATH
Definition
boss_doomwalker.cpp:15
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_doomwalker.cpp:11
SAY_EARTHQUAKE
@ SAY_EARTHQUAKE
Definition
boss_doomwalker.cpp:12
SAY_OVERRUN
@ SAY_OVERRUN
Definition
boss_doomwalker.cpp:13
SAY_SLAY
@ SAY_SLAY
Definition
boss_doomwalker.cpp:14
AddSC_boss_doomwalker
void AddSC_boss_doomwalker()
Definition
boss_doomwalker.cpp:155
EVENT_ENRAGE
@ EVENT_ENRAGE
Definition
boss_doomwalker.cpp:31
EVENT_ARMOR
@ EVENT_ARMOR
Definition
boss_doomwalker.cpp:32
EVENT_OVERRUN
@ EVENT_OVERRUN
Definition
boss_doomwalker.cpp:35
EVENT_QUAKE
@ EVENT_QUAKE
Definition
boss_doomwalker.cpp:34
EVENT_CHAIN
@ EVENT_CHAIN
Definition
boss_doomwalker.cpp:33
SPELL_EARTHQUAKE
@ SPELL_EARTHQUAKE
Definition
boss_golemagg.cpp:28
EVENT_CHAIN
@ EVENT_CHAIN
Definition
boss_kelthuzad.cpp:47
SPELL_SUNDER_ARMOR
@ SPELL_SUNDER_ARMOR
Definition
boss_prince_malchezaar.cpp:71
EVENT_QUAKE
@ EVENT_QUAKE
Definition
boss_the_lich_king.cpp:205
SPELL_CHAIN_LIGHTNING
@ SPELL_CHAIN_LIGHTNING
Definition
bosses_opera.cpp:73
CreatureAI
Definition
CreatureAI.h:54
CreatureAI::Talk
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
Definition
CreatureAI.cpp:28
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
EventMap
Definition
CreatureAIImpl.h:304
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
UnitAI::SelectTarget
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition
UnitAI.cpp:66
UnitAI::DoCastVictim
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:168
Unit
Definition
Unit.h:1367
boss_doomwalker
Definition
boss_doomwalker.cpp:39
boss_doomwalker::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_doomwalker.cpp:149
boss_doomwalker::boss_doomwalker
boss_doomwalker()
Definition
boss_doomwalker.cpp:41
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::HealthAbovePct
bool HealthAbovePct(uint32 pct) const
Definition
ScriptedCreature.h:251
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
boss_doomwalker::boss_doomwalkerAI
Definition
boss_doomwalker.cpp:44
boss_doomwalker::boss_doomwalkerAI::KilledUnit
void KilledUnit(Unit *victim) OVERRIDE
Definition
boss_doomwalker.cpp:60
boss_doomwalker::boss_doomwalkerAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_doomwalker.cpp:75
boss_doomwalker::boss_doomwalkerAI::Reset
void Reset() OVERRIDE
Definition
boss_doomwalker.cpp:49
boss_doomwalker::boss_doomwalkerAI::MoveInLineOfSight
void MoveInLineOfSight(Unit *who) OVERRIDE
Definition
boss_doomwalker.cpp:80
boss_doomwalker::boss_doomwalkerAI::_events
EventMap _events
Definition
boss_doomwalker.cpp:145
boss_doomwalker::boss_doomwalkerAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_doomwalker.cpp:88
boss_doomwalker::boss_doomwalkerAI::_inEnrage
bool _inEnrage
Definition
boss_doomwalker.cpp:146
boss_doomwalker::boss_doomwalkerAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_doomwalker.cpp:70
boss_doomwalker::boss_doomwalkerAI::boss_doomwalkerAI
boss_doomwalkerAI(Creature *creature)
Definition
boss_doomwalker.cpp:45
src
server
scripts
Outland
boss_doomwalker.cpp
Generated on
for Project SkyFire Core by
1.17.0