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 "Map.h"
27#include "ScriptedCreature.h"
28#include "SpellAuraEffects.h"
29#include "SpellMgr.h"
30#include "SpellScript.h"
31#include "Weather.h"
32#include "zulaman.h"
33
44
66
78
88
89static constexpr std::array<uint32, 4> EagleSpawnGroupsData =
90{
95};
96
97// 23574 - Akil'zon
98struct boss_akilzon : public BossAI
99{
100 boss_akilzon(Creature* creature) : BossAI(creature, BOSS_AKILZON) { }
101
115
116 void OnSpellCast(SpellInfo const* spellInfo) override
117 {
118 if (spellInfo->Id == SPELL_BERSERK)
120 }
121
122 void EnterEvadeMode(EvadeReason /*why*/) override
123 {
124 for (uint32 group : EagleSpawnGroupsData)
125 me->GetMap()->SpawnGroupDespawn(group);
126
127 // Guessed. What should we do?
129
131 }
132
133 void KilledUnit(Unit* /*who*/) override
134 {
135 Talk(SAY_SLAY);
136 }
137
138 void JustDied(Unit* /*killer*/) override
139 {
140 _JustDied();
142
143 for (uint32 group : EagleSpawnGroupsData)
144 me->GetMap()->SpawnGroupDespawn(group);
145 }
146
147 void UpdateAI(uint32 diff) override
148 {
149 if (!UpdateVictim())
150 return;
151
152 events.Update(diff);
153
155 return;
156
157 while (uint32 eventId = events.ExecuteEvent())
158 {
159 switch (eventId)
160 {
162 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 80.0f, true))
163 DoCast(target, SPELL_GUST_OF_WIND);
164 events.Repeat(10s, 25s);
165 break;
167 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
169 events.Repeat(6s, 12s);
170 break;
173 events.Repeat(5s, 25s);
174 break;
177 for (uint32 group : EagleSpawnGroupsData)
178 me->GetMap()->SpawnGroupSpawn(group, true);
179 events.Repeat(1min);
180 break;
183 events.Repeat(1min);
186 break;
189 break;
192 break;
193 case EVENT_BERSERK:
195 break;
196 default:
197 break;
198 }
199 }
200
202 }
203};
204
205// 24858 - Soaring Eagle
207{
209
210 void InitializeAI() override
211 {
213 me->SetCorpseDelay(15, true);
215 }
216
217 void JustAppeared() override
218 {
219 _scheduler.Schedule(0s, 10s, [this](TaskContext task)
220 {
223 task.Repeat(1s, 15s);
224 });
225 }
226
227 void UpdateAI(uint32 diff) override
228 {
229 _scheduler.Update(diff);
230
231 if (UpdateVictim())
233 }
234
235private:
237};
238
239// 44733 - Eagle Swoop Primer
265
266// 44735 - Electrical Overload Primer
292
293// 43658 - Electrical Overload Graphic Pulse
295{
297
298 bool Validate(SpellInfo const* spellInfo) override
299 {
300 return ValidateSpellInfo(
301 {
307 }) && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_1).TriggerSpell });
308 }
309
310 void HandleScript(SpellEffIndex /*effIndex*/)
311 {
312 Unit* caster = GetCaster();
313 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_1, true);
314 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_2, true);
315 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_3, true);
316 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_4, true);
317 caster->CastSpell(nullptr, SPELL_ELECTRICAL_ARC_5, true);
318 }
319
321 {
322 PreventHitDefaultEffect(effIndex);
323
324 SpellInfo const* damageSpellSpellInfo = sSpellMgr->AssertSpellInfo(GetEffectInfo().TriggerSpell);
325
326 if (SpellInfo const* triggeringSpellSpellInfo = GetTriggeringSpell())
327 if (AuraEffect const* eff = GetCaster()->GetAuraEffect(triggeringSpellSpellInfo->Id, EFFECT_1))
328 GetCaster()->CastSpell(nullptr, uint32(GetEffectInfo().TriggerSpell), CastSpellExtraArgs()
329 .SetTriggerFlags(TRIGGERED_FULL_MASK)
330 .AddSpellMod(SPELLVALUE_BASE_POINT0, int32(eff->GetTickNumber() * damageSpellSpellInfo->GetEffect(EFFECT_0).CalcValue())));
331 }
332
338};
339
340// 43648 - Electrical Storm
342{
344
345 bool Validate(SpellInfo const* /*spellInfo*/) override
346 {
348 }
349
351 {
352 Unit* target = GetHitUnit();
353
354 if (Creature* caster = GetCaster()->ToCreature())
355 caster->AI()->Talk(EMOTE_STORM, target);
356
357 // this is a hack to ensure that DynamicObject granting SPELL_ELECTRICAL_STORM_AURA is only removed after damaging periodic fades
358 target->m_Events.AddEventAtOffset([target]
359 {
360 target->CastSpell(nullptr, SPELL_ELECTRICAL_STORM_AURA, true);
361 target->CastSpell(nullptr, SPELL_TELEPORT_SELF, true);
362 }, 100ms);
363 }
364
369};
370
371// 43657 - Electrical Storm
391
392// 44006 - Teleport Self
407
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
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
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_BASE_POINT0
#define sSpellMgr
Definition SpellMgr.h:738
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
#define SpellHitFn(F)
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:249
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
@ 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_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:82
void SetReactState(ReactStates st)
Definition Creature.h:128
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:98
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float intensity)
Definition Map.cpp:4788
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:3382
bool SpawnGroupDespawn(uint32 groupId, bool deleteRespawnTimes=false, size_t *count=nullptr)
Definition Map.cpp:3458
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr) const
uint32 Id
Definition SpellInfo.h:289
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
Unit * GetCaster() const
HookList< HitHandler > AfterHit
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
HookList< EffectHandler > OnEffectHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
SpellInfo const * GetTriggeringSpell() const
Unit * GetHitUnit() const
int32 GetEffectValue() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
HookList< EffectHandler > OnEffectLaunch
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
virtual void InitializeAI()
Definition UnitAI.cpp:36
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
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:783
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
Map * GetMap() const
Definition Object.h:451
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
EventProcessor m_Events
Definition Object.h:593
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_akilzon_eagle_swoop_primer)
bool Validate(SpellInfo const *spellInfo) override
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *spellInfo) override
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_akilzon_electrical_overload_primer)
PrepareSpellScript(spell_akilzon_electrical_overload)
void HandleEffect(SpellEffIndex effIndex)
bool Validate(SpellInfo const *spellInfo) override
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_akilzon_electrical_storm_damage)
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_akilzon_electrical_storm)
bool Validate(SpellInfo const *) override
void SetDest(SpellDestination &dest)
PrepareSpellScript(spell_akilzon_teleport_self)
@ 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:66
ScriptedAI(Creature *creature)
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void RelocateOffset(Position const &offset)
Definition Spell.cpp:110
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
TaskScheduler _scheduler
void UpdateAI(uint32 diff) override
void InitializeAI() override
void JustAppeared() override
@ BOSS_AKILZON
Definition zulaman.h:29
#define RegisterZulAmanCreatureAI(ai_name)
Definition zulaman.h:94