TrinityCore
boss_telash_greywing.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#include "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "CreatureAI.h"
21#include "CreatureAIImpl.h"
22#include "Map.h"
23#include "MotionMaster.h"
24#include "InstanceScript.h"
25#include "ObjectAccessor.h"
26#include "Player.h"
27#include "ScriptMgr.h"
28#include "ScriptedCreature.h"
29#include "SpellAuraEffects.h"
30#include "SpellScript.h"
31#include "SpellAuras.h"
32#include "SharedDefines.h"
33#include "azure_vault.h"
34
36{
37 // Telash
53
54 // Conversation
56};
57
59{
63};
64
66{
68};
69
71{
73};
74
76{
82 SAY_DEATH = 5
83};
84
85Position const TelashJumpPosition = { -5336.8003f, 1066.6493f, 344.32678f };
86
88{
89 { -5350.0835f, 1089.8976f, 340.5709f, 5.0882f },
90 { -5310.4464f, 1066.8134f, 340.5967f, 3.9184f },
91 { -5350.3934f, 1043.9323f, 340.5894f, 2.0924f }
92};
93
94// 186737 - Telash Greywing
96{
98
99 void JustAppeared() override
100 {
102 me->SetPower(me->GetPowerType(), 60);
103 }
104
105 void JustEngagedWith(Unit* who) override
106 {
109
112
118 }
119
120 void EnterEvadeMode(EvadeReason /*why*/) override
121 {
125 }
126
127 void JustDied(Unit* /*killer*/) override
128 {
131 }
132
133 void MovementInform(uint32 /*type*/, uint32 id) override
134 {
135 if (id == EVENT_JUMP)
136 {
137 if (!_isInCenter)
138 {
140 _isInCenter = true;
141 }
142 else
143 {
147 _isInCenter = false;
148 }
149 }
150 }
151
152 void UpdateAI(uint32 diff) override
153 {
154 scheduler.Update(diff);
155
156 if (!UpdateVictim())
157 return;
158
159 events.Update(diff);
160
162 return;
163
164 while (uint32 eventId = events.ExecuteEvent())
165 {
166 switch (eventId)
167 {
168 case EVENT_FROST_BOMB:
169 {
172
175 {
177 {
180 }
181 break;
182 }
183
184 events.ScheduleEvent(EVENT_FROST_BOMB, _frostBombRemaining == 2 ? 18200ms : 15800ms);
185 break;
186 }
188 {
189 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 75.0f, true))
190 {
193
196 {
197 if (_frostBombRemaining == 1)
198 {
201 }
202 break;
203 }
205 }
206 break;
207 }
209 if (me->GetPower(me->GetPowerType()) >= 100)
210 {
214 me->SetDisableGravity(true, true);
221 }
222 events.Repeat(500ms);
223 break;
224 default:
225 break;
226 }
228 return;
229 }
230 }
231
232 void DoAction(int32 param) override
233 {
234 if (param == ACTION_RESCHEDULE_SPELLS)
235 {
238
241 }
242 }
243
244private:
248};
249
250// 30743 - Vault Rune
252{
254
255 void OnUnitEnter(Unit* unit) override
256 {
257 if (!unit->IsPlayer())
258 return;
259
260 Unit* caster = at->GetCaster();
261 if (!caster)
262 return;
263
264 if (caster->HasAura(SPELL_VAULT_RUNE_SHIELD))
265 return;
266
267 caster->CastSpell(nullptr, SPELL_VAULT_RUNE_SHIELD, true);
268 }
269
270 void OnUnitExit(Unit* unit) override
271 {
272 if (!unit->IsPlayer())
273 return;
274
275 for (ObjectGuid const& guid : at->GetInsideUnits())
276 {
277 Player* player = ObjectAccessor::GetPlayer(*at, guid);
278 if (!player)
279 continue;
280
281 if (player->isDead())
282 continue;
283
284 return;
285 }
286
287 Unit* caster = at->GetCaster();
288 if (!caster)
289 return;
290
292 }
293
294 void OnRemove() override
295 {
296 if (!at->GetMap()->IsMythic() && !at->GetMap()->IsMythicPlus())
297 return;
298
299 for (ObjectGuid const& guid : at->GetInsideUnits())
300 {
301 Player* player = ObjectAccessor::GetPlayer(*at, guid);
302 if (!player)
303 continue;
304
305 if (player->isDead())
306 continue;
307
308 Unit* caster = at->GetCaster();
309 if (!caster)
310 return;
311
312 caster->CastSpell(caster, SPELL_INACTIVE_VAULT_RUNE, true);
313 break;
314 }
315 }
316};
317
318// 389453 - Ice Power (periodic)
320{
321 void HandlePeriodic(AuraEffect const* /*aurEff*/)
322 {
323 Unit* target = GetTarget();
324 target->SetPower(target->GetPowerType(), target->GetPower(POWER_ENERGY) + 2);
325 }
326
327 void Register() override
328 {
330 }
331};
332
333// 386781 - Frost Bomb
335{
336 bool Validate(SpellInfo const* /*spellInfo*/) override
337 {
339 }
340
341 void HandleHit(SpellEffIndex /*effIndex*/)
342 {
344 }
345
346 void Register() override
347 {
349 }
350};
351
352// 386881 - Frost Bomb
354{
355 bool Validate(SpellInfo const* /*spellInfo*/) override
356 {
357 return ValidateSpellInfo(
358 {
361 });
362 }
363
364 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
365 {
366 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
367 return;
368
369 if (Unit* caster = GetCaster())
370 {
371 caster->CastSpell(GetTarget(), SPELL_FROZEN_GROUND_AT, true);
372 caster->CastSpell(GetTarget(), SPELL_FROST_BOMB_DAMAGE, true);
373 }
374 }
375
376 void Register() override
377 {
379 }
380};
381
382// 387928 - Absolute Zero
384{
385 bool Validate(SpellInfo const* /*spellInfo*/) override
386 {
388 }
389
390 void HandleHit(SpellEffIndex /*effIndex*/)
391 {
393 }
394
395 void Register() override
396 {
398 }
399};
400
401// 390209 - Activate Vault Rune
403{
404 bool Validate(SpellInfo const* /*spellInfo*/) override
405 {
406 return ValidateSpellInfo(
407 {
410 });
411 }
412
414 {
416 return;
417
419 }
420
421 void Register() override
422 {
424 }
425};
426
427// 388008 - Absolute Zero
429{
430 bool Validate(SpellInfo const* /*spellInfo*/) override
431 {
432 return ValidateSpellInfo(
433 {
437 });
438 }
439
441 {
442 float nearestDist = std::numeric_limits<float>::max();
443 Position const* nearestPos = &TelashJumpBackPositions[0];
444
445 for (Position const& pos : TelashJumpBackPositions)
446 {
447 float dist = victim->GetDistance(pos);
448 if (dist < nearestDist)
449 {
450 nearestDist = dist;
451 nearestPos = &pos;
452 }
453 }
454
455 return *nearestPos;
456 }
457
459 {
460 Unit* caster = GetCaster();
461 UnitAI* casterAI = caster->GetAI();
462 if (!casterAI)
463 return;
464
466 if (!victim)
467 return;
468
471 }
472
474 {
477 }
478
479 void Register() override
480 {
483 }
484};
485
487{
488 // Creature
490
491 // AreaTrigger
493
494 // Spells
501}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterAreaTriggerAI(ai_name)
Definition: ScriptMgr.h:1416
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ EVENT_JUMP
@ SPELL_EFFECT_DUMMY
@ POWER_ENERGY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_DUMMY
@ SPELL_AURA_PERIODIC_DUMMY
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define SpellCastFn(F)
Definition: SpellScript.h:825
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
EvadeReason
Definition: UnitAICommon.h:30
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterAzureVaultCreatureAI(ai_name)
Definition: azure_vault.h:63
@ DATA_TELASH_GREYWING
Definition: azure_vault.h:33
void AddSC_boss_telash_greywing()
@ ACTION_RESCHEDULE_SPELLS
@ SAY_ANNOUNCE_ABSOLUTE_ZERO
@ SAY_FROST_BOMB
@ SAY_FLY_TO_MIDDLE
@ SAY_ICY_DEVASTATOR
TelashSummonGroups
@ SUMMON_GROUP_TELASH_VAULT_RUNES
Position const TelashJumpBackPositions[]
@ SPELL_ABSOLUTE_ZERO_JUMP_BACK
@ SPELL_FROST_BOMB_DAMAGE
@ SPELL_FROST_BOMB_AURA
@ SPELL_ABSOLUTE_ZERO_DAMAGE
@ SPELL_ACTIVATE_VAULT_RUNE
@ SPELL_POWER_ENERGIZE_ICE_POWER_PERIODIC
@ SPELL_ABSOLUTE_ZERO_CAST
@ SPELL_ICY_DEVASTATOR
@ SPELL_TELASH_APPROACH_CONV
@ SPELL_FROZEN_GROUND_AT
@ SPELL_VAULT_RUNE_SHIELD
@ SPELL_INACTIVE_VAULT_RUNE
@ SPELL_ABSOLUTE_ZERO_SHIELD
@ SPELL_FROST_BOMB_CAST
@ SPELL_VAULT_RUNE_AT_AURA
@ SPELL_ABSOLUTE_ZERO_JUMP
@ EVENT_ICY_DEVASTATOR
@ EVENT_FROST_BOMB
@ EVENT_ABSOLUTE_ZERO
Position const TelashJumpPosition
AreaTrigger *const at
Definition: AreaTriggerAI.h:33
GuidUnorderedSet const & GetInsideUnits() const
Definition: AreaTrigger.h:135
Unit * GetCaster() const
AuraApplication const * GetTargetApplication() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetCaster() const
Unit * GetTarget() const
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:2035
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
TaskScheduler scheduler
SummonList summons
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:299
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void SetReactState(ReactStates st)
Definition: Creature.h:160
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
bool IsMythicPlus() const
Definition: Map.cpp:3310
bool IsMythic() const
Definition: Map.cpp:3303
bool IsPlayer() const
Definition: Object.h:212
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
HookList< CastHandler > AfterCast
Definition: SpellScript.h:824
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
TaskScheduler & Update(success_t const &callback=nullptr)
Definition: UnitAI.h:50
virtual void DoAction(int32)
Definition: UnitAI.h:72
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:9419
Powers GetPowerType() const
Definition: Unit.h:799
UnitAI * GetAI() const
Definition: Unit.h:660
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
int32 GetPower(Powers power) const
Definition: Unit.cpp:9401
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
bool isDead() const
Definition: Unit.h:1166
Map * GetMap() const
Definition: Object.h:624
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1078
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition: Object.cpp:2131
bool Validate(SpellInfo const *) override
Position const & GetClosestPositionToMaxThreatTarget(Unit *victim)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandlePeriodic(AuraEffect const *)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
void OnUnitExit(Unit *unit) override
at_telash_greywing_vault_rune(AreaTrigger *areatrigger)
void OnUnitEnter(Unit *unit) override
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
void MovementInform(uint32, uint32 id) override
void DoAction(int32 param) override
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason) override
boss_telash_greywing(Creature *creature)