TrinityCore
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 "ScriptedCreature.h"
20#include "black_temple.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
98// 22947 - Mother Shahraz
100{
102
103 void Reset() override
104 {
105 _Reset();
106 _enraged = false;
107 }
108
109 void JustEngagedWith(Unit* who) override
110 {
119 }
120
121 void KilledUnit(Unit* victim) override
122 {
123 if (victim->GetTypeId() == TYPEID_PLAYER)
124 Talk(SAY_SLAY);
125 }
126
127 void JustDied(Unit* /*killer*/) override
128 {
129 _JustDied();
131 }
132
133 void EnterEvadeMode(EvadeReason /*why*/) override
134 {
136 }
137
138 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
139 {
140 if (!_enraged && me->HealthBelowPctDamaged(10, damage))
141 {
142 _enraged = true;
146 }
147 }
148
149 void ExecuteEvent(uint32 eventId) override
150 {
151 switch (eventId)
152 {
155 events.Repeat(30s);
156 break;
159 events.Repeat(15s);
160 break;
164 events.Repeat(30s);
165 break;
168 events.Repeat(18s, 30s);
169 break;
170 case EVENT_TAUNT:
172 events.Repeat(30s, 40s);
173 break;
174 case EVENT_BERSERK:
177 break;
178 default:
179 break;
180 }
181 }
182
183private:
185};
186
187// 40869 - Fatal Attraction
189{
191
192 bool Validate(SpellInfo const* /*spell*/) override
193 {
194 return ValidateSpellInfo(
195 {
198 });
199 }
200
201 void FilterTargets(std::list<WorldObject*>& targets)
202 {
203 targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SABER_LASH_IMMUNITY));
204 }
205
207 {
208 dest.Relocate(GetCaster()->GetRandomNearPosition(50.0f));
209 }
210
211 void HandleTeleport(SpellEffIndex /*effIndex*/)
212 {
214 }
215
216 void Register() override
217 {
221 }
222};
223
224// 40870 - Fatal Attraction Dummy Visual
226{
228
229 bool Validate(SpellInfo const* /*spell*/) override
230 {
232 }
233
234 void HandleDummy(SpellEffIndex /*effIndex*/)
235 {
237 }
238
239 void Register() override
240 {
242 }
243};
244
245// 40816 - Saber Lash
247{
249
250 bool Validate(SpellInfo const* spellInfo) override
251 {
252 return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_1).TriggerSpell });
253 }
254
255 void OnTrigger(AuraEffect const* aurEff)
256 {
258
259 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
260 if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0))
261 GetUnitOwner()->CastSpell(target, triggerSpell, true);
262 }
263
264 void Register() override
265 {
267 }
268};
269
270/* 40863 - Sinister Periodic
271 40865 - Vile Periodic
272 40866 - Wicked Periodic
273 40862 - Sinful Periodic */
275{
277
278 bool Validate(SpellInfo const* spellInfo) override
279 {
280 return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
281 }
282
283 void OnTrigger(AuraEffect const* aurEff)
284 {
286
287 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
288 if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0))
289 GetUnitOwner()->CastSpell(target, triggerSpell, true);
290 }
291
292 void Register() override
293 {
295 }
296};
297
298// 40867 - Random Periodic
300{
302
303 bool Validate(SpellInfo const* /*spellInfo*/) override
304 {
306 }
307
308 void OnPeriodic(AuraEffect const* /*aurEffect*/)
309 {
312 }
313
314 void Register() override
315 {
317 }
318};
319
321{
328}
uint32_t uint32
Definition: Define.h:133
@ TYPEID_PLAYER
Definition: ObjectGuid.h:39
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1129
SpellEffIndex
Definition: SharedDefines.h:30
@ EFFECT_1
Definition: SharedDefines.h:32
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_TELEPORT_UNITS
@ TARGET_DEST_CASTER_RANDOM
@ TARGET_UNIT_SRC_AREA_ENEMY
#define EFFECT_ALL
Definition: SharedDefines.h:38
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELLVALUE_MAX_TARGETS
Definition: SpellDefines.h:136
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:384
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:401
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:815
#define SpellDestinationTargetSelectFn(F, I, N)
Definition: SpellScript.h:411
DamageEffectType
Definition: Unit.h:352
#define RegisterBlackTempleCreatureAI(ai_name)
Definition: black_temple.h:149
@ DATA_MOTHER_SHAHRAZ
Definition: black_temple.h:37
void AddSC_boss_mother_shahraz()
uint32 const PrismaticAuras[6]
@ EVENT_TAUNT
@ EVENT_RANDOM_BEAM
@ EVENT_SILENCING_SHRIEK
@ EVENT_BERSERK
@ EVENT_FATAL_ATTRACTION
@ EVENT_PRISMATIC_SHIELD
uint32 const RandomBeam[4]
uint32 const BeamTriggers[4]
@ 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
@ EMOTE_ENRAGE
@ SAY_ENRAGE
@ EMOTE_BERSERK
SpellEffectInfo const & GetSpellEffectInfo() const
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:814
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:48
Creature *const me
Definition: CreatureAI.h:81
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition: EventMap.cpp:36
TypeID GetTypeId() const
Definition: Object.h:92
uint32 TriggerSpell
Definition: SpellInfo.h:232
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:487
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Definition: SpellScript.h:410
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:382
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:400
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:174
Definition: Unit.h:769
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:916
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2831
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:145
PrepareSpellScript(spell_mother_shahraz_fatal_attraction)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *spellInfo) override
void OnTrigger(AuraEffect const *aurEff)
PrepareAuraScript(spell_mother_shahraz_generic_periodic)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_mother_shahraz_random_periodic)
bool Validate(SpellInfo const *spellInfo) override
void OnTrigger(AuraEffect const *aurEff)
PrepareAuraScript(spell_mother_shahraz_saber_lash)
void Relocate(Position const &pos)
Definition: Spell.cpp:99
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