TrinityCore
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#include "ScriptMgr.h"
19#include "InstanceScript.h"
20#include "MotionMaster.h"
21#include "ObjectAccessor.h"
22#include "ruins_of_ahnqiraj.h"
23#include "ScriptedCreature.h"
24
26{
32 SPELL_LASH = 25852,
33 SPELL_FEED = 25721
34};
35
37{
44 EVENT_TRASH = 7
45};
46
48{
49 EMOTE_FRENZY = 0
50};
51
53{
55 PHASE_GROUND = 1
56};
57
59{
63};
64
65const Position AyamissAirPos = { -9689.292f, 1547.912f, 48.02729f, 0.0f };
66const Position AltarPos = { -9717.18f, 1517.72f, 27.4677f, 0.0f };
68const Position SwarmerPos = { -9647.352f, 1578.062f, 55.32f, 0.0f };
70{
71 { -9674.4707f, 1528.4133f, 22.457f, 0.0f },
72 { -9701.6005f, 1566.9993f, 24.118f, 0.0f }
73};
74
76{
77 public:
78 boss_ayamiss() : CreatureScript("boss_ayamiss") { }
79
80 struct boss_ayamissAI : public BossAI
81 {
83 {
84 Initialize();
85 }
86
88 {
90 _enraged = false;
91 }
92
93 void Reset() override
94 {
95 _Reset();
96 Initialize();
97 SetCombatMovement(false);
98 }
99
100 void JustSummoned(Creature* who) override
101 {
102 switch (who->GetEntry())
103 {
104 case NPC_SWARMER:
105 _swarmers.push_back(who->GetGUID());
106 break;
107 case NPC_LARVA:
109 break;
110 case NPC_HORNET:
112 who->AI()->AttackStart(target);
113 break;
114 }
115 }
116
117 void MovementInform(uint32 type, uint32 id) override
118 {
119 if (type == POINT_MOTION_TYPE)
120 {
121 switch (id)
122 {
123 case POINT_AIR:
125 break;
126 case POINT_GROUND:
128 break;
129 }
130 }
131 }
132
133 void EnterEvadeMode(EvadeReason why) override
134 {
137 }
138
139 void JustEngagedWith(Unit* attacker) override
140 {
141 BossAI::JustEngagedWith(attacker);
142
148
149 me->SetCanFly(true);
150 me->SetDisableGravity(true);
152 }
153
154 void UpdateAI(uint32 diff) override
155 {
156 if (!UpdateVictim())
157 return;
158
159 events.Update(diff);
160
161 if (_phase == PHASE_AIR && me->GetHealthPct() < 70.0f)
162 {
164 SetCombatMovement(true);
165 me->SetCanFly(false);
166 if (me->GetVictim())
167 {
168 Position VictimPos = me->EnsureVictim()->GetPosition();
170 }
175 }
176
177 if (!_enraged && me->GetHealthPct() < 20.0f)
178 {
181 _enraged = true;
182 }
183
184 while (uint32 eventId = events.ExecuteEvent())
185 {
186 switch (eventId)
187 {
191 break;
195 break;
196 case EVENT_PARALYZE:
197 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0, true))
198 {
199 DoCast(target, SPELL_PARALYZE);
200 instance->SetGuidData(DATA_PARALYZED, target->GetGUID());
201 uint8 Index = urand(0, 1);
203 }
205 break;
207 for (GuidList::iterator i = _swarmers.begin(); i != _swarmers.end(); ++i)
208 if (Creature* swarmer = ObjectAccessor::GetCreature(*me, *i))
210 swarmer->AI()->AttackStart(target);
211
212 _swarmers.clear();
214 break;
216 {
217 Position Pos = me->GetRandomPoint(SwarmerPos, 80.0f);
220 break;
221 }
222 case EVENT_TRASH:
225 break;
226 case EVENT_LASH:
229 break;
230 }
231 }
232 }
233 private:
237 };
238
239 CreatureAI* GetAI(Creature* creature) const override
240 {
241 return GetAQ20AI<boss_ayamissAI>(creature);
242 }
243};
244
246{
247 public:
248 npc_hive_zara_larva() : CreatureScript("npc_hive_zara_larva") { }
249
251 {
253 {
255 }
256
257 void MovementInform(uint32 type, uint32 id) override
258 {
259 if (type == POINT_MOTION_TYPE && id == POINT_PARALYZE)
261 if (target->GetTypeId() == TYPEID_PLAYER)
262 DoCast(target, SPELL_FEED); // Omnomnom
263 }
264
265 void MoveInLineOfSight(Unit* who) override
266 {
268 return;
269
271 }
272
273 void AttackStart(Unit* victim) override
274 {
276 return;
277
279 }
280
281 void UpdateAI(uint32 diff) override
282 {
284 return;
285
287 }
288 private:
290 };
291
292 CreatureAI* GetAI(Creature* creature) const override
293 {
294 return GetAQ20AI<npc_hive_zara_larvaAI>(creature);
295 }
296};
297
299{
300 new boss_ayamiss();
302}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ POINT_MOTION_TYPE
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition: ObjectDefines.h:64
std::list< ObjectGuid > GuidList
Definition: ObjectGuid.h:394
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
EvadeReason
Definition: UnitAICommon.h:30
@ UNIT_STATE_ROOT
Definition: Unit.h:265
const Position AltarPos
void AddSC_boss_ayamiss()
@ EMOTE_FRENZY
const Position AyamissAirPos
const Position LarvaPos[2]
@ POINT_GROUND
@ POINT_AIR
@ POINT_PARALYZE
@ SPELL_STINGER_SPRAY
@ SPELL_FEED
@ SPELL_LASH
@ SPELL_TRASH
@ SPELL_FRENZY
@ SPELL_PARALYZE
@ SPELL_POISON_STINGER
@ PHASE_GROUND
@ PHASE_AIR
const Position SwarmerPos
@ EVENT_POISON_STINGER
@ EVENT_TRASH
@ EVENT_LASH
@ EVENT_SWARMER_ATTACK
@ EVENT_PARALYZE
@ EVENT_SUMMON_SWARMER
@ EVENT_STINGER_SPRAY
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
virtual void MoveInLineOfSight(Unit *)
Definition: CreatureAI.cpp:122
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
CreatureAI * AI() const
Definition: Creature.h:214
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
virtual ObjectGuid GetGuidData(uint32 type) const override
EncounterState GetBossState(uint32 id) const
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void ClearUnitState(uint32 f)
Definition: Unit.h:733
float GetHealthPct() const
Definition: Unit.h:784
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
void AddUnitState(uint32 f)
Definition: Unit.h:731
Unit * EnsureVictim() const
Definition: Unit.h:717
bool SetCanFly(bool enable)
Definition: Unit.cpp:12820
Unit * GetVictim() const
Definition: Unit.h:715
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
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:2025
void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
Definition: Object.cpp:1331
virtual void SetGuidData(uint32, ObjectGuid)
Definition: ZoneScript.h:84
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ NPC_HORNET
@ NPC_LARVA
@ NPC_SWARMER
@ DATA_PARALYZED
@ DATA_AYAMISS
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void SetCombatMovement(bool allowMovement)
void ResetThreatList(Unit *who=nullptr)
virtual void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason why) override
void JustSummoned(Creature *who) override
void MovementInform(uint32 type, uint32 id) override
void JustEngagedWith(Unit *attacker) override
void UpdateAI(uint32 diff) override
boss_ayamissAI(Creature *creature)
void MovementInform(uint32 type, uint32 id) override
void MoveInLineOfSight(Unit *who) override
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================