TrinityCore
boss_tharon_ja.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 "drak_tharon_keep.h"
20#include "ScriptedCreature.h"
21#include "SpellScript.h"
22
23/*
24 * Known Issues: Spell 49356 and 53463 will be interrupted for an unknown reason
25 */
26
28{
29 // Skeletal Spells (phase 1)
33 SPELL_DECAY_FLESH = 49356, // cast at end of phase 1, starts phase 2
34 // Flesh Spells (phase 2)
40 SPELL_RETURN_FLESH = 53463, // Channeled spell ending phase two and returning to phase 1. This ability will stun the party for 6 seconds.
43 SPELL_DUMMY = 49551
44};
45
47{
51
55
60};
61
63{
68 SAY_DEATH = 4
69};
70
72{
73 MODEL_FLESH = 27073
74};
75
76struct boss_tharon_ja : public BossAI
77{
78 boss_tharon_ja(Creature* creature) : BossAI(creature, DATA_THARON_JA) { }
79
80 void Reset() override
81 {
82 _Reset();
84 }
85
86 void JustEngagedWith(Unit* who) override
87 {
90
95 }
96
97 void KilledUnit(Unit* who) override
98 {
99 if (who->GetTypeId() == TYPEID_PLAYER)
100 Talk(SAY_KILL);
101 }
102
103 void JustDied(Unit* /*killer*/) override
104 {
105 _JustDied();
106
110 }
111
112 void UpdateAI(uint32 diff) override
113 {
114 if (!UpdateVictim())
115 return;
116
117 events.Update(diff);
118
120 return;
121
122 while (uint32 eventId = events.ExecuteEvent())
123 {
124 switch (eventId)
125 {
127 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
130 return;
134 return;
136 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
137 DoCast(target, SPELL_RAIN_OF_FIRE);
139 return;
141 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
144 return;
145 case EVENT_EYE_BEAM:
146 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
147 DoCast(target, SPELL_EYE_BEAM);
149 return;
153 return;
157 return;
163 DoCast(me, SPELL_DUMMY, true);
164
165 events.Reset();
170 break;
174 return;
179
180 events.Reset();
185 break;
186 default:
187 break;
188 }
189
191 return;
192 }
193 }
194};
195
196// 53242 - Clear Gift of Tharon'ja
198{
199 bool Validate(SpellInfo const* /*spellInfo*/) override
200 {
202 }
203
204 void HandleScript(SpellEffIndex /*effIndex*/)
205 {
206 if (Unit* target = GetHitUnit())
207 target->RemoveAura(SPELL_GIFT_OF_THARON_JA);
208 }
209
210 void Register() override
211 {
213 }
214};
215
217{
220}
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#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
@ SAY_DEATH
@ SAY_FLESH
@ SAY_AGGRO
@ SAY_KILL
@ SAY_SKELETON
@ SPELL_CLEAR_GIFT_OF_THARON_JA
@ SPELL_DECAY_FLESH
@ SPELL_ACHIEVEMENT_CHECK
@ SPELL_FLESH_VISUAL
@ SPELL_SHADOW_VOLLEY
@ SPELL_DUMMY
@ SPELL_EYE_BEAM
@ SPELL_CURSE_OF_LIFE
@ SPELL_RETURN_FLESH
@ SPELL_RAIN_OF_FIRE
@ SPELL_GIFT_OF_THARON_JA
@ SPELL_LIGHTNING_BREATH
@ SPELL_POISON_CLOUD
void AddSC_boss_tharon_ja()
@ MODEL_FLESH
@ EVENT_POISON_CLOUD
@ EVENT_GOING_SKELETAL
@ EVENT_DECAY_FLESH
@ EVENT_EYE_BEAM
@ EVENT_SHADOW_VOLLEY
@ EVENT_GOING_FLESH
@ EVENT_RAIN_OF_FIRE
@ EVENT_CURSE_OF_LIFE
@ EVENT_RETURN_FLESH
@ EVENT_LIGHTNING_BREATH
Yells
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
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
void SetDisplayId(uint32 displayId, bool setNative=false) override
Definition: Creature.cpp:3402
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
void Reset()
Definition: EventMap.cpp:21
TypeID GetTypeId() const
Definition: Object.h:173
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting=false)
Definition: Unit.cpp:10172
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool Validate(SpellInfo const *) override
#define RegisterDrakTharonKeepCreatureAI(ai_name)
@ DATA_THARON_JA
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *who) override
boss_tharon_ja(Creature *creature)
void JustEngagedWith(Unit *who) override
void Reset() override