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/*
19 * Combat timers requires to be revisited
20 * SAY_EVENT is NYI
21 */
22
23#include "ScriptMgr.h"
24#include "Containers.h"
25#include "GridNotifiers.h"
26#include "InstanceScript.h"
27#include "Map.h"
28#include "MotionMaster.h"
29#include "ScriptedCreature.h"
30#include "SpellAuraEffects.h"
31#include "SpellMgr.h"
32#include "SpellScript.h"
33#include "TemporarySummon.h"
34#include "Weather.h"
35#include "zulaman.h"
36
47
49{
50 // Akil'zon
56
57 // Soaring Eagle
59
60 // Amani Kidnapper
62
63 // Scripts
71};
72
84
96
97static constexpr std::array<uint32, 4> EagleSpawnGroupsData =
98{
103};
104
105// 23574 - Akil'zon
106struct boss_akilzon : public BossAI
107{
108 boss_akilzon(Creature* creature) : BossAI(creature, BOSS_AKILZON) { }
109
123
124 void OnSpellCast(SpellInfo const* spellInfo) override
125 {
126 if (spellInfo->Id == SPELL_BERSERK)
128 }
129
130 void EnterEvadeMode(EvadeReason /*why*/) override
131 {
132 for (uint32 group : EagleSpawnGroupsData)
133 me->GetMap()->SpawnGroupDespawn(group);
134
135 // Guessed. What should we do?
137
139 }
140
141 void KilledUnit(Unit* /*who*/) override
142 {
143 Talk(SAY_SLAY);
144 }
145
146 void JustDied(Unit* /*killer*/) override
147 {
148 _JustDied();
150
151 for (uint32 group : EagleSpawnGroupsData)
152 me->GetMap()->SpawnGroupDespawn(group);
153 }
154
155 void UpdateAI(uint32 diff) override
156 {
157 if (!UpdateVictim())
158 return;
159
160 events.Update(diff);
161
163 return;
164
165 while (uint32 eventId = events.ExecuteEvent())
166 {
167 switch (eventId)
168 {
170 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 80.0f, true))
171 DoCast(target, SPELL_GUST_OF_WIND);
172 events.Repeat(10s, 25s);
173 break;
175 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
177 events.Repeat(12s, 18s);
178 break;
181 events.Repeat(5s, 25s);
182 break;
185 for (uint32 group : EagleSpawnGroupsData)
186 me->GetMap()->SpawnGroupSpawn(group, true);
187 events.Repeat(1min);
188 break;
191 events.Repeat(1min);
194 break;
197 break;
200 break;
201 case EVENT_BERSERK:
203 break;
204 default:
205 break;
206 }
207 }
208 }
209};
210
211// 24858 - Soaring Eagle
213{
215
216 void InitializeAI() override
217 {
219 me->SetCorpseDelay(15, true);
221 }
222
223 void JustAppeared() override
224 {
225 _scheduler.Schedule(0s, 10s, [this](TaskContext& task)
226 {
229 task.Repeat(1s, 15s);
230 });
231 }
232
233 void UpdateAI(uint32 diff) override
234 {
235 _scheduler.Update(diff);
236
237 UpdateVictim();
238 }
239
240private:
242};
243
244// 52638 - Amani Kidnapper
246{
248
249 void IsSummonedBy(WorldObject* summoner) override
250 {
251 if (InstanceScript* instance = me->GetInstanceScript())
252 if (Creature* akilzon = instance->GetCreature(BOSS_AKILZON))
253 akilzon->AI()->JustSummoned(me);
254
256 me->SetCorpseDelay(5, true);
258 }
259
260 void MovementInform(uint32 type, uint32 pointId) override
261 {
262 if (type != POINT_MOTION_TYPE || pointId != POINT_KIDNAPPER_PLAYER)
263 return;
264
265 if (TempSummon* summon = me->ToTempSummon())
266 if (Unit* summoner = summon->GetSummonerUnit())
267 DoCast(summoner, SPELL_GRAB_PASSENGER);
268 }
269
270 void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool apply) override
271 {
272 if (apply)
274 }
275};
276
277// 44733 - Eagle Swoop Primer
301
302// 44735 - Electrical Overload Primer
326
327// 43658 - Electrical Overload Graphic Pulse
329{
330 bool Validate(SpellInfo const* spellInfo) override
331 {
332 return ValidateSpellInfo(
333 {
339 }) && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_1).TriggerSpell });
340 }
341
342 void HandleScript(SpellEffIndex /*effIndex*/)
343 {
344 Unit* caster = GetCaster();
345 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_1, true);
346 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_2, true);
347 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_3, true);
348 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_4, true);
349 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_5, true);
350 }
351
353 {
354 PreventHitDefaultEffect(effIndex);
355
356 SpellInfo const* damageSpellSpellInfo = sSpellMgr->AssertSpellInfo(GetEffectInfo().TriggerSpell, GetCastDifficulty());
357
358 if (SpellInfo const* triggeringSpellSpellInfo = GetTriggeringSpell())
359 if (AuraEffect const* eff = GetCaster()->GetAuraEffect(triggeringSpellSpellInfo->Id, EFFECT_1))
360 GetCaster()->CastSpell(nullptr, uint32(GetEffectInfo().TriggerSpell), CastSpellExtraArgs()
361 .SetTriggerFlags(TRIGGERED_FULL_MASK)
362 .AddSpellMod(SPELLVALUE_BASE_POINT0, eff->GetTickNumber() * damageSpellSpellInfo->GetEffect(EFFECT_0).CalcValue()));
363 }
364
370};
371
372// 43648 - Electrical Storm
374{
375 bool Validate(SpellInfo const* /*spellInfo*/) override
376 {
378 }
379
381 {
382 Unit* target = GetHitUnit();
383
384 if (Creature* caster = GetCaster()->ToCreature())
385 caster->AI()->Talk(EMOTE_STORM, target);
386
387 // this is a hack to ensure that DynamicObject granting SPELL_ELECTRICAL_STORM_AURA is only removed after damaging periodic fades
388 target->m_Events.AddEventAtOffset([target]
389 {
390 target->CastSpell(nullptr, SPELL_ELECTRICAL_STORM_AURA, true);
391 target->CastSpell(nullptr, SPELL_TELEPORT_SELF, true);
392 }, 100ms);
393 }
394
399};
400
401// 43657 - Electrical Storm
403{
404 bool Validate(SpellInfo const* /*spellInfo*/) override
405 {
407 }
408
409 void FilterTargets(std::list<WorldObject*>& targets)
410 {
411 targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_ELECTRICAL_STORM_AURA));
412 }
413
418};
419
420// 44006 - Teleport Self
422{
424 {
425 dest.RelocateOffset({ 0.0f, 0.0f, 10.0f, 0.0f });
426 }
427
432};
433
434// 97316 - Summon Amani Kidnapper
436{
437 static void SetDest(SpellScript const&, SpellDestination& dest)
438 {
439 static constexpr Position Offset = { 0.0f, 0.0f, 30.0f, 0.0f };
440 dest.RelocateOffset(Offset);
441 }
442
447};
448
449// 98869 - Grab Passenger
451{
452 bool Validate(SpellInfo const* spellInfo) override
453 {
454 return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValueAsInt()) });
455 }
456
458 {
460 }
461
466};
467
int8_t int8
Definition Define.h:152
uint32_t uint32
Definition Define.h:154
@ POINT_MOTION_TYPE
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_TRIGGER_SPELL
@ TARGET_UNIT_SRC_AREA_ALLY
@ TARGET_UNIT_SRC_AREA_ENEMY
@ TARGET_DEST_CASTER
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ SPELLVALUE_BASE_POINT0
#define sSpellMgr
Definition SpellMgr.h:812
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
#define SpellHitFn(F)
EvadeReason
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:290
AkilzonEvents
@ EVENT_SET_WEATHER_2
@ EVENT_CALL_LIGHTNING
@ EVENT_SUMMON_EAGLES
@ EVENT_GUST_OF_WIND
@ EVENT_ELECTRICAL_STORM
@ EVENT_BERSERK
@ EVENT_SET_WEATHER
@ EVENT_STATIC_DISRUPTION
static constexpr std::array< uint32, 4 > EagleSpawnGroupsData
void AddSC_boss_akilzon()
AkilzonMisc
@ POINT_KIDNAPPER_PLAYER
@ PATH_KIDNAPPER_CYCLIC
@ SPAWN_GROUP_EAGLE_1
@ SOUND_EAGLE
@ SPAWN_GROUP_EAGLE_4
@ SPAWN_GROUP_EAGLE_3
@ SPAWN_GROUP_EAGLE_2
@ AREA_ZULAMAN
AkilzonTexts
@ EMOTE_STORM
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_SUMMON
@ SAY_BERSERK
@ SAY_EVENT
AkilzonSpells
@ SPELL_EAGLE_SWOOP
@ SPELL_ELECTRICAL_ARC_4
@ SPELL_GRAB_PASSENGER
@ SPELL_TELEPORT_SELF
@ SPELL_ELECTRICAL_ARC_1
@ SPELL_ELECTRICAL_ARC_2
@ SPELL_ELECTRICAL_ARC_5
@ SPELL_STATIC_DISRUPTION
@ SPELL_GUST_OF_WIND
@ SPELL_CALL_LIGHTNING
@ SPELL_ELECTRICAL_STORM
@ SPELL_ELECTRICAL_ARC_3
@ SPELL_BERSERK
@ SPELL_ELECTRICAL_STORM_AURA
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:180
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:118
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float intensity)
Definition Map.cpp:4061
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:2360
bool SpawnGroupDespawn(uint32 groupId, bool deleteRespawnTimes=false, size_t *count=nullptr)
Definition Map.cpp:2449
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
SpellEffectValue CalcValue(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
int32 CalcValueAsInt(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
uint32 const Id
Definition SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:590
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< HitHandler > AfterHit
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
int32 GetEffectValueAsInt() const
HookList< EffectHandler > OnEffectHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
SpellInfo const * GetTriggeringSpell() const
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Difficulty GetCastDifficulty() const
HookList< EffectHandler > OnEffectLaunch
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual void InitializeAI()
Definition UnitAI.cpp:35
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
TempSummon * ToTempSummon()
Definition Unit.h:1844
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
Map * GetMap() const
Definition Object.h:411
InstanceScript * GetInstanceScript() const
Definition Object.cpp:394
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
EventProcessor m_Events
Definition Object.h:561
bool Validate(SpellInfo const *spellInfo) override
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *spellInfo) override
void FilterTargets(std::list< WorldObject * > &targets)
void HandleEffect(SpellEffIndex effIndex)
bool Validate(SpellInfo const *spellInfo) override
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
void HandleScriptEffect(SpellEffIndex)
bool Validate(SpellInfo const *spellInfo) override
static void SetDest(SpellScript const &, SpellDestination &dest)
void SetDest(SpellDestination &dest)
@ WEATHER_STATE_MEDIUM_RAIN
Definition Weather.h:52
@ WEATHER_STATE_FINE
Definition Weather.h:48
@ WEATHER_STATE_FOG
Definition Weather.h:49
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:67
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void RelocateOffset(Position const &offset)
Definition Spell.cpp:90
void JustEngagedWith(Unit *who) override
void KilledUnit(Unit *) override
void UpdateAI(uint32 diff) override
boss_akilzon(Creature *creature)
void JustDied(Unit *) override
void EnterEvadeMode(EvadeReason) override
void OnSpellCast(SpellInfo const *spellInfo) override
void PassengerBoarded(Unit *, int8, bool apply) override
== Fields =======================================
void IsSummonedBy(WorldObject *summoner) override
void MovementInform(uint32 type, uint32 pointId) override
TaskScheduler _scheduler
void UpdateAI(uint32 diff) override
void InitializeAI() override
void JustAppeared() override
@ BOSS_AKILZON
Definition zulaman.h:28
#define RegisterZulAmanCreatureAI(ai_name)
Definition zulaman.h:114