TrinityCore
Loading...
Searching...
No Matches
boss_fankriss.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
/* ScriptData
19
SDName: Boss_Fankriss
20
SD%Complete: 100
21
SDComment: sound not implemented
22
SDCategory: Temple of Ahn'Qiraj
23
EndScriptData */
24
25
#include "
ScriptMgr.h
"
26
#include "
ScriptedCreature.h
"
27
#include "
temple_of_ahnqiraj.h
"
28
#include "
TemporarySummon.h
"
29
30
#define SOUND_SENTENCE_YOU 8588
31
#define SOUND_SERVE_TO 8589
32
#define SOUND_LAWS 8590
33
#define SOUND_TRESPASS 8591
34
#define SOUND_WILL_BE 8592
35
36
enum
Spells
37
{
38
SPELL_MORTAL_WOUND
= 28467,
39
SPELL_ROOT
= 28858,
40
41
// Enrage for his spawns
42
SPELL_ENRAGE
= 28798
43
};
44
45
class
boss_fankriss
:
public
CreatureScript
46
{
47
public
:
48
boss_fankriss
() :
CreatureScript
(
"boss_fankriss"
) { }
49
50
CreatureAI
*
GetAI
(
Creature
* creature)
const override
51
{
52
return
GetAQ40AI<boss_fankrissAI>(creature);
53
}
54
55
struct
boss_fankrissAI
:
public
BossAI
56
{
57
boss_fankrissAI
(
Creature
* creature) :
BossAI
(creature,
DATA_FRANKRIS
)
58
{
59
Initialize
();
60
}
61
62
void
Initialize
()
63
{
64
MortalWound_Timer
=
urand
(10000, 15000);
65
SpawnHatchlings_Timer
=
urand
(6000, 12000);
66
SpawnSpawns_Timer
=
urand
(15000, 45000);
67
}
68
69
uint32
MortalWound_Timer
;
70
uint32
SpawnHatchlings_Timer
;
71
uint32
SpawnSpawns_Timer
;
72
73
void
Reset
()
override
74
{
75
Initialize
();
76
_Reset
();
77
}
78
79
void
SummonSpawn
(
Unit
* victim)
80
{
81
if
(!victim)
82
return
;
83
84
int
Rand = 10 + (
rand32
() % 10);
85
float
RandX = 0.f;
86
float
RandY = 0.f;
87
88
switch
(
rand32
() % 2)
89
{
90
case
0: RandX = 0.0f - Rand;
break
;
91
case
1: RandX = 0.0f + Rand;
break
;
92
}
93
94
Rand = 10 + (
rand32
() % 10);
95
switch
(
rand32
() % 2)
96
{
97
case
0: RandY = 0.0f - Rand;
break
;
98
case
1: RandY = 0.0f + Rand;
break
;
99
}
100
Rand = 0;
101
Creature
*
Spawn
=
DoSpawnCreature
(15630, RandX, RandY, 0, 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 30s);
102
if
(
Spawn
)
103
Spawn
->AI()->AttackStart(victim);
104
}
105
106
void
UpdateAI
(
uint32
diff)
override
107
{
108
//Return since we have no target
109
if
(!
UpdateVictim
())
110
return
;
111
112
//MortalWound_Timer
113
if
(
MortalWound_Timer
<= diff)
114
{
115
DoCastVictim
(
SPELL_MORTAL_WOUND
);
116
MortalWound_Timer
=
urand
(10000, 20000);
117
}
else
MortalWound_Timer
-= diff;
118
119
//Summon 1-3 Spawns of Fankriss at random time.
120
if
(
SpawnSpawns_Timer
<= diff)
121
{
122
switch
(
urand
(0, 2))
123
{
124
case
0:
125
SummonSpawn
(
SelectTarget
(
SelectTargetMethod::Random
, 0));
126
break
;
127
case
1:
128
SummonSpawn
(
SelectTarget
(
SelectTargetMethod::Random
, 0));
129
SummonSpawn
(
SelectTarget
(
SelectTargetMethod::Random
, 0));
130
break
;
131
case
2:
132
SummonSpawn
(
SelectTarget
(
SelectTargetMethod::Random
, 0));
133
SummonSpawn
(
SelectTarget
(
SelectTargetMethod::Random
, 0));
134
SummonSpawn
(
SelectTarget
(
SelectTargetMethod::Random
, 0));
135
break
;
136
}
137
SpawnSpawns_Timer
=
urand
(30000, 60000);
138
}
else
SpawnSpawns_Timer
-= diff;
139
140
// Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer.
141
//We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot.
142
if
(
HealthAbovePct
(3))
143
{
144
if
(
SpawnHatchlings_Timer
<= diff)
145
{
146
if
(
Unit
* target =
SelectTarget
(
SelectTargetMethod::Random
, 0, 0.0f,
true
))
147
{
148
DoCast
(target,
SPELL_ROOT
);
149
150
if
(
GetThreat
(target))
151
ModifyThreatByPercent
(target, -100);
152
153
Creature
* Hatchling =
nullptr
;
154
switch
(
urand
(0, 2))
155
{
156
case
0:
157
DoTeleportPlayer
(target, -8106.0142f, 1289.2900f, -74.419533f, 5.112f);
158
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-3, target->GetPositionY()-3, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
159
if
(Hatchling)
160
Hatchling->
AI
()->
AttackStart
(target);
161
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
162
if
(Hatchling)
163
Hatchling->
AI
()->
AttackStart
(target);
164
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
165
if
(Hatchling)
166
Hatchling->
AI
()->
AttackStart
(target);
167
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
168
if
(Hatchling)
169
Hatchling->
AI
()->
AttackStart
(target);
170
break
;
171
case
1:
172
DoTeleportPlayer
(target, -7990.135354f, 1155.1907f, -78.849319f, 2.608f);
173
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX() - 3, target->GetPositionY() - 3, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
174
if
(Hatchling)
175
Hatchling->
AI
()->
AttackStart
(target);
176
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
177
if
(Hatchling)
178
Hatchling->
AI
()->
AttackStart
(target);
179
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
180
if
(Hatchling)
181
Hatchling->
AI
()->
AttackStart
(target);
182
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
183
if
(Hatchling)
184
Hatchling->
AI
()->
AttackStart
(target);
185
break
;
186
case
2:
187
DoTeleportPlayer
(target, -8159.7753f, 1127.9064f, -76.868660f, 0.675f);
188
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX() - 3, target->GetPositionY() - 3, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
189
if
(Hatchling)
190
Hatchling->
AI
()->
AttackStart
(target);
191
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
192
if
(Hatchling)
193
Hatchling->
AI
()->
AttackStart
(target);
194
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
195
if
(Hatchling)
196
Hatchling->
AI
()->
AttackStart
(target);
197
Hatchling =
me
->
SummonCreature
(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15s);
198
if
(Hatchling)
199
Hatchling->
AI
()->
AttackStart
(target);
200
break
;
201
}
202
}
203
SpawnHatchlings_Timer
=
urand
(45000, 60000);
204
}
else
SpawnHatchlings_Timer
-= diff;
205
}
206
}
207
};
208
209
};
210
211
void
AddSC_boss_fankriss
()
212
{
213
new
boss_fankriss
();
214
}
uint32
uint32_t uint32
Definition
Define.h:154
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition
ObjectDefines.h:66
Spells
Spells
Definition
PlayerAI.cpp:32
urand
uint32 urand(uint32 min, uint32 max)
Definition
Random.cpp:42
rand32
uint32 rand32()
Definition
Random.cpp:70
ScriptMgr.h
ScriptedCreature.h
StringIdType::Spawn
@ Spawn
TemporarySummon.h
SelectTargetMethod::Random
@ Random
SPELL_ROOT
@ SPELL_ROOT
Definition
boss_fankriss.cpp:39
SPELL_ENRAGE
@ SPELL_ENRAGE
Definition
boss_fankriss.cpp:42
SPELL_MORTAL_WOUND
@ SPELL_MORTAL_WOUND
Definition
boss_fankriss.cpp:38
AddSC_boss_fankriss
void AddSC_boss_fankriss()
Definition
boss_fankriss.cpp:211
BossAI
Definition
ScriptedCreature.h:308
BossAI::_Reset
void _Reset()
Definition
ScriptedCreature.cpp:542
CreatureAI
Definition
CreatureAI.h:61
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:244
CreatureAI::AttackStart
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition
CreatureAI.cpp:327
CreatureAI::me
Creature *const me
Definition
CreatureAI.h:63
CreatureScript
Definition
ScriptMgr.h:441
Creature
Definition
Creature.h:82
Creature::AI
CreatureAI * AI() const
Definition
Creature.h:228
UnitAI::DoCastVictim
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition
UnitAI.cpp:180
UnitAI::SelectTarget
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition
UnitAI.cpp:79
UnitAI::DoCast
SpellCastResult DoCast(uint32 spellId)
Definition
UnitAI.cpp:89
Unit
Definition
Unit.h:635
WorldObject::SummonCreature
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition
Object.cpp:1398
boss_fankriss
Definition
boss_fankriss.cpp:46
boss_fankriss::boss_fankriss
boss_fankriss()
Definition
boss_fankriss.cpp:48
boss_fankriss::GetAI
CreatureAI * GetAI(Creature *creature) const override
Definition
boss_fankriss.cpp:50
ScriptedAI::HealthAbovePct
bool HealthAbovePct(uint32 pct) const
Definition
ScriptedCreature.cpp:296
ScriptedAI::GetThreat
float GetThreat(Unit const *victim, Unit const *who=nullptr)
Definition
ScriptedCreature.cpp:230
ScriptedAI::DoTeleportPlayer
void DoTeleportPlayer(Unit *unit, float x, float y, float z, float o)
Definition
ScriptedCreature.cpp:431
ScriptedAI::ModifyThreatByPercent
void ModifyThreatByPercent(Unit *victim, int32 pct, Unit *who=nullptr)
Definition
ScriptedCreature.cpp:205
ScriptedAI::DoSpawnCreature
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)
Definition
ScriptedCreature.cpp:286
boss_fankriss::boss_fankrissAI
Definition
boss_fankriss.cpp:56
boss_fankriss::boss_fankrissAI::MortalWound_Timer
uint32 MortalWound_Timer
Definition
boss_fankriss.cpp:69
boss_fankriss::boss_fankrissAI::SpawnHatchlings_Timer
uint32 SpawnHatchlings_Timer
Definition
boss_fankriss.cpp:70
boss_fankriss::boss_fankrissAI::UpdateAI
void UpdateAI(uint32 diff) override
Definition
boss_fankriss.cpp:106
boss_fankriss::boss_fankrissAI::Initialize
void Initialize()
Definition
boss_fankriss.cpp:62
boss_fankriss::boss_fankrissAI::SpawnSpawns_Timer
uint32 SpawnSpawns_Timer
Definition
boss_fankriss.cpp:71
boss_fankriss::boss_fankrissAI::Reset
void Reset() override
Definition
boss_fankriss.cpp:73
boss_fankriss::boss_fankrissAI::boss_fankrissAI
boss_fankrissAI(Creature *creature)
Definition
boss_fankriss.cpp:57
boss_fankriss::boss_fankrissAI::SummonSpawn
void SummonSpawn(Unit *victim)
Definition
boss_fankriss.cpp:79
temple_of_ahnqiraj.h
DATA_FRANKRIS
@ DATA_FRANKRIS
Definition
temple_of_ahnqiraj.h:32
server
scripts
Kalimdor
TempleOfAhnQiraj
boss_fankriss.cpp
Generated on Sun May 10 2026 02:09:10 for TrinityCore by
1.9.8