TrinityCore
boss_warlord_najentus.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 "ScriptMgr.h"
19#include "black_temple.h"
20#include "GameObjectAI.h"
21#include "GridNotifiers.h"
22#include "GameObject.h"
23#include "InstanceScript.h"
24#include "ObjectAccessor.h"
25#include "Player.h"
26#include "ScriptedCreature.h"
27#include "SpellInfo.h"
28#include "SpellScript.h"
29
31{
37 SAY_DEATH = 5
38};
39
41{
49 SPELL_BERSERK = 26662
50};
51
53{
58 EVENT_SHIELD = 5
59};
60
61enum Misc
62{
65};
66
67struct boss_najentus : public BossAI
68{
70
71 void Reset() override
72 {
73 _Reset();
75 }
76
77 void EnterEvadeMode(EvadeReason /*why*/) override
78 {
81 }
82
83 void KilledUnit(Unit* victim) override
84 {
85 if (victim->GetTypeId() == TYPEID_PLAYER)
87 }
88
89 void JustDied(Unit* /*killer*/) override
90 {
91 _JustDied();
93 }
94
95 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
96 {
97 if (spellInfo->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
98 {
102 }
103 }
104
105 void JustEngagedWith(Unit* who) override
106 {
113 events.ScheduleEvent(EVENT_YELL, 45s, 100s);
114 }
115
116 uint32 GetData(uint32 data) const override
117 {
118 if (data == DATA_REMOVE_IMPALING_SPINE)
119 return RemoveImpalingSpine() ? 1 : 0;
120 return 0;
121 }
122
123 void DoAction(int32 actionId) override
124 {
125 if (actionId == ACTION_RESET_IMPALING_TARGET)
127 }
128
130 {
131 if (!_spineTargetGUID)
132 return false;
133
135 if (target && target->HasAura(SPELL_IMPALING_SPINE))
137 return true;
138 }
139
140 void ExecuteEvent(uint32 eventId) override
141 {
142 switch (eventId)
143 {
144 case EVENT_SHIELD:
147 events.Repeat(Seconds(55), Seconds(60));
148 break;
149 case EVENT_BERSERK:
152 break;
153 case EVENT_SPINE:
154 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 200.0f, true))
155 {
156 DoCast(target, SPELL_IMPALING_SPINE, true);
157 _spineTargetGUID = target->GetGUID();
158 //must let target summon, otherwise you cannot click the spine
159 target->SummonGameObject(GO_NAJENTUS_SPINE, *target, QuaternionData(), 30s);
161 }
162 events.Repeat(Seconds(20), Seconds(25));
163 break;
164 case EVENT_NEEDLE:
167 break;
168 case EVENT_YELL:
170 events.Repeat(Seconds(25), Seconds(100));
171 break;
172 default:
173 break;
174 }
175 }
176
177private:
179};
180
182{
183 go_najentus_spine(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { }
184
185 bool OnGossipHello(Player* player) override
186 {
187 if (!_instance)
188 return false;
189
191 if (najentus->AI()->GetData(DATA_REMOVE_IMPALING_SPINE))
192 {
193 najentus->AI()->DoAction(ACTION_RESET_IMPALING_TARGET);
195 me->Delete();
196 }
197 return true;
198 }
199private:
201};
202
203// 39992 - Needle Spine Targeting
205{
206 bool Validate(SpellInfo const* /*spellInfo*/) override
207 {
209 }
210
211 void FilterTargets(std::list<WorldObject*>& targets)
212 {
213 targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_IMPALING_SPINE));
214 }
215
216 void HandleScript(SpellEffIndex /*effIndex*/)
217 {
219 }
220
221 void Register() override
222 {
225 }
226};
227
229{
233}
Texts
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#define RegisterGameObjectAI(ai_name)
Definition: ScriptMgr.h:1398
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
EvadeReason
Definition: UnitAICommon.h:30
#define RegisterBlackTempleCreatureAI(ai_name)
Definition: black_temple.h:149
@ DATA_HIGH_WARLORD_NAJENTUS
Definition: black_temple.h:31
@ GO_NAJENTUS_SPINE
Definition: black_temple.h:118
@ ACTION_RESET_IMPALING_TARGET
@ DATA_REMOVE_IMPALING_SPINE
@ SPELL_NEEDLE_SPINE_TARGETING
@ SPELL_HURL_SPINE
@ SPELL_IMPALING_SPINE
@ SPELL_NEEDLE_SPINE
@ SPELL_CREATE_NAJENTUS_SPINE
@ SPELL_TIDAL_SHIELD
@ SPELL_TIDAL_BURST
void AddSC_boss_najentus()
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:299
Creature *const me
Definition: CreatureAI.h:61
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:52
GameObject *const me
Definition: GameObjectAI.h:50
void Delete()
Creature * GetCreature(uint32 type)
void Clear()
Definition: ObjectGuid.h:286
TypeID GetTypeId() const
Definition: Object.h:173
uint32 const Id
Definition: SpellInfo.h:325
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
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 DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
void EnterEvadeMode(EvadeReason) override
void DoAction(int32 actionId) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
uint32 GetData(uint32 data) const override
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
bool RemoveImpalingSpine() const
void Reset() override
boss_najentus(Creature *creature)
void KilledUnit(Unit *victim) override
void ExecuteEvent(uint32 eventId) override
go_najentus_spine(GameObject *go)
bool OnGossipHello(Player *player) override
InstanceScript * _instance