Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_commander_sarannis.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 "
the_botanica.h
"
9
#include "
SpellScript.h
"
10
11
enum
Says
12
{
13
SAY_AGGRO
= 0,
14
SAY_KILL
= 1,
15
SAY_ARCANE_RESONANCE
= 2,
16
SAY_ARCANE_DEVASTATION
= 3,
17
EMOTE_SUMMON
= 4,
18
SAY_SUMMON
= 5,
19
SAY_DEATH
= 6
20
};
21
22
enum
Spells
23
{
24
SPELL_ARCANE_RESONANCE
= 34794,
25
SPELL_ARCANE_DEVASTATION
= 34799,
26
SPELL_SUMMON_REINFORCEMENTS
= 34803
27
};
28
29
enum
Events
30
{
31
EVENT_ARCANE_RESONANCE
= 1,
32
EVENT_ARCANE_DEVASTATION
= 2
33
};
34
35
class
boss_commander_sarannis
:
public
CreatureScript
36
{
37
public
:
38
boss_commander_sarannis
() :
CreatureScript
(
"boss_commander_sarannis"
) { }
39
40
struct
boss_commander_sarannisAI
:
public
BossAI
41
{
42
boss_commander_sarannisAI
(
Creature
* creature) :
BossAI
(creature,
DATA_COMMANDER_SARANNIS
) { }
43
44
void
Reset
()
OVERRIDE
45
{
46
_Reset
();
47
_phase
=
true
;
48
}
49
50
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
51
{
52
_EnterCombat
();
53
Talk
(
SAY_AGGRO
);
54
events
.ScheduleEvent(
EVENT_ARCANE_RESONANCE
, 42700);
55
events
.ScheduleEvent(
EVENT_ARCANE_DEVASTATION
, 15200);
56
}
57
58
void
KilledUnit
(
Unit
*
/*victim*/
)
OVERRIDE
59
{
60
Talk
(
SAY_KILL
);
61
}
62
63
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
64
{
65
_JustDied
();
66
Talk
(
SAY_DEATH
);
67
}
68
69
void
DamageTaken
(
Unit
*
/*killer*/
,
uint32
&damage)
OVERRIDE
70
{
71
if
(
me
->HealthBelowPctDamaged(50, damage) &&
_phase
)
72
{
73
_phase
=
false
;
74
Talk
(
EMOTE_SUMMON
);
75
Talk
(
SAY_SUMMON
);
76
DoCast
(
me
,
SPELL_SUMMON_REINFORCEMENTS
);
77
}
78
}
79
80
void
JustSummoned
(
Creature
* summon)
OVERRIDE
81
{
82
BossAI::JustSummoned
(summon);
83
}
84
85
void
UpdateAI
(
uint32
diff)
OVERRIDE
86
{
87
if
(!
UpdateVictim
())
88
return
;
89
90
events
.Update(diff);
91
92
if
(
me
->HasUnitState(
UNIT_STATE_CASTING
))
93
return
;
94
95
while
(
uint32
eventId =
events
.ExecuteEvent())
96
{
97
switch
(eventId)
98
{
99
case
EVENT_ARCANE_RESONANCE
:
100
Talk
(
SAY_ARCANE_RESONANCE
);
101
DoCastVictim
(
SPELL_ARCANE_RESONANCE
,
true
);
102
events
.ScheduleEvent(
EVENT_ARCANE_RESONANCE
, 42700);
103
break
;
104
case
EVENT_ARCANE_DEVASTATION
:
105
Talk
(
SAY_ARCANE_DEVASTATION
);
106
DoCastVictim
(
SPELL_ARCANE_DEVASTATION
,
true
);
107
events
.ScheduleEvent(
EVENT_ARCANE_DEVASTATION
, std::rand() % 19200 + 11000);
108
break
;
109
default
:
110
break
;
111
}
112
}
113
114
DoMeleeAttackIfReady
();
115
}
116
117
private
:
118
bool
_phase
;
119
};
120
121
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
122
{
123
return
new
boss_commander_sarannisAI
(creature);
124
}
125
};
126
127
Position
const
PosSummonReinforcements
[4] =
128
{
129
{ 160.4483f, 287.6435f, -3.887904f, 2.3841f },
130
{ 153.4406f, 289.9929f, -4.736916f, 2.3841f },
131
{ 154.4137f, 292.8956f, -4.683603f, 2.3841f },
132
{ 157.1544f, 294.2599f, -4.726504f, 2.3841f }
133
};
134
135
enum
Creatures
136
{
137
NPC_SUMMONED_BLOODWARDER_MENDER
= 20083,
138
NPC_SUMMONED_BLOODWARDER_RESERVIST
= 20078
139
};
140
141
class
spell_commander_sarannis_summon_reinforcements
:
public
SpellScriptLoader
142
{
143
public
:
144
spell_commander_sarannis_summon_reinforcements
() :
SpellScriptLoader
(
"spell_commander_sarannis_summon_reinforcements"
) { }
145
146
class
spell_commander_sarannis_summon_reinforcements_SpellScript
:
public
SpellScript
147
{
148
PrepareSpellScript
(
spell_commander_sarannis_summon_reinforcements_SpellScript
);
149
150
void
HandleCast
(
SpellEffIndex
/*effIndex*/
)
151
{
152
GetCaster
()->
SummonCreature
(
NPC_SUMMONED_BLOODWARDER_MENDER
,
PosSummonReinforcements
[0],
TempSummonType::TEMPSUMMON_CORPSE_DESPAWN
);
153
GetCaster
()->
SummonCreature
(
NPC_SUMMONED_BLOODWARDER_RESERVIST
,
PosSummonReinforcements
[1],
TempSummonType::TEMPSUMMON_CORPSE_DESPAWN
);
154
GetCaster
()->
SummonCreature
(
NPC_SUMMONED_BLOODWARDER_RESERVIST
,
PosSummonReinforcements
[2],
TempSummonType::TEMPSUMMON_CORPSE_DESPAWN
);
155
if
(
GetCaster
()->GetMap()->IsHeroic())
156
GetCaster
()->
SummonCreature
(
NPC_SUMMONED_BLOODWARDER_RESERVIST
,
PosSummonReinforcements
[3],
TempSummonType::TEMPSUMMON_CORPSE_DESPAWN
);
157
}
158
159
void
Register
()
OVERRIDE
160
{
161
OnEffectHitTarget
+=
SpellEffectFn
(
spell_commander_sarannis_summon_reinforcements_SpellScript::HandleCast
,
EFFECT_0
,
SPELL_EFFECT_DUMMY
);
162
}
163
};
164
165
SpellScript
*
GetSpellScript
() const
OVERRIDE
166
{
167
return
new
spell_commander_sarannis_summon_reinforcements_SpellScript
();
168
}
169
};
170
171
void
AddSC_boss_commander_sarannis
()
172
{
173
new
boss_commander_sarannis
();
174
new
spell_commander_sarannis_summon_reinforcements
();
175
}
Spells
Spells
Definition
BattlegroundIC.h:645
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
TempSummonType::TEMPSUMMON_CORPSE_DESPAWN
@ TEMPSUMMON_CORPSE_DESPAWN
Definition
Object.h:72
ScriptMgr.h
ScriptedCreature.h
SpellEffIndex
SpellEffIndex
Definition
SharedDefines.h:17
EFFECT_0
@ EFFECT_0
Definition
SharedDefines.h:18
SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_DUMMY
Definition
SharedDefines.h:891
SpellScript.h
SpellEffectFn
#define SpellEffectFn(F, I, N)
Definition
SpellScript.h:269
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:527
Creatures
Creatures
Definition
alterac_valley.cpp:28
Events
Events
Definition
alterac_valley.cpp:40
SAY_DEATH
#define SAY_DEATH
Definition
boss_commander_kolurg.cpp:30
SAY_AGGRO
#define SAY_AGGRO
Definition
boss_commander_kolurg.cpp:28
SAY_KILL
#define SAY_KILL
Definition
boss_commander_kolurg.cpp:29
SAY_DEATH
@ SAY_DEATH
Definition
boss_commander_sarannis.cpp:19
SAY_ARCANE_DEVASTATION
@ SAY_ARCANE_DEVASTATION
Definition
boss_commander_sarannis.cpp:16
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_commander_sarannis.cpp:13
EMOTE_SUMMON
@ EMOTE_SUMMON
Definition
boss_commander_sarannis.cpp:17
SAY_KILL
@ SAY_KILL
Definition
boss_commander_sarannis.cpp:14
SAY_ARCANE_RESONANCE
@ SAY_ARCANE_RESONANCE
Definition
boss_commander_sarannis.cpp:15
SAY_SUMMON
@ SAY_SUMMON
Definition
boss_commander_sarannis.cpp:18
NPC_SUMMONED_BLOODWARDER_RESERVIST
@ NPC_SUMMONED_BLOODWARDER_RESERVIST
Definition
boss_commander_sarannis.cpp:138
NPC_SUMMONED_BLOODWARDER_MENDER
@ NPC_SUMMONED_BLOODWARDER_MENDER
Definition
boss_commander_sarannis.cpp:137
SPELL_SUMMON_REINFORCEMENTS
@ SPELL_SUMMON_REINFORCEMENTS
Definition
boss_commander_sarannis.cpp:26
SPELL_ARCANE_DEVASTATION
@ SPELL_ARCANE_DEVASTATION
Definition
boss_commander_sarannis.cpp:25
SPELL_ARCANE_RESONANCE
@ SPELL_ARCANE_RESONANCE
Definition
boss_commander_sarannis.cpp:24
PosSummonReinforcements
Position const PosSummonReinforcements[4]
Definition
boss_commander_sarannis.cpp:127
AddSC_boss_commander_sarannis
void AddSC_boss_commander_sarannis()
Definition
boss_commander_sarannis.cpp:171
EVENT_ARCANE_RESONANCE
@ EVENT_ARCANE_RESONANCE
Definition
boss_commander_sarannis.cpp:31
EVENT_ARCANE_DEVASTATION
@ EVENT_ARCANE_DEVASTATION
Definition
boss_commander_sarannis.cpp:32
Says
Says
Definition
boss_halycon.cpp:17
EMOTE_SUMMON
@ EMOTE_SUMMON
Definition
boss_nightbane.cpp:35
SAY_SUMMON
@ SAY_SUMMON
Definition
boss_urok_doomhowl.cpp:19
BossAI::JustSummoned
void JustSummoned(Creature *summon) OVERRIDE
Definition
ScriptedCreature.cpp:562
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
SpellScript
Definition
SpellScript.h:139
SpellScript::OnEffectHitTarget
HookList< EffectHandler > OnEffectHitTarget
Definition
SpellScript.h:268
SpellScript::GetCaster
Unit * GetCaster()
Definition
SpellScript.cpp:352
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::DoCastVictim
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:168
Unit
Definition
Unit.h:1367
WorldObject::SummonCreature
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition
Object.cpp:2703
boss_commander_sarannis
Definition
boss_commander_sarannis.cpp:36
boss_commander_sarannis::boss_commander_sarannis
boss_commander_sarannis()
Definition
boss_commander_sarannis.cpp:38
boss_commander_sarannis::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_commander_sarannis.cpp:121
spell_commander_sarannis_summon_reinforcements::spell_commander_sarannis_summon_reinforcements_SpellScript
Definition
boss_commander_sarannis.cpp:147
spell_commander_sarannis_summon_reinforcements::spell_commander_sarannis_summon_reinforcements_SpellScript::PrepareSpellScript
PrepareSpellScript(spell_commander_sarannis_summon_reinforcements_SpellScript)
spell_commander_sarannis_summon_reinforcements::spell_commander_sarannis_summon_reinforcements_SpellScript::HandleCast
void HandleCast(SpellEffIndex)
Definition
boss_commander_sarannis.cpp:150
spell_commander_sarannis_summon_reinforcements::spell_commander_sarannis_summon_reinforcements_SpellScript::Register
void Register() OVERRIDE
Definition
boss_commander_sarannis.cpp:159
spell_commander_sarannis_summon_reinforcements
Definition
boss_commander_sarannis.cpp:142
spell_commander_sarannis_summon_reinforcements::spell_commander_sarannis_summon_reinforcements
spell_commander_sarannis_summon_reinforcements()
Definition
boss_commander_sarannis.cpp:144
spell_commander_sarannis_summon_reinforcements::GetSpellScript
SpellScript * GetSpellScript() const OVERRIDE
Definition
boss_commander_sarannis.cpp:165
Position
Definition
Object.h:274
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
boss_commander_sarannis::boss_commander_sarannisAI
Definition
boss_commander_sarannis.cpp:41
boss_commander_sarannis::boss_commander_sarannisAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_commander_sarannis.cpp:63
boss_commander_sarannis::boss_commander_sarannisAI::JustSummoned
void JustSummoned(Creature *summon) OVERRIDE
Definition
boss_commander_sarannis.cpp:80
boss_commander_sarannis::boss_commander_sarannisAI::Reset
void Reset() OVERRIDE
Definition
boss_commander_sarannis.cpp:44
boss_commander_sarannis::boss_commander_sarannisAI::KilledUnit
void KilledUnit(Unit *) OVERRIDE
Definition
boss_commander_sarannis.cpp:58
boss_commander_sarannis::boss_commander_sarannisAI::DamageTaken
void DamageTaken(Unit *, uint32 &damage) OVERRIDE
Definition
boss_commander_sarannis.cpp:69
boss_commander_sarannis::boss_commander_sarannisAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_commander_sarannis.cpp:85
boss_commander_sarannis::boss_commander_sarannisAI::_phase
bool _phase
Definition
boss_commander_sarannis.cpp:118
boss_commander_sarannis::boss_commander_sarannisAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_commander_sarannis.cpp:50
boss_commander_sarannis::boss_commander_sarannisAI::boss_commander_sarannisAI
boss_commander_sarannisAI(Creature *creature)
Definition
boss_commander_sarannis.cpp:42
the_botanica.h
DATA_COMMANDER_SARANNIS
@ DATA_COMMANDER_SARANNIS
Definition
the_botanica.h:13
src
server
scripts
Outland
TempestKeep
botanica
boss_commander_sarannis.cpp
Generated on
for Project SkyFire Core by
1.17.0