TrinityCore
boss_elder_leaxa.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 "CreatureAI.h"
19#include "CreatureAIImpl.h"
20#include "Containers.h"
21#include "InstanceScript.h"
22#include "MotionMaster.h"
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "SpellScript.h"
26#include "SpellAuras.h"
27#include "underrot.h"
28
30{
41};
42
44{
49};
50
52{
58 SAY_DEATH = 5
59};
60
62{
64};
65
66// 131318 - Elder Leaxa
67struct boss_elder_leaxa : public BossAI
68{
70
71 void JustDied(Unit* /*killer*/) override
72 {
73 _JustDied();
75
77 }
78
79 void EnterEvadeMode(EvadeReason /*why*/) override
80 {
85 }
86
87 void JustEngagedWith(Unit* who) override
88 {
91
95 if (IsHeroicOrHigher())
99 }
100
101 void UpdateAI(uint32 diff) override
102 {
103 if (!UpdateVictim())
104 return;
105
106 events.Update(diff);
107
109 return;
110
111 switch (events.ExecuteEvent())
112 {
113 case EVENT_BLOOD_BOLT:
116 break;
121 break;
126 break;
132 break;
133 default:
134 break;
135 }
136 }
137};
138
139// 134701 - Blood Effigy
141{
142 npc_blood_effigy(Creature* creature) : ScriptedAI(creature) { }
143
144 void JustEngagedWith(Unit* /*who*/) override
145 {
149 }
150
151 void JustDied(Unit* /*killer*/) override
152 {
155 }
156
157 void UpdateAI(uint32 diff) override
158 {
159 if (!UpdateVictim())
160 return;
161
162 _events.Update(diff);
163
165 return;
166
167 switch (_events.ExecuteEvent())
168 {
169 case EVENT_BLOOD_BOLT:
172 break;
176 break;
180 break;
181 default:
182 break;
183 }
184 }
185private:
187};
188
189// 132398 - Blood Wave Stalker
191{
192 npc_blood_wave_stalker(Creature* creature) : ScriptedAI(creature) { }
193
194 static constexpr float WALK_DISTANCE = 58.0f;
195
196 void JustAppeared() override
197 {
199
200 float angle = me->GetOrientation();
201 float destX = me->GetPositionX() + WALK_DISTANCE * std::cos(angle);
202 float destY = me->GetPositionY() + WALK_DISTANCE * std::sin(angle);
203 float destZ = me->GetPositionZ();
204 Position walkDest(destX, destY, destZ);
205
206 me->GetMotionMaster()->MovePoint(0, walkDest);
207 }
208};
209
210// 264747 - Sanguine Feast
212{
213 bool Validate(SpellInfo const* spellInfo) override
214 {
215 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_0 } }) && ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) });
216 }
217
218 void HandleHit(SpellEffIndex /*effIndex*/)
219 {
220 Unit* caster = GetCaster();
221 caster->CastSpell(GetHitUnit(), uint32(GetEffectInfo().CalcValue(caster)));
222 }
223
224 void Register() override
225 {
227 }
228};
229
230// 260889 - Creeping Rot
232{
233 static constexpr float SPAWN_DISTANCE = 5.0f;
234
235 void HandleHit(SpellEffIndex /*effIndex*/)
236 {
237 Unit* caster = GetCaster();
238 Unit* target = GetHitUnit();
239
240 // make sure spell is cast towards target and caster looks towards target
241 caster->SetInFront(target);
242 caster->SetFacingToObject(target);
243
244 caster->CastSpell(target, SPELL_CREEPING_ROT_SUMMON);
245
246 float angle = caster->GetOrientation();
247 float destX = caster->GetPositionX() + SPAWN_DISTANCE * std::cos(angle);
248 float destY = caster->GetPositionY() + SPAWN_DISTANCE * std::sin(angle);
249 float destZ = caster->GetPositionZ();
250 Position spawnVisualDest(destX, destY, destZ);
251 caster->CastSpell(spawnVisualDest, SPELL_CREEPING_ROT_SPAWN_VISUAL, true);
252 }
253
254 void Register() override
255 {
257 }
258};
259
260// 261496 - Creeping Rot (Aura)
262{
263 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
264 {
265 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
266 return;
267
268 Creature* creature = GetTarget()->ToCreature();
269 if (!creature)
270 return;
271
272 creature->DespawnOrUnsummon();
273 }
274
275 void Register() override
276 {
278 }
279};
280
282{
283 { 879.79865f, 1222.6233f, 56.47815f },
284 { 856.184f, 1232.5435f, 56.52007f },
285 { 859.34204f, 1238.0243f, 56.520065f },
286 { 857.8333f, 1220.6545f, 56.468567f },
287 { 876.17365f, 1240.2848f, 56.409615f },
288 { 864.25867f, 1240.5903f, 56.520065f },
289 { 863.1042f, 1218.0591f, 56.468765f }
290};
291
292// 264603 - Blood Mirror
294{
295 bool Validate(SpellInfo const* /*spellInfo*/) override
296 {
298 }
299
300 void HandleHit(SpellEffIndex /*effIndex*/)
301 {
304 }
305
306 void Register() override
307 {
309 }
310};
311
312// 260879 - Blood Bolt
313// 264757 - Sanguine Feast
314// 261498 - Creeping Rot
316{
317 bool Validate(SpellInfo const* /*spellInfo*/) override
318 {
320 }
321
323 {
325 if (!instance)
326 return;
327
328 Creature* leaxa = instance->GetCreature(DATA_ELDER_LEAXA);
329 if (!leaxa)
330 return;
331
333 }
334
335 void Register() override
336 {
338 }
339};
340
342{
343 // Creature
347
348 // Spells
354}
uint32_t uint32
Definition: Define.h:142
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellHitFn(F)
Definition: SpellScript.h:854
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
EvadeReason
Definition: UnitAICommon.h:30
@ UNIT_STATE_CASTING
Definition: Unit.h:270
LeaxaAnimKits
@ ANIMKIT_BLOOD_EFFIGY_DEATH
LeaxaTexts
@ SAY_DEATH
@ SAY_BLOOD_MIRROR
@ SAY_AGGRO
@ SAY_SANGUINE_FEAST
@ SAY_ANNOUNCE_BLOOD_MIRROR
@ SAY_ROT_AND_WITHER
LeaxaEvents
@ EVENT_BLOOD_MIRROR
@ EVENT_BLOOD_BOLT
@ EVENT_SANGUINE_FEAST
@ EVENT_CREEPING_ROT
void AddSC_boss_elder_leaxa()
LeaxaSpells
@ SPELL_CREEPING_ROT_SUMMON
@ SPELL_CREEPING_ROT_SPAWN_VISUAL
@ SPELL_SANGUINE_FEAST
@ SPELL_BLOOD_MIRROR_MISSILE
@ SPELL_CREEPING_ROT_PERIODIC_DMG
@ SPELL_BLOOD_MIRROR_SELECTOR
@ SPELL_TAINT_OF_GHUUN
@ SPELL_BLOOD_BOLT
@ SPELL_CREEPING_ROT_SELECTOR
@ SPELL_CREEPING_ROT_AURA
static Position const MirrorSpawnPositions[]
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:299
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
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
Creature * GetCreature(uint32 type)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
static Creature * ToCreature(Object *o)
Definition: Object.h:219
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:495
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< HitHandler > AfterHit
Definition: SpellScript.h:852
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void SetFacingToObject(WorldObject const *object, bool force=true)
Definition: Unit.cpp:12671
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:12647
void SetAIAnimKitId(uint16 animKitId)
Definition: Unit.cpp:10543
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
static constexpr float SPAWN_DISTANCE
bool Validate(SpellInfo const *spellInfo) override
bool Validate(SpellInfo const *) override
void Register() override
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
bool IsHeroicOrHigher() const
void EnterEvadeMode(EvadeReason) override
boss_elder_leaxa(Creature *creature)
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void JustDied(Unit *) override
npc_blood_effigy(Creature *creature)
void JustAppeared() override
npc_blood_wave_stalker(Creature *creature)
static constexpr float WALK_DISTANCE
@ DATA_ELDER_LEAXA
Definition: underrot.h:31
#define RegisterUnderrotCreatureAI(ai_name)
Definition: underrot.h:60