TrinityCore
Loading...
Searching...
No Matches
boss_loken.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/* ScriptData
19SDName: Boss Loken
20SD%Complete: 60%
21SDComment: Missing intro.
22SDCategory: Halls of Lightning
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "halls_of_lightning.h"
27#include "InstanceScript.h"
28#include "ScriptedCreature.h"
29#include "SpellScript.h"
30
44
52
53#define SPELL_PULSING_SHOCKWAVE DUNGEON_MODE<uint32>(52961,59836)
54
62
64{
65 // Phases are used to allow executing the intro event while UpdateVictim() returns false and convenience.
68};
69
74
75/*######
76## Boss Loken
77######*/
78
79struct boss_loken : public BossAI
80{
81 boss_loken(Creature* creature) : BossAI(creature, DATA_LOKEN)
82 {
83 Initialize();
84 _isIntroDone = false;
85 }
86
88 {
90 }
91
92 void Reset() override
93 {
94 Initialize();
95 _Reset();
96 }
97
108
109 void JustDied(Unit* /*killer*/) override
110 {
112 _JustDied();
114 }
115
116 void KilledUnit(Unit* who) override
117 {
118 if (who->GetTypeId() == TYPEID_PLAYER)
119 Talk(SAY_SLAY);
120 }
121
122 void MoveInLineOfSight(Unit* who) override
123 {
124 if (!_isIntroDone && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40.0f))
125 {
126 _isIntroDone = true;
129 }
131 }
132
133 void UpdateAI(uint32 diff) override
134 {
136 return;
137
138 events.Update(diff);
139
140 while (uint32 eventId = events.ExecuteEvent())
141 {
142 switch (eventId)
143 {
148 break;
150 Talk(SAY_NOVA);
154 events.ScheduleEvent(EVENT_RESUME_PULSING_SHOCKWAVE, DUNGEON_MODE(5s, 4s)); // Pause Pulsing Shockwave aura
156 break;
159 me->ClearUnitState(UNIT_STATE_CASTING); // Workaround to allow DoMeleeAttackIfReady work
161 break;
165 break;
166 default:
167 break;
168 }
169 }
170 }
171
172 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
173 {
174 if (me->HealthBelowPctDamaged(100 - 25 * _healthAmountModifier, damage))
175 {
176 switch (_healthAmountModifier)
177 {
178 case 1:
180 break;
181 case 2:
183 break;
184 case 3:
186 break;
187 default:
188 break;
189 }
191 }
192 }
193
194 private:
197};
198
199// 52942, 59837 - Pulsing Shockwave
201{
203 {
204 if (!GetHitUnit())
205 return;
206
207 float distance = GetCaster()->GetDistance2d(GetHitUnit());
208 if (distance > 1.0f)
209 SetHitDamage(int32(GetHitDamage() * distance));
210 }
211
216};
217
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCHOOL_DAMAGE
#define SpellEffectFn(F, I, N)
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_loken()
#define SPELL_PULSING_SHOCKWAVE
@ ACHIEV_TIMELY_DEATH_START_EVENT
@ SPELL_ARC_LIGHTNING
@ SPELL_PULSING_SHOCKWAVE_AURA
@ SPELL_LIGHTNING_NOVA
@ PHASE_INTRO
@ PHASE_NORMAL
@ SAY_DEATH
@ SAY_INTRO_2
@ SAY_AGGRO
@ EMOTE_NOVA
@ SAY_INTRO_1
@ SAY_25HEALTH
@ SAY_SLAY
@ SAY_NOVA
@ SAY_50HEALTH
@ SAY_75HEALTH
@ EVENT_INTRO_DIALOGUE
@ EVENT_LIGHTNING_NOVA
@ EVENT_RESUME_PULSING_SHOCKWAVE
@ EVENT_ARC_LIGHTNING
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
virtual void MoveInLineOfSight(Unit *)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
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
bool IsInPhase(uint8 phase) const
Definition EventMap.h:222
void SetPhase(uint8 phase)
Definition EventMap.cpp:32
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
void TriggerGameEvent(uint32 gameEventId, WorldObject *source=nullptr, WorldObject *target=nullptr) override
int32 GetHitDamage() const
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void SetHitDamage(int32 damage)
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:79
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void ClearUnitState(uint32 f)
Definition Unit.h:744
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2324
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:450
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:501
void CalculateDamage(SpellEffIndex)
#define RegisterHallsOfLightningCreatureAI(ai_name)
@ DATA_LOKEN
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const
void JustEngagedWith(Unit *who) override
uint32 _healthAmountModifier
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *who) override
boss_loken(Creature *creature)
void JustDied(Unit *) override
void Initialize()
void Reset() override
void MoveInLineOfSight(Unit *who) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
bool _isIntroDone