TrinityCore
Loading...
Searching...
No Matches
boss_akilzon.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
19SDName: boss_Akilzon
20SD%Complete: 75%
21SDComment: Missing timer for Call Lightning and Sound ID's
22SQLUpdate:
23#Temporary fix for Soaring Eagles
24
25EndScriptData */
26
27#include "ScriptMgr.h"
28#include "CellImpl.h"
29#include "GridNotifiersImpl.h"
30#include "MiscPackets.h"
31#include "MotionMaster.h"
32#include "ObjectAccessor.h"
33#include "ScriptedCreature.h"
34#include "SpellScript.h"
35#include "TemporarySummon.h"
36#include "Weather.h"
37#include "zulaman.h"
38
61
62enum Says
63{
66 SAY_INTRO = 2, // Not used in script
69 SAY_DEATH = 5
70};
71
72enum Misc
73{
78 SE_LOC_Y_MIN = 1370
79};
80
92
94{
95 public:
96 boss_akilzon() : CreatureScript("boss_akilzon") { }
97
98 struct boss_akilzonAI : public BossAI
99 {
101 {
102 Initialize();
103 }
104
106 {
110 for (ObjectGuid& guid : BirdGUIDs)
111 guid.Clear();
112
113 StormCount = 0;
114 isRaining = false;
115 }
116
117 void Reset() override
118 {
119 _Reset();
120
121 Initialize();
122
124 }
125
126 void JustEngagedWith(Unit* who) override
127 {
129
130 events.ScheduleEvent(EVENT_STATIC_DISRUPTION, 10s, 20s); // 10 to 20 seconds (bosskillers)
131 events.ScheduleEvent(EVENT_GUST_OF_WIND, 20s, 30s); // 20 to 30 seconds(bosskillers)
132 events.ScheduleEvent(EVENT_CALL_LIGHTNING, 10s, 20s); // totaly random timer. can't find any info on this
133 events.ScheduleEvent(EVENT_ELECTRICAL_STORM, 1min); // 60 seconds(bosskillers)
135 events.ScheduleEvent(EVENT_ENRAGE, 10min); // 10 minutes till enrage(bosskillers)
136
138 }
139
140 void JustDied(Unit* /*killer*/) override
141 {
143 _JustDied();
144 }
145
146 void KilledUnit(Unit* who) override
147 {
148 if (who->GetTypeId() == TYPEID_PLAYER)
149 Talk(SAY_KILL);
150 }
151
152 void SetWeather(WeatherState weather, float grade)
153 {
154 Map* map = me->GetMap();
155 if (!map->IsDungeon())
156 return;
157
158 map->SendToPlayers(WorldPackets::Misc::Weather(weather, grade).Write());
159 }
160
161 void HandleStormSequence(Unit* Cloud) // 1: begin, 2-9: tick, 10: end
162 {
163 if (StormCount < 10 && StormCount > 1)
164 {
165 // deal damage
166 int32 bp0 = 800;
167 for (uint8 i = 2; i < StormCount; ++i)
168 bp0 *= 2;
169
170 std::list<Unit*> tempUnitMap;
174
175 // deal damage
176 for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i)
177 {
178 if (Unit* target = (*i))
179 {
180 if (Cloud && !Cloud->IsWithinDist(target, 6, false))
181 {
184 args.OriginalCaster = me->GetGUID();
186 Cloud->CastSpell(target, SPELL_ZAP, args);
187 }
188 }
189 }
190
191 // visual
192 float x, y, z;
193 z = me->GetPositionZ();
194 uint8 maxCount = 5 + rand32() % 5;
195 for (uint8 i = 0; i < maxCount; ++i)
196 {
197 x = 343.0f + rand32() % 60;
198 y = 1380.0f + rand32() % 60;
199 if (Unit* trigger = me->SummonTrigger(x, y, z, 0, 2s))
200 {
201 trigger->SetFaction(FACTION_FRIENDLY);
202 trigger->SetMaxHealth(100000);
203 trigger->SetHealth(100000);
204 trigger->RemoveUnitFlag(UNIT_FLAG_UNINTERACTIBLE);
205 if (Cloud)
206 {
209 args.OriginalCaster = Cloud->GetGUID();
211 Cloud->CastSpell(trigger, SPELL_ZAP, args);
212 }
213 }
214 }
215 }
216
217 ++StormCount;
218
219 if (StormCount > 10)
220 {
221 StormCount = 0; // finish
225 if (Cloud)
226 Cloud->KillSelf();
228 isRaining = false;
229 }
231 }
232
233 void UpdateAI(uint32 diff) override
234 {
235 if (!UpdateVictim())
236 return;
237
238 events.Update(diff);
239
240 while (uint32 eventId = events.ExecuteEvent())
241 {
242 switch (eventId)
243 {
245 {
247 if (!target)
248 target = me->GetVictim();
249 if (target)
250 {
251 TargetGUID = target->GetGUID();
252 DoCast(target, SPELL_STATIC_DISRUPTION, false);
253 }
254 /*if (float dist = me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f;
255 SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/
257 break;
258 }
260 {
262 if (!target)
263 target = me->GetVictim();
264 if (target)
265 DoCast(target, SPELL_GUST_OF_WIND);
267 break;
268 }
271 events.ScheduleEvent(EVENT_CALL_LIGHTNING, 12s, 17s); // totaly random timer. can't find any info on this
272 break;
274 {
275 Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50, true);
276 if (!target)
277 {
279 return;
280 }
281 target->CastSpell(target, 44007, true); // cloud visual
282 DoCast(target, SPELL_ELECTRICAL_STORM, false); // storm cyclon + visual
283 float x, y, z;
284 target->GetPosition(x, y, z);
286 /*
287 if (target)
288 {
289 target->SetDisableGravity(true);
290 target->MonsterMoveWithSpeed(x, y, me->GetPositionZ()+15, 0);
291 }
292 */
293
294 Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15s);
295 if (Cloud)
296 {
297 CloudGUID = Cloud->GetGUID();
298 Cloud->SetDisableGravity(true);
299 Cloud->StopMoving();
300 Cloud->SetObjectScale(1.0f);
302 Cloud->SetMaxHealth(9999999);
303 Cloud->SetHealth(9999999);
305 }
306 StormCount = 1;
307 events.ScheduleEvent(EVENT_ELECTRICAL_STORM, 1min); // 60 seconds(bosskillers)
309 break;
310 }
311 case EVENT_RAIN:
312 if (!isRaining)
313 {
315 isRaining = true;
316 }
317 else
319 break;
321 {
323 if (!target || !target->IsAlive())
324 {
326 return;
327 }
328 else if (Unit* Cyclone = ObjectAccessor::GetUnit(*me, CycloneGUID))
329 Cyclone->CastSpell(target, SPELL_SAND_STORM, true); // keep casting or...
330 HandleStormSequence(target);
331 break;
332 }
335
336 float x, y, z;
337 me->GetPosition(x, y, z);
338
339 for (uint8 i = 0; i < 8; ++i)
340 {
342 if (!bird) //they despawned on die
343 {
345 {
346 x = target->GetPositionX() + irand(-10, 10);
347 y = target->GetPositionY() + irand(-10, 10);
348 z = target->GetPositionZ() + urand(16, 20);
349 if (z > 95)
350 z = 95.0f - urand(0, 5);
351 }
353 if (creature)
354 {
355 AddThreat(me->GetVictim(), 1.0f, creature);
356 creature->AI()->AttackStart(me->GetVictim());
357 BirdGUIDs[i] = creature->GetGUID();
358 }
359 }
360 }
361 break;
362 case EVENT_ENRAGE:
364 DoCast(me, SPELL_BERSERK, true);
366 break;
367 default:
368 break;
369 }
370 }
371
373 }
374
375 private:
382 };
383
384 CreatureAI* GetAI(Creature* creature) const override
385 {
386 return GetZulAmanAI<boss_akilzonAI>(creature);
387 }
388};
389
391{
392 public:
393 npc_akilzon_eagle() : CreatureScript("npc_akilzon_eagle") { }
394
396 {
398 {
399 Initialize();
400 }
401
403 {
404 EagleSwoop_Timer = urand(5000, 10000);
405 arrived = true;
407 }
408
412
413 void Reset() override
414 {
415 Initialize();
416 me->SetDisableGravity(true);
417 }
418
419 void JustEngagedWith(Unit* /*who*/) override
420 {
422 }
423
424 void MoveInLineOfSight(Unit* /*who*/) override { }
425
427 {
428 arrived = true;
429 if (!TargetGUID.IsEmpty())
430 {
431 if (Unit* target = ObjectAccessor::GetUnit(*me, TargetGUID))
432 DoCast(target, SPELL_EAGLE_SWOOP, true);
434 me->SetSpeedRate(MOVE_RUN, 1.2f);
435 EagleSwoop_Timer = urand(5000, 10000);
436 }
437 }
438
439 void UpdateAI(uint32 diff) override
440 {
441 if (EagleSwoop_Timer <= diff)
443 else
444 EagleSwoop_Timer -= diff;
445
446 if (arrived)
447 {
449 {
450 float x, y, z;
452 {
453 x = target->GetPositionX() + irand(-10, 10);
454 y = target->GetPositionY() + irand(-10, 10);
455 z = target->GetPositionZ() + urand(10, 15);
456 if (z > 95)
457 z = 95.0f - urand(0, 5);
458 }
459 else
460 {
461 target->GetContactPoint(me, x, y, z);
462 z += 2;
463 me->SetSpeedRate(MOVE_RUN, 5.0f);
464 TargetGUID = target->GetGUID();
465 }
466 me->GetMotionMaster()->MovePoint(0, x, y, z);
467 arrived = false;
468 }
469 }
470 }
471 };
472
473 CreatureAI* GetAI(Creature* creature) const override
474 {
475 return GetZulAmanAI<npc_akilzon_eagleAI>(creature);
476 }
477};
478
479// 43648 - Electrical Storm
481{
483
484 bool Validate(SpellInfo const* /*spellInfo*/) override
485 {
487 }
488
490 {
491 Unit* target = GetHitUnit();
492 target->CastSpell(target, SPELL_ELECTRICAL_STORM_AURA, true);
493 target->CastSpell(target, SPELL_TELEPORT_SELF, true);
494 }
495
500};
501
502// 43658 - Electrical Overload Graphic Pulse
504{
506
507 bool Validate(SpellInfo const* /*spellInfo*/) override
508 {
509 return ValidateSpellInfo(
510 {
516 });
517 }
518
519 void HandleScript(SpellEffIndex /*effIndex*/)
520 {
521 Unit* caster = GetCaster();
522 caster->CastSpell(caster, SPELL_ELECTRICAL_ARC_1, true);
523 caster->CastSpell(caster, SPELL_ELECTRICAL_ARC_2, true);
524 caster->CastSpell(caster, SPELL_ELECTRICAL_ARC_3, true);
525 caster->CastSpell(caster, SPELL_ELECTRICAL_ARC_4, true);
526 caster->CastSpell(caster, SPELL_ELECTRICAL_ARC_5, true);
527 }
528
533};
534
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define SIZE_OF_GRIDS
Definition GridDefines.h:38
@ TEMPSUMMON_CORPSE_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
int32 irand(int32 min, int32 max)
Definition Random.cpp:35
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
uint32 rand32()
Definition Random.cpp:70
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ FACTION_FRIENDLY
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_BASE_POINT0
#define SpellEffectFn(F, I, N)
#define SpellHitFn(F)
@ MOVE_RUN
@ UNIT_FLAG_UNINTERACTIBLE
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_KILL
@ SAY_ENRAGE
@ SAY_SUMMON
@ SAY_INTRO
@ NPC_SOARING_EAGLE
@ SE_LOC_Y_MAX
@ SE_LOC_Y_MIN
@ SE_LOC_X_MAX
@ SE_LOC_X_MIN
@ SPELL_EAGLE_SWOOP
@ SPELL_ELECTRICAL_ARC_4
@ SPELL_STATIC_VISUAL
@ SPELL_TELEPORT_SELF
@ SPELL_ELECTRICAL_ARC_1
@ SPELL_ELECTRICAL_ARC_2
@ SPELL_SAND_STORM
@ SPELL_ELECTRICAL_ARC_5
@ SPELL_ELECTRICAL_OVERLOAD
@ SPELL_STATIC_DISRUPTION
@ SPELL_GUST_OF_WIND
@ SPELL_CALL_LIGHTNING
@ SPELL_ELECTRICAL_STORM
@ SPELL_ZAP
@ SPELL_ELECTRICAL_ARC_3
@ SPELL_BERSERK
@ SPELL_ELECTRICAL_STORM_AURA
void AddSC_boss_akilzon()
@ EVENT_CALL_LIGHTNING
@ EVENT_SUMMON_EAGLES
@ EVENT_ENRAGE
@ EVENT_GUST_OF_WIND
@ EVENT_RAIN
@ EVENT_ELECTRICAL_STORM
@ EVENT_STORM_SEQUENCE
@ EVENT_STATIC_DISRUPTION
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
CreatureAI * AI() const
Definition Creature.h:154
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Definition Map.h:281
bool IsDungeon() const
Definition Map.cpp:4236
void SendToPlayers(WorldPacket const *data) const
Definition Map.cpp:3668
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
bool IsEmpty() const
Definition ObjectGuid.h:172
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
virtual void SetObjectScale(float scale)
Definition Object.h:85
Unit * GetCaster() const
HookList< HitHandler > AfterHit
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void KillSelf(bool durabilityLoss=true)
Definition Unit.h:1023
void SetFaction(uint32 faction) override
Definition Unit.h:974
void StopMoving(bool force=false)
Definition Unit.cpp:10312
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3093
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool IsAlive() const
Definition Unit.h:1234
void SetHealth(uint32 val)
Definition Unit.cpp:9361
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13286
Unit * GetVictim() const
Definition Unit.h:859
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition Unit.cpp:8678
void SetMaxHealth(uint32 val)
Definition Unit.cpp:9393
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
Map * GetMap() const
Definition Object.h:449
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
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:1992
Creature * SummonTrigger(float x, float y, float z, float ang, Milliseconds despawnTime, CreatureAI *(*GetAI)(Creature *)=nullptr)
Definition Object.cpp:2057
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition Object.cpp:1187
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_akilzon_electrical_overload)
PrepareSpellScript(spell_akilzon_electrical_storm)
bool Validate(SpellInfo const *) override
WeatherState
Definition Weather.h:47
@ WEATHER_STATE_HEAVY_RAIN
Definition Weather.h:53
@ WEATHER_STATE_FINE
Definition Weather.h:48
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TriggerCastFlags TriggerFlags
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
ObjectGuid OriginalCaster
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:192
float GetPositionZ() const
Definition Position.h:81
void GetPosition(float &x, float &y) const
Definition Position.h:84
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void UpdateAI(uint32 diff) override
void SetWeather(WeatherState weather, float grade)
boss_akilzonAI(Creature *creature)
void KilledUnit(Unit *who) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
void HandleStormSequence(Unit *Cloud)
void UpdateAI(uint32 diff) override
void MovementInform(uint32, uint32) override
@ BOSS_AKILZON
Definition zulaman.h:29