Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_pit_lord_argaloth.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 "
baradin_hold.h
"
10
11
/* TODO:
12
- Fel Firestorm need completion
13
- Need Correct timer
14
*/
15
16
enum
Spells
17
{
18
SPELL_METEOR_SLASH
= 88942,
19
SPELL_CONSUMING_DARKNESS
= 88954,
20
SPELL_FEL_FIRESTORM
= 88972,
21
SPELL_BERSERK
= 47008
22
};
23
24
enum
Events
25
{
26
EVENT_METEOR_SLASH
= 1,
27
EVENT_CONSUMING_DARKNESS
= 2,
28
EVENT_BERSERK
= 3
29
};
30
31
class
boss_pit_lord_argaloth
:
public
CreatureScript
32
{
33
public
:
34
boss_pit_lord_argaloth
() :
CreatureScript
(
"boss_pit_lord_argaloth"
) { }
35
36
struct
boss_pit_lord_argalothAI
:
public
BossAI
37
{
38
boss_pit_lord_argalothAI
(
Creature
* creature) :
BossAI
(creature,
DATA_ARGALOTH
) { }
39
40
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
41
{
42
_EnterCombat
();
43
instance
->SendEncounterUnit(
ENCOUNTER_FRAME_ENGAGE
,
me
);
44
events
.ScheduleEvent(
EVENT_METEOR_SLASH
, std::rand() % (20 *
IN_MILLISECONDS
) + (10 *
IN_MILLISECONDS
));
45
events
.ScheduleEvent(
EVENT_CONSUMING_DARKNESS
, std::rand() % (25 *
IN_MILLISECONDS
) + (20 *
IN_MILLISECONDS
));
46
events
.ScheduleEvent(
EVENT_BERSERK
, 5 *
MINUTE
*
IN_MILLISECONDS
);
47
}
48
49
void
EnterEvadeMode
()
OVERRIDE
50
{
51
me
->GetMotionMaster()->MoveTargetedHome();
52
instance
->SendEncounterUnit(
ENCOUNTER_FRAME_DISENGAGE
,
me
);
53
_DespawnAtEvade
();
54
}
55
56
void
DamageTaken
(
Unit
*
/*attacker*/
,
uint32
& damage)
OVERRIDE
57
{
58
if
(
me
->HealthBelowPctDamaged(33, damage) ||
59
me
->HealthBelowPctDamaged(66, damage))
60
{
61
DoCastAOE
(
SPELL_FEL_FIRESTORM
);
62
}
63
}
64
65
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
66
{
67
_JustDied
();
68
instance
->SendEncounterUnit(
ENCOUNTER_FRAME_DISENGAGE
,
me
);
69
}
70
71
void
UpdateAI
(
uint32
diff)
OVERRIDE
72
{
73
if
(!
UpdateVictim
())
74
return
;
75
76
events
.Update(diff);
77
78
if
(
me
->HasUnitState(
UNIT_STATE_CASTING
))
79
return
;
80
81
while
(
uint32
eventId =
events
.ExecuteEvent())
82
{
83
switch
(eventId)
84
{
85
case
EVENT_METEOR_SLASH
:
86
DoCastAOE
(
SPELL_METEOR_SLASH
);
87
events
.ScheduleEvent(
EVENT_METEOR_SLASH
, std::rand() % (20 *
IN_MILLISECONDS
) + (15 *
IN_MILLISECONDS
));
88
break
;
89
case
EVENT_CONSUMING_DARKNESS
:
90
DoCastAOE
(
SPELL_CONSUMING_DARKNESS
,
true
);
91
events
.ScheduleEvent(
EVENT_CONSUMING_DARKNESS
, std::rand() % (25 *
IN_MILLISECONDS
) + (20 *
IN_MILLISECONDS
));
92
break
;
93
case
EVENT_BERSERK
:
94
DoCast
(
me
,
SPELL_BERSERK
,
true
);
95
break
;
96
default
:
97
break
;
98
}
99
}
100
101
DoMeleeAttackIfReady
();
102
}
103
};
104
105
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
106
{
107
return
GetBaradinHoldAI<boss_pit_lord_argalothAI>
(creature);
108
}
109
};
110
111
// 88954 / 95173 - Consuming Darkness
112
class
spell_argaloth_consuming_darkness
:
public
SpellScriptLoader
113
{
114
public
:
115
spell_argaloth_consuming_darkness
() :
SpellScriptLoader
(
"spell_argaloth_consuming_darkness"
) { }
116
117
class
spell_argaloth_consuming_darkness_SpellScript
:
public
SpellScript
118
{
119
PrepareSpellScript
(
spell_argaloth_consuming_darkness_SpellScript
);
120
121
void
FilterTargets
(std::list<WorldObject*>& targets)
122
{
123
Skyfire::Containers::RandomResizeList
(targets,
GetCaster
()->GetMap()->Is25ManRaid() ? 8 : 3);
124
}
125
126
void
Register
()
OVERRIDE
127
{
128
OnObjectAreaTargetSelect
+=
SpellObjectAreaTargetSelectFn
(
spell_argaloth_consuming_darkness_SpellScript::FilterTargets
,
EFFECT_0
,
TARGET_UNIT_SRC_AREA_ENEMY
);
129
}
130
};
131
132
SpellScript
*
GetSpellScript
() const
OVERRIDE
133
{
134
return
new
spell_argaloth_consuming_darkness_SpellScript
();
135
}
136
};
137
138
// 88942 / 95172 - Meteor Slash
139
class
spell_argaloth_meteor_slash
:
public
SpellScriptLoader
140
{
141
public
:
142
spell_argaloth_meteor_slash
() :
SpellScriptLoader
(
"spell_argaloth_meteor_slash"
) { }
143
144
class
spell_argaloth_meteor_slash_SpellScript
:
public
SpellScript
145
{
146
PrepareSpellScript
(
spell_argaloth_meteor_slash_SpellScript
);
147
148
bool
Load
()
OVERRIDE
149
{
150
_targetCount
= 0;
151
return
true
;
152
}
153
154
void
CountTargets
(std::list<WorldObject*>& targets)
155
{
156
_targetCount
= targets.size();
157
}
158
159
void
SplitDamage
()
160
{
161
if
(!
_targetCount
)
162
return
;
163
164
SetHitDamage
(
GetHitDamage
() /
_targetCount
);
165
}
166
167
void
Register
()
OVERRIDE
168
{
169
OnObjectAreaTargetSelect
+=
SpellObjectAreaTargetSelectFn
(
spell_argaloth_meteor_slash_SpellScript::CountTargets
,
EFFECT_0
,
TARGET_UNIT_CONE_ENEMY_104
);
170
OnHit
+=
SpellHitFn
(
spell_argaloth_meteor_slash_SpellScript::SplitDamage
);
171
}
172
173
private
:
174
uint32
_targetCount
;
175
};
176
177
SpellScript
*
GetSpellScript
() const
OVERRIDE
178
{
179
return
new
spell_argaloth_meteor_slash_SpellScript
();
180
}
181
};
182
183
void
AddSC_boss_pit_lord_argaloth
()
184
{
185
new
boss_pit_lord_argaloth
();
186
new
spell_argaloth_consuming_darkness
();
187
new
spell_argaloth_meteor_slash
();
188
}
Spells
Spells
Definition
BattlegroundIC.h:645
IN_MILLISECONDS
@ IN_MILLISECONDS
Definition
Common.h:125
MINUTE
@ MINUTE
Definition
Common.h:119
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_DISENGAGE
Definition
InstanceScript.h:34
ENCOUNTER_FRAME_ENGAGE
@ ENCOUNTER_FRAME_ENGAGE
Definition
InstanceScript.h:33
ScriptMgr.h
ScriptedCreature.h
EFFECT_0
@ EFFECT_0
Definition
SharedDefines.h:18
TARGET_UNIT_CONE_ENEMY_104
@ TARGET_UNIT_CONE_ENEMY_104
Definition
SharedDefines.h:1709
TARGET_UNIT_SRC_AREA_ENEMY
@ TARGET_UNIT_SRC_AREA_ENEMY
Definition
SharedDefines.h:1621
SpellScript.h
SpellObjectAreaTargetSelectFn
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition
SpellScript.h:283
SpellHitFn
#define SpellHitFn(F)
Definition
SpellScript.h:278
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:527
Events
Events
Definition
alterac_valley.cpp:40
baradin_hold.h
GetBaradinHoldAI
CreatureAI * GetBaradinHoldAI(Creature *creature)
Definition
baradin_hold.h:43
DATA_ARGALOTH
@ DATA_ARGALOTH
Definition
baradin_hold.h:19
SPELL_BERSERK
#define SPELL_BERSERK
Definition
boss_four_horsemen.cpp:62
EVENT_BERSERK
@ EVENT_BERSERK
Definition
boss_occuthar.cpp:31
SPELL_CONSUMING_DARKNESS
@ SPELL_CONSUMING_DARKNESS
Definition
boss_pit_lord_argaloth.cpp:19
SPELL_FEL_FIRESTORM
@ SPELL_FEL_FIRESTORM
Definition
boss_pit_lord_argaloth.cpp:20
SPELL_BERSERK
@ SPELL_BERSERK
Definition
boss_pit_lord_argaloth.cpp:21
SPELL_METEOR_SLASH
@ SPELL_METEOR_SLASH
Definition
boss_pit_lord_argaloth.cpp:18
AddSC_boss_pit_lord_argaloth
void AddSC_boss_pit_lord_argaloth()
Definition
boss_pit_lord_argaloth.cpp:183
EVENT_CONSUMING_DARKNESS
@ EVENT_CONSUMING_DARKNESS
Definition
boss_pit_lord_argaloth.cpp:27
EVENT_METEOR_SLASH
@ EVENT_METEOR_SLASH
Definition
boss_pit_lord_argaloth.cpp:26
EVENT_BERSERK
@ EVENT_BERSERK
Definition
boss_pit_lord_argaloth.cpp:28
BossAI::instance
InstanceScript *const instance
Definition
ScriptedCreature.h:383
BossAI::_DespawnAtEvade
void _DespawnAtEvade()
Definition
ScriptedCreature.cpp:590
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::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
SpellScript
Definition
SpellScript.h:139
SpellScript::OnHit
HookList< HitHandler > OnHit
Definition
SpellScript.h:274
SpellScript::SetHitDamage
void SetHitDamage(int32 damage)
Definition
SpellScript.cpp:475
SpellScript::GetCaster
Unit * GetCaster()
Definition
SpellScript.cpp:352
SpellScript::OnObjectAreaTargetSelect
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition
SpellScript.h:282
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::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
UnitAI::DoCastAOE
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:176
Unit
Definition
Unit.h:1367
boss_pit_lord_argaloth
Definition
boss_pit_lord_argaloth.cpp:32
boss_pit_lord_argaloth::boss_pit_lord_argaloth
boss_pit_lord_argaloth()
Definition
boss_pit_lord_argaloth.cpp:34
boss_pit_lord_argaloth::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:105
spell_argaloth_consuming_darkness::spell_argaloth_consuming_darkness_SpellScript
Definition
boss_pit_lord_argaloth.cpp:118
spell_argaloth_consuming_darkness::spell_argaloth_consuming_darkness_SpellScript::Register
void Register() OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:126
spell_argaloth_consuming_darkness::spell_argaloth_consuming_darkness_SpellScript::PrepareSpellScript
PrepareSpellScript(spell_argaloth_consuming_darkness_SpellScript)
spell_argaloth_consuming_darkness::spell_argaloth_consuming_darkness_SpellScript::FilterTargets
void FilterTargets(std::list< WorldObject * > &targets)
Definition
boss_pit_lord_argaloth.cpp:121
spell_argaloth_consuming_darkness
Definition
boss_pit_lord_argaloth.cpp:113
spell_argaloth_consuming_darkness::GetSpellScript
SpellScript * GetSpellScript() const OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:132
spell_argaloth_consuming_darkness::spell_argaloth_consuming_darkness
spell_argaloth_consuming_darkness()
Definition
boss_pit_lord_argaloth.cpp:115
spell_argaloth_meteor_slash::spell_argaloth_meteor_slash_SpellScript
Definition
boss_pit_lord_argaloth.cpp:145
spell_argaloth_meteor_slash::spell_argaloth_meteor_slash_SpellScript::_targetCount
uint32 _targetCount
Definition
boss_pit_lord_argaloth.cpp:174
spell_argaloth_meteor_slash::spell_argaloth_meteor_slash_SpellScript::SplitDamage
void SplitDamage()
Definition
boss_pit_lord_argaloth.cpp:159
spell_argaloth_meteor_slash::spell_argaloth_meteor_slash_SpellScript::PrepareSpellScript
PrepareSpellScript(spell_argaloth_meteor_slash_SpellScript)
spell_argaloth_meteor_slash::spell_argaloth_meteor_slash_SpellScript::Load
bool Load() OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:148
spell_argaloth_meteor_slash::spell_argaloth_meteor_slash_SpellScript::CountTargets
void CountTargets(std::list< WorldObject * > &targets)
Definition
boss_pit_lord_argaloth.cpp:154
spell_argaloth_meteor_slash::spell_argaloth_meteor_slash_SpellScript::Register
void Register() OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:167
spell_argaloth_meteor_slash
Definition
boss_pit_lord_argaloth.cpp:140
spell_argaloth_meteor_slash::spell_argaloth_meteor_slash
spell_argaloth_meteor_slash()
Definition
boss_pit_lord_argaloth.cpp:142
spell_argaloth_meteor_slash::GetSpellScript
SpellScript * GetSpellScript() const OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:177
Skyfire::Containers::RandomResizeList
void RandomResizeList(std::list< T > &list, uint32 size)
Definition
Containers.h:19
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
boss_pit_lord_argaloth::boss_pit_lord_argalothAI::EnterEvadeMode
void EnterEvadeMode() OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:49
boss_pit_lord_argaloth::boss_pit_lord_argalothAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:65
boss_pit_lord_argaloth::boss_pit_lord_argalothAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_pit_lord_argaloth.cpp:71
boss_pit_lord_argaloth::boss_pit_lord_argalothAI::DamageTaken
void DamageTaken(Unit *, uint32 &damage) OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:56
boss_pit_lord_argaloth::boss_pit_lord_argalothAI::boss_pit_lord_argalothAI
boss_pit_lord_argalothAI(Creature *creature)
Definition
boss_pit_lord_argaloth.cpp:38
boss_pit_lord_argaloth::boss_pit_lord_argalothAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_pit_lord_argaloth.cpp:40
src
server
scripts
EasternKingdoms
BaradinHold
boss_pit_lord_argaloth.cpp
Generated on
for Project SkyFire Core by
1.17.0