TrinityCore
Loading...
Searching...
No Matches
boss_the_black_stalker.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 "ScriptedCreature.h"
19#include "ScriptMgr.h"
20#include "SpellScript.h"
21#include "the_underbog.h"
22
23/*
24How levitation sequence works: boss casts Levitate and it triggers a chain of spells, target(any target, player or pet, any position in
25threat list) eventually gets pulled towards by randomly selected trigger. Then target becomes protected from Pull Towards by Suspension
26aura which is triggered every 1 sec up to 4 times. Since it has stun mechanic, diminishing returns cuts off its duration every cast in
27half (20 > 10 > 5 > 0). Eventually player becomes immune to Suspension and vulnerable to another pull towards.
28Whole levitate sequence is designed to pull player towards up to 3 times. Usually it works like this: player gets pulled towards,
29gets protected by Suspension from Pull Towards next 2 times. If player is unlucky, boss can cast Levitate on same player again, in that case
30player can be pulled towards 2 times in a row without any protection from fall damage by Suspension(case from sniffs).
31
32However currently diminishing returns affects Suspension after first cast, its duration is 10 instead of 20 seconds and player will be
33immune to 4th cast. That allows to pull player towards when levitation sequence ends. Levitation sequence has sensetive design and looks
34like lack of delays between packets makes it work differently too.
35Of course as was said above player can be pulled towards 2 times in a row but that looks like a rare case.
36*/
37
39{
42 SPELL_STATIC_CHARGE = 31715, // Never seen any cast on retail, probably because of shared cooldown with Chain Lightning
43 SPELL_SUMMON_PLAYER = 20279, // NYI, may be 20311 or any other
45
51
53};
54
63
64// 17882 - The Black Stalker
66{
68
79
80 void UpdateAI(uint32 diff) override
81 {
82 if (!UpdateVictim())
83 return;
84
85 events.Update(diff);
86
88 return;
89
90 while (uint32 eventId = events.ExecuteEvent())
91 {
92 switch (eventId)
93 {
95 {
96 float x, y, z, o;
97 me->GetHomePosition(x, y, z, o);
98 if (!me->IsWithinDist3d(x, y, z, 60))
99 {
101 return;
102 }
103 events.Repeat(1s);
104 break;
105 }
106 case EVENT_LEVITATE:
108 events.Repeat(18s, 24s);
109 break;
112 events.Repeat(6s, 12s);
113 break;
115 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30, true))
117 events.Repeat(10s);
118 break;
121 events.Repeat(15s, 25s);
122 break;
123 default:
124 break;
125 }
126
128 return;
129 }
130
132 }
133};
134
135// 31704 - Levitate
155
156// 31701 - Levitation Pulse
176
177// 31702 - Someone Grab Me
198
199// 31703 - Magnetic Pull
219
220// 38756 - Summon Spore Strider
241
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ EVENT_CHAIN_LIGHTNING
@ EVENT_STATIC_CHARGE
@ EVENT_SUMMON_SPORE_STRIDER
@ SPELL_SUSPENSION_PRIMER
@ SPELL_MAGNETIC_PULL
@ SPELL_SUMMON_PLAYER
@ SPELL_SUMMON_SPORE_STRIDER
@ SPELL_SOMEONE_GRAB_ME
@ SPELL_CHAIN_LIGHTNING
@ SPELL_STATIC_CHARGE
@ SPELL_LEVITATION_PULSE
@ SPELL_SUMMON_SPORE_STRIDER_SCRIPT
void AddSC_boss_the_black_stalker()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:295
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
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
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition Object.cpp:1167
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 *) override
PrepareSpellScript(spell_the_black_stalker_levitate)
PrepareSpellScript(spell_the_black_stalker_levitation_pulse)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_the_black_stalker_magnetic_pull)
PrepareSpellScript(spell_the_black_stalker_someone_grab_me)
PrepareSpellScript(spell_the_black_stalker_summon_spore_strider)
bool IsHeroic() const
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
boss_the_black_stalker(Creature *creature)
#define RegisterTheUnderbogCreatureAI(ai_name)
@ DATA_THE_BLACK_STALKER