TrinityCore
boss_jedoga_shadowseeker.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 "ahnkahet.h"
19#include "Containers.h"
20#include "InstanceScript.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "ScriptedCreature.h"
24#include "ScriptMgr.h"
25#include "SpellScript.h"
26#include "TemporarySummon.h"
27
29{
36
39};
40
42{
51
52 //Jedoga Controller
55
56 //Twilight Volunteer
59};
60
62{
74};
75
77{
82};
83
85{
91};
92
93Position const JedogaSacrificePosition = { 376.5385f, -707.3567f, -16.14124f };
94Position const JedogaGroundPosition = { 371.6281f, -704.4836f, -16.17967f };
95Position const JedogaFlyPosition = { 371.627f, -704.4217f, -6.707521f };
97{
98 { 402.7893f, -748.5251f, 29.39399f, 2.024582f },
99 { 420.1999f, -727.0132f, 28.88036f, 2.042035f },
100 { 375.4977f, -707.3635f, -16.0964f, 2.426008f }
101};
102
103typedef std::pair<Position, Position> JedogaVolunteerPositionPair;
104std::vector<JedogaVolunteerPositionPair> const JedogaVolunteerSpotPositions =
105{
106 { { 400.7701f, -784.8928f, -31.60143f }, { 365.9514f, -719.1235f, -16.17974f } },
107 { { 397.3595f, -788.5157f, -31.59679f }, { 359.7433f, -715.017f, -16.17974f } },
108 { { 399.3177f, -787.2599f, -31.59631f }, { 362.0263f, -719.1036f, -16.17974f } },
109 { { 460.4623f, -719.2227f, -31.58718f }, { 389.266f, -679.3693f, -16.17973f } },
110 { { 456.0909f, -724.3412f, -31.58718f }, { 400.5992f, -691.7954f, -16.17973f } },
111 { { 452.6613f, -726.9518f, -31.58718f }, { 400.3423f, -701.5115f, -16.17974f } },
112 { { 447.8852f, -732.3298f, -31.58718f }, { 389.861f, -710.6993f, -16.17974f } },
113 { { 457.562f, -721.1855f, -31.58718f }, { 395.4494f, -684.5345f, -16.17973f } },
114 { { 451.7243f, -730.2181f, -31.58718f }, { 397.0945f, -708.4188f, -15.99747f } },
115 { { 413.9582f, -777.132f, -31.58716f }, { 388.1394f, -723.124f, -15.9938f } },
116 { { 411.5661f, -781.2356f, -31.58716f }, { 381.7102f, -730.0745f, -15.99554f } },
117 { { 407.395f, -786.793f, -31.58716f }, { 366.9791f, -737.3303f, -16.17974f } },
118 { { 404.9166f, -788.3472f, -31.58716f }, { 358.6124f, -735.9944f, -15.9855f } },
119 { { 401.5697f, -791.2033f, -31.58717f }, { 351.9383f, -729.6436f, -16.17974f } },
120 { { 410.1105f, -785.4691f, -31.58716f }, { 373.1659f, -736.2893f, -16.17974f } },
121 { { 442.5644f, -730.2499f, -31.59826f }, { 390.5955f, -714.6851f, -16.17974f } },
122 { { 445.5233f, -725.9542f, -31.60173f }, { 393.9694f, -708.1727f, -16.17974f } },
123 { { 448.5531f, -722.5888f, -31.60066f }, { 395.2702f, -702.556f, -16.17974f } },
124 { { 449.8521f, -719.7265f, -31.58849f }, { 394.5757f, -695.1004f, -16.17974f } },
125 { { 453.5134f, -717.7018f, -31.59883f }, { 387.6152f, -690.1782f, -16.17974f } },
126 { { 457.8564f, -711.7424f, -31.59773f }, { 378.6874f, -687.1343f, -16.17973f } },
127 { { 410.0583f, -774.4119f, -31.60115f }, { 383.8151f, -723.4276f, -16.17974f } },
128 { { 408.7458f, -777.955f, -31.59873f }, { 376.9857f, -725.0735f, -16.17974f } },
129 { { 405.2404f, -779.6614f, -31.60512f }, { 373.3736f, -722.7498f, -16.17974f } },
130 { { 404.0797f, -783.829f, -31.59497f }, { 367.8631f, -722.5212f, -16.17974f } }
131};
132
134{
141
143{
145
146 void Reset() override
147 {
148 _Reset();
149
152
153 std::list<TempSummon*> summoned;
155 for (TempSummon* value : summoned)
156 _initiateGUIDS.insert(value->GetGUID());
157
159 controller->CastSpell(me, SPELL_BEAM_VISUAL_JEDOGA);
161 controller->CastSpell(me, SPELL_BEAM_VISUAL_JEDOGA);
162
164 }
165
166 void JustEngagedWith(Unit* who) override
167 {
171
175
177 {
179 {
180 volunteer->GetMotionMaster()->MovePoint(POINT_INITIAL_POSITION, posPair.second);
181 _volunteerGUIDS.push_back(volunteer->GetGUID());
182 }
183 }
184 }
185
186 void EnterEvadeMode(EvadeReason /*why*/) override
187 {
191 }
192
193 void KilledUnit(Unit* Victim) override
194 {
195 if (Victim->GetTypeId() == TYPEID_PLAYER)
196 Talk(SAY_SLAY);
197 }
198
199 void JustDied(Unit* /*killer*/) override
200 {
201 _JustDied();
203 }
204
205 uint32 GetData(uint32 type) const override
206 {
207 if (type == DATA_VOLUNTEER_WORK)
208 return _volunteerWork ? 1 : 0;
209
210 return 0;
211 }
212
213 void DamageTaken(Unit* /*done_by*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
214 {
216 {
217 events.Reset();
220 }
221 }
222
223 void DoAction(int32 action) override
224 {
225 if (action == ACTION_SACRIFICE)
226 {
231 }
232 }
233
234 void JustSummoned(Creature* summon) override
235 {
236 if (summon->GetEntry() == NPC_TWILIGHT_WORSHIPPER)
237 {
239 summons.Summon(summon);
240 return;
241 }
242
243 BossAI::JustSummoned(summon);
244 }
245
246 void SummonedCreatureDies(Creature* summon, Unit* killer) override
247 {
248 if (summon->GetEntry() == NPC_TWILIGHT_INITIATE)
249 {
250 _initiateGUIDS.erase(summon->GetGUID());
251 if (_initiateGUIDS.empty())
252 {
256 }
257 }
258 else if (summon->GetEntry() == NPC_TWILIGHT_VOLUNTEER)
259 {
260 _volunteerWork = false;
261
263 {
266 }
267
269 }
270
271 BossAI::SummonedCreatureDies(summon, killer);
272 }
273
274 void MovementInform(uint32 type, uint32 pointId) override
275 {
276 if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
277 return;
278
279 switch (pointId)
280 {
281 case POINT_GROUND:
282 me->SetUninteractible(false);
288 break;
289 case POINT_PHASE_TWO:
291 break;
294 break;
295 default:
296 break;
297 }
298 }
299
300 void UpdateAI(uint32 diff) override
301 {
303 return;
304
305 events.Update(diff);
306
308 return;
309
310 while (uint32 eventId = events.ExecuteEvent())
311 {
312 switch (eventId)
313 {
314 case EVENT_INTRO_SAY:
318 break;
322 break;
325 me->SetDisableGravity(false);
327 break;
330 me->AttackStop();
332 me->SetUninteractible(true);
334 break;
335 case EVENT_FLY_DELAY:
336 me->SetDisableGravity(true);
338 break;
341 {
342 me->SetFacingToObject(controller);
343 controller->CastSpell(controller, SPELL_SACRIFICE_VISUAL);
344 }
345
347
348 if (_volunteerGUIDS.empty())
349 break;
350
353 volunteer->AI()->DoAction(ACTION_CHOSEN);
354 break;
356 {
357 uint32 pos = std::distance(_volunteerGUIDS.begin(), std::find(_volunteerGUIDS.begin(), _volunteerGUIDS.end(), _selectedVolunteerGUID));
358 if (pos < JedogaVolunteerSpotPositions.size())
359 {
362 volunteer->GetMotionMaster()->MovePoint(POINT_INITIAL_POSITION, posPair.second);
363 }
364 break;
365 }
369 me->SetDisableGravity(false);
371 break;
374 events.Repeat(Seconds(15), Seconds(30));
375 break;
377 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
379 events.Repeat(Seconds(15), Seconds(30));
380 break;
382 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
383 DoCast(target, SPELL_THUNDERSHOCK);
384 events.Repeat(Seconds(15), Seconds(30));
385 break;
386 default:
387 break;
388 }
389
391 return;
392 }
393 }
394
395private:
400};
401
403{
404 npc_twilight_volunteer(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
405 {
407 }
408
409 void DoAction(int32 action) override
410 {
411 if (action == ACTION_CHOSEN)
412 {
417 me->SetUninteractible(false);
418 me->SetWalk(true);
420 }
421 }
422
423 void MovementInform(uint32 type, uint32 pointId) override
424 {
425 if (type != POINT_MOTION_TYPE)
426 return;
427
428 switch (pointId)
429 {
432 me->SetFacingToObject(jedoga);
433
436 break;
437 case POINT_SACRIFICE:
439 {
441 jedoga->AI()->DoAction(ACTION_SACRIFICE);
443
444 _scheduler.Schedule(Seconds(3), [this](TaskContext /*context*/)
445 {
448 });
449 }
450 break;
451 default:
452 break;
453 }
454 }
455
456 void UpdateAI(uint32 diff) override
457 {
458 _scheduler.Update(diff);
459 }
460
461private:
464};
465
466// 56328 - Random Lightning Visual Effect
468{
470 {
471 Position const offset = { 0.0f, 0.0f, -19.0f, 0.0f };
472 dest.RelocateOffset(offset);
473 }
474
475 void Register() override
476 {
478 }
479
480};
481
483{
484 public:
485 achievement_volunteer_work() : AchievementCriteriaScript("achievement_volunteer_work") { }
486
487 bool OnCheck(Player* /*player*/, Unit* target) override
488 {
489 if (!target)
490 return false;
491
492 if (Creature* jedoga = target->ToCreature())
493 if (jedoga->AI()->GetData(DATA_VOLUNTEER_WORK) == 1)
494 return true;
495
496 return false;
497 }
498};
499
501{
506}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
std::chrono::minutes Minutes
Minutes shorthand typedef.
Definition: Duration.h:35
@ DONE
@ POINT_MOTION_TYPE
@ EFFECT_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: ObjectDefines.h:70
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:68
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition: ObjectGuid.h:396
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
std::vector< ObjectGuid > GuidVector
Definition: ObjectGuid.h:395
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_DEST_CASTER_RANDOM
#define SpellDestinationTargetSelectFn(F, I, N)
Definition: SpellScript.h:874
EvadeReason
Definition: UnitAICommon.h:30
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
@ UNIT_STAND_STATE_DEAD
Definition: UnitDefines.h:49
@ UNIT_STAND_STATE_KNEEL
Definition: UnitDefines.h:50
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:42
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ DATA_JEDOGA_SHADOWSEEKER
Definition: ahnkahet.h:33
@ DATA_PRINCE_TALDARAM
Definition: ahnkahet.h:32
#define RegisterAhnKahetCreatureAI(ai_name)
Definition: ahnkahet.h:87
@ NPC_TWILIGHT_VOLUNTEER
Definition: ahnkahet.h:57
@ NPC_TWILIGHT_INITIATE
Definition: ahnkahet.h:56
@ NPC_TWILIGHT_WORSHIPPER
Definition: ahnkahet.h:58
@ NPC_JEDOGA_CONTROLLER
Definition: ahnkahet.h:59
Position const JedogaGroundPosition
@ SPELL_SACRIFICE_VISUAL
@ SPELL_RANDOM_LIGHTNING_VISUAL
@ SPELL_PILLAR_OF_LIGHTNING
@ SPELL_SPHERE_VISUAL_VOLUNTEER
@ SPELL_LIGHTNING_BOLT
@ SPELL_BEAM_VISUAL_JEDOGA
@ SPELL_CYCLONE_STRIKE
@ SPELL_SACRIFICE_BEAM
Position const JedogaFlyPosition
void AddSC_boss_jedoga_shadowseeker()
std::vector< JedogaVolunteerPositionPair > const JedogaVolunteerSpotPositions
@ EVENT_CHOOSE_VOLUNTEER
@ EVENT_CYCLONE_STRIKE
@ EVENT_LIGHTNING_BOLT
@ EVENT_SUMMON_VOLUNTEER
@ EVENT_START_PHASE_TWO
@ POINT_INITIAL_POSITION
Position const JedogaSacrificePosition
@ SUMMON_GROUP_WORSHIPPERS
@ SUMMON_GROUP_INITIATES
std::pair< Position, Position > JedogaVolunteerPositionPair
Position const JedogaControllerPositions[3]
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void _JustDied()
void DoZoneInCombat()
Definition: CreatureAI.h:161
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
virtual void SummonedCreatureDies(Creature *, Unit *)
Definition: CreatureAI.h:115
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
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
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
bool IsInPhase(uint8 phase) const
Definition: EventMap.h:217
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:52
void Reset()
Definition: EventMap.cpp:21
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
void MoveTakeoff(uint32 id, Position const &pos, Optional< int32 > tierTransitionId={}, Optional< float > velocity={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
void MoveLand(uint32 id, Position const &pos, Optional< int32 > tierTransitionId={}, Optional< float > velocity={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default)
static Creature * ToCreature(Object *o)
Definition: Object.h:219
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Definition: SpellScript.h:873
void DespawnEntry(uint32 entry)
void Summon(Creature const *summon)
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:10100
void SetAnimTier(AnimTier animTier, bool notifyClient=true)
Definition: Unit.cpp:10114
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void SetFacingToObject(WorldObject const *object, bool force=true)
Definition: Unit.cpp:12671
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
bool SetWalk(bool enable)
Definition: Unit.cpp:12707
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool AttackStop()
Definition: Unit.cpp:5781
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
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:2025
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition: Object.cpp:2131
bool OnCheck(Player *, Unit *target) override
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
bool HealthBelowPct(uint32 pct) const
void RelocateOffset(Position const &offset)
Definition: Spell.cpp:122
void EnterEvadeMode(EvadeReason) override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
void SummonedCreatureDies(Creature *summon, Unit *killer) override
void MovementInform(uint32 type, uint32 pointId) override
void JustSummoned(Creature *summon) override
uint32 GetData(uint32 type) const override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *Victim) override
void DoAction(int32 action) override
boss_jedoga_shadowseeker(Creature *creature)
void JustEngagedWith(Unit *who) override
void MovementInform(uint32 type, uint32 pointId) override
void UpdateAI(uint32 diff) override
void DoAction(int32 action) override
npc_twilight_volunteer(Creature *creature)