Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_heigan.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 "
SpellScript.h
"
9
#include "
naxxramas.h
"
10
#include "
Player.h
"
11
12
enum
Heigan
13
{
14
SPELL_DECREPIT_FEVER
= 29998,
// 25-man: 55011
15
SPELL_SPELL_DISRUPTION
= 29310,
16
SPELL_PLAGUE_CLOUD
= 29350,
17
18
SAY_AGGRO
= 0,
19
SAY_SLAY
= 1,
20
SAY_TAUNT
= 2,
21
SAY_DEATH
= 3
22
};
23
24
enum
Events
25
{
26
EVENT_NONE
,
27
EVENT_DISRUPT
,
28
EVENT_FEVER
,
29
EVENT_ERUPT
,
30
EVENT_PHASE
,
31
};
32
33
enum
Phases
34
{
35
PHASE_FIGHT
= 1,
36
PHASE_DANCE
,
37
};
38
39
enum
Misc
40
{
41
ACTION_SAFETY_DANCE_FAIL
= 1,
42
DATA_SAFETY_DANCE
= 19962139
43
};
44
45
class
boss_heigan
:
public
CreatureScript
46
{
47
public
:
48
boss_heigan
() :
CreatureScript
(
"boss_heigan"
) { }
49
50
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
51
{
52
return
new
boss_heiganAI
(creature);
53
}
54
55
struct
boss_heiganAI
:
public
BossAI
56
{
57
boss_heiganAI
(
Creature
* creature) :
BossAI
(creature,
BOSS_HEIGAN
) { }
58
59
uint32
eruptSection
;
60
bool
eruptDirection
;
61
bool
safetyDance
;
62
Phases
phase
;
63
64
void
KilledUnit
(
Unit
* who)
OVERRIDE
65
{
66
if
(!(rand()%5))
67
Talk
(
SAY_SLAY
);
68
if
(who->GetTypeId() ==
TypeID::TYPEID_PLAYER
)
69
safetyDance
=
false
;
70
}
71
72
void
SetData
(
uint32
id
,
uint32
data)
OVERRIDE
73
{
74
if
(
id
==
DATA_SAFETY_DANCE
)
75
safetyDance
= data ? true :
false
;
76
}
77
78
uint32
GetData
(
uint32
type)
const
OVERRIDE
79
{
80
if
(type ==
DATA_SAFETY_DANCE
)
81
return
safetyDance
? 1 : 0;
82
83
return
0;
84
}
85
86
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
87
{
88
_JustDied
();
89
Talk
(
SAY_DEATH
);
90
}
91
92
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
93
{
94
_EnterCombat
();
95
Talk
(
SAY_AGGRO
);
96
EnterPhase
(
PHASE_FIGHT
);
97
safetyDance
=
true
;
98
}
99
100
void
EnterPhase
(
Phases
newPhase)
101
{
102
phase
= newPhase;
103
events
.Reset();
104
eruptSection
= 3;
105
if
(
phase
==
PHASE_FIGHT
)
106
{
107
events
.ScheduleEvent(
EVENT_DISRUPT
, std::rand() % 25000 + 10000);
108
events
.ScheduleEvent(
EVENT_FEVER
, std::rand() % 20000 + 15000);
109
events
.ScheduleEvent(
EVENT_PHASE
, 90000);
110
events
.ScheduleEvent(
EVENT_ERUPT
, 15000);
111
me
->GetMotionMaster()->MoveChase(
me
->GetVictim());
112
}
113
else
114
{
115
float
x, y, z, o;
116
me
->GetHomePosition(x, y, z, o);
117
me
->NearTeleportTo(x, y, z, o - G3D::halfPi());
118
me
->GetMotionMaster()->Clear();
119
me
->GetMotionMaster()->MoveIdle();
120
me
->SetTarget(0);
121
DoCastAOE
(
SPELL_PLAGUE_CLOUD
);
122
events
.ScheduleEvent(
EVENT_PHASE
, 45000);
123
events
.ScheduleEvent(
EVENT_ERUPT
, 8000);
124
}
125
}
126
127
void
UpdateAI
(
uint32
diff)
OVERRIDE
128
{
129
if
(!
UpdateVictim
() || !
CheckInRoom
())
130
return
;
131
132
events
.Update(diff);
133
134
while
(
uint32
eventId =
events
.ExecuteEvent())
135
{
136
switch
(eventId)
137
{
138
case
EVENT_DISRUPT
:
139
DoCastAOE
(
SPELL_SPELL_DISRUPTION
);
140
events
.ScheduleEvent(
EVENT_DISRUPT
, std::rand() % 10000 + 5000);
141
break
;
142
case
EVENT_FEVER
:
143
DoCastAOE
(
SPELL_DECREPIT_FEVER
);
144
events
.ScheduleEvent(
EVENT_FEVER
, std::rand() % 25000 + 20000);
145
break
;
146
case
EVENT_PHASE
:
148
EnterPhase
(
phase
==
PHASE_FIGHT
?
PHASE_DANCE
:
PHASE_FIGHT
);
149
break
;
150
case
EVENT_ERUPT
:
151
instance
->SetData(
DATA_HEIGAN_ERUPT
,
eruptSection
);
152
TeleportCheaters
();
153
154
if
(
eruptSection
== 0)
155
eruptDirection
=
true
;
156
else
if
(
eruptSection
== 3)
157
eruptDirection
=
false
;
158
159
eruptDirection
? ++
eruptSection
: --
eruptSection
;
160
161
events
.ScheduleEvent(
EVENT_ERUPT
,
phase
==
PHASE_FIGHT
? 10000 : 3000);
162
break
;
163
}
164
}
165
166
DoMeleeAttackIfReady
();
167
}
168
};
169
};
170
171
class
spell_heigan_eruption
:
public
SpellScriptLoader
172
{
173
public
:
174
spell_heigan_eruption
() :
SpellScriptLoader
(
"spell_heigan_eruption"
) { }
175
176
class
spell_heigan_eruption_SpellScript
:
public
SpellScript
177
{
178
PrepareSpellScript
(
spell_heigan_eruption_SpellScript
);
179
180
void
HandleScript
(
SpellEffIndex
/*eff*/
)
181
{
182
Unit
* caster =
GetCaster
();
183
if
(!caster || !
GetHitPlayer
())
184
return
;
185
186
if
(
GetHitDamage
() >=
int32
(
GetHitPlayer
()->GetHealth()))
187
if
(
InstanceScript
* instance = caster->
GetInstanceScript
())
188
if
(
Creature
*
Heigan
=
ObjectAccessor::GetCreature
(*caster, instance->GetData64(
DATA_HEIGAN
)))
189
Heigan
->AI()->SetData(
DATA_SAFETY_DANCE
, 0);
190
}
191
192
void
Register
()
OVERRIDE
193
{
194
OnEffectHitTarget
+=
SpellEffectFn
(
spell_heigan_eruption_SpellScript::HandleScript
,
EFFECT_0
,
SPELL_EFFECT_SCHOOL_DAMAGE
);
195
}
196
};
197
198
SpellScript
*
GetSpellScript
() const
OVERRIDE
199
{
200
return
new
spell_heigan_eruption_SpellScript
();
201
}
202
};
203
204
class
achievement_safety_dance
:
public
AchievementCriteriaScript
205
{
206
public
:
207
achievement_safety_dance
() :
AchievementCriteriaScript
(
"achievement_safety_dance"
)
208
{
209
}
210
211
bool
OnCheck
(
Player
*
/*player*/
,
Unit
* target)
OVERRIDE
212
{
213
if
(!target)
214
return
false
;
215
216
if
(
Creature
*
Heigan
= target->ToCreature())
217
if
(
Heigan
->AI()->GetData(
DATA_SAFETY_DANCE
))
218
return
true
;
219
220
return
false
;
221
}
222
};
223
224
void
AddSC_boss_heigan
()
225
{
226
new
boss_heigan
();
227
new
spell_heigan_eruption
();
228
new
achievement_safety_dance
();
229
}
int32
std::int32_t int32
Definition
Define.h:73
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
Player.h
ScriptMgr.h
ScriptedCreature.h
SpellEffIndex
SpellEffIndex
Definition
SharedDefines.h:17
EFFECT_0
@ EFFECT_0
Definition
SharedDefines.h:18
SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition
SharedDefines.h:890
SpellScript.h
SpellEffectFn
#define SpellEffectFn(F, I, N)
Definition
SpellScript.h:269
Events
Events
Definition
alterac_valley.cpp:40
SAY_SLAY
@ SAY_SLAY
Definition
boss_alizabal.cpp:20
Phases
Phases
Definition
boss_anraphet.cpp:80
SAY_DEATH
#define SAY_DEATH
Definition
boss_commander_kolurg.cpp:30
SAY_AGGRO
#define SAY_AGGRO
Definition
boss_commander_kolurg.cpp:28
EVENT_NONE
@ EVENT_NONE
Definition
boss_felmyst.cpp:84
SAY_TAUNT
@ SAY_TAUNT
Definition
boss_four_horsemen.cpp:67
ACTION_SAFETY_DANCE_FAIL
@ ACTION_SAFETY_DANCE_FAIL
Definition
boss_heigan.cpp:41
DATA_SAFETY_DANCE
@ DATA_SAFETY_DANCE
Definition
boss_heigan.cpp:42
Heigan
Heigan
Definition
boss_heigan.cpp:13
SAY_DEATH
@ SAY_DEATH
Definition
boss_heigan.cpp:21
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_heigan.cpp:18
SPELL_SPELL_DISRUPTION
@ SPELL_SPELL_DISRUPTION
Definition
boss_heigan.cpp:15
SPELL_PLAGUE_CLOUD
@ SPELL_PLAGUE_CLOUD
Definition
boss_heigan.cpp:16
SAY_SLAY
@ SAY_SLAY
Definition
boss_heigan.cpp:19
SPELL_DECREPIT_FEVER
@ SPELL_DECREPIT_FEVER
Definition
boss_heigan.cpp:14
AddSC_boss_heigan
void AddSC_boss_heigan()
Definition
boss_heigan.cpp:224
Phases
Phases
Definition
boss_heigan.cpp:34
PHASE_FIGHT
@ PHASE_FIGHT
Definition
boss_heigan.cpp:35
PHASE_DANCE
@ PHASE_DANCE
Definition
boss_heigan.cpp:36
EVENT_ERUPT
@ EVENT_ERUPT
Definition
boss_heigan.cpp:29
EVENT_FEVER
@ EVENT_FEVER
Definition
boss_heigan.cpp:28
EVENT_DISRUPT
@ EVENT_DISRUPT
Definition
boss_heigan.cpp:27
EVENT_PHASE
@ EVENT_PHASE
Definition
boss_heigan.cpp:30
Misc
Misc
Definition
boss_occuthar.cpp:37
AchievementCriteriaScript::AchievementCriteriaScript
AchievementCriteriaScript(const char *name)
Definition
ScriptMgr.cpp:1508
BossAI::instance
InstanceScript *const instance
Definition
ScriptedCreature.h:383
BossAI::TeleportCheaters
void TeleportCheaters()
Definition
ScriptedCreature.cpp:501
BossAI::CheckInRoom
bool CheckInRoom()
Definition
ScriptedCreature.h:427
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::_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
InstanceScript
Definition
InstanceScript.h:123
ObjectAccessor::GetCreature
static Creature * GetCreature(WorldObject const &u, uint64 guid)
Definition
ObjectAccessor.cpp:209
Player
Definition
Player.h:1289
SpellScript
Definition
SpellScript.h:139
SpellScript::GetHitPlayer
Player * GetHitPlayer()
Definition
SpellScript.cpp:422
SpellScript::OnEffectHitTarget
HookList< EffectHandler > OnEffectHitTarget
Definition
SpellScript.h:268
SpellScript::GetCaster
Unit * GetCaster()
Definition
SpellScript.cpp:352
SpellScript::GetHitDamage
int32 GetHitDamage()
Definition
SpellScript.cpp:465
SpellScriptLoader::SpellScriptLoader
SpellScriptLoader(const char *name)
Definition
ScriptMgr.cpp:1372
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
UnitAI::DoCastAOE
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:176
Unit
Definition
Unit.h:1367
WorldObject::GetInstanceScript
InstanceScript * GetInstanceScript()
Definition
Object.cpp:1612
achievement_safety_dance
Definition
boss_heigan.cpp:205
achievement_safety_dance::achievement_safety_dance
achievement_safety_dance()
Definition
boss_heigan.cpp:207
achievement_safety_dance::OnCheck
bool OnCheck(Player *, Unit *target) OVERRIDE
Definition
boss_heigan.cpp:211
boss_heigan
Definition
boss_heigan.cpp:46
boss_heigan::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_heigan.cpp:50
boss_heigan::boss_heigan
boss_heigan()
Definition
boss_heigan.cpp:48
spell_heigan_eruption::spell_heigan_eruption_SpellScript
Definition
boss_heigan.cpp:177
spell_heigan_eruption::spell_heigan_eruption_SpellScript::Register
void Register() OVERRIDE
Definition
boss_heigan.cpp:192
spell_heigan_eruption::spell_heigan_eruption_SpellScript::PrepareSpellScript
PrepareSpellScript(spell_heigan_eruption_SpellScript)
spell_heigan_eruption::spell_heigan_eruption_SpellScript::HandleScript
void HandleScript(SpellEffIndex)
Definition
boss_heigan.cpp:180
spell_heigan_eruption
Definition
boss_heigan.cpp:172
spell_heigan_eruption::spell_heigan_eruption
spell_heigan_eruption()
Definition
boss_heigan.cpp:174
spell_heigan_eruption::GetSpellScript
SpellScript * GetSpellScript() const OVERRIDE
Definition
boss_heigan.cpp:198
naxxramas.h
DATA_HEIGAN
@ DATA_HEIGAN
Definition
naxxramas.h:51
BOSS_HEIGAN
@ BOSS_HEIGAN
Definition
naxxramas.h:17
DATA_HEIGAN_ERUPT
@ DATA_HEIGAN_ERUPT
Definition
naxxramas.h:32
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
boss_heigan::boss_heiganAI
Definition
boss_heigan.cpp:56
boss_heigan::boss_heiganAI::boss_heiganAI
boss_heiganAI(Creature *creature)
Definition
boss_heigan.cpp:57
boss_heigan::boss_heiganAI::phase
Phases phase
Definition
boss_heigan.cpp:62
boss_heigan::boss_heiganAI::safetyDance
bool safetyDance
Definition
boss_heigan.cpp:61
boss_heigan::boss_heiganAI::GetData
uint32 GetData(uint32 type) const OVERRIDE
Definition
boss_heigan.cpp:78
boss_heigan::boss_heiganAI::eruptSection
uint32 eruptSection
Definition
boss_heigan.cpp:59
boss_heigan::boss_heiganAI::KilledUnit
void KilledUnit(Unit *who) OVERRIDE
Definition
boss_heigan.cpp:64
boss_heigan::boss_heiganAI::eruptDirection
bool eruptDirection
Definition
boss_heigan.cpp:60
boss_heigan::boss_heiganAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_heigan.cpp:92
boss_heigan::boss_heiganAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_heigan.cpp:86
boss_heigan::boss_heiganAI::SetData
void SetData(uint32 id, uint32 data) OVERRIDE
Definition
boss_heigan.cpp:72
boss_heigan::boss_heiganAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_heigan.cpp:127
boss_heigan::boss_heiganAI::EnterPhase
void EnterPhase(Phases newPhase)
Definition
boss_heigan.cpp:100
src
server
scripts
Northrend
Naxxramas
boss_heigan.cpp
Generated on
for Project SkyFire Core by
1.17.0