TrinityCore
Loading...
Searching...
No Matches
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
36
61
71
79
87
97
99{
101
102 void Reset() override
103 {
104 _Reset();
105 _enraged = false;
106 }
107
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
220
221// 40870 - Fatal Attraction Dummy Visual
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
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
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
309};
310
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ TARGET_DEST_CASTER_RANDOM
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_TELEPORT_UNITS
#define EFFECT_ALL
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELLVALUE_MAX_TARGETS
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
EvadeReason
DamageEffectType
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_MOTHER_SHAHRAZ
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_BERSERK
uint32 const BeamTriggers[4]
@ EVENT_RANDOM_BEAM
@ EVENT_SILENCING_SHRIEK
@ EVENT_BERSERK
@ EVENT_FATAL_ATTRACTION
@ EVENT_PRISMATIC_SHIELD
SpellEffectInfo const & GetSpellEffectInfo() const
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetUnitOwner() const
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
Creature *const me
Definition CreatureAI.h:63
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
uint32 TriggerSpell
Definition SpellInfo.h:234
uint32 const Id
Definition SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:588
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
Definition Unit.h:635
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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:82
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