Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_patchwerk.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
#include "
naxxramas.h
"
9
10
enum
Spells
11
{
12
SPELL_HATEFUL_STRIKE
= 41926,
13
H_SPELL_HATEFUL_STRIKE
= 59192,
14
SPELL_FRENZY
= 28131,
15
SPELL_BERSERK
= 26662,
16
SPELL_SLIME_BOLT
= 32309
17
};
18
19
enum
Yells
20
{
21
SAY_AGGRO
= 0,
22
SAY_SLAY
= 1,
23
SAY_DEATH
= 2,
24
EMOTE_BERSERK
= 3,
25
EMOTE_ENRAGE
= 4
26
};
27
28
enum
Events
29
{
30
EVENT_NONE
,
31
EVENT_BERSERK
,
32
EVENT_HATEFUL
,
33
EVENT_SLIME
34
};
35
36
enum
Misc
37
{
38
ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT
= 10286
39
};
40
41
class
boss_patchwerk
:
public
CreatureScript
42
{
43
public
:
44
boss_patchwerk
() :
CreatureScript
(
"boss_patchwerk"
) { }
45
46
struct
boss_patchwerkAI
:
public
BossAI
47
{
48
boss_patchwerkAI
(
Creature
* creature) :
BossAI
(creature,
BOSS_PATCHWERK
)
49
{
50
Enraged
=
false
;
51
}
52
53
void
Reset
()
OVERRIDE
54
{
55
_Reset
();
56
57
if
(
instance
)
58
instance
->DoStopTimedAchievement(
ACHIEVEMENT_TIMED_TYPE_EVENT
,
ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT
);
59
}
60
61
void
KilledUnit
(
Unit
*
/*Victim*/
)
OVERRIDE
62
{
63
if
(!(rand()%5))
64
Talk
(
SAY_SLAY
);
65
}
66
67
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
68
{
69
_JustDied
();
70
Talk
(
SAY_DEATH
);
71
}
72
73
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
74
{
75
_EnterCombat
();
76
Enraged
=
false
;
77
Talk
(
SAY_AGGRO
);
78
events
.ScheduleEvent(
EVENT_HATEFUL
, 1000);
79
events
.ScheduleEvent(
EVENT_BERSERK
, 360000);
80
81
if
(
instance
)
82
instance
->DoStartTimedAchievement(
ACHIEVEMENT_TIMED_TYPE_EVENT
,
ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT
);
83
}
84
85
void
UpdateAI
(
uint32
diff)
OVERRIDE
86
{
87
if
(!
UpdateVictim
())
88
return
;
89
90
events
.Update(diff);
91
92
while
(
uint32
eventId =
events
.ExecuteEvent())
93
{
94
switch
(eventId)
95
{
96
case
EVENT_HATEFUL
:
97
{
98
//Cast Hateful strike on the player with the highest
99
//amount of HP within melee distance
100
uint32
MostHP = 0;
101
Unit
* pMostHPTarget = NULL;
102
std::list<HostileReference*>::const_iterator i =
me
->getThreatManager().getThreatList().begin();
103
for
(; i !=
me
->getThreatManager().getThreatList().end(); ++i)
104
{
105
Unit
* target = (*i)->getTarget();
106
if
(target->
IsAlive
() && target !=
me
->GetVictim() && target->
GetHealth
() > MostHP &&
me
->IsWithinMeleeRange(target))
107
{
108
MostHP = target->
GetHealth
();
109
pMostHPTarget = target;
110
}
111
}
112
113
if
(!pMostHPTarget)
114
pMostHPTarget =
me
->GetVictim();
115
116
DoCast
(pMostHPTarget,
RAID_MODE
(
SPELL_HATEFUL_STRIKE
,
H_SPELL_HATEFUL_STRIKE
),
true
);
117
118
events
.ScheduleEvent(
EVENT_HATEFUL
, 1000);
119
break
;
120
}
121
case
EVENT_BERSERK
:
122
DoCast
(
me
,
SPELL_BERSERK
,
true
);
123
Talk
(
EMOTE_BERSERK
);
124
events
.ScheduleEvent(
EVENT_SLIME
, 2000);
125
break
;
126
case
EVENT_SLIME
:
127
DoCastVictim
(
SPELL_SLIME_BOLT
,
true
);
128
events
.ScheduleEvent(
EVENT_SLIME
, 2000);
129
break
;
130
}
131
}
132
133
if
(!
Enraged
&&
HealthBelowPct
(5))
134
{
135
DoCast
(
me
,
SPELL_FRENZY
,
true
);
136
Talk
(
EMOTE_ENRAGE
);
137
Enraged
=
true
;
138
}
139
140
DoMeleeAttackIfReady
();
141
}
142
143
private
:
144
bool
Enraged
;
145
};
146
147
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
148
{
149
return
new
boss_patchwerkAI
(creature);
150
}
151
};
152
153
void
AddSC_boss_patchwerk
()
154
{
155
new
boss_patchwerk
();
156
}
Spells
Spells
Definition
BattlegroundIC.h:645
ACHIEVEMENT_TIMED_TYPE_EVENT
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition
DBCEnums.h:158
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
ScriptMgr.h
ScriptedCreature.h
Events
Events
Definition
alterac_valley.cpp:40
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_FRENZY
@ SPELL_FRENZY
Definition
boss_drekthar.cpp:14
EVENT_NONE
@ EVENT_NONE
Definition
boss_felmyst.cpp:84
SPELL_BERSERK
#define SPELL_BERSERK
Definition
boss_four_horsemen.cpp:62
EMOTE_ENRAGE
@ EMOTE_ENRAGE
Definition
boss_herod.cpp:23
EMOTE_BERSERK
@ EMOTE_BERSERK
Definition
boss_huhuran.cpp:19
Misc
Misc
Definition
boss_occuthar.cpp:37
EVENT_BERSERK
@ EVENT_BERSERK
Definition
boss_occuthar.cpp:31
ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT
@ ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT
Definition
boss_patchwerk.cpp:38
SAY_DEATH
@ SAY_DEATH
Definition
boss_patchwerk.cpp:23
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_patchwerk.cpp:21
EMOTE_ENRAGE
@ EMOTE_ENRAGE
Definition
boss_patchwerk.cpp:25
SAY_SLAY
@ SAY_SLAY
Definition
boss_patchwerk.cpp:22
EMOTE_BERSERK
@ EMOTE_BERSERK
Definition
boss_patchwerk.cpp:24
H_SPELL_HATEFUL_STRIKE
@ H_SPELL_HATEFUL_STRIKE
Definition
boss_patchwerk.cpp:13
SPELL_SLIME_BOLT
@ SPELL_SLIME_BOLT
Definition
boss_patchwerk.cpp:16
SPELL_FRENZY
@ SPELL_FRENZY
Definition
boss_patchwerk.cpp:14
SPELL_HATEFUL_STRIKE
@ SPELL_HATEFUL_STRIKE
Definition
boss_patchwerk.cpp:12
SPELL_BERSERK
@ SPELL_BERSERK
Definition
boss_patchwerk.cpp:15
AddSC_boss_patchwerk
void AddSC_boss_patchwerk()
Definition
boss_patchwerk.cpp:153
EVENT_SLIME
@ EVENT_SLIME
Definition
boss_patchwerk.cpp:33
EVENT_BERSERK
@ EVENT_BERSERK
Definition
boss_patchwerk.cpp:31
EVENT_HATEFUL
@ EVENT_HATEFUL
Definition
boss_patchwerk.cpp:32
BossAI::instance
InstanceScript *const instance
Definition
ScriptedCreature.h:383
BossAI::events
EventMap events
Definition
ScriptedCreature.h:439
BossAI::BossAI
BossAI(Creature *creature, uint32 bossId)
Definition
ScriptedCreature.cpp:456
BossAI::_JustDied
void _JustDied()
Definition
ScriptedCreature.cpp:474
BossAI::_Reset
void _Reset()
Definition
ScriptedCreature.cpp:462
BossAI::_EnterCombat
void _EnterCombat()
Definition
ScriptedCreature.cpp:485
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
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
UnitAI::DoCastVictim
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:168
Unit
Definition
Unit.h:1367
Unit::IsAlive
bool IsAlive() const
Definition
Unit.h:2032
Unit::GetHealth
uint32 GetHealth() const
Definition
Unit.h:1600
boss_patchwerk
Definition
boss_patchwerk.cpp:42
boss_patchwerk::boss_patchwerk
boss_patchwerk()
Definition
boss_patchwerk.cpp:44
boss_patchwerk::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_patchwerk.cpp:147
naxxramas.h
BOSS_PATCHWERK
@ BOSS_PATCHWERK
Definition
naxxramas.h:19
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::HealthBelowPct
bool HealthBelowPct(uint32 pct) const
Definition
ScriptedCreature.h:247
ScriptedAI::RAID_MODE
const T & RAID_MODE(const T &normal10, const T &normal25) const
Definition
ScriptedCreature.h:310
Yells
Definition
boss_illidan.cpp:256
boss_patchwerk::boss_patchwerkAI
Definition
boss_patchwerk.cpp:47
boss_patchwerk::boss_patchwerkAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_patchwerk.cpp:85
boss_patchwerk::boss_patchwerkAI::KilledUnit
void KilledUnit(Unit *) OVERRIDE
Definition
boss_patchwerk.cpp:61
boss_patchwerk::boss_patchwerkAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_patchwerk.cpp:73
boss_patchwerk::boss_patchwerkAI::boss_patchwerkAI
boss_patchwerkAI(Creature *creature)
Definition
boss_patchwerk.cpp:48
boss_patchwerk::boss_patchwerkAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_patchwerk.cpp:67
boss_patchwerk::boss_patchwerkAI::Enraged
bool Enraged
Definition
boss_patchwerk.cpp:144
boss_patchwerk::boss_patchwerkAI::Reset
void Reset() OVERRIDE
Definition
boss_patchwerk.cpp:53
src
server
scripts
Northrend
Naxxramas
boss_patchwerk.cpp
Generated on
for Project SkyFire Core by
1.17.0