TrinityCore
Loading...
Searching...
No Matches
boss_astromancer.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 * Everything related to split requires sniff verification, maybe something is missing or implemented wrongly
21 * Solarian should have big aggro radius
22 * Can transition start while in split phase? What should happen? Currently prevented
23 * Boss does arcane melee damage, is this correct?
24 */
25
26#include "ScriptMgr.h"
27#include "Containers.h"
28#include "InstanceScript.h"
29#include "ObjectAccessor.h"
30#include "ScriptedCreature.h"
31#include "SpellAuras.h"
32#include "SpellInfo.h"
33#include "SpellScript.h"
34#include "the_eye.h"
35
45
81
105
107{
109 VOIDWALKER_ARMOR = 31000
111
119
127
135
142
143// 18805 - High Astromancer Solarian
145{
147 _defaultArmor(creature->GetArmor()), _isSecondPhaseStarted(false), _isSplitInProgress(false) { }
148
149 void Reset() override
150 {
151 _Reset();
152
154 me->SetVisible(true);
156
159 me->SetRegenerateHealth(false);
160 me->SetFullHealth();
161
162 _spotlightsGuidVector.clear();
163 _isSecondPhaseStarted = false;
164 _isSplitInProgress = false;
165 }
166
180
181 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
182 {
184 {
187
192 }
193 }
194
195 void JustSummoned(Creature* summon) override
196 {
197 // Do not engage summons
198 summons.Summon(summon);
199
200 if (summon->GetEntry() == NPC_SPOTLIGHT)
201 _spotlightsGuidVector.push_back(summon->GetGUID());
202 }
203
204 void KilledUnit(Unit* /*victim*/) override
205 {
206 Talk(SAY_SLAY);
207 }
208
209 void JustDied(Unit* /*killer*/) override
210 {
212 _JustDied();
213
215 }
216
217 void UpdateAI(uint32 diff) override
218 {
219 if (!UpdateVictim())
220 return;
221
222 events.Update(diff);
223
225 return;
226
227 while (uint32 eventId = events.ExecuteEvent())
228 {
229 switch (eventId)
230 {
231 // Phase 1 (Looks like combat timers keep tick while in split phase, boss just doesn't cast spells)
236 events.Repeat(3600ms);
237 break;
241 events.Repeat(30s);
242 break;
245 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
247 events.Repeat(10s, 20s);
248 break;
249
250 // Split
251 case EVENT_SPLIT_1:
252 _isSplitInProgress = true;
256 break;
257 case EVENT_SPLIT_2:
258 _spotlightsGuidVector.clear();
263 break;
264 case EVENT_SPLIT_3:
267 break;
268 case EVENT_SPLIT_4:
269 me->SetVisible(false);
271 break;
272 case EVENT_SPLIT_5:
274 if (Creature* spotlight = ObjectAccessor::GetCreature(*me, guid))
275 spotlight->CastSpell(spotlight, SPELL_SUMMON_ASTROMANCER_ADDS);
277 break;
278 case EVENT_SPLIT_6:
279 {
280 // We become visible here because otherwise spell below will not hit Solarian
281 me->SetVisible(true);
282
284
285 for (std::size_t i = 0; i < _spotlightsGuidVector.size() && i < SpotlightSummonSpells.size(); ++i)
287 spotlight->CastSpell(spotlight, SpotlightSummonSpells[i]);
288
290
291 _isSplitInProgress = false;
292
294 break;
295 }
296 // Transition
303 break;
309 break;
310
311 // Phase 2
314 events.Repeat(15s, 25s);
315 break;
316 case EVENT_VOID_BOLT:
318 events.Repeat(8s, 12s);
319 break;
320 default:
321 break;
322 }
323
325 return;
326 }
327
329 }
330
331private:
336};
337
338// 18806 - Solarium Priest
340{
341 npc_solarium_priest(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
342
343 void InitializeAI() override
344 {
345 me->SetCorpseDelay(1, true);
347 }
348
349 void JustAppeared() override
350 {
352
354 AddThreat(target, 100000.0f);
355
357 solarian->AI()->JustSummoned(me);
358 }
359
360 void Reset() override
361 {
363 }
364
365 void AttackStart(Unit* who) override
366 {
368 }
369
370 void JustEngagedWith(Unit* /*who*/) override
371 {
373 .SetValidator([this]
374 {
376 })
377 .Schedule(0s, [this](TaskContext task)
378 {
380 task.Repeat(3s, 5s);
381 })
382 .Schedule(10s, 15s, [this](TaskContext task)
383 {
384 if (Unit* target = DoSelectLowestHpFriendly(100.0f))
385 DoCast(target, SPELL_GREAT_HEAL);
386 task.Repeat(10s, 15s);
387 })
388 .Schedule(10s, 20s, [this](TaskContext task)
389 {
391 task.Repeat(10s, 20s);
392 });
393 }
394
395 void UpdateAI(uint32 diff) override
396 {
397 if (!UpdateVictim())
398 return;
399
400 _scheduler.Update(diff, [this]
401 {
403 });
404 }
405
406private:
409};
410
411// 18925 - Solarium Agent
413{
414 npc_solarium_agent(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
415
416 void InitializeAI() override
417 {
418 me->SetCorpseDelay(1, true);
420 }
421
422 void JustAppeared() override
423 {
425
427 AddThreat(target, 100000.0f);
428
430 solarian->AI()->JustSummoned(me);
431 }
432
433private:
435};
436
437// 42783 - Wrath of the Astromancer
460
uint32_t uint32
Definition Define.h:133
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:262
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_1
@ EFFECT_0
@ AURA_REMOVE_BY_EXPIRE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define AuraEffectRemoveFn(F, I, N, M)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
static constexpr std::array< uint32, 4 > SplitLargeRadiusSpells2
void AddSC_boss_high_astromancer_solarian()
@ NPC_SPOTLIGHT
@ VOIDWALKER_ARMOR
SolarianTexts
@ SAY_DEATH
@ SAY_VOID_1
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_SUMMON
@ SAY_VOID_2
SolarianEvents
@ EVENT_WRATH_OF_THE_ASTROMANCER
@ EVENT_ARCANE_MISSILES
@ EVENT_SPLIT_4
@ EVENT_PSYCHIC_SCREAM
@ EVENT_SPLIT_2
@ EVENT_VOID_BOLT
@ EVENT_SPLIT_1
@ EVENT_TRANSITION_1
@ EVENT_TRANSITION_2
@ EVENT_SPLIT_3
@ EVENT_BLINDING_LIGHT
@ EVENT_SPLIT_5
@ EVENT_SPLIT_6
static constexpr std::array< uint32, 4 > SplitLargeRadiusSpells1
SolarianSpells
@ SPELL_ASTROMANCER_SPLIT_LARGE_5
@ SPELL_BLINDING_LIGHT
@ SPELL_ARCANE_TORRENT
@ SPELL_ASTROMANCER_SPLIT_LARGE_4
@ SPELL_ASTROMANCER_SPLIT_SMALL_2
@ SPELL_SOLARIAN_TRANSFORM
@ SPELL_ASTROMANCER_SPLIT_LARGE_8
@ SPELL_ASTROMANCER_SPLIT_LARGE_6
@ SPELL_VOID_BOLT
@ SPELL_HOLY_SMITE
@ SPELL_ASTROMANCER_SPLIT_LARGE_1
@ SPELL_SUMMON_ASTROMANCER_SOLARIAN
@ SPELL_ASTROMANCER_SPLIT_LARGE_3
@ SPELL_ASTROMANCER_SPLIT_SMALL_4
@ SPELL_SUMMON_ASTROMANCER_PRIEST
@ SPELL_SUMMON_ASTROMANCER_ADDS
@ SPELL_ASTROMANCER_SPLIT_SMALL_3
@ SPELL_GREAT_HEAL
@ SPELL_ASTROMANCER_SPLIT_SMALL_1
@ SPELL_PSYCHIC_SCREAM
@ SPELL_WRATH_OF_THE_ASTROMANCER
@ SPELL_ASTROMANCER_SPLIT_LARGE_2
@ SPELL_ARCANE_MISSILES
@ SPELL_ASTROMANCER_SPLIT_LARGE_7
static constexpr std::array< uint32, 4 > SplitSmallRadiusSpells
static constexpr std::array< uint32, 3 > SpotlightSummonSpells
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
SpellEffectInfo const & GetEffectInfo(SpellEffIndex effIndex) const
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void CallForHelp(float fRadius)
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:295
void SetReactState(ReactStates st)
Definition Creature.h:119
void SetRegenerateHealth(bool value)
Definition Creature.h:285
ReactStates GetReactState() const
Definition Creature.h:120
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:89
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Creature * GetCreature(uint32 type)
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr) const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
void Summon(Creature const *summon)
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
TaskScheduler & Update(success_t const &callback=EmptyCallback)
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
void AttackStartCaster(Unit *victim, float dist)
Definition UnitAI.cpp:48
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:769
void SetVisible(bool x)
Definition Unit.cpp:8513
void SetFullHealth()
Definition Unit.h:927
void NearTeleportTo(Position const &pos, bool casting=false)
Definition Unit.cpp:12832
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
void SetArmor(int32 val)
Definition Unit.h:906
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *spellInfo) override
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void RandomShuffle(C &container)
Reorder the elements of the container randomly.
Definition Containers.h:166
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
Unit * DoSelectLowestHpFriendly(float range, uint32 minHPDiff=1)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void UpdateAI(uint32 diff) override
boss_high_astromancer_solarian(Creature *creature)
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
InstanceScript * _instance
void InitializeAI() override
npc_solarium_agent(Creature *creature)
void JustAppeared() override
void UpdateAI(uint32 diff) override
InstanceScript * _instance
void InitializeAI() override
npc_solarium_priest(Creature *creature)
void JustEngagedWith(Unit *) override
void AttackStart(Unit *who) override
void JustAppeared() override
#define RegisterTheEyeCreatureAI(ai_name)
Definition the_eye.h:74
@ DATA_SOLARIAN
Definition the_eye.h:33