Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_garr.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
/* ScriptData
7
SDName: Boss_Garr
8
SD%Complete: 50
9
SDComment: Adds NYI
10
SDCategory: Molten Core
11
EndScriptData */
12
13
#include "
ObjectMgr.h
"
14
#include "
ScriptMgr.h
"
15
#include "
ScriptedCreature.h
"
16
#include "
molten_core.h
"
17
18
enum
Spells
19
{
20
// Garr
21
SPELL_ANTIMAGIC_PULSE
= 19492,
22
SPELL_MAGMA_SHACKLES
= 19496,
23
SPELL_ENRAGE
= 19516,
24
25
// Adds
26
SPELL_ERUPTION
= 19497,
27
SPELL_IMMOLATE
= 20294,
28
};
29
30
enum
Events
31
{
32
EVENT_ANTIMAGIC_PULSE
= 1,
33
EVENT_MAGMA_SHACKLES
= 2,
34
};
35
36
class
boss_garr
:
public
CreatureScript
37
{
38
public
:
39
boss_garr
() :
CreatureScript
(
"boss_garr"
) { }
40
41
struct
boss_garrAI
:
public
BossAI
42
{
43
boss_garrAI
(
Creature
* creature) :
BossAI
(creature,
BOSS_GARR
)
44
{
45
}
46
47
void
EnterCombat
(
Unit
* victim)
OVERRIDE
48
{
49
BossAI::EnterCombat
(victim);
50
events
.ScheduleEvent(
EVENT_ANTIMAGIC_PULSE
, 25000);
51
events
.ScheduleEvent(
EVENT_MAGMA_SHACKLES
, 15000);
52
}
53
54
void
UpdateAI
(
uint32
diff)
OVERRIDE
55
{
56
if
(!
UpdateVictim
())
57
return
;
58
59
events
.Update(diff);
60
61
if
(
me
->HasUnitState(
UNIT_STATE_CASTING
))
62
return
;
63
64
while
(
uint32
eventId =
events
.ExecuteEvent())
65
{
66
switch
(eventId)
67
{
68
case
EVENT_ANTIMAGIC_PULSE
:
69
DoCast
(
me
,
SPELL_ANTIMAGIC_PULSE
);
70
events
.ScheduleEvent(
EVENT_ANTIMAGIC_PULSE
, std::rand() % 15000 + 10000);
71
break
;
72
case
EVENT_MAGMA_SHACKLES
:
73
DoCast
(
me
,
SPELL_MAGMA_SHACKLES
);
74
events
.ScheduleEvent(
EVENT_MAGMA_SHACKLES
, std::rand() % 12000 + 8000);
75
break
;
76
default
:
77
break
;
78
}
79
}
80
81
DoMeleeAttackIfReady
();
82
}
83
};
84
85
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
86
{
87
return
new
boss_garrAI
(creature);
88
}
89
};
90
91
class
npc_firesworn
:
public
CreatureScript
92
{
93
public
:
94
npc_firesworn
() :
CreatureScript
(
"npc_firesworn"
) { }
95
96
struct
npc_fireswornAI
:
public
ScriptedAI
97
{
98
npc_fireswornAI
(
Creature
* creature) :
ScriptedAI
(creature) { }
99
100
uint32
immolateTimer
;
101
102
void
Reset
()
OVERRIDE
103
{
104
immolateTimer
= 4000;
//These times are probably wrong
105
}
106
107
void
DamageTaken
(
Unit
*
/*attacker*/
,
uint32
& damage)
OVERRIDE
108
{
109
uint32
const
health10pct =
me
->CountPctFromMaxHealth(10);
110
uint32
health =
me
->GetHealth();
111
if
(
int32
(health) -
int32
(damage) <
int32
(health10pct))
112
{
113
damage = 0;
114
DoCastVictim
(
SPELL_ERUPTION
);
115
me
->DespawnOrUnsummon();
116
}
117
}
118
119
void
UpdateAI
(
uint32
diff)
OVERRIDE
120
{
121
if
(!
UpdateVictim
())
122
return
;
123
124
if
(
immolateTimer
<= diff)
125
{
126
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0))
127
DoCast
(target,
SPELL_IMMOLATE
);
128
immolateTimer
= std::rand() % 10000 + 5000;
129
}
130
else
131
immolateTimer
-= diff;
132
133
DoMeleeAttackIfReady
();
134
}
135
};
136
137
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
138
{
139
return
new
npc_fireswornAI
(creature);
140
}
141
};
142
143
void
AddSC_boss_garr
()
144
{
145
new
boss_garr
();
146
new
npc_firesworn
();
147
}
Spells
Spells
Definition
BattlegroundIC.h:645
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
ObjectMgr.h
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
SPELL_ANTIMAGIC_PULSE
@ SPELL_ANTIMAGIC_PULSE
Definition
boss_garr.cpp:21
SPELL_MAGMA_SHACKLES
@ SPELL_MAGMA_SHACKLES
Definition
boss_garr.cpp:22
SPELL_IMMOLATE
@ SPELL_IMMOLATE
Definition
boss_garr.cpp:27
SPELL_ERUPTION
@ SPELL_ERUPTION
Definition
boss_garr.cpp:26
AddSC_boss_garr
void AddSC_boss_garr()
Definition
boss_garr.cpp:143
EVENT_MAGMA_SHACKLES
@ EVENT_MAGMA_SHACKLES
Definition
boss_garr.cpp:33
EVENT_ANTIMAGIC_PULSE
@ EVENT_ANTIMAGIC_PULSE
Definition
boss_garr.cpp:32
SPELL_IMMOLATE
@ SPELL_IMMOLATE
Definition
boss_tomb_of_seven.cpp:83
BossAI::events
EventMap events
Definition
ScriptedCreature.h:439
BossAI::BossAI
BossAI(Creature *creature, uint32 bossId)
Definition
ScriptedCreature.cpp:456
BossAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
ScriptedCreature.h:404
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
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_garr
Definition
boss_garr.cpp:37
boss_garr::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_garr.cpp:85
boss_garr::boss_garr
boss_garr()
Definition
boss_garr.cpp:39
npc_firesworn
Definition
boss_garr.cpp:92
npc_firesworn::npc_firesworn
npc_firesworn()
Definition
boss_garr.cpp:94
npc_firesworn::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_garr.cpp:137
molten_core.h
BOSS_GARR
@ BOSS_GARR
Definition
molten_core.h:14
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
boss_garr::boss_garrAI
Definition
boss_garr.cpp:42
boss_garr::boss_garrAI::EnterCombat
void EnterCombat(Unit *victim) OVERRIDE
Definition
boss_garr.cpp:47
boss_garr::boss_garrAI::boss_garrAI
boss_garrAI(Creature *creature)
Definition
boss_garr.cpp:43
boss_garr::boss_garrAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_garr.cpp:54
npc_firesworn::npc_fireswornAI
Definition
boss_garr.cpp:97
npc_firesworn::npc_fireswornAI::immolateTimer
uint32 immolateTimer
Definition
boss_garr.cpp:100
npc_firesworn::npc_fireswornAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_garr.cpp:119
npc_firesworn::npc_fireswornAI::Reset
void Reset() OVERRIDE
Definition
boss_garr.cpp:102
npc_firesworn::npc_fireswornAI::npc_fireswornAI
npc_fireswornAI(Creature *creature)
Definition
boss_garr.cpp:98
npc_firesworn::npc_fireswornAI::DamageTaken
void DamageTaken(Unit *, uint32 &damage) OVERRIDE
Definition
boss_garr.cpp:107
src
server
scripts
EasternKingdoms
BlackrockMountain
MoltenCore
boss_garr.cpp
Generated on
for Project SkyFire Core by
1.17.0