TrinityCore
Loading...
Searching...
No Matches
boss_mandokir.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 "InstanceScript.h"
20#include "MotionMaster.h"
21#include "ObjectAccessor.h"
22#include "ScriptedCreature.h"
23#include "ScriptMgr.h"
24#include "SpellAuras.h"
25#include "SpellScript.h"
26#include "TemporarySummon.h"
27
38
40{
41 SPELL_CHARGE = 24408, // seen
42 SPELL_OVERPOWER = 24407, // Seen
43 SPELL_FEAR = 29321,
44 SPELL_WHIRLWIND = 13736, // Triggers 15589
45 SPELL_MORTAL_STRIKE = 16856, // Seen
46 SPELL_FRENZY = 24318, // seen
47 SPELL_WATCH = 24314, // seen 24315, 24316
48 SPELL_WATCH_CHARGE = 24315, // Triggers 24316
49 SPELL_LEVEL_UP = 24312 //
50};
51
63
71
73{
74 { -12167.17f, -1979.330f, 133.0992f, 2.268928f },
75 { -12262.74f, -1953.394f, 133.5496f, 0.593412f },
76 { -12176.89f, -1983.068f, 133.7841f, 2.129302f },
77 { -12226.45f, -1977.933f, 132.7982f, 1.466077f },
78 { -12204.74f, -1890.431f, 135.7569f, 4.415683f },
79 { -12216.70f, -1891.806f, 136.3496f, 4.677482f },
80 { -12236.19f, -1892.034f, 134.1041f, 5.044002f },
81 { -12248.24f, -1893.424f, 134.1182f, 5.270895f },
82 { -12257.36f, -1897.663f, 133.1484f, 5.462881f },
83 { -12265.84f, -1903.077f, 133.1649f, 5.654867f },
84 { -12158.69f, -1972.707f, 133.8751f, 2.408554f },
85 { -12178.82f, -1891.974f, 134.1786f, 3.944444f },
86 { -12193.36f, -1890.039f, 135.1441f, 4.188790f },
87 { -12275.59f, -1932.845f, 134.9017f, 0.174533f },
88 { -12273.51f, -1941.539f, 136.1262f, 0.314159f },
89 { -12247.02f, -1963.497f, 133.9476f, 0.872665f },
90 { -12238.68f, -1969.574f, 133.6273f, 1.134464f },
91 { -12192.78f, -1982.116f, 132.6966f, 1.919862f },
92 { -12210.81f, -1979.316f, 133.8700f, 1.797689f },
93 { -12283.51f, -1924.839f, 133.5170f, 0.069813f }
94};
95
97{
98 { -12167.8f, -1927.25f, 153.73f, 3.76991f },
99 { -12197.86f, -1949.392f, 130.2745f, 0.0f }
100};
101
102struct boss_mandokir : public BossAI
103{
105 {
106 Initialize();
107 }
108
110 {
111 _killCount = 0;
112 }
113
114 void Reset() override
115 {
116 if (me->GetPositionZ() > 140.0f)
117 {
118 _Reset();
119 Initialize();
120 me->SetImmuneToAll(true);
123 if (!speaker->IsAlive())
124 speaker->Respawn(true);
125 }
128 }
129
130 void JustDied(Unit* /*killer*/) override
131 {
135 }
136
137 void JustReachedHome() override
138 {
139 me->SetImmuneToAll(false);
140 }
141
142 void JustEngagedWith(Unit* who) override
143 {
152 me->Dismount();
153
154 // Summon Ohgan (Spell missing) TEMP HACK
156 // Summon Chained Spirits
157 for (int i = 0; i < CHAINED_SPIRT_COUNT; ++i)
159
161 }
162
163 void KilledUnit(Unit* victim) override
164 {
165 if (victim->GetTypeId() != TYPEID_PLAYER)
166 return;
167
168 if (++_killCount == 3)
169 {
172 if (jindo->IsAlive())
173 jindo->AI()->Talk(SAY_GRATS_JINDO);
174 DoCast(me, SPELL_LEVEL_UP, true);
175 _killCount = 0;
176 }
177 }
178
179 void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
180 {
181 if (summon->GetEntry() == NPC_OHGAN)
182 {
185 }
186 }
187
188 void MovementInform(uint32 type, uint32 id) override
189 {
190 if (type == WAYPOINT_MOTION_TYPE)
191 {
192 me->SetWalk(false);
193 if (id == POINT_MANDOKIR_END)
194 {
198 }
199 }
200 }
201
202 void UpdateAI(uint32 diff) override
203 {
204 events.Update(diff);
205
206 if (!UpdateVictim())
207 {
209 {
210 while (uint32 eventId = events.ExecuteEvent())
211 {
212 switch (eventId)
213 {
216 {
219 }
220 else
222 break;
223 case EVENT_STARTED:
224 me->SetImmuneToAll(false);
226 break;
227 default:
228 break;
229 }
230 }
231 }
232 return;
233 }
234
236 return;
237
238 while (uint32 eventId = events.ExecuteEvent())
239 {
240 switch (eventId)
241 {
242 case EVENT_OVERPOWER:
245 break;
247 if (me->GetVictim() && me->EnsureVictim()->HealthBelowPct(50))
250 break;
251 case EVENT_WHIRLWIND:
254 break;
256 if (Unit* player = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
257 {
258 DoCast(player, SPELL_WATCH);
259 Talk(SAY_WATCH, player);
260 }
262 break;
266 break;
267 default:
268 break;
269 }
270
272 return;
273 }
274
276 }
277
278private:
280};
281
282// Ohgan
283
285{
286 SPELL_SUNDERARMOR = 24317
288
289struct npc_ohgan : public ScriptedAI
290{
291 npc_ohgan(Creature* creature) : ScriptedAI(creature)
292 {
293 Initialize();
294 }
295
297 {
298 _sunderArmorTimer = 5000;
299 }
300
301 void Reset() override
302 {
303 Initialize();
304 }
305
306 void UpdateAI(uint32 diff) override
307 {
308 if (!UpdateVictim())
309 return;
310
311 if (_sunderArmorTimer <= diff)
312 {
314 _sunderArmorTimer = urand(10000, 15000);
315 }
316 else
317 _sunderArmorTimer -= diff;
318
320 }
321
322private:
324};
325
331
333{
334 npc_vilebranch_speaker(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
335 {
336 Initialize();
337 }
338
340 {
341 _demoralizingShoutTimer = urand(2000, 4000);
342 _cleaveTimer = urand(5000, 8000);
343 }
344
345 void Reset() override
346 {
347 Initialize();
348 }
349
350 void JustDied(Unit* /*killer*/) override
351 {
353 }
354
355 void UpdateAI(uint32 diff) override
356 {
357 // Return since we have no target
358 if (!UpdateVictim())
359 return;
360
361 if (_demoralizingShoutTimer <= diff)
362 {
364 _demoralizingShoutTimer = urand(22000, 30000);
365 }
366 else
368
369 if (_cleaveTimer <= diff)
370 {
372 _cleaveTimer = urand(6000, 9000);
373 }
374 else
375 _cleaveTimer -= diff;
376
378 }
379
380private:
384};
385
386// 24314 - Threatening Gaze
388{
390
391 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
392 {
393 if (Unit* caster = GetCaster())
394 if (Unit* target = GetTarget())
395 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
396 caster->CastSpell(target, SPELL_WATCH_CHARGE);
397 }
398
403};
404
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ DONE
@ SPECIAL
@ NOT_STARTED
@ WAYPOINT_MOTION_TYPE
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
@ TEMPSUMMON_CORPSE_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ AURA_REMOVE_BY_DEATH
@ AURA_REMOVE_BY_EXPIRE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
Position const PosMandokir[2]
@ SAY_GRATS_JINDO
@ SAY_WATCH_WHISPER
@ SAY_DING_KILL
@ SAY_AGGRO
@ SAY_WATCH
@ SAY_OHGAN_DEAD
VilebranchSpells
@ SPELL_CLEAVE
@ SPELL_DEMORALIZING_SHOUT
@ PATH_MANDOKIR
@ CHAINED_SPIRT_COUNT
@ MODEL_OHGAN_MOUNT
@ POINT_MANDOKIR_END
@ SPELL_CHARGE
@ SPELL_FEAR
@ SPELL_MORTAL_STRIKE
@ SPELL_OVERPOWER
@ SPELL_FRENZY
@ SPELL_WATCH
@ SPELL_WATCH_CHARGE
@ SPELL_WHIRLWIND
@ SPELL_LEVEL_UP
OhganSpells
@ SPELL_SUNDERARMOR
Position const PosSummonChainedSpirits[CHAINED_SPIRT_COUNT]
@ EVENT_OVERPOWER
@ EVENT_WHIRLWIND
@ EVENT_WATCH_PLAYER
@ EVENT_CHECK_START
@ EVENT_CHARGE_PLAYER
@ EVENT_STARTED
@ EVENT_CHECK_SPEAKER
@ EVENT_MORTAL_STRIKE
void AddSC_boss_mandokir()
AuraApplication const * GetTargetApplication() const
Unit * GetCaster() const
Unit * GetTarget() const
HookList< EffectApplyHandler > OnEffectRemove
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:293
void SetImmuneToAll(bool apply) override
Definition Creature.h:126
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void MovePath(uint32 pathId, bool repeatable)
void MoveTargetedHome()
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
void DespawnEntry(uint32 entry)
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
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void Dismount()
Definition Unit.cpp:8234
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:8184
Unit * EnsureVictim() const
Definition Unit.h:861
bool HealthBelowPct(int32 pct) const
Definition Unit.h:917
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
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
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_threatening_gaze)
float GetPositionZ() const
Definition Position.h:81
float GetOrientation() const
Definition Position.h:82
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
void KilledUnit(Unit *victim) override
void JustDied(Unit *) override
void Reset() override
void UpdateAI(uint32 diff) override
void MovementInform(uint32 type, uint32 id) override
boss_mandokir(Creature *creature)
void JustReachedHome() override
void SummonedCreatureDies(Creature *summon, Unit *) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void Initialize()
void Reset() override
npc_ohgan(Creature *creature)
uint32 _sunderArmorTimer
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
npc_vilebranch_speaker(Creature *creature)
InstanceScript * _instance
@ NPC_OHGAN
Definition zulgurub.h:62
@ NPC_CHAINED_SPIRT
Definition zulgurub.h:64
#define RegisterZulGurubCreatureAI(ai_name)
Definition zulgurub.h:91
@ DATA_JINDO
Definition zulgurub.h:37
@ DATA_MANDOKIR
Definition zulgurub.h:36
@ DATA_VILEBRANCH_SPEAKER
Definition zulgurub.h:44