TrinityCore
Loading...
Searching...
No Matches
boss_garr.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 "molten_core.h"
20#include "ScriptedCreature.h"
21#include "SpellAuraEffects.h"
22#include "SpellInfo.h"
23#include "SpellScript.h"
24
29
31{
32 // Garr
36
37 SPELL_FRENZY = 19516,
39
40 // Firesworn
43
47
48 // Scripts
50};
51
58
59// 12057 - Garr
60struct boss_garr : public BossAI
61{
62 boss_garr(Creature* creature) : BossAI(creature, BOSS_GARR) { }
63
74
75 void OnSpellCast(SpellInfo const* spell) override
76 {
77 if (spell->Id == SPELL_ERUPTION_TRIGGER)
79 }
80
81 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
82 {
83 if (spellInfo->Id == SPELL_FRENZY_TRIGGER)
85 }
86
87 void UpdateAI(uint32 diff) override
88 {
89 if (!UpdateVictim())
90 return;
91
92 events.Update(diff);
93
95 return;
96
97 while (uint32 eventId = events.ExecuteEvent())
98 {
99 switch (eventId)
100 {
103 events.Repeat(15s, 20s);
104 break;
107 events.Repeat(10s, 15s);
108 break;
111 events.Repeat(20s);
112 break;
113 default:
114 break;
115 }
116
118 return;
119 }
120
122 }
123};
124
125// 12099 - Firesworn
127{
128 npc_firesworn(Creature* creature) : ScriptedAI(creature) { }
129
130 void InitializeAI() override
131 {
132 me->SetCorpseDelay(5, true);
134 }
135
136 void Reset() override
137 {
140 }
141
142 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
143 {
144 if (spellInfo->Id == SPELL_ERUPTION_TRIGGER)
146 }
147
148 void JustDied(Unit* killer) override
149 {
150 if (killer != me)
152
154 }
155
156 void UpdateAI(uint32 /*diff*/) override
157 {
158 if (!UpdateVictim())
159 return;
160
162 }
163};
164
165// 23487 - Separation Anxiety
167{
169
170 bool Validate(SpellInfo const* /*spellInfo*/) override
171 {
173 }
174
175 void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
176 {
177 isPeriodic = true;
178 amplitude = 5 * IN_MILLISECONDS;
179 }
180
181 void HandleDummyTick(AuraEffect const* aurEff)
182 {
183 Unit* target = GetTarget();
184
185 if (Unit* caster = GetCaster())
186 if (caster->IsAlive() && !caster->IsWithinDistInMap(target, aurEff->GetSpellEffectInfo().CalcRadius()))
187 target->CastSpell(target, SPELL_SEPARATION_ANXIETY_EFFECT, true);
188 }
189
195};
196
@ IN_MILLISECONDS
Definition Common.h:35
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ SPELL_AURA_DUMMY
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectCalcPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
GarrSpells
Definition boss_garr.cpp:31
@ SPELL_FRENZY_TRIGGER
Definition boss_garr.cpp:45
@ SPELL_SEPARATION_ANXIETY_EFFECT
Definition boss_garr.cpp:49
@ SPELL_ANTIMAGIC_PULSE
Definition boss_garr.cpp:33
@ SPELL_SEPARATION_ANXIETY
Definition boss_garr.cpp:38
@ SPELL_ERUPTION_TRIGGER
Definition boss_garr.cpp:35
@ SPELL_MASSIVE_ERUPTION
Definition boss_garr.cpp:46
@ SPELL_MAGMA_SHACKLES
Definition boss_garr.cpp:34
@ SPELL_IMMOLATE
Definition boss_garr.cpp:42
@ SPELL_THRASH
Definition boss_garr.cpp:41
@ SPELL_FRENZY
Definition boss_garr.cpp:37
@ SPELL_ERUPTION
Definition boss_garr.cpp:44
GarrTexts
Definition boss_garr.cpp:26
@ EMOTE_MASSIVE_ERUPTION
Definition boss_garr.cpp:27
void AddSC_boss_garr()
GarrEvents
Definition boss_garr.cpp:53
@ EVENT_MASSIVE_ERUPTION
Definition boss_garr.cpp:56
@ EVENT_MAGMA_SHACKLES
Definition boss_garr.cpp:55
@ EVENT_ANTIMAGIC_PULSE
Definition boss_garr.cpp:54
SpellEffectInfo const & GetSpellEffectInfo() const
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
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
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
Definition Unit.h:769
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)
void CalcPeriodic(AuraEffect const *, bool &isPeriodic, int32 &amplitude)
PrepareAuraScript(spell_garr_separation_anxiety)
void HandleDummyTick(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
#define RegisterMoltenCoreCreatureAI(ai_name)
@ BOSS_GARR
Definition molten_core.h:33
boss_garr(Creature *creature)
Definition boss_garr.cpp:62
void UpdateAI(uint32 diff) override
Definition boss_garr.cpp:87
void OnSpellCast(SpellInfo const *spell) override
Definition boss_garr.cpp:75
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
Definition boss_garr.cpp:81
void JustEngagedWith(Unit *who) override
Definition boss_garr.cpp:64
npc_firesworn(Creature *creature)
void UpdateAI(uint32) override
void Reset() override
void InitializeAI() override
void JustDied(Unit *killer) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override