TrinityCore
Loading...
Searching...
No Matches
boss_tunk.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 "InstanceScript.h"
21#include "PathGenerator.h"
22#include "Player.h"
23#include "ScriptedCreature.h"
24#include "ScriptMgr.h"
25#include "SpellInfo.h"
26#include "SpellMgr.h"
27#include "SpellScript.h"
28#include "darkmaul_citadel.h"
29
37
43
49
50// 157300 - Tunk
51struct boss_tunk : public BossAI
52{
53 boss_tunk(Creature* creature) : BossAI(creature, DATA_TUNK) { }
54
55 void JustDied(Unit* /*killer*/) override
56 {
58 _JustDied();
59 }
60
67
76
77 void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
78 {
79 if (!target->IsPlayer())
80 return;
81
82 if (spellInfo->Id == SPELL_SEISMIC_SLAM_DAMAGE)
84 }
85
86 void UpdateAI(uint32 diff) override
87 {
88 if (!UpdateVictim())
89 return;
90
91 events.Update(diff);
92
94 return;
95
96 while (uint32 eventId = events.ExecuteEvent())
97 {
98 switch (eventId)
99 {
101 {
103 events.Repeat(20s);
104 break;
105 }
107 {
109 events.Repeat(30s);
110 break;
111 }
112 default:
113 break;
114 }
115
117 return;
118 }
119 }
120};
121
122// 308454 - Seismic Slam
143
144// 308455 - Seismic Slam
146{
148
149 void OnInitialize() override
150 {
151 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(at->GetSpellId(), DIFFICULTY_NONE);
152 if (!spellInfo)
153 return;
154
155 Unit* caster = at->GetCaster();
156 if (!caster)
157 return;
158
159 Position destPos = at->GetFirstCollisionPosition(spellInfo->GetMaxRange(false, caster), 0.0f);
160 PathGenerator path(at);
161
162 path.CalculatePath(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ(), false);
163
164 at->InitSplines(path.GetPath());
165 }
166
167 void OnUnitEnter(Unit* unit) override
168 {
169 if (Unit* caster = at->GetCaster())
170 if (caster->IsValidAttackTarget(unit))
172 }
173};
174
175// 321240 - Interrupting Shout
177{
178 void HandleLaunchTarget(SpellEffIndex /*effIndex*/) const
179 {
180 Creature* caster = GetCaster()->ToCreature();
181 if (!caster)
182 return;
183
184 Player* hitPlayer = GetHitUnit()->ToPlayer();
185 if (!hitPlayer)
186 return;
187
189 caster->AI()->Talk(SAY_WARNING_INTERRUPT, hitPlayer);
190 }
191
196};
197
@ DIFFICULTY_NONE
Definition DBCEnums.h:933
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
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_INTERRUPT_CAST
@ 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 sSpellMgr
Definition SpellMgr.h:812
#define SpellEffectFn(F, I, N)
EvadeReason
@ CURRENT_GENERIC_SPELL
Definition Unit.h:598
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_tunk()
TunkEvents
Definition boss_tunk.cpp:39
@ EVENT_INTERRUPTING_SHOUT
Definition boss_tunk.cpp:40
@ EVENT_SEISMIC_SLAM
Definition boss_tunk.cpp:41
TunkSpells
Definition boss_tunk.cpp:31
@ SPELL_SEISMIC_SLAM_DAMAGE
Definition boss_tunk.cpp:35
@ SPELL_SEISMIC_SLAM_AT
Definition boss_tunk.cpp:34
@ SPELL_SEISMIC_SLAM_SELECTOR
Definition boss_tunk.cpp:33
@ SPELL_INTERRUPTING_SHOUT
Definition boss_tunk.cpp:32
TunkTexts
Definition boss_tunk.cpp:45
@ SAY_WARNING_SEISMIC_SLAM
Definition boss_tunk.cpp:46
@ SAY_WARNING_INTERRUPT
Definition boss_tunk.cpp:47
AreaTrigger *const at
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={}) noexcept
void InitSplines(std::vector< G3D::Vector3 > const &splinePoints, Optional< float > overrideSpeed={}, Optional< bool > speedIsTimeInSeconds={})
uint32 GetSpellId() const
Unit * GetCaster() const
bool IsPlayer() const
Definition BaseEntity.h:173
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
CreatureAI * AI() const
Definition Creature.h:228
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 SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
Player * ToPlayer()
Definition Object.h:126
Creature * ToCreature()
Definition Object.h:121
Movement::PointsArray const & GetPath() const
bool CalculatePath(float srcX, float srcY, float srcZ, float destX, float destY, float destZ, bool forceDest=false)
float GetMaxRange(bool positive=false, WorldObject const *caster=nullptr, Spell *spell=nullptr) const
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< EffectHandler > OnEffectLaunchTarget
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1466
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
Position GetFirstCollisionPosition(float dist, float angle)
Definition Object.cpp:2762
void HandleLaunchTarget(SpellEffIndex) const
bool Validate(SpellInfo const *) override
void HandleHitTarget(SpellEffIndex) const
#define RegisterDarkmaulCitadelCreatureAI(ai_name)
@ DATA_TUNK
TriggerCastFlags TriggerFlags
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr float GetPositionZ() const
Definition Position.h:89
void OnUnitEnter(Unit *unit) override
void OnInitialize() override
void UpdateAI(uint32 diff) override
Definition boss_tunk.cpp:86
boss_tunk(Creature *creature)
Definition boss_tunk.cpp:53
void EnterEvadeMode(EvadeReason) override
Definition boss_tunk.cpp:61
void JustDied(Unit *) override
Definition boss_tunk.cpp:55
void JustEngagedWith(Unit *who) override
Definition boss_tunk.cpp:68
void SpellHitTarget(WorldObject *target, SpellInfo const *spellInfo) override
Definition boss_tunk.cpp:77