TrinityCore
Loading...
Searching...
No Matches
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
42
50
60
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
86
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
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).CalcValueAsInt()) });
216 }
217
218 void HandleHit(SpellEffIndex /*effIndex*/)
219 {
220 Unit* caster = GetCaster();
221 caster->CastSpell(GetHitUnit(), uint32(GetEffectInfo().CalcValueAsInt(caster)));
222 }
223
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
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
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
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
uint32_t uint32
Definition Define.h:154
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
#define SpellHitFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
@ UNIT_STATE_CASTING
Definition Unit.h:276
LeaxaAnimKits
@ ANIMKIT_BLOOD_EFFIGY_DEATH
@ SAY_DEATH
@ SAY_BLOOD_MIRROR
@ SAY_AGGRO
@ SAY_SANGUINE_FEAST
@ SAY_ANNOUNCE_BLOOD_MIRROR
@ SAY_ROT_AND_WITHER
@ EVENT_BLOOD_MIRROR
@ EVENT_BLOOD_BOLT
@ EVENT_SANGUINE_FEAST
@ EVENT_CREEPING_ROT
void AddSC_boss_elder_leaxa()
@ 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
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
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={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Creature * ToCreature()
Definition Object.h:121
int32 CalcValueAsInt(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
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< HitHandler > AfterHit
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
void SetFacingToObject(WorldObject const *object, bool force=true)
Definition Unit.cpp:13307
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void SetInFront(WorldObject const *target)
Definition Unit.cpp:13283
void SetAIAnimKitId(uint16 animKitId)
Definition Unit.cpp:11174
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr float GetOrientation() const
Definition Position.h:90
constexpr float GetPositionZ() const
Definition Position.h:89
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)
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