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 }
121};
122
123// 12099 - Firesworn
125{
126 npc_firesworn(Creature* creature) : ScriptedAI(creature) { }
127
128 void InitializeAI() override
129 {
130 me->SetCorpseDelay(5, true);
132 }
133
134 void Reset() override
135 {
138 }
139
140 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
141 {
142 if (spellInfo->Id == SPELL_ERUPTION_TRIGGER)
144 }
145
146 void JustDied(Unit* killer) override
147 {
148 if (killer != me)
150
152 }
153};
154
155// 23487 - Separation Anxiety
157{
158 bool Validate(SpellInfo const* /*spellInfo*/) override
159 {
161 }
162
163 void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
164 {
165 isPeriodic = true;
166 amplitude = 5 * IN_MILLISECONDS;
167 }
168
169 void HandleDummyTick(AuraEffect const* aurEff)
170 {
171 Unit* target = GetTarget();
172
173 if (Unit* caster = GetCaster())
174 if (caster->IsAlive() && !caster->IsWithinDistInMap(target, aurEff->GetSpellEffectInfo().CalcRadius(caster, SpellTargetIndex::TargetA).Max))
175 target->CastSpell(target, SPELL_SEPARATION_ANXIETY_EFFECT, true);
176 }
177
183};
184
@ IN_MILLISECONDS
Definition Common.h:38
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
@ SPELL_AURA_DUMMY
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectCalcPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:290
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:63
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:118
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
SpellRange CalcRadius(WorldObject const *caster=nullptr, SpellTargetIndex targetIndex=SpellTargetIndex::TargetA, Spell *spell=nullptr) const
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual void InitializeAI()
Definition UnitAI.cpp:35
Definition Unit.h:647
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
void CalcPeriodic(AuraEffect const *, bool &isPeriodic, int32 &amplitude)
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 Reset() override
void InitializeAI() override
void JustDied(Unit *killer) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override