TrinityCore
Loading...
Searching...
No Matches
boss_king_deepbeard.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 "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "Creature.h"
21#include "GridNotifiersImpl.h"
22#include "InstanceScript.h"
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "SpellAuras.h"
26#include "SpellScript.h"
27#include "eye_of_azshara.h"
28
41
49
63
65{
67 NPC_QUAKE = 97916,
68};
69
70// 91797 - King Deepbeard
72{
74
75 void JustAppeared() override
76 {
77 me->SetPower(me->GetPowerType(), 30);
78 }
79
80 void KilledUnit(Unit* victim) override
81 {
82 if (!victim->IsPlayer())
83 return;
84
86 }
87
89 {
90 std::list<Creature*> quakes;
93 Cell::VisitAllObjects(me, searcher, 200.0f);
94
95 if (quakes.empty())
96 return;
97
98 for (Creature* quake : quakes)
99 quake->DespawnOrUnsummon();
100 }
101
103 {
104 std::list<Creature*> callTheSeas;
107 Cell::VisitAllObjects(me, searcher, 200.0f);
108
109 if (callTheSeas.empty())
110 return;
111
112 for (Creature* callTheSea : callTheSeas)
113 callTheSea->RemoveAurasDueToSpell(SPELL_CALL_THE_SEAS_AT);
114 }
115
126
140
155
156 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
157 {
158 if (me->HealthBelowPctDamaged(30, damage) && !me->HasAura(SPELL_FRENZY))
159 {
163 }
164 }
165
166 void UpdateAI(uint32 diff) override
167 {
168 scheduler.Update(diff);
169
170 if (!UpdateVictim())
171 return;
172
173 events.Update(diff);
174
176 return;
177
178 if (uint32 eventId = events.ExecuteEvent())
179 {
180 switch (eventId)
181 {
182 case EVENT_ENERGIZE:
183 {
184 if (me->GetPower(me->GetPowerType()) == 100)
185 {
189 }
190 else
191 {
193 events.Repeat(1s);
194 }
195 break;
196 }
198 {
202 events.Repeat(30400ms);
203 break;
204 }
206 {
209 events.Repeat(32800ms, 35300ms);
210 break;
211 }
213 {
215 events.Repeat(21800ms);
216 break;
217 }
218 default:
219 break;
220 }
221 }
222 }
223};
224
225// 193093 - Ground Slam
227{
228 bool Validate(SpellInfo const* /*spellInfo*/) override
229 {
231 }
232
237
238 void Register() override { }
239};
240
241// 193018 - Gaseous Bubbles
263
264// 193054 - Call the Seas
265// Id - 4968
267{
269
270 void OnUnitEnter(Unit* unit) override
271 {
272 Unit* caster = at->GetCaster();
273 if (!caster)
274 return;
275
276 if (!unit->IsPlayer())
277 return;
278
280 }
281
282 void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override
283 {
285 }
286};
287
AreaTriggerExitReason
Definition AreaTrigger.h:69
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ FAIL
@ DONE
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_SCHOOL_ABSORB
@ 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 AuraEffectRemoveFn(F, I, N, M)
EvadeReason
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ NPC_CALL_THE_SEAS
@ SAY_CALL_THE_SEAS
@ SAY_GASEOUS_BUBBLES
@ SAY_CALL_THE_SEAS_WARNING
@ SAY_FRENZY_WARNING
void AddSC_boss_king_deepbeard()
KingDeepbeardSpells
@ SPELL_CALL_THE_SEAS
@ SPELL_CALL_THE_SEAS_AT
@ SPELL_GASEOUS_BUBBLES
@ SPELL_CALL_THE_SEAS_DAMAGE
@ SPELL_GROUND_SLAM_MISSILE
@ SPELL_GROUND_SLAM
@ SPELL_GASEOUS_EXPLOSION
KingDeepbeardEvents
@ EVENT_ENERGIZE
@ EVENT_GROUND_SLAM
@ EVENT_GASEOUS_BUBBLES
@ EVENT_CALL_THE_SEAS
AreaTrigger *const at
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={}) noexcept
Unit * GetCaster() const
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
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)
TaskScheduler scheduler
EventMap events
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
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 RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:56
virtual bool SetBossState(uint32 id, EncounterState state)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
Unit * GetExplTargetUnit() const
TaskScheduler & Update()
Update the scheduler to the current time.
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
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10046
Powers GetPowerType() const
Definition Unit.h:811
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
int32 GetPower(Powers power) const
Definition Unit.cpp:10028
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
@ DATA_KING_DEEPBEARD
#define RegisterEyeOfAzsharaCreatureAI(ai_name)
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:203
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
void OnUnitEnter(Unit *unit) override
void EnterEvadeMode(EvadeReason) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void KilledUnit(Unit *victim) override
boss_king_deepbeard(Creature *creature)