TrinityCore
Loading...
Searching...
No Matches
boss_rajaxx.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 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "ruins_of_ahnqiraj.h"
24#include "ScriptedCreature.h"
25#include "SpellInfo.h"
26#include "SpellScript.h"
27
29{
30 // Intro
37
38 // Combat
41 EMOTE_FRENZY = 8
42};
43
50
57
58// 15341 - General Rajaxx
59struct boss_rajaxx : public BossAI
60{
61 boss_rajaxx(Creature* creature) : BossAI(creature, DATA_RAJAXX), _frenzied(false) { }
62
63 void Reset() override
64 {
65 _Reset();
66 _frenzied = false;
67 }
68
69 void JustEngagedWith(Unit* who) override
70 {
72
75 }
76
77 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
78 {
79 if (!_frenzied && me->HealthBelowPctDamaged(30, damage))
80 {
81 _frenzied = true;
83 }
84 }
85
86 void OnSpellCast(SpellInfo const* spell) override
87 {
88 if (spell->Id == SPELL_FRENZY)
90 }
91
92 void DoAction(int32 action) override
93 {
94 if (!me->IsAlive())
95 return;
96
97 switch (action)
98 {
101 break;
104 break;
107 break;
110 break;
113 break;
117 break;
118 default:
119 break;
120 }
121 }
122
123 void KilledUnit(Unit* /*victim*/) override
124 {
125 Talk(SAY_SLAY);
126 }
127
128 void JustDied(Unit* /*killer*/) override
129 {
131 _JustDied();
132 }
133
134 void UpdateAI(uint32 diff) override
135 {
136 if (!UpdateVictim())
137 return;
138
139 events.Update(diff);
140
142 return;
143
144 while (uint32 eventId = events.ExecuteEvent())
145 {
146 switch (eventId)
147 {
148 case EVENT_DISARM:
150 events.Repeat(20s, 30s);
151 break;
154 events.Repeat(20s, 35s);
155 break;
156 case EVENT_FRENZY:
158 break;
159 default:
160 break;
161 }
162
164 return;
165 }
166
168 }
169
170private:
172};
173
174// 25599 - Thundercrash
176{
178
180 {
181 int32 damage = GetHitUnit()->GetHealth() / 2;
182 if (damage < 200)
183 damage = 200;
184
185 SetEffectValue(damage);
186 }
187
189 {
190 if (GetCaster()->CanHaveThreatList())
192 }
193
199};
200
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCHOOL_DAMAGE
#define SpellEffectFn(F, I, N)
#define SpellCastFn(F)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
RajaxxEvents
@ EVENT_DISARM
@ EVENT_THUNDERCRASH
@ EVENT_FRENZY
RajaxxTexts
@ SAY_DEATH
@ SAY_WAVE_5
@ SAY_WAVE_6
@ EMOTE_FRENZY
@ SAY_WAVE_3
@ SAY_WAVE_4
@ SAY_SLAY
@ SAY_WAVE_7
@ SAY_INTRO
void AddSC_boss_rajaxx()
RajaxxSpells
@ SPELL_FRENZY
@ SPELL_THUNDERCRASH
@ SPELL_DISARM
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
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 ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
uint32 Id
Definition SpellInfo.h:289
HookList< CastHandler > AfterCast
void SetEffectValue(int32 value)
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectLaunchTarget
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Definition Unit.h:769
ThreatManager & GetThreatManager()
Definition Unit.h:1155
bool IsAlive() const
Definition Unit.h:1234
uint32 GetHealth() const
Definition Unit.h:913
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
void HandleDamageCalc(SpellEffIndex)
PrepareSpellScript(spell_rajaxx_thundercrash)
@ ACTION_WAVE_STARTS_6
@ ACTION_RAJAXX_ENTER
@ ACTION_WAVE_STARTS_7
@ ACTION_WAVE_STARTS_3
@ ACTION_WAVE_STARTS_5
@ ACTION_WAVE_STARTS_4
#define RegisterAQ20CreatureAI(ai_name)
@ DATA_RAJAXX
void JustEngagedWith(Unit *who) override
void DoAction(int32 action) override
void OnSpellCast(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void KilledUnit(Unit *) override
void JustDied(Unit *) override
void Reset() override
void UpdateAI(uint32 diff) override
boss_rajaxx(Creature *creature)