TrinityCore
Loading...
Searching...
No Matches
boss_priestess_alun_za.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 "CellImpl.h"
21#include "Containers.h"
22#include "Creature.h"
23#include "GridNotifiersImpl.h"
24#include "InstanceScript.h"
25#include "MotionMaster.h"
26#include "ObjectAccessor.h"
27#include "ScriptMgr.h"
28#include "ScriptedCreature.h"
29#include "SpellAuraEffects.h"
30#include "SpellScript.h"
31#include "atal_dazar.h"
32
56
68
80
93
95{
96 { -1124.4688f, 2294.139f, 747.2801f },
97 { -1126.8889f, 2307.7466f, 743.11414f },
98 { -1124.342f, 2292.5173f, 747.76434f },
99 { -1131.6841f, 2304.0347f, 743.94354f },
100 { -1131.2916f, 2282.3438f, 743.99896f }
101};
102
104{
105 { -1110.4965f, 2259.4306f, 741.8436f, 0.261799f },
106 { -1110.5451f, 2325.2829f, 741.8436f, 0.785398f }
107};
108
109constexpr Position SpiritOfGoldSpawnPosition = { -1119.8f, 2292.46f, 745.114f };
110
111// 122967 - Priestess Alun'za
113{
115
124
125 void Reset() override
126 {
128
130 }
131
142
143 void KilledUnit(Unit* victim) override
144 {
145 if (!victim->IsPlayer())
146 return;
147
148 Talk(SAY_SLAY);
149 }
150
171
172 void JustDied(Unit* /*killer*/) override
173 {
174 _JustDied();
176
177 Talk(SAY_DIED);
178 }
179
180 void ExecuteEvent(uint32 eventId) override
181 {
182 switch (eventId)
183 {
185 {
189 events.Repeat(34s);
190 break;
191 }
193 {
197 events.Repeat(2s, 4s);
198 break;
199 }
201 {
203 events.Repeat(24s);
204 break;
205 }
207 {
208 if (me->GetPower(POWER_ENERGY) >= 100)
209 {
213
214 // make sure new pools spawn
217 }
218 events.Repeat(500ms);
219 break;
220 }
222 {
225 events.Repeat(3s);
226 break;
227 }
229 {
231 events.Repeat(34s);
232 break;
233 }
234 default:
235 break;
236 }
237 }
238
239private:
241};
242
243// 130738 - Corrupted Gold
245{
247
248 void JustAppeared() override
249 {
251
253
254 static constexpr float MAX_DISTANCE = 116.0f;
255 float randomAngle = frand(me->GetOrientation() - float(M_PI) / 3.0f, me->GetOrientation() + float(M_PI) / 3.0f);
256 Position despawnPos = me->GetPosition();
257 me->MovePosition(despawnPos, MAX_DISTANCE, randomAngle);
258
259 me->GetMotionMaster()->MovePoint(POINT_DESPAWN, despawnPos, true, {}, 2.0f);
260
261 // manually scheduling as regular timer is only scheduled on engaged unitsw
262 _scheduler.Schedule(2500ms, [this](TaskContext& context)
263 {
264 CheckInRoom();
265 context.Repeat();
266 });
267 }
268
269 void UpdateAI(uint32 diff) override
270 {
271 _scheduler.Update(diff);
272 }
273
274 bool CheckInRoom() override
275 {
276 if (!IsInBoundary())
277 {
279 return false;
280 }
281 return true;
282 }
283
284 void MovementInform(uint32 type, uint32 pointId) override
285 {
286 if (type != POINT_MOTION_TYPE)
287 return;
288
289 if (pointId == POINT_DESPAWN)
291 }
292
293private:
295};
296
297// 131009 - Spirit of Gold
299{
301
303 {
304 static constexpr float SELECT_RANGE_TAINTED_BLOOD = 300.0f;
305
306 AreaTrigger* at = nullptr;
309 Cell::VisitGridObjects(me, checker, SELECT_RANGE_TAINTED_BLOOD);
310 return at;
311 }
312
320
321 void MovementInform(uint32 type, uint32 pointId) override
322 {
323 if (type != POINT_MOTION_TYPE)
324 return;
325
326 if (pointId != POINT_POOL)
327 return;
328
330 return;
331
333 if (at && me->GetDistance(at) <= 1.0f)
335
337 }
338
339 void UpdateAI(uint32 diff) override
340 {
341 UpdateVictim();
342
343 _events.Update(diff);
344
346 return;
347
348 while (uint32 eventId = _events.ExecuteEvent())
349 {
350 switch (eventId)
351 {
353 {
355 break;
356
358 {
359 _targetAtGUID = at->GetGUID();
361 me->GetMotionMaster()->MovePoint(POINT_POOL, at ->GetPosition());
362 }
363 else
364 {
367 _events.Repeat(500ms);
368 }
369 break;
370 }
371 default:
372 break;
373 }
374
376 return;
377 }
378 }
379
380private:
383};
384
385// 258388 - Ritual
398
399// 258681 - Energy Regen
412
413// 255615 - Agitate
435
436// 255591 - Molten Gold
438{
439 void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
440 {
441 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
442 return;
443
444 Unit* target = GetTarget();
445 target->CastSpell(target, aurEff->GetAmountAsInt(), CastSpellExtraArgsInit{
446 .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
447 .TriggeringAura = aurEff
448 });
449 }
450
455};
456
457// 255584 - Molten Gold
478
479// 255592 - Tainted Blood
492
493// 255566 - Bubble
495{
496 static constexpr float DestMinX = -1097.241577f;
497 static constexpr float DestMaxX = -1070.074463f;
498 static constexpr float DestMinY = 2268.181396f;
499 static constexpr float DestMaxY = 2319.480957f;
500
501 bool Validate(SpellInfo const* /*spellInfo*/) override
502 {
504 }
505
516
521};
522
523// 255577 - Transfusion
525{
526 bool Validate(SpellInfo const* /*spellInfo*/) override
527 {
529 }
530
531 void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
532 {
533 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
534 return;
535
536 Unit* target = GetTarget();
539 .TriggeringAura = aurEff
540 });
541 }
542
547};
548
549// 255575 - transfusion Damage
577
578// 255835 - Transfusion
591
592// 255836 - Transfusion
605
606// 259205 - Spirit of Gold
607// 259209 - Summon Spirit of Gold
620
621// 259032 - Corrupt
623{
624 void OnStackChange(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
625 {
626 if (GetStackAmount() == 8)
627 {
630 .TriggeringAura = aurEff
631 });
632
633 Creature* creature = GetTarget()->ToCreature();
634 if (!creature)
635 return;
636
638 creature->AI()->DoZoneInCombat();
639 }
640 }
641
646};
647
648// 255559 - Tainted Blood
649// ID - 11867
651{
653
654 void OnUnitEnter(Unit* unit) override
655 {
656 if (unit->IsPlayer())
657 {
659 at->Remove();
660 }
661 else if (unit->GetEntry() == NPC_SPIRIT_OF_GOLD && !unit->HasAura(SPELL_FATALLY_CORRUPTED))
662 {
663 _scheduler.Schedule(3s, [this](TaskContext const& /*task*/)
664 {
665 at->Remove();
666 });
667 }
668 }
669
670 void OnUpdate(uint32 diff) override
671 {
672 _scheduler.Update(diff);
673 }
674
675private:
677};
678
679// 258703 - Corrupted Gold
680// ID - 12159
682{
684
685 void OnUnitEnter(Unit* unit) override
686 {
687 if (!unit->IsPlayer())
688 return;
689
690 Unit* caster = at->GetCaster();
691 if (!caster)
692 return;
693
695 }
696};
697
#define M_PI
Definition Common.h:118
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
@ POINT_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
float frand(float min, float max)
Definition Random.cpp:55
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENTRY
@ TARGET_DEST_DEST
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELL_EFFECT_HEAL_PCT
@ POWER_ENERGY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAPPLY
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ DATA_PRIESTESS_ALUNZA
Definition atal_dazar.h:31
#define RegisterAtalDazarCreatureAI(ai_name)
Definition atal_dazar.h:60
constexpr Position SpiritOfGoldSpawnPosition
void AddSC_boss_priestess_alun_za()
@ EVENT_SPIRIT_OF_GOLD
@ EVENT_TAINTED_BLOOD
@ EVENT_CHECK_TAINTED_BLOOD
@ EVENT_CORRUPTED_GOLD
@ SAY_GILDED_CLAWS_WARNING
@ SAY_TRANSFUSION_WARNING
@ SUMMON_GROUP_CAULDRONS
@ AREATRIGGER_TAINTED_BLOOD
@ SPELL_TAINTED_BLOOD_SELECTOR
@ SPELL_CORRUPTED_GOLD_DAMAGE
@ SPELL_MOLTEN_GOLD_MISSILE
@ SPELL_TAINTED_BLOOD_AT
@ SPELL_TRANSFUSION_DAMAGE
@ SPELL_TAINTED_BLOOD_DAMAGE
@ SPELL_TRANSFUSION_HEAL
@ SPELL_FATALLY_CORRUPTED
@ SPELL_SPIRIT_OF_GOLD
@ SPELL_TAINTED_BLOOD_MISSILE
@ SPELL_CORRUPTED_GOLD
constexpr Position CorruptedGoldSpawnPosition[2]
constexpr Position RitualPosition[5]
AreaTrigger *const at
Unit * GetCaster() const
int32 GetAmountAsInt() const
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
uint8 GetStackAmount() const
bool IsPlayer() const
Definition BaseEntity.h:173
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void Reset() override
void DoZoneInCombat()
Definition CreatureAI.h:169
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool IsInBoundary(Position const *who=nullptr) const
bool UpdateVictim()
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:174
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:228
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
CreatureBoundary const * GetBossBoundary(uint32 id) const
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
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 Clear()
Definition ObjectGuid.h:329
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
void SetEffectValue(SpellEffectValue value)
SpellEffectValue GetEffectValue() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
int32 GetEffectValueAsInt() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
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
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:8697
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10046
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
int32 GetPower(Powers power) const
Definition Unit.cpp:10028
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void SetPowerType(Powers power, bool sendUpdate=true, bool onInit=false)
Definition Unit.cpp:5697
void MovePosition(Position &pos, float dist, float angle, float maxHeightChange=6.0f) const
Definition Object.cpp:2782
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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:1398
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition Object.cpp:700
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:432
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:1507
static void SelectTarget(SpellScript const &, std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
void OnStackChange(AuraEffect const *aurEff, AuraEffectHandleModes) const
void OnPeriodic(AuraEffect const *aurEff) const
void OnRemove(AuraEffect const *aurEff, AuraEffectHandleModes) const
static void SetDest(SpellScript const &, SpellDestination &dest)
static void SetDest(SpellScript const &, SpellDestination &dest)
static void FilterTargets(SpellScript const &, std::list< WorldObject * > &targets)
void OnRemove(AuraEffect const *aurEff, AuraEffectHandleModes) const
bool Validate(SpellInfo const *) override
TC_GAME_API AreaTrigger * GetAreaTrigger(WorldObject const &u, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:67
TriggerCastFlags TriggerFlags
CastSpellExtraArgs & SetTriggeringSpell(Spell const *triggeringSpell)
Definition Spell.cpp:9707
CastSpellExtraArgs & SetTriggerFlags(TriggerCastFlags flag)
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:179
constexpr float GetPositionX() const
Definition Position.h:87
float m_positionZ
Definition Position.h:66
constexpr float GetPositionY() const
Definition Position.h:88
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
constexpr float GetOrientation() const
Definition Position.h:90
bool IsMythicPlus() const
bool IsHeroicOrHigher() const
void Relocate(Position const &pos)
Definition Spell.cpp:82
at_priestess_alun_za_corrupted_gold(AreaTrigger *areatrigger)
at_priestess_alun_za_tainted_blood(AreaTrigger *areatrigger)
void KilledUnit(Unit *victim) override
void EnterEvadeMode(EvadeReason) override
void JustEngagedWith(Unit *who) override
void ExecuteEvent(uint32 eventId) override
boss_priestess_alun_za(Creature *creature)
void MovementInform(uint32 type, uint32 pointId) override
void MovementInform(uint32 type, uint32 pointId) override