TrinityCore
Loading...
Searching...
No Matches
boss_volkaal.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 "AreaTriggerAI.h"
19#include "CellImpl.h"
20#include "Creature.h"
21#include "GridNotifiersImpl.h"
22#include "InstanceScript.h"
23#include "MotionMaster.h"
24#include "MoveSpline.h"
25#include "ObjectAccessor.h"
26#include "ScriptMgr.h"
27#include "ScriptedCreature.h"
28#include "SpellAuraEffects.h"
29#include "SpellScript.h"
30#include "atal_dazar.h"
31
47
53
58
63
72
73// 122965 - Vol'kaal
74struct boss_volkaal : public BossAI
75{
76 boss_volkaal(Creature* creature) : BossAI(creature, DATA_VOLKAAL), _toxicLeapCount(1), _leaping(false) { }
77
82
83 void Reset() override
84 {
85 _Reset();
86
88 _leaping = false;
89 }
90
101
102 void KilledUnit(Unit* victim) override
103 {
104 if (!victim->IsPlayer())
105 return;
106
107 Talk(SAY_SLAY);
108 }
109
110 void JustEngagedWith(Unit* who) override
111 {
114
115 for (ObjectGuid summonGuid : summons)
116 {
117 if (Creature * totem = ObjectAccessor::GetCreature(*me, summonGuid))
119 }
120
122
125 }
126
127 void JustDied(Unit* /*killer*/) override
128 {
129 _JustDied();
132
133 Talk(SAY_DIED);
134 }
135
136 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
137 {
138 if (spellInfo->Id == SPELL_RAPID_DECAY)
139 {
142 }
143 }
144
145 void MovementInform(uint32 /*type*/, uint32 id) override
146 {
147 if (id == EVENT_JUMP)
148 {
150 _leaping = false;
151 }
152 }
153
154 void DoAction(int32 action) override
155 {
156 if (action == ACTION_TOTEMS_DIED)
157 {
158 for (ObjectGuid summonGuid : summons)
159 {
160 if (Creature* totem = ObjectAccessor::GetCreature(*me, summonGuid))
161 {
162 totem->SetUnkillable(false);
163 totem->KillSelf();
164 }
165 }
166 }
167 }
168
169 void UpdateAI(uint32 diff) override
170 {
171 if (!UpdateVictim())
172 return;
173
174 events.Update(diff);
175
177 return;
178
179 while (uint32 eventId = events.ExecuteEvent())
180 {
181 switch (eventId)
182 {
183 case EVENT_TOXIC_LEAP:
184 {
185 _leaping = true;
188 if (_toxicLeapCount % 3 == 2)
189 events.Repeat(8500ms);
190 else
191 events.Repeat(6s);
192 break;
193 }
195 {
196 if (!_leaping)
197 {
199 events.Repeat(19400ms);
200 }
201 else
202 events.Repeat(100ms);
203 break;
204 }
205 default:
206 break;
207 }
208
210 return;
211 }
212 }
213
214private:
217};
218
219// 125977 - Reanimation Totem
221{
223
224 void JustAppeared() override
225 {
226 if (IsHeroicOrHigher())
227 me->SetUnkillable(true);
228 }
229
230 void JustEngagedWith(Unit* /*who*/) override
231 {
232 InstanceScript* instance = me->GetInstanceScript();
233 if (!instance)
234 return;
235
236 if (Creature* volkaal = instance->GetCreature(DATA_VOLKAAL))
237 volkaal->AI()->DoZoneInCombat();
238 }
239
240 void DamageTaken(Unit* /*who*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
241 {
242 if (me->GetHealth() <= damage)
243 {
244 if (IsHeroicOrHigher())
245 {
248 }
249 }
250 }
251
252 void JustDied(Unit* /*killer*/) override
253 {
254 InstanceScript* instance = me->GetInstanceScript();
255 if (!instance)
256 return;
257
259 }
260};
261
262// 250372 - Lingering Nausea
264{
265 void HandlePeriodic(AuraEffect const* aurEff) const
266 {
267 Unit* target = GetTarget();
268
269 if (Unit* caster = GetCaster())
270 caster->CastSpell(target, aurEff->GetAmountAsInt(), CastSpellExtraArgsInit{
271 .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
272 .TriggeringAura = aurEff
273 });
274 }
275
280};
281
282// 250368 - Noxious Stench
303
304// 250708 - Toxic Leap
306{
307 bool Validate(SpellInfo const* /*spellInfo*/) override
308 {
310 }
311
312 void HandleScript(SpellEffIndex /*effIndex*/) const
313 {
315 }
316
321};
322
323// 250229 - Soul Anchor
325{
326 void SelectTotem(std::list<WorldObject*>& targets) const
327 {
328 if (targets.empty())
329 {
331 if (!instance)
332 return;
333
334 if (Creature* volkaal = instance->GetCreature(DATA_VOLKAAL))
335 volkaal->AI()->DoAction(ACTION_TOTEMS_DIED);
336
337 Unit* caster = GetCaster();
341 .TriggeringSpell = GetSpell()
342 });
343 }
344 }
345
350};
351
352// 259531 - Reanimate
365
366// 250241 - Rapid Decay
368{
369 bool Validate(SpellInfo const* /*spellInfo*/) override
370 {
372 }
373
374 void HandleToxicPool(AuraEffect const* aurEff) const
375 {
376 Unit* caster = GetCaster();
377 if (!caster)
378 return;
379
380 float range = 100.0f;
381 Player* player = nullptr;
382 Trinity::AnyUnitInObjectRangeCheck check(caster, range);
383 Trinity::PlayerSearcher searcher(caster, player, check);
384 Cell::VisitWorldObjects(caster, searcher, range);
385
388 args.TriggeringAura = aurEff;
389 caster->CastSpell(player->GetPosition(), SPELL_RAPID_DECAY_TARGET, args);
390 // not present in 11.0.7
391 //caster->CastSpell(caster, SPELL_RAPID_DECAY_RANDOM, args);
392 }
393
398};
399
400// 250696 - Rapid Decay
401// ID - 11243
403{
404 at_volkaal_rapid_decay(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { }
405
406 void OnUnitEnter(Unit* unit) override
407 {
408 if (!unit->IsPlayer())
409 return;
410
412 }
413
414 void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override
415 {
417 }
418};
419
AreaTriggerExitReason
Definition AreaTrigger.h:69
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENTRY
@ EVENT_JUMP
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELL_EFFECT_HEAL_PCT
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
EvadeReason
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ DATA_VOLKAAL
Definition atal_dazar.h:32
#define RegisterAtalDazarCreatureAI(ai_name)
Definition atal_dazar.h:60
VolkaalSummonGroups
@ SUMMON_GROUP_VOLKAAL_TOTEMS
void AddSC_boss_volkaal()
VolkaalActions
@ ACTION_TOTEMS_DIED
VolkaalEvents
@ EVENT_TOXIC_LEAP
@ EVENT_NOXIOUS_STENCH
VolkaalTexts
@ SAY_WIPE
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_DIED
@ SAY_DECAY
VolkaalSpells
@ SPELL_SOUL_ANCHOR
@ SPELL_RAPID_DECAY_RANDOM
@ SPELL_NOXIOUS_STENCH
@ SPELL_TOXIC_LEAP_DAMAGE
@ SPELL_RAPID_DECAY
@ SPELL_LINGERING_NAUSEA
@ SPELL_BAD_VOODOO
@ SPELL_TOXIC_POOL
@ SPELL_REANIMATE
@ SPELL_TOXIC_LEAP_SELECTOR
@ SPELL_RAPID_DECAY_TARGET
@ SPELL_TOXIC_LEAP
int32 GetAmountAsInt() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
bool IsPlayer() const
Definition BaseEntity.h:173
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 SetUnkillable(bool unkillable)
Definition Creature.h:189
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void CancelEvent(uint32 eventId)
Definition EventMap.cpp:135
Creature * GetCreature(uint32 type)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
uint64 GetHealth() const
Definition Unit.h:788
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:1507
virtual void DoAction(uint32 actionId, WorldObject *source=nullptr, WorldObject *target=nullptr)
Definition ZoneScript.h:104
void HandlePeriodic(AuraEffect const *aurEff) const
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex) const
bool Validate(SpellInfo const *) override
void HandleToxicPool(AuraEffect const *aurEff) const
void HandleScript(SpellEffIndex) const
void SelectTotem(std::list< WorldObject * > &targets) const
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex) const
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
TriggerCastFlags TriggerFlags
AuraEffect const * TriggeringAura
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:191
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
bool IsHeroicOrHigher() const
at_volkaal_rapid_decay(AreaTrigger *areatrigger)
void OnUnitEnter(Unit *unit) override
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
boss_volkaal(Creature *creature)
void MovementInform(uint32, uint32 id) override
void JustEngagedWith(Unit *who) override
uint32 _toxicLeapCount
void KilledUnit(Unit *victim) override
void JustDied(Unit *) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void EnterEvadeMode(EvadeReason) override
void JustAppeared() override
void DoAction(int32 action) override
void Reset() override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
npc_volkaal_reanimation_totem(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustDied(Unit *) override