TrinityCore
Loading...
Searching...
No Matches
boss_arlokk.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 "zulgurub.h"
19#include "GameObject.h"
20#include "GameObjectAI.h"
21#include "InstanceScript.h"
22#include "MotionMaster.h"
23#include "ObjectAccessor.h"
24#include "ScriptedCreature.h"
25#include "ScriptMgr.h"
26#include "SpellInfo.h"
27
34
36{
37 SPELL_SHADOW_WORD_PAIN = 24212, // Corrected
38 SPELL_GOUGE = 12540, // Corrected
39 SPELL_MARK_OF_ARLOKK = 24210, // triggered spell 24211 Added to spell_dbc
40 SPELL_RAVAGE = 24213, // Corrected
41 SPELL_CLEAVE = 25174, // Searching for right spell
42 SPELL_PANTHER_TRANSFORM = 24190, // Transform to panther now used
43 SPELL_SUMMON_PROWLER = 24246, // Added to Spell_dbc
44 SPELL_VANISH_VISUAL = 24222, // Added
45 SPELL_VANISH = 24223, // Added
46 SPELL_SUPER_INVIS = 24235 // Added to Spell_dbc
47};
48
62
64{
67 PHASE_TWO = 2
68};
69
71{
72 WEAPON_DAGGER = 10616
73};
74
75enum Misc
76{
78};
79
81{
82 { -11561.9f, -1627.868f, 41.29941f, 0.0f }
83};
84
85// AWFUL HACK WARNING
86// To whoever reads this: Zul'Gurub needs your love
87// Need to do this calculation to increase/decrease Arlokk's damage by 35% (probably some aura missing)
88// This is only to compile the scripts after the aura calculation revamp
89float const DamageIncrease = 35.0f;
90float const DamageDecrease = 100.f / (1.f + DamageIncrease / 100.f) - 100.f;
91
92struct boss_arlokk : public BossAI
93{
94 boss_arlokk(Creature* creature) : BossAI(creature, DATA_ARLOKK)
95 {
96 Initialize();
97 }
98
100 {
101 _summonCountA = 0;
102 _summonCountB = 0;
103 }
104
116
117 void JustDied(Unit* /*killer*/) override
118 {
119 _JustDied();
121 }
122
123 void JustEngagedWith(Unit* who) override
124 {
132
133 // Sets up list of Panther spawners to cast on
134 std::list<Creature*> triggerList;
136 if (!triggerList.empty())
137 {
138 uint8 sideA = 0;
139 uint8 sideB = 0;
140 for (std::list<Creature*>::const_iterator itr = triggerList.begin(); itr != triggerList.end(); ++itr)
141 {
142 if (Creature* trigger = *itr)
143 {
144 if (trigger->GetPositionY() < -1625.0f)
145 {
146 _triggersSideAGUID[sideA] = trigger->GetGUID();
147 ++sideA;
148 }
149 else
150 {
151 _triggersSideBGUID[sideB] = trigger->GetGUID();
152 ++sideB;
153 }
154 }
155 }
156 }
157 }
158
159 void EnterEvadeMode(EvadeReason why) override
160 {
163 object->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
165 }
166
167 void SetData(uint32 id, uint32 /*value*/) override
168 {
169 if (id == 1)
171 else if (id == 2)
173 }
174
175 void UpdateAI(uint32 diff) override
176 {
177 if (!UpdateVictim())
178 return;
179
180 events.Update(diff);
181
183 return;
184
185 while (uint32 eventId = events.ExecuteEvent())
186 {
187 switch (eventId)
188 {
192 break;
193 case EVENT_GOUGE:
195 break;
198 {
199 if (Unit* trigger = ObjectAccessor::GetUnit(*me, _triggersSideAGUID[urand(0, 4)]))
200 {
201 trigger->CastSpell(trigger, SPELL_SUMMON_PROWLER);
203 }
204 }
206 {
207 if (Unit* trigger = ObjectAccessor::GetUnit(*me, _triggersSideBGUID[urand(0, 4)]))
208 {
209 trigger->CastSpell(trigger, SPELL_SUMMON_PROWLER);
211 }
212 }
214 break;
216 {
217 Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, urand(1, 3), 0.0f, false, true, -SPELL_MARK_OF_ARLOKK);
218 if (!target)
219 target = me->GetVictim();
220 if (target)
221 {
222 DoCast(target, SPELL_MARK_OF_ARLOKK, true);
223 Talk(SAY_FEAST_PROWLER, target);
224 }
226 break;
227 }
228 case EVENT_TRANSFORM:
229 {
230 DoCast(me, SPELL_PANTHER_TRANSFORM); // SPELL_AURA_TRANSFORM
233 /*
234 CreatureTemplate const* cinfo = me->GetCreatureTemplate();
235 me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
236 me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
237 me->UpdateDamagePhysical(BASE_ATTACK);
238 */
239 me->AttackStop();
246 break;
247 }
248 case EVENT_VANISH:
250 me->SetWalk(false);
251 me->GetMotionMaster()->MovePoint(0, frand(-11551.0f, -11508.0f), frand(-1638.0f, -1617.0f), me->GetPositionZ());
253 break;
254 case EVENT_VANISH_2:
258 break;
259 case EVENT_VISIBLE:
263 AttackStart(target);
270 break;
271 case EVENT_RAVAGE:
274 break;
276 {
277 me->RemoveAura(SPELL_PANTHER_TRANSFORM); // SPELL_AURA_TRANSFORM
281 /*
282 CreatureTemplate const* cinfo = me->GetCreatureTemplate();
283 me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg));
284 me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg));
285 me->UpdateDamagePhysical(BASE_ATTACK);
286 */
292 break;
293 }
294 default:
295 break;
296 }
297
299 return;
300 }
301
303 }
304
305private:
310};
311
312/*######
313## npc_zulian_prowler
314######*/
315
317{
319 SPELL_SNEAK_RANK_1_2 = 7939, // Added to Spell_dbc
320 SPELL_MARK_OF_ARLOKK_TRIGGER = 24211 // Added to Spell_dbc
322
327
329{
330 { -11556.7f, -1631.344f, 41.2994f, 0.0f }
331};
332
334{
335 npc_zulian_prowler(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
336 {
337 _sideData = 0;
338 }
339
340 void Reset() override
341 {
342 if (me->GetPositionY() < -1625.0f)
343 _sideData = 1;
344 else
345 _sideData = 2;
346
349
351 if (arlokk->IsAlive())
352 me->GetMotionMaster()->MovePoint(0, arlokk->GetPosition());
353
355 }
356
357 void JustEngagedWith(Unit* /*who*/) override
358 {
362 }
363
364 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
365 {
366 Unit* unitCaster = caster->ToUnit();
367 if (!unitCaster)
368 return;
369
370 if (spellInfo->Id == SPELL_MARK_OF_ARLOKK_TRIGGER) // Should only hit if line of sight
371 me->Attack(unitCaster, true);
372 }
373
374 void JustDied(Unit* /*killer*/) override
375 {
377 {
378 if (arlokk->IsAlive())
379 arlokk->GetAI()->SetData(_sideData, 0);
380 }
382 }
383
384 void UpdateAI(uint32 diff) override
385 {
386 if (UpdateVictim())
387 {
389 return;
390 }
391
392 _events.Update(diff);
393
394 while (uint32 eventId = _events.ExecuteEvent())
395 {
396 switch (eventId)
397 {
398 case EVENT_ATTACK:
399 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0.0f, 100, false))
400 me->Attack(target, true);
401 break;
402 default:
403 break;
404 }
405 }
406 }
407
408private:
412};
413
414/*######
415## go_gong_of_bethekk
416######*/
417
419{
420 { -11507.22f, -1628.062f, 41.38264f, 3.159046f }
421};
422
424{
426
427 bool OnGossipHello(Player* /*player*/) override
428 {
430 me->SendCustomAnim(0);
432 return true;
433 }
434};
435
@ EQUIP_UNEQUIP
Definition CreatureAI.h:76
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_DEAD_DESPAWN
Spells
Definition PlayerAI.cpp:32
float frand(float min, float max)
Definition Random.cpp:55
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
@ GO_FLAG_NOT_SELECTABLE
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:180
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ TOTAL_PCT
Definition Unit.h:146
ZulianProwlerSpells
@ SPELL_SNEAK_RANK_1_1
@ SPELL_SNEAK_RANK_1_2
@ SPELL_MARK_OF_ARLOKK_TRIGGER
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_FEAST_PROWLER
@ MAX_PROWLERS_PER_SIDE
void AddSC_boss_arlokk()
@ SPELL_CLEAVE
@ SPELL_PANTHER_TRANSFORM
@ SPELL_SUMMON_PROWLER
@ SPELL_RAVAGE
@ SPELL_SHADOW_WORD_PAIN
@ SPELL_SUPER_INVIS
@ SPELL_VANISH
@ SPELL_MARK_OF_ARLOKK
@ SPELL_GOUGE
@ SPELL_VANISH_VISUAL
@ PHASE_ONE
@ PHASE_ALL
@ PHASE_TWO
Position const PosProwlerCenter[1]
ZulianProwlerEvents
@ EVENT_ATTACK
float const DamageIncrease
float const DamageDecrease
Position const PosSummonArlokk[1]
Position const PosMoveOnSpawn[1]
Weapon
@ WEAPON_DAGGER
@ EVENT_SUMMON_PROWLERS
@ EVENT_SHADOW_WORD_PAIN
@ EVENT_TRANSFORM_BACK
@ EVENT_GOUGE
@ EVENT_VISIBLE
@ EVENT_VANISH_2
@ EVENT_VANISH
@ EVENT_TRANSFORM
@ EVENT_RAVAGE
@ EVENT_MARK_OF_ARLOKK
InstanceScript *const instance
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 SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
GameObject *const me
void SetFlag(GameObjectFlags flags)
Definition GameObject.h:171
void SendCustomAnim(uint32 anim)
Creature * GetCreature(uint32 type)
GameObject * GetGameObject(uint32 type)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
static Unit * ToUnit(Object *o)
Definition Object.h:192
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
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 RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3638
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:9042
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void SetVirtualItem(uint32 slot, uint32 itemId)
Definition Unit.cpp:13868
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:5535
bool SetWalk(bool enable)
Definition Unit.cpp:13268
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool AttackStop()
Definition Unit.cpp:5645
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
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:1992
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
float GetPositionZ() const
Definition Position.h:81
float GetPositionY() const
Definition Position.h:80
void AttackStart(Unit *) override
void ResetThreatList(Unit *who=nullptr)
void Initialize()
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason why) override
void JustDied(Unit *) override
void Reset() override
ObjectGuid _triggersSideAGUID[5]
void JustEngagedWith(Unit *who) override
ObjectGuid _triggersSideBGUID[5]
uint8 _summonCountA
uint8 _summonCountB
boss_arlokk(Creature *creature)
void SetData(uint32 id, uint32) override
go_gong_of_bethekk(GameObject *go)
bool OnGossipHello(Player *) override
void JustDied(Unit *) override
npc_zulian_prowler(Creature *creature)
void UpdateAI(uint32 diff) override
void Reset() override
void JustEngagedWith(Unit *) override
InstanceScript * _instance
void SpellHit(WorldObject *caster, SpellInfo const *spellInfo) override
@ NPC_PANTHER_TRIGGER
Definition zulgurub.h:50
@ NPC_ARLOKK
Definition zulgurub.h:49
#define RegisterZulGurubCreatureAI(ai_name)
Definition zulgurub.h:91
#define RegisterZulGurubGameObjectAI(ai_name)
Definition zulgurub.h:92
@ DATA_ARLOKK
Definition zulgurub.h:33
@ DATA_GONG_BETHEKK
Definition zulgurub.h:43