TrinityCore
Loading...
Searching...
No Matches
boss_majordomo_executus.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 "Map.h"
21#include "molten_core.h"
22#include "MotionMaster.h"
23#include "Player.h"
24#include "ScriptedCreature.h"
25#include "ScriptedGossip.h"
26#include "SpellAuraEffects.h"
27#include "SpellInfo.h"
28#include "SpellScript.h"
29
44
67
90
97
98Position const TeleToRagnarosPosition = { 848.9330f, -812.8750f, -229.60100f, 4.046000003814697265f };
99Position const SummonRagnarosPosition = { 830.9636f, -814.7055f, -228.97328f, 5.445427417755126953f };
100
101// 12018 - Majordomo Executus
102struct boss_majordomo : public BossAI
103{
105
106 void InitializeAI() override
107 {
108 me->SetCorpseDelay(20, true);
110 }
111
112 void JustAppeared() override
113 {
115 {
118 }
119 else
121 }
122
123 void Reset() override
124 {
125 _Reset();
127 }
128
144
145 void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo*/) override
146 {
147 if (attacker->GetEntry() == NPC_RAGNAROS)
148 return;
149
150 if (damage >= me->GetHealth())
151 damage = me->GetHealth() - 1;
152 }
153
161
162 void OnSpellCast(SpellInfo const* spellInfo) override
163 {
164 switch (spellInfo->Id)
165 {
169 break;
170 case SPELL_CHAMPION:
172 break;
173 default:
174 break;
175 }
176 }
177
178 void DoAction(int32 action) override
179 {
180 if (action == ACTION_FLAMEWAKER_DIES)
181 {
183
184 switch (_deadFlamewakerCount)
185 {
186 case 4:
188 break;
189 case 7:
191 break;
192 case 8:
194 break;
195 default:
196 break;
197 }
198
200 }
201 }
202
203 void KilledUnit(Unit* /*victim*/) override
204 {
205 Talk(SAY_SLAY);
206 }
207
209 {
211
212 while (uint32 eventId = _specialEvents.ExecuteEvent())
213 {
214 switch (eventId)
215 {
216 case EVENT_OUTRO_1:
220 me->SetImmuneToPC(true);
222 _JustDied();
224 break;
225 case EVENT_OUTRO_2:
228 break;
229 case EVENT_OUTRO_3:
232 break;
233 case EVENT_OUTRO_4:
236 break;
237 case EVENT_OUTRO_5:
240 break;
241
242 case EVENT_SUMMON_1:
248 break;
249 case EVENT_SUMMON_2:
252 me->SetWalk(true);
253 // He should move while casting spell but he starts to move only when spell cast is finished
254 // Orientation is not changed after reaching point
255 me->GetMotionMaster()->MovePoint(POINT_SUMMON, SummonRagnarosPosition, true, 5.445427417755126953f);
257 break;
258 case EVENT_SUMMON_3:
261 break;
262 case EVENT_SUMMON_4:
265 break;
266 case EVENT_SUMMON_5:
268 break;
269
273 break;
274 default:
275 break;
276 }
277 }
278 }
279
280 void UpdateAI(uint32 diff) override
281 {
283
284 if (!UpdateVictim())
285 return;
286
287 events.Update(diff);
288
290 return;
291
292 while (uint32 eventId = events.ExecuteEvent())
293 {
294 switch (eventId)
295 {
299 events.Repeat(0s, 10s);
300 break;
303 break;
306 events.Repeat(25s, 30s);
307 break;
311 events.Repeat(25s, 30s);
312 break;
313 case EVENT_SHIELD:
315 events.Repeat(30s);
316 break;
317 default:
318 break;
319 }
320
322 return;
323 }
324
326 }
327
328 bool OnGossipSelect(Player* player, uint32 menuId, uint32 /*gossipListId*/) override
329 {
330 if (menuId == GOSSIP_MENU_EVENT)
331 {
332 CloseGossipMenuFor(player);
333 Talk(SAY_SUMMON_1, player);
335 }
336 return false;
337 }
338
339private:
342};
343
344// 21094 - Separation Anxiety
346{
348
349 bool Validate(SpellInfo const* /*spellInfo*/) override
350 {
352 }
353
354 void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
355 {
356 isPeriodic = true;
357 amplitude = 5 * IN_MILLISECONDS;
358 }
359
360 void HandleDummyTick(AuraEffect const* aurEff)
361 {
362 Unit* target = GetTarget();
363
364 if (Unit* caster = GetCaster())
365 if (caster->IsAlive() && !caster->IsWithinDistInMap(target, aurEff->GetSpellEffectInfo().CalcRadius()))
366 target->CastSpell(target, SPELL_SEPARATION_ANXIETY_EFFECT, true);
367 }
368
374};
375
@ IN_MILLISECONDS
Definition Common.h:35
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ DONE
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
void CloseGossipMenuFor(Player *player)
@ EFFECT_0
@ SPELL_AURA_DUMMY
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectCalcPeriodicFn(F, I, N)
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
@ SPELL_SEPARATION_ANXIETY_EFFECT
@ SPELL_SEPARATION_ANXIETY
@ SPELL_TELEPORT_VISUAL
@ SPELL_TELEPORT_VICTIM
@ SPELL_SUMMON_RAGNAROS
@ SPELL_AEGIS_OF_RAGNAROS
@ SPELL_TELEPORT_RANDOM
@ SPELL_MAGIC_REFLECTION
Position const TeleToRagnarosPosition
void AddSC_boss_majordomo()
@ EVENT_TELEPORT_RANDOM
@ EVENT_TELEPORT_VICTIM
@ EVENT_SEPARATION_ANXIETY
@ EVENT_DESPAWN_OBJECTS
@ EVENT_AEGIS_OF_RAGNAROS
Position const SummonRagnarosPosition
SpellEffectInfo const & GetSpellEffectInfo() const
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
InstanceScript *const instance
void _JustReachedHome()
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 SetImmuneToPC(bool apply) override
Definition Creature.h:129
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 ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
InstanceMap * instance
void UpdateEncounterStateForKilledCreature(uint32 creatureId, Unit *source)
EncounterState GetBossState(uint32 id) const
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:3382
bool SpawnGroupDespawn(uint32 groupId, bool deleteRespawnTimes=false, size_t *count=nullptr)
Definition Map.cpp:3458
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
uint32 GetEntry() const
Definition Object.h:81
float CalcRadius(WorldObject *caster=nullptr, Spell *=nullptr) const
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
virtual void InitializeAI()
Definition UnitAI.cpp:36
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 SetFaction(uint32 faction) override
Definition Unit.h:974
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
uint32 GetHealth() const
Definition Unit.h:913
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
bool SetWalk(bool enable)
Definition Unit.cpp:13268
void NearTeleportTo(Position const &pos, bool casting=false)
Definition Unit.cpp:12832
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *) override
void CalcPeriodic(AuraEffect const *, bool &isPeriodic, int32 &amplitude)
PrepareAuraScript(spell_majordomo_separation_anxiety)
void HandleDummyTick(AuraEffect const *aurEff)
#define RegisterMoltenCoreCreatureAI(ai_name)
@ SPAWN_GROUP_RAGNAROS
Definition molten_core.h:86
@ SPAWN_GROUP_LAVA_STEAM
Definition molten_core.h:88
@ SPAWN_GROUP_FLAMEWAKERS
Definition molten_core.h:85
@ SPAWN_GROUP_LAVA_SPLASH
Definition molten_core.h:89
@ ACTION_FLAMEWAKER_DIES
Definition molten_core.h:94
@ NPC_RAGNAROS
Definition molten_core.h:64
@ BOSS_MAJORDOMO_EXECUTUS
Definition molten_core.h:38
void JustReachedHome() override
void KilledUnit(Unit *) override
void UpdateSpecialEvents(uint32 diff)
void DoAction(int32 action) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
bool OnGossipSelect(Player *player, uint32 menuId, uint32) override
void OnSpellCast(SpellInfo const *spellInfo) override
void DamageTaken(Unit *attacker, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_majordomo(Creature *creature)