TrinityCore
Loading...
Searching...
No Matches
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 "Spell.h"
26#include "SpellScript.h"
27#include "TemporarySummon.h"
28
41
61
76
84
93
94Position const JedogaSacrificePosition = { 376.5385f, -707.3567f, -16.14124f };
95Position const JedogaGroundPosition = { 371.6281f, -704.4836f, -16.17967f };
96Position const JedogaFlyPosition = { 371.627f, -704.4217f, -6.707521f };
98{
99 { 402.7893f, -748.5251f, 29.39399f, 2.024582f },
100 { 420.1999f, -727.0132f, 28.88036f, 2.042035f },
101 { 375.4977f, -707.3635f, -16.0964f, 2.426008f }
102};
103
104typedef std::pair<Position, Position> JedogaVolunteerPositionPair;
105std::vector<JedogaVolunteerPositionPair> const JedogaVolunteerSpotPositions =
106{
107 { { 400.7701f, -784.8928f, -31.60143f }, { 365.9514f, -719.1235f, -16.17974f } },
108 { { 397.3595f, -788.5157f, -31.59679f }, { 359.7433f, -715.017f, -16.17974f } },
109 { { 399.3177f, -787.2599f, -31.59631f }, { 362.0263f, -719.1036f, -16.17974f } },
110 { { 460.4623f, -719.2227f, -31.58718f }, { 389.266f, -679.3693f, -16.17973f } },
111 { { 456.0909f, -724.3412f, -31.58718f }, { 400.5992f, -691.7954f, -16.17973f } },
112 { { 452.6613f, -726.9518f, -31.58718f }, { 400.3423f, -701.5115f, -16.17974f } },
113 { { 447.8852f, -732.3298f, -31.58718f }, { 389.861f, -710.6993f, -16.17974f } },
114 { { 457.562f, -721.1855f, -31.58718f }, { 395.4494f, -684.5345f, -16.17973f } },
115 { { 451.7243f, -730.2181f, -31.58718f }, { 397.0945f, -708.4188f, -15.99747f } },
116 { { 413.9582f, -777.132f, -31.58716f }, { 388.1394f, -723.124f, -15.9938f } },
117 { { 411.5661f, -781.2356f, -31.58716f }, { 381.7102f, -730.0745f, -15.99554f } },
118 { { 407.395f, -786.793f, -31.58716f }, { 366.9791f, -737.3303f, -16.17974f } },
119 { { 404.9166f, -788.3472f, -31.58716f }, { 358.6124f, -735.9944f, -15.9855f } },
120 { { 401.5697f, -791.2033f, -31.58717f }, { 351.9383f, -729.6436f, -16.17974f } },
121 { { 410.1105f, -785.4691f, -31.58716f }, { 373.1659f, -736.2893f, -16.17974f } },
122 { { 442.5644f, -730.2499f, -31.59826f }, { 390.5955f, -714.6851f, -16.17974f } },
123 { { 445.5233f, -725.9542f, -31.60173f }, { 393.9694f, -708.1727f, -16.17974f } },
124 { { 448.5531f, -722.5888f, -31.60066f }, { 395.2702f, -702.556f, -16.17974f } },
125 { { 449.8521f, -719.7265f, -31.58849f }, { 394.5757f, -695.1004f, -16.17974f } },
126 { { 453.5134f, -717.7018f, -31.59883f }, { 387.6152f, -690.1782f, -16.17974f } },
127 { { 457.8564f, -711.7424f, -31.59773f }, { 378.6874f, -687.1343f, -16.17973f } },
128 { { 410.0583f, -774.4119f, -31.60115f }, { 383.8151f, -723.4276f, -16.17974f } },
129 { { 408.7458f, -777.955f, -31.59873f }, { 376.9857f, -725.0735f, -16.17974f } },
130 { { 405.2404f, -779.6614f, -31.60512f }, { 373.3736f, -722.7498f, -16.17974f } },
131 { { 404.0797f, -783.829f, -31.59497f }, { 367.8631f, -722.5212f, -16.17974f } }
132};
133
142
144{
146
147 void Reset() override
148 {
149 _Reset();
150
153
154 std::list<TempSummon*> summoned;
156 for (TempSummon* value : summoned)
157 _initiateGUIDS.insert(value->GetGUID());
158
160 controller->CastSpell(me, SPELL_BEAM_VISUAL_JEDOGA);
162 controller->CastSpell(me, SPELL_BEAM_VISUAL_JEDOGA);
163
165 }
166
167 void JustEngagedWith(Unit* who) override
168 {
172
176
178 {
180 {
181 volunteer->GetMotionMaster()->MovePoint(POINT_INITIAL_POSITION, posPair.second);
182 _volunteerGUIDS.push_back(volunteer->GetGUID());
183 }
184 }
185 }
186
187 void EnterEvadeMode(EvadeReason /*why*/) override
188 {
192 }
193
194 void KilledUnit(Unit* Victim) override
195 {
196 if (Victim->GetTypeId() == TYPEID_PLAYER)
197 Talk(SAY_SLAY);
198 }
199
200 void JustDied(Unit* /*killer*/) override
201 {
202 _JustDied();
204 }
205
206 uint32 GetData(uint32 type) const override
207 {
208 if (type == DATA_VOLUNTEER_WORK)
209 return _volunteerWork ? 1 : 0;
210
211 return 0;
212 }
213
214 void DamageTaken(Unit* /*done_by*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
215 {
217 {
218 events.Reset();
221 }
222 }
223
224 void DoAction(int32 action) override
225 {
226 if (action == ACTION_SACRIFICE)
227 {
232 }
233 }
234
235 void JustSummoned(Creature* summon) override
236 {
237 if (summon->GetEntry() == NPC_TWILIGHT_WORSHIPPER)
238 {
240 summons.Summon(summon);
241 return;
242 }
243
244 BossAI::JustSummoned(summon);
245 }
246
247 void SummonedCreatureDies(Creature* summon, Unit* killer) override
248 {
249 if (summon->GetEntry() == NPC_TWILIGHT_INITIATE)
250 {
251 _initiateGUIDS.erase(summon->GetGUID());
252 if (_initiateGUIDS.empty())
253 {
257 }
258 }
259 else if (summon->GetEntry() == NPC_TWILIGHT_VOLUNTEER)
260 {
261 _volunteerWork = false;
262
264 {
267 }
268
270 }
271
272 BossAI::SummonedCreatureDies(summon, killer);
273 }
274
275 void MovementInform(uint32 type, uint32 pointId) override
276 {
277 if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
278 return;
279
280 switch (pointId)
281 {
282 case POINT_GROUND:
289 break;
290 case POINT_PHASE_TWO:
292 break;
295 break;
296 default:
297 break;
298 }
299 }
300
301 void UpdateAI(uint32 diff) override
302 {
304 return;
305
306 events.Update(diff);
307
309 return;
310
311 while (uint32 eventId = events.ExecuteEvent())
312 {
313 switch (eventId)
314 {
315 case EVENT_INTRO_SAY:
319 break;
323 break;
326 me->SetDisableGravity(false);
328 break;
331 me->AttackStop();
335 break;
336 case EVENT_FLY_DELAY:
337 me->SetDisableGravity(true);
339 break;
342 {
343 me->SetFacingToObject(controller);
344 controller->CastSpell(controller, SPELL_SACRIFICE_VISUAL);
345 }
346
348
349 if (_volunteerGUIDS.empty())
350 break;
351
354 volunteer->AI()->DoAction(ACTION_CHOSEN);
355 break;
357 {
358 uint32 pos = std::distance(_volunteerGUIDS.begin(), std::find(_volunteerGUIDS.begin(), _volunteerGUIDS.end(), _selectedVolunteerGUID));
359 if (pos < JedogaVolunteerSpotPositions.size())
360 {
363 volunteer->GetMotionMaster()->MovePoint(POINT_INITIAL_POSITION, posPair.second);
364 }
365 break;
366 }
370 me->SetDisableGravity(false);
372 break;
375 events.Repeat(Seconds(15), Seconds(30));
376 break;
378 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
380 events.Repeat(Seconds(15), Seconds(30));
381 break;
383 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
384 DoCast(target, SPELL_THUNDERSHOCK);
385 events.Repeat(Seconds(15), Seconds(30));
386 break;
387 default:
388 break;
389 }
390
392 return;
393 }
394
396 }
397
398private:
403};
404
406{
407 npc_twilight_volunteer(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
408 {
410 }
411
425
426 void MovementInform(uint32 type, uint32 pointId) override
427 {
428 if (type != POINT_MOTION_TYPE)
429 return;
430
431 switch (pointId)
432 {
435 me->SetFacingToObject(jedoga);
436
439 break;
440 case POINT_SACRIFICE:
442 {
444 jedoga->AI()->DoAction(ACTION_SACRIFICE);
446
447 _scheduler.Schedule(Seconds(3), [this](TaskContext /*context*/)
448 {
451 });
452 }
453 break;
454 default:
455 break;
456 }
457 }
458
459 void UpdateAI(uint32 diff) override
460 {
461 _scheduler.Update(diff);
462 }
463
464private:
467};
468
469// 56328 - Random Lightning Visual Effect
486
488{
489 public:
490 achievement_volunteer_work() : AchievementCriteriaScript("achievement_volunteer_work") { }
491
492 bool OnCheck(Player* /*player*/, Unit* target) override
493 {
494 if (!target)
495 return false;
496
497 if (Creature* jedoga = target->ToCreature())
498 if (jedoga->AI()->GetData(DATA_VOLUNTEER_WORK) == 1)
499 return true;
500
501 return false;
502 }
503};
504
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
std::chrono::minutes Minutes
Minutes shorthand typedef.
Definition Duration.h:30
@ DONE
@ POINT_MOTION_TYPE
@ EFFECT_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition ObjectGuid.h:263
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:262
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ TARGET_DEST_CASTER_RANDOM
#define SpellDestinationTargetSelectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STAND_STATE_DEAD
Definition UnitDefines.h:41
@ UNIT_STAND_STATE_KNEEL
Definition UnitDefines.h:42
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
@ 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_RANDOM_LIGHTNING_VISUAL
@ SPELL_PILLAR_OF_LIGHTNING
@ SPELL_SPHERE_VISUAL_VOLUNTEER
@ SPELL_BEAM_VISUAL_JEDOGA
Position const JedogaFlyPosition
void AddSC_boss_jedoga_shadowseeker()
std::vector< JedogaVolunteerPositionPair > const JedogaVolunteerSpotPositions
Position const JedogaSacrificePosition
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
bool _EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void DoZoneInCombat(Creature *creature=nullptr)
virtual void SummonedCreatureDies(Creature *, Unit *)
Definition CreatureAI.h:140
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:52
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void MoveTakeoff(uint32 id, Position const &pos, Optional< float > velocity={})
void MoveLand(uint32 id, Position const &pos, Optional< float > velocity={})
static Creature * ToCreature(Object *o)
Definition Object.h:186
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
void DespawnEntry(uint32 entry)
void Summon(Creature const *summon)
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
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void SetAnimTier(AnimTier animTier)
Definition Unit.cpp:10391
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3093
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13286
void SetFacingToObject(WorldObject const *object, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13259
bool SetWalk(bool enable)
Definition Unit.cpp:13268
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool AttackStop()
Definition Unit.cpp:5645
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
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:1992
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2082
bool OnCheck(Player *, Unit *target) override
PrepareSpellScript(spell_random_lightning_visual_effect)
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:108
bool HealthBelowPct(uint32 pct) const
void RelocateOffset(Position const &offset)
Definition Spell.cpp:110
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)