TrinityCore
boss_mother_shahraz.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 "black_temple.h"
20#include "ScriptedCreature.h"
21#include "SpellScript.h"
22#include "SpellAuraEffects.h"
23#include "GridNotifiers.h"
24
26{
35};
36
38{
59 SPELL_BEAM_SINFUL = 40827
60};
61
63{
70};
71
73{
78};
79
81{
86};
87
89{
96};
97
99{
101
102 void Reset() override
103 {
104 _Reset();
105 _enraged = false;
106 }
107
108 void JustEngagedWith(Unit* who) override
109 {
118 }
119
120 void KilledUnit(Unit* victim) override
121 {
122 if (victim->GetTypeId() == TYPEID_PLAYER)
123 Talk(SAY_SLAY);
124 }
125
126 void JustDied(Unit* /*killer*/) override
127 {
128 _JustDied();
130 }
131
132 void EnterEvadeMode(EvadeReason /*why*/) override
133 {
135 }
136
137 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
138 {
139 if (!_enraged && me->HealthBelowPctDamaged(10, damage))
140 {
141 _enraged = true;
145 }
146 }
147
148 void ExecuteEvent(uint32 eventId) override
149 {
150 switch (eventId)
151 {
154 events.Repeat(Seconds(30));
155 break;
158 events.Repeat(Seconds(15));
159 break;
163 events.Repeat(Seconds(30));
164 break;
167 events.Repeat(Seconds(18), Seconds(30));
168 break;
169 case EVENT_TAUNT:
171 events.Repeat(Seconds(30), Seconds(40));
172 break;
173 case EVENT_BERSERK:
176 break;
177 default:
178 break;
179 }
180 }
181
182private:
184};
185
186// 40869 - Fatal Attraction
188{
189 bool Validate(SpellInfo const* /*spellInfo*/) override
190 {
191 return ValidateSpellInfo(
192 {
195 });
196 }
197
198 void FilterTargets(std::list<WorldObject*>& targets)
199 {
200 targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SABER_LASH_IMMUNITY));
201 }
202
204 {
205 dest.Relocate(GetCaster()->GetRandomNearPosition(50.0f));
206 }
207
208 void HandleTeleport(SpellEffIndex /*effIndex*/)
209 {
211 }
212
213 void Register() override
214 {
218 }
219};
220
221// 40870 - Fatal Attraction Dummy Visual
223{
224 bool Validate(SpellInfo const* /*spellInfo*/) override
225 {
227 }
228
229 void HandleDummy(SpellEffIndex /*effIndex*/)
230 {
232 }
233
234 void Register() override
235 {
237 }
238};
239
240// 40816 - Saber Lash
242{
243 bool Validate(SpellInfo const* spellInfo) override
244 {
245 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } })
246 && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_1).TriggerSpell });
247 }
248
249 void OnTrigger(AuraEffect const* aurEff)
250 {
252
253 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
254 if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0))
255 GetUnitOwner()->CastSpell(target, triggerSpell, true);
256 }
257
258 void Register() override
259 {
261 }
262};
263
264/* 40863 - Sinister Periodic
265 40865 - Vile Periodic
266 40866 - Wicked Periodic
267 40862 - Sinful Periodic */
269{
270 bool Validate(SpellInfo const* spellInfo) override
271 {
272 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_0 } })
273 && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
274 }
275
276 void OnTrigger(AuraEffect const* aurEff)
277 {
279
280 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
281 if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0))
282 GetUnitOwner()->CastSpell(target, triggerSpell, true);
283 }
284
285 void Register() override
286 {
288 }
289};
290
291// 40867 - Random Periodic
293{
294 bool Validate(SpellInfo const* /*spellInfo*/) override
295 {
297 }
298
299 void OnPeriodic(AuraEffect const* /*aurEffect*/)
300 {
303 }
304
305 void Register() override
306 {
308 }
309};
310
312{
319}
Texts
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_DEST_CASTER_RANDOM
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_TELEPORT_UNITS
#define EFFECT_ALL
Definition: SharedDefines.h:72
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELLVALUE_MAX_TARGETS
Definition: SpellDefines.h:230
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define SpellDestinationTargetSelectFn(F, I, N)
Definition: SpellScript.h:874
EvadeReason
Definition: UnitAICommon.h:30
DamageEffectType
Definition: UnitDefines.h:131
#define RegisterBlackTempleCreatureAI(ai_name)
Definition: black_temple.h:149
@ DATA_MOTHER_SHAHRAZ
Definition: black_temple.h:37
void AddSC_boss_mother_shahraz()
@ SPELL_SABER_LASH_IMMUNITY
@ SPELL_RANDOM_PERIODIC
@ SPELL_SILENCING_SHRIEK
@ SPELL_SINISTER_PERIODIC
@ SPELL_BEAM_WICKED
@ SPELL_PRISMATIC_AURA_NATURE
@ SPELL_BEAM_VILE
@ SPELL_BEAM_SINISTER
@ SPELL_PRISMATIC_AURA_FIRE
@ SPELL_SINFUL_PERIODIC
@ SPELL_FATAL_ATTRACTION
@ SPELL_FATAL_ATTRACTION_TELEPORT
@ SPELL_WICKED_PERIODIC
@ SPELL_BEAM_SINFUL
@ SPELL_PRISMATIC_AURA_SHADOW
@ SPELL_PRISMATIC_AURA_FROST
@ SPELL_BERSERK
@ SPELL_PRISMATIC_AURA_HOLY
@ SPELL_PRISMATIC_AURA_ARCANE
@ SPELL_VILE_PERIODIC
@ SPELL_FATAL_ATTRACTION_DAMAGE
uint32 const PrismaticAuras[6]
uint32 const RandomBeam[4]
@ EMOTE_ENRAGE
@ SAY_ENRAGE
@ EMOTE_BERSERK
uint32 const BeamTriggers[4]
@ EVENT_TAUNT
@ EVENT_RANDOM_BEAM
@ EVENT_SILENCING_SHRIEK
@ EVENT_BERSERK
@ EVENT_FATAL_ATTRACTION
@ EVENT_PRISMATIC_SHIELD
SpellEffectInfo const & GetSpellEffectInfo() const
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetUnitOwner() const
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
Creature *const me
Definition: CreatureAI.h:61
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
TypeID GetTypeId() const
Definition: Object.h:173
uint32 TriggerSpell
Definition: SpellInfo.h:237
uint32 const Id
Definition: SpellInfo.h:325
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:577
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
Definition: SpellScript.h:173
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Definition: SpellScript.h:873
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *spellInfo) override
void OnTrigger(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *spellInfo) override
void OnTrigger(AuraEffect const *aurEff)
void Relocate(Position const &pos)
Definition: Spell.cpp:111
void JustEngagedWith(Unit *who) override
void KilledUnit(Unit *victim) override
void ExecuteEvent(uint32 eventId) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void EnterEvadeMode(EvadeReason) override
boss_mother_shahraz(Creature *creature)
void JustDied(Unit *) override