TrinityCore
Loading...
Searching...
No Matches
boss_magmadar.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 * Lava Bomb requires additional research. Both spells can target mana-users. Doesn't look like they're used randomly. Only one spell is used every 12-15 seconds.
20 Looks like the spell boss uses depends on HP PCT but exact PCT is unknown. That should be double-checked
21 */
22
23#include "ScriptMgr.h"
24#include "molten_core.h"
25#include "ScriptedCreature.h"
26#include "SpellInfo.h"
27#include "SpellScript.h"
28
34
47
57
58// 11982 - Magmadar
59struct boss_magmadar : public BossAI
60{
61 boss_magmadar(Creature* creature) : BossAI(creature, BOSS_MAGMADAR), _lavaBombSwitched(false), _isExhausted(false) { }
62
63 void Reset() override
64 {
65 _Reset();
66 _lavaBombSwitched = false;
67 _isExhausted = false;
69 }
70
71 void JustEngagedWith(Unit* who) override
72 {
74
78 }
79
80 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
81 {
82 if (!_lavaBombSwitched && me->HealthBelowPctDamaged(60, damage))
83 {
84 _lavaBombSwitched = true;
87 }
88
89 if (!_isExhausted && me->HealthBelowPctDamaged(2, damage))
90 {
91 _isExhausted = true;
93 }
94 }
95
96 void OnSpellCast(SpellInfo const* spell) override
97 {
98 if (spell->Id == SPELL_FRENZY)
100 }
101
102 void UpdateAI(uint32 diff) override
103 {
104 if (!UpdateVictim())
105 return;
106
107 events.Update(diff);
108
110 return;
111
112 while (uint32 eventId = events.ExecuteEvent())
113 {
114 switch (eventId)
115 {
116 case EVENT_FRENZY:
118 events.Repeat(15s, 20s);
119 break;
120 case EVENT_PANIC:
122 events.Repeat(30s, 35s);
123 break;
126 DoCast(target, SPELL_LAVA_BOMB_1);
127 events.Repeat(12s, 15s);
128 break;
131 DoCast(target, SPELL_LAVA_BOMB_2);
132 events.Repeat(12s, 15s);
133 break;
134
135 case EVENT_EXHAUSTED:
137 break;
138 default:
139 break;
140 }
141
143 return;
144 }
145
147 }
148
149private:
152};
153
154// 19411, 20474 - Lava Bomb
156{
158
159 bool Validate(SpellInfo const* /*spellInfo*/) override
160 {
162 }
163
164 void HandleDummy(SpellEffIndex /*effIndex*/)
165 {
166 switch (GetSpellInfo()->Id)
167 {
170 break;
173 break;
174 default:
175 break;
176 }
177 }
178
183};
184
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
MagmadarTexts
@ EMOTE_FRENZY
@ EMOTE_EXHAUSTED
void AddSC_boss_magmadar()
MagmadarSpells
@ SPELL_LAVA_BOMB_1
@ SPELL_LAVA_BOMB_2
@ SPELL_SUMMON_LAVA_BOMB_1
@ SPELL_SUMMON_LAVA_BOMB_2
@ SPELL_FRENZY
@ SPELL_MAGMA_SPIT
@ SPELL_PANIC
MagmadarEvents
@ EVENT_PANIC
@ EVENT_LAVA_BOMB_1
@ EVENT_LAVA_BOMB_2
@ EVENT_FRENZY
@ EVENT_EXHAUSTED
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
uint32 Id
Definition SpellInfo.h:289
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
SpellInfo const * GetSpellInfo() const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
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 HasUnitState(const uint32 f) const
Definition Unit.h:876
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
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
PrepareSpellScript(spell_magmadar_lava_bomb)
void HandleDummy(SpellEffIndex)
#define RegisterMoltenCoreCreatureAI(ai_name)
@ BOSS_MAGMADAR
Definition molten_core.h:31
void UpdateAI(uint32 diff) override
void Reset() override
boss_magmadar(Creature *creature)
void JustEngagedWith(Unit *who) override
void OnSpellCast(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override