TrinityCore
Loading...
Searching...
No Matches
boss_ragnaros.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 * Is SAY_REINFORCEMENTS_2 really used?
20 * Are SPELL_SUBMERGE_FADE and SPELL_EMERGE used?
21 * Combat timers requires to be revisited
22 */
23
24#include "ScriptMgr.h"
25#include "Containers.h"
26#include "GameObject.h"
27#include "GameObjectAI.h"
28#include "InstanceScript.h"
29#include "molten_core.h"
30#include "ScriptedCreature.h"
31#include "SpellInfo.h"
32#include "SpellScript.h"
33
45
94
111
117
130
142
143// 11502 - Ragnaros
144struct boss_ragnaros : public BossAI
145{
148
155
168
179
187
188 void OnSpellCast(SpellInfo const* spellInfo) override
189 {
190 switch (spellInfo->Id)
191 {
193 if (roll_chance_i(50))
195 break;
199 break;
200 default:
201 break;
202 }
203 }
204
205 void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
206 {
207 if (summon->GetEntry() == NPC_SON_OF_FLAME)
208 {
210
212 {
214 if (_isSubmerged)
216 }
217 }
218 }
219
220 void KilledUnit(Unit* victim) override
221 {
222 if (victim->GetTypeId() == TYPEID_PLAYER)
223 Talk(SAY_SLAY);
224 }
225
227 {
228 events.Update(diff);
229
230 while (uint32 eventId = events.ExecuteEvent())
231 {
232 switch (eventId)
233 {
234 case EVENT_INTRO_1:
237 break;
238 case EVENT_INTRO_2:
241 break;
242 case EVENT_INTRO_3:
245 break;
246 case EVENT_INTRO_4:
249 break;
250 case EVENT_INTRO_5:
251 me->SetImmuneToPC(false);
252 break;
253 default:
254 break;
255 }
256 }
257 }
258
259 void UpdateAI(uint32 diff) override
260 {
261 if (!UpdateVictim())
262 {
263 UpdateIntroEvents(diff);
264 return;
265 }
266
267 events.Update(diff);
268
270 return;
271
272 while (uint32 eventId = events.ExecuteEvent())
273 {
274 switch (eventId)
275 {
279 events.Repeat(3s, 4s);
280 break;
283 events.Repeat(25s, 30s);
284 break;
288 events.Repeat(9s, 12s);
289 break;
290 case EVENT_LAVA_BURST:
292 events.Repeat(2s, 15s);
293 break;
294
295 case EVENT_SUBMERGE:
303
305 _hasSubmergedOnce = true;
306 _isSubmerged = true;
307
312
314 break;
315 case EVENT_EMERGE:
321
322 _isSubmerged = false;
323
329 break;
330 default:
331 break;
332 }
333
335 return;
336 }
337
339 }
340
341private:
345};
346
347// 13148 - Flame of Ragnaros
349{
350 npc_flame_of_ragnaros(Creature* creature) : ScriptedAI(creature) { }
351
352 void InitializeAI() override
353 {
355 }
356
357 void JustAppeared() override
358 {
361 }
362};
363
364// 12143 - Son of Flame
366{
367 npc_son_of_flame(Creature* creature) : ScriptedAI(creature) { }
368
369 void InitializeAI() override
370 {
371 me->SetCorpseDelay(1, true);
372 }
373
380
381 void UpdateAI(uint32 /*diff*/) override
382 {
383 if (!UpdateVictim())
384 return;
385
387 }
388};
389
390// 21908 - Lava Burst Randomizer
410
411// 21108 - Summon Sons of Flame
413{
415
416 bool Validate(SpellInfo const* /*spellInfo*/) override
417 {
419 }
420
421 void HandleDummy(SpellEffIndex /*effIndex*/)
422 {
423 Unit* caster = GetCaster();
424 for (uint32 spell : SummonSonsOfFlameSpells)
425 caster->CastSpell(caster, spell, true);
426 }
427
432};
433
434// 178088 - Ragnaros
436{
438
439 void InitializeAI() override
440 {
441 // This trap is supposed to trigger immediately after spawning without any nearby players
443 {
444 // no spell found in sniff (either serverside and not in spell_dbc or just a manual script action)
445 go->ActivateObject(GameObjectActions::AnimateCustom0);
446
447 if (Creature* ragnaros = go->GetInstanceScript()->GetCreature(BOSS_RAGNAROS))
448 go->ActivateObject(GameObjectActions::Disturb, ragnaros);
449 }, 1ms);
450 }
451};
452
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_AURA_PROC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STAND_STATE_SUBMERGED
Definition UnitDefines.h:43
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
RagnarosEvents
@ EVENT_INTRO_4
@ EVENT_EMERGE
@ EVENT_MAGMA_BLAST
@ EVENT_INTRO_1
@ EVENT_INTRO_2
@ EVENT_INTRO_5
@ EVENT_WRATH_OF_RAGNAROS
@ EVENT_MIGHT_OF_RAGNAROS
@ EVENT_SUBMERGE
@ EVENT_INTRO_3
@ EVENT_LAVA_BURST
static constexpr std::array< uint32, 9 > SummonLavaBurstSpells
static constexpr std::array< uint32, 8 > SummonSonsOfFlameSpells
RagnarosMisc
@ NPC_SON_OF_FLAME
@ MAX_SONS_OF_FLAME
RagnarosTexts
@ SAY_ARRIVAL_3
@ SAY_ARRIVAL_2
@ SAY_REINFORCEMENTS_2
@ SAY_ARRIVAL_1
@ SAY_SLAY
@ SAY_MIGHT
@ SAY_WRATH
@ SAY_REINFORCEMENTS_1
void AddSC_boss_ragnaros()
RagnarosSpells
@ SPELL_SUMMON_LAVA_BURST_E
@ SPELL_SUMMON_LAVA_BURST_C
@ SPELL_SUMMON_SON_OF_FLAME_D
@ SPELL_SUMMON_SON_OF_FLAME_F
@ SPELL_ELEMENTAL_FIRE
@ SPELL_WRATH_OF_RAGNAROS
@ SPELL_SUMMON_LAVA_BURST_I
@ SPELL_INTENSE_HEAT
@ SPELL_SUMMON_LAVA_BURST_G
@ SPELL_MAGMA_BLAST
@ SPELL_EMERGE
@ SPELL_SUBMERGE_FADE
@ SPELL_SUMMON_LAVA_BURST_H
@ SPELL_ELEMENTAL_FIRE_KILL
@ SPELL_LAVA_BURST
@ SPELL_SUMMON_LAVA_BURST_B
@ SPELL_SUMMON_SON_OF_FLAME_C
@ SPELL_SUMMON_LAVA_BURST_A
@ SPELL_LAVA_SHIELD
@ SPELL_SUBMERGE_EFFECT
@ SPELL_SUMMON_SON_OF_FLAME_H
@ SPELL_SUMMON_SON_OF_FLAME_B
@ SPELL_SUMMON_SON_OF_FLAME_G
@ SPELL_SUMMON_LAVA_BURST_D
@ SPELL_SUMMON_SON_OF_FLAME_A
@ SPELL_SUMMON_SONS_OF_FLAME
@ SPELL_SUBMERGE_VISUAL
@ SPELL_SUMMON_LAVA_BURST_F
@ SPELL_SUMMON_SON_OF_FLAME_E
@ SPELL_MIGHT_OF_RAGNAROS
@ SPELL_MELT_WEAPON
@ SPELL_DOUBLE_ATTACK
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
EventMap events
void Reset() override
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToPC(bool apply) override
Definition Creature.h:129
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 RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:52
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
GameObject *const me
GameObjectAI(GameObject *go)
Creature * GetCreature(uint32 type)
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
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
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:844
void RemoveAllAurasExceptType(AuraType type)
Definition Unit.cpp:4272
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
EventProcessor m_Events
Definition Object.h:591
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void HandleDummy(SpellEffIndex)
PrepareSpellScript(spell_ragnaros_lava_burst)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_ragnaros_summon_sons_of_flame)
bool Validate(SpellInfo const *) override
#define RegisterMoltenCoreCreatureAI(ai_name)
#define RegisterMoltenCoreGameObjectAI(ai_name)
@ BOSS_RAGNAROS
Definition molten_core.h:39
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
void ResetThreatList(Unit *who=nullptr)
void JustReachedHome() override
void UpdateIntroEvents(uint32 diff)
void JustAppeared() override
void OnSpellCast(SpellInfo const *spellInfo) override
void KilledUnit(Unit *victim) override
void UpdateAI(uint32 diff) override
uint8 _deadSonsOfFlameCount
void SummonedCreatureDies(Creature *summon, Unit *) override
void Reset() override
boss_ragnaros(Creature *creature)
void JustEngagedWith(Unit *who) override
npc_flame_of_ragnaros(Creature *creature)
void InitializeAI() override
void JustAppeared() override
void JustAppeared() override
npc_son_of_flame(Creature *creature)
void UpdateAI(uint32) override
void InitializeAI() override