TrinityCore
Loading...
Searching...
No Matches
boss_ayamiss.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 * Timers requires to be revisited
20 * Initial movement for swarmers is NYI (SwarmerLoopSpells)
21 * SPELL_DESPAWN_SWARMERS is NYI, seems like used in combat after SPELL_SWARMERS_SWARM, not just as regular cleanup spell in case of wipe \ death.
22 Seems like targets only alive units
23 * What's the purpose of world triggers spawned in the room? The one spawned near altar enters in combat
24 * What's the purpose of Script Effect of SPELL_SUMMON_LARVA_1 & SPELL_SUMMON_LARVA_2?
25 */
26
27#include "ScriptMgr.h"
28#include "Containers.h"
29#include "InstanceScript.h"
30#include "MotionMaster.h"
31#include "ObjectAccessor.h"
32#include "ruins_of_ahnqiraj.h"
33#include "ScriptedCreature.h"
34#include "SpellInfo.h"
35#include "SpellScript.h"
36
38{
39 EMOTE_FRENZY = 0
40};
41
43{
48 SPELL_LASH = 25852,
50
56
57 // Hive'Zara Swarmer
60
64
70
71 // Hive'Zara Larva
72 SPELL_FEED = 25721,
73 SPELL_LARVA_AGGRO_EFFECT = 25724, // NYI, most likely related to Paralyze
74 SPELL_LARVA_FEAR_EFFECT = 25726 // NYI, most likely related to Paralyze
75};
76
88
94
102
103const Position AyamissAirPos = { -9689.292f, 1547.9122f, 48.027287f, 0.0f };
104const Position AyamissGroundPos = { -9689.981f, 1548.2961f, 33.277330f, 0.0f };
105const Position AltarPos = { -9715.510f, 1518.8200f, 27.467716f, 0.0f };
106const Position SwarmerPos = { -9647.352f, 1578.0620f, 55.320000f, 0.0f };
107
112
117
118// 15369 - Ayamiss the Hunter
119struct boss_ayamiss : public BossAI
120{
121 boss_ayamiss(Creature* creature) : BossAI(creature, DATA_AYAMISS), _frenzied(false), _phase(PHASE_AIR) { }
122
123 void Reset() override
124 {
125 _Reset();
126 _frenzied = false;
128 }
129
145
146 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
147 {
148 if (_phase == PHASE_AIR && me->HealthBelowPctDamaged(70, damage))
149 {
153 }
154
155 if (!_frenzied && me->HealthBelowPctDamaged(20, damage))
156 {
157 _frenzied = true;
159 }
160 }
161
162 void OnSpellCast(SpellInfo const* spell) override
163 {
164 if (spell->Id == SPELL_FRENZY)
166 }
167
168 void MovementInform(uint32 type, uint32 id) override
169 {
170 if (type == POINT_MOTION_TYPE)
171 {
172 switch (id)
173 {
174 case POINT_AIR:
175 SetCombatMovement(false);
177 break;
178 case POINT_GROUND:
179 SetCombatMovement(true);
180 me->SetHover(false);
181 me->SetDisableGravity(false);
187 break;
188 }
189 }
190 }
191
192 // Do not despawn swarmers and larva
193 void JustSummoned(Creature* /*summon*/) override { }
194
195 void JustReachedHome() override
196 {
198 SetCombatMovement(true);
199 me->SetHover(false);
200 me->SetDisableGravity(false);
202 }
203
204 void UpdateAI(uint32 diff) override
205 {
206 if (!UpdateVictim())
207 return;
208
209 events.Update(diff);
210
212 return;
213
214 while (uint32 eventId = events.ExecuteEvent())
215 {
216 switch (eventId)
217 {
220 events.Repeat(15s, 20s);
221 break;
224 events.Repeat(2s, 3s);
225 break;
228 events.Repeat(5s);
229 break;
232 events.Repeat(1min);
233 break;
234 case EVENT_PARALYZE:
235 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0, true))
236 {
237 DoCast(target, SPELL_PARALYZE);
238 instance->SetGuidData(DATA_PARALYZED, target->GetGUID());
239 }
240 events.Repeat(12s, 18s);
241 break;
242 case EVENT_THRASH:
244 events.Repeat(5s, 7s);
245 break;
246 case EVENT_LASH:
248 events.Repeat(8s, 15s);
249 break;
250 case EVENT_FRENZY:
252 break;
253 default:
254 break;
255 }
256
258 return;
259 }
260 }
261
262private:
265};
266
267// 15555 - Hive'Zara Larva
269{
270 npc_hive_zara_larva(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
271
272 void InitializeAI() override
273 {
274 me->SetCorpseDelay(3, true);
276 }
277
278 void JustAppeared() override
279 {
280 me->GetMotionMaster()->MovePoint(POINT_ALTAR, AltarPos, true, 3.724058866500854492f);
281 }
282
283 void MovementInform(uint32 type, uint32 id) override
284 {
285 if (type != POINT_MOTION_TYPE)
286 return;
287
288 if (id == POINT_ALTAR)
289 if (Unit* target = ObjectAccessor::GetUnit(*me, _instance->GetGuidData(DATA_PARALYZED)); target && target->IsPlayer())
290 DoCast(target, SPELL_FEED);
291 }
292
293private:
295};
296
297// 15546 - Hive'Zara Swarmer
299{
300 npc_hive_zara_swarmer(Creature* creature) : ScriptedAI(creature) { }
301
302 void InitializeAI() override
303 {
304 me->SetCorpseDelay(3, true);
305 }
306
317
318 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
319 {
320 switch (spellInfo->Id)
321 {
325 break;
327 me->SetDisableGravity(false);
331 break;
333 break;
335 break;
337 break;
338 default:
339 break;
340 }
341 }
342};
343
344// 25725 - Paralyze
346{
347 bool Validate(SpellInfo const* /*spellInfo*/) override
348 {
350 }
351
356
361};
362// 25711 - Hive'Zara Swarmer Start Loop
380
381// 25830 - Hive'Zara Swarmer Teleport Trigger
399
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ POINT_MOTION_TYPE
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
#define SpellHitFn(F)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
const Position AltarPos
std::array< uint32, 5 > const SwarmerTeleportSpells
void AddSC_boss_ayamiss()
const Position AyamissGroundPos
AyamissSpells
@ SPELL_STINGER_SPRAY
@ SPELL_FEED
@ SPELL_LARVA_FEAR_EFFECT
@ SPELL_SWARMER_LOOP_3
@ SPELL_LARVA_AGGRO_EFFECT
@ SPELL_SUMMON_LARVA_1
@ SPELL_DESPAWN_SWARMERS
@ SPELL_SUMMON_LARVA_2
@ SPELL_SWARMER_TELEPORT_3
@ SPELL_SWARMER_TELEPORT_2
@ SPELL_SWARMER_LOOP_1
@ SPELL_LASH
@ SPELL_SWARMERS_SWARM
@ SPELL_SWARMER_TELEPORT_5
@ SPELL_THRASH
@ SPELL_SUMMON_SWARMER
@ SPELL_SWARMER_TELEPORT_1
@ SPELL_FRENZY
@ SPELL_SWARMER_START_LOOP
@ SPELL_PARALYZE
@ SPELL_SWARMER_LOOP_2
@ SPELL_SWARMER_TELEPORT_4
@ SPELL_SWARMER_TELE_TRIGGER
@ SPELL_POISON_STINGER
const Position AyamissAirPos
AyamissPhases
@ PHASE_GROUND
@ PHASE_AIR
std::array< uint32, 3 > const SwarmerLoopSpells
AyamissPoints
@ POINT_GROUND
@ POINT_SWARMER
@ POINT_ALTAR
@ POINT_AIR
AyamissEvents
@ EVENT_POISON_STINGER
@ EVENT_LASH
@ EVENT_SWARMERS_SWARM
@ EVENT_PARALYZE
@ EVENT_FRENZY
@ EVENT_THRASH
@ EVENT_SUMMON_SWARMER
@ EVENT_STINGER_SPRAY
const Position SwarmerPos
AyamissTexts
@ EMOTE_FRENZY
InstanceScript *const instance
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:180
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:118
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void CancelEvent(EventId eventId)
Definition EventMap.cpp:156
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveFall(uint32 id=0, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
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={})
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< HitHandler > AfterHit
HookList< EffectHandler > OnEffectHit
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13656
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool SetDisableGravity(bool disable, bool updateAnimTier=true, bool updatePlayHoverAnim=true)
Definition Unit.cpp:13440
Position GetRandomPoint(Position const &srcPos, float distance, float minDistance=0.0f) const
Definition Object.cpp:678
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
virtual void SetGuidData(uint32, ObjectGuid)
Definition ZoneScript.h:92
void Register() override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
#define RegisterAQ20CreatureAI(ai_name)
@ DATA_PARALYZED
@ DATA_AYAMISS
float m_positionZ
Definition Position.h:66
void SetCombatMovement(bool allowMovement)
void ResetThreatList(Unit *who=nullptr)
boss_ayamiss(Creature *creature)
void Reset() override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void UpdateAI(uint32 diff) override
void JustReachedHome() override
void JustSummoned(Creature *) override
void MovementInform(uint32 type, uint32 id) override
void JustEngagedWith(Unit *who) override
void OnSpellCast(SpellInfo const *spell) override
void JustAppeared() override
npc_hive_zara_larva(Creature *creature)
void MovementInform(uint32 type, uint32 id) override
void InitializeAI() override
InstanceScript * _instance
void JustAppeared() override
npc_hive_zara_swarmer(Creature *creature)
void InitializeAI() override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override