TrinityCore
boss_archavon.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 "ScriptedCreature.h"
20#include "SpellScript.h"
21#include "vault_of_archavon.h"
22
24{
26 EMOTE_LEAP = 1
27};
28
30{
37 SPELL_STOMP = 58663,
38 SPELL_IMPALE = 58666,
39 SPELL_BERSERK = 47008
40};
41
43{
44 EVENT_ROCK_SHARDS = 1, // 15s cd
46 EVENT_STOMP, // 45s cd
48 EVENT_BERSERK // 300s cd
49};
50
51struct boss_archavon : public BossAI
52{
53 boss_archavon(Creature* creature) : BossAI(creature, DATA_ARCHAVON) { }
54
55 void JustEngagedWith(Unit* who) override
56 {
61
63 }
64
65 // Below UpdateAI may need review/debug.
66 void UpdateAI(uint32 diff) override
67 {
68 if (!UpdateVictim())
69 return;
70
71 events.Update(diff);
72
74 return;
75
76 while (uint32 eventId = events.ExecuteEvent())
77 {
78 switch (eventId)
79 {
84 break;
86 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, -10.0f, true))
87 {
88 DoCast(target, SPELL_CRUSHING_LEAP, true); // 10y~80y, ignore range
89 Talk(EMOTE_LEAP, target);
90 }
92 break;
93 case EVENT_STOMP:
97 break;
98 case EVENT_IMPALE:
100 break;
101 case EVENT_BERSERK:
104 break;
105 default:
106 break;
107 }
108
110 return;
111 }
112 }
113};
114
115// 58941 - Rock Shards
117{
118 bool Validate(SpellInfo const* /*spellInfo*/) override
119 {
120 return ValidateSpellInfo(
121 {
126 });
127 }
128
129 void HandleScript(SpellEffIndex /*effIndex*/)
130 {
131 Unit* caster = GetCaster();
132
133 for (uint8 i = 0; i < 3; ++i)
134 {
135 caster->CastSpell(nullptr, SPELL_ROCK_SHARDS_VISUAL_L, true);
136 caster->CastSpell(nullptr, SPELL_ROCK_SHARDS_VISUAL_R, true);
137 }
138
139 caster->CastSpell(nullptr, SPELL_ROCK_SHARDS_DAMAGE_L, true);
140 caster->CastSpell(nullptr, SPELL_ROCK_SHARDS_DAMAGE_R, true);
141 }
142
143 void Register() override
144 {
146 }
147};
148
150{
153}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
@ UNIT_STATE_CASTING
Definition: Unit.h:270
ArchavonSpells
@ SPELL_STOMP
@ SPELL_ROCK_SHARDS
@ SPELL_ROCK_SHARDS_DAMAGE_R
@ SPELL_ROCK_SHARDS_VISUAL_R
@ SPELL_ROCK_SHARDS_VISUAL_L
@ SPELL_BERSERK
@ SPELL_CRUSHING_LEAP
@ SPELL_ROCK_SHARDS_DAMAGE_L
@ SPELL_IMPALE
ArchavonTexts
@ EMOTE_LEAP
@ EMOTE_BERSERK
ArchavonEvents
@ EVENT_BERSERK
@ EVENT_ROCK_SHARDS
@ EVENT_STOMP
@ EVENT_IMPALE
@ EVENT_CHOKING_CLOUD
void AddSC_boss_archavon()
void JustEngagedWith(Unit *who) override
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
boss_archavon(Creature *creature)
@ DATA_ARCHAVON
#define RegisterVaultOfArchavonCreatureAI(ai_name)