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 "Player.h"
33#include "ruins_of_ahnqiraj.h"
34#include "ScriptedCreature.h"
35#include "SpellInfo.h"
36#include "SpellScript.h"
37
39{
40 EMOTE_FRENZY = 0
41};
42
44{
49 SPELL_LASH = 25852,
51
57
58 // Hive'Zara Swarmer
61
65
71
72 // Hive'Zara Larva
73 SPELL_FEED = 25721,
74 SPELL_LARVA_AGGRO_EFFECT = 25724, // NYI, most likely related to Paralyze
75 SPELL_LARVA_FEAR_EFFECT = 25726 // NYI, most likely related to Paralyze
76};
77
89
95
103
104const Position AyamissAirPos = { -9689.292f, 1547.9122f, 48.027287f, 0.0f };
105const Position AyamissGroundPos = { -9689.981f, 1548.2961f, 33.277330f, 0.0f };
106const Position AltarPos = { -9715.510f, 1518.8200f, 27.467716f, 0.0f };
107const Position SwarmerPos = { -9647.352f, 1578.0620f, 55.320000f, 0.0f };
108
113
118
119// 15369 - Ayamiss the Hunter
120struct boss_ayamiss : public BossAI
121{
122 boss_ayamiss(Creature* creature) : BossAI(creature, DATA_AYAMISS), _frenzied(false), _phase(PHASE_AIR) { }
123
124 void Reset() override
125 {
126 _Reset();
127 _frenzied = false;
129 }
130
146
147 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
148 {
149 if (_phase == PHASE_AIR && me->HealthBelowPctDamaged(70, damage))
150 {
154 }
155
156 if (!_frenzied && me->HealthBelowPctDamaged(20, damage))
157 {
158 _frenzied = true;
160 }
161 }
162
163 void OnSpellCast(SpellInfo const* spell) override
164 {
165 if (spell->Id == SPELL_FRENZY)
167 }
168
169 void MovementInform(uint32 type, uint32 id) override
170 {
171 if (type == POINT_MOTION_TYPE)
172 {
173 switch (id)
174 {
175 case POINT_AIR:
176 SetCombatMovement(false);
178 break;
179 case POINT_GROUND:
180 SetCombatMovement(true);
181 me->SetHover(false);
182 me->SetDisableGravity(false);
188 break;
189 }
190 }
191 }
192
193 // Do not despawn swarmers and larva
194 void JustSummoned(Creature* /*summon*/) override { }
195
196 void JustReachedHome() override
197 {
199 SetCombatMovement(true);
200 me->SetHover(false);
201 me->SetDisableGravity(false);
203 }
204
205 void UpdateAI(uint32 diff) override
206 {
207 if (!UpdateVictim())
208 return;
209
210 events.Update(diff);
211
213 return;
214
215 while (uint32 eventId = events.ExecuteEvent())
216 {
217 switch (eventId)
218 {
221 events.Repeat(15s, 20s);
222 break;
225 events.Repeat(2s, 3s);
226 break;
229 events.Repeat(5s);
230 break;
233 events.Repeat(1min);
234 break;
235 case EVENT_PARALYZE:
236 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0, true))
237 {
238 DoCast(target, SPELL_PARALYZE);
239 instance->SetGuidData(DATA_PARALYZED, target->GetGUID());
240 }
241 events.Repeat(12s, 18s);
242 break;
243 case EVENT_THRASH:
245 events.Repeat(5s, 7s);
246 break;
247 case EVENT_LASH:
249 events.Repeat(8s, 15s);
250 break;
251 case EVENT_FRENZY:
253 break;
254 default:
255 break;
256 }
257
259 return;
260 }
261
263 }
264
265private:
268};
269
270// 15555 - Hive'Zara Larva
272{
273 npc_hive_zara_larva(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
274
275 void InitializeAI() override
276 {
277 me->SetCorpseDelay(3, true);
279 }
280
281 void JustAppeared() override
282 {
283 me->GetMotionMaster()->MovePoint(POINT_ALTAR, AltarPos, true, 3.724058866500854492f);
284 }
285
286 void MovementInform(uint32 type, uint32 id) override
287 {
288 if (type != POINT_MOTION_TYPE)
289 return;
290
291 if (id == POINT_ALTAR)
293 DoCast(target, SPELL_FEED);
294 }
295
296private:
298};
299
300// 15546 - Hive'Zara Swarmer
302{
303 npc_hive_zara_swarmer(Creature* creature) : ScriptedAI(creature) { }
304
305 void InitializeAI() override
306 {
307 me->SetCorpseDelay(3, true);
308 }
309
320
321 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
322 {
323 switch (spellInfo->Id)
324 {
328 break;
330 me->SetDisableGravity(false);
333 break;
335 break;
337 break;
339 break;
340 default:
341 break;
342 }
343 }
344
345 void UpdateAI(uint32 /*diff*/) override
346 {
347 if (!UpdateVictim())
348 return;
349
351 }
352};
353
354// 25725 - Paralyze
374
375// 25711 - Hive'Zara Swarmer Start Loop
395
396// 25830 - Hive'Zara Swarmer Teleport Trigger
416
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ POINT_MOTION_TYPE
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
#define SpellHitFn(F)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
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(Creature *creature=nullptr)
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 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
virtual ObjectGuid GetGuidData(uint32 type) const override
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void MoveFall(uint32 id=0)
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< HitHandler > AfterHit
HookList< EffectHandler > OnEffectHit
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
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13503
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13286
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
void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
Definition Object.cpp:1376
virtual void SetGuidData(uint32, ObjectGuid)
Definition ZoneScript.h:49
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_ayamiss_paralyze)
void Register() override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_ayamiss_swarmer_start_loop)
PrepareSpellScript(spell_ayamiss_swarmer_teleport_trigger)
bool Validate(SpellInfo const *) override
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
#define RegisterAQ20CreatureAI(ai_name)
@ DATA_PARALYZED
@ DATA_AYAMISS
float m_positionZ
Definition Position.h:58
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
void UpdateAI(uint32) override
npc_hive_zara_swarmer(Creature *creature)
void InitializeAI() override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override