Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_fankriss.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
7SDName: Boss_Fankriss
8SD%Complete: 100
9SDComment: sound not implemented
10SDCategory: Temple of Ahn'Qiraj
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15
16#define SOUND_SENTENCE_YOU 8588
17#define SOUND_SERVE_TO 8589
18#define SOUND_LAWS 8590
19#define SOUND_TRESPASS 8591
20#define SOUND_WILL_BE 8592
21
23{
25 SPELL_ROOT = 28858,
26
27 // Enrage for his spawns
29};
30
32{
33public:
34 boss_fankriss() : CreatureScript("boss_fankriss") { }
35
37 {
38 return new boss_fankrissAI(creature);
39 }
40
42 {
43 boss_fankrissAI(Creature* creature) : ScriptedAI(creature)
44 {
48 Rand = 0;
49 RandX = 0.0f;
50 RandY = 0.0f;
51
52 Hatchling = NULL;
53 Spawn = NULL;
54 }
55
57 {
58 MortalWound_Timer = std::rand() % 15000 + 10000;
59 SpawnHatchlings_Timer = std::rand() % 12000 + 6000;
60 SpawnSpawns_Timer = std::rand() % 45000 + 15000;
61 }
62
63 void SummonSpawn(Unit* victim)
64 {
65 if (!victim)
66 return;
67
68 Rand = 10 + (rand()%10);
69 switch (rand()%2)
70 {
71 case 0: RandX = 0.0f - Rand; break;
72 case 1: RandX = 0.0f + Rand; break;
73 }
74
75 Rand = 10 + (rand()%10);
76 switch (rand()%2)
77 {
78 case 0: RandY = 0.0f - Rand; break;
79 case 1: RandY = 0.0f + Rand; break;
80 }
81 Rand = 0;
83 if (Spawn)
84 Spawn->AI()->AttackStart(victim);
85 }
86
87 void EnterCombat(Unit* /*who*/) OVERRIDE
88 {
89 }
90
92 {
93 //Return since we have no target
94 if (!UpdateVictim())
95 return;
96
97 //MortalWound_Timer
98 if (MortalWound_Timer <= diff)
99 {
101 MortalWound_Timer = std::rand() % 20000 + 10000;
102 } else MortalWound_Timer -= diff;
103
104 //Summon 1-3 Spawns of Fankriss at random time.
105 if (SpawnSpawns_Timer <= diff)
106 {
107 switch (std::rand() % 2)
108 {
109 case 0:
111 break;
112 case 1:
115 break;
116 case 2:
120 break;
121 }
122 SpawnSpawns_Timer = std::rand() % 60000 + 30000;
123 } else SpawnSpawns_Timer -= diff;
124
125 // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer.
126 //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot.
127 if (HealthAbovePct(3))
128 {
129 if (SpawnHatchlings_Timer <= diff)
130 {
131 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
132 {
133 DoCast(target, SPELL_ROOT);
134
135 if (DoGetThreat(target))
136 DoModifyThreatPercent(target, -100);
137
138 switch (std::rand() % 2)
139 {
140 case 0:
141 DoTeleportPlayer(target, -8106.0142f, 1289.2900f, -74.419533f, 5.112f);
142 Hatchling = me->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()-3, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
143 if (Hatchling)
144 Hatchling->AI()->AttackStart(target);
145 Hatchling = me->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
146 if (Hatchling)
147 Hatchling->AI()->AttackStart(target);
148 Hatchling = me->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
149 if (Hatchling)
150 Hatchling->AI()->AttackStart(target);
151 Hatchling = me->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
152 if (Hatchling)
153 Hatchling->AI()->AttackStart(target);
154 break;
155 case 1:
156 DoTeleportPlayer(target, -7990.135354f, 1155.1907f, -78.849319f, 2.608f);
157 Hatchling = me->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()-3, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
158 if (Hatchling)
159 Hatchling->AI()->AttackStart(target);
160 Hatchling = me->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
161 if (Hatchling)
162 Hatchling->AI()->AttackStart(target);
163 Hatchling = me->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
164 if (Hatchling)
165 Hatchling->AI()->AttackStart(target);
166 Hatchling = me->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
167 if (Hatchling)
168 Hatchling->AI()->AttackStart(target);
169 break;
170 case 2:
171 DoTeleportPlayer(target, -8159.7753f, 1127.9064f, -76.868660f, 0.675f);
172 Hatchling = me->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()-3, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
173 if (Hatchling)
174 Hatchling->AI()->AttackStart(target);
175 Hatchling = me->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
176 if (Hatchling)
177 Hatchling->AI()->AttackStart(target);
178 Hatchling = me->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
179 if (Hatchling)
180 Hatchling->AI()->AttackStart(target);
181 Hatchling = me->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
182 if (Hatchling)
183 Hatchling->AI()->AttackStart(target);
184 break;
185 }
186 }
187 SpawnHatchlings_Timer = std::rand() % 60000 + 45000;
188 } else SpawnHatchlings_Timer -= diff;
189 }
190
192 }
193
194 private:
198 int Rand;
199 float RandX;
200 float RandY;
201
204 };
205};
206
208{
209 new boss_fankriss();
210}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_ENRAGE
@ SPELL_ROOT
@ SPELL_MORTAL_WOUND
void AddSC_boss_fankriss()
@ SPELL_MORTAL_WOUND
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthAbovePct(uint32 pct) const
float DoGetThreat(Unit *unit)
void DoTeleportPlayer(Unit *unit, float x, float y, float z, float o)
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint32 despawntime)
ScriptedAI(Creature *creature)
void DoModifyThreatPercent(Unit *unit, int32 pct)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE
boss_fankrissAI(Creature *creature)