TrinityCore
Loading...
Searching...
No Matches
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 "InstanceScript.h"
23#include "ObjectAccessor.h"
24#include "Player.h"
25#include "ScriptedCreature.h"
26#include "SpellInfo.h"
27#include "SpellScript.h"
28
38
53
62
68
69// 22887 - High Warlord Naj'entus
70struct boss_najentus : public BossAI
71{
73
74 void Reset() override
75 {
76 _Reset();
78 }
79
80 void EnterEvadeMode(EvadeReason /*why*/) override
81 {
84 }
85
86 void KilledUnit(Unit* victim) override
87 {
88 if (victim->GetTypeId() == TYPEID_PLAYER)
90 }
91
92 void JustDied(Unit* /*killer*/) override
93 {
94 _JustDied();
96 }
97
98 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
99 {
100 if (spellInfo->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
101 {
105 }
106 }
107
118
119 uint32 GetData(uint32 data) const override
120 {
121 if (data == DATA_REMOVE_IMPALING_SPINE)
122 return RemoveImpalingSpine() ? 1 : 0;
123 return 0;
124 }
125
126 void DoAction(int32 actionId) override
127 {
128 if (actionId == ACTION_RESET_IMPALING_TARGET)
130 }
131
133 {
134 if (!_spineTargetGUID)
135 return false;
136
138 if (target && target->HasAura(SPELL_IMPALING_SPINE))
140 return true;
141 }
142
143 void ExecuteEvent(uint32 eventId) override
144 {
145 switch (eventId)
146 {
147 case EVENT_SHIELD:
150 events.Repeat(55s, 60s);
151 break;
152 case EVENT_BERSERK:
155 break;
156 case EVENT_SPINE:
157 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 200.0f, true))
158 {
159 DoCast(target, SPELL_IMPALING_SPINE, true);
160 _spineTargetGUID = target->GetGUID();
161 //must let target summon, otherwise you cannot click the spine
162 target->SummonGameObject(GO_NAJENTUS_SPINE, *target, QuaternionData(), 30s);
164 }
165 events.Repeat(20s, 25s);
166 break;
167 case EVENT_NEEDLE:
169 events.Repeat(2s);
170 break;
171 case EVENT_YELL:
173 events.Repeat(25s, 100s);
174 break;
175 default:
176 break;
177 }
178 }
179
180private:
182};
183
184// 185584 - Naj'entus Spine
186{
187 go_najentus_spine(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { }
188
189 bool OnGossipHello(Player* player) override
190 {
191 if (!_instance)
192 return false;
193
195 if (najentus->AI()->GetData(DATA_REMOVE_IMPALING_SPINE))
196 {
197 najentus->AI()->DoAction(ACTION_RESET_IMPALING_TARGET);
199 me->Delete();
200 }
201 return true;
202 }
203private:
205};
206
207// 39992 - Needle Spine Targeting
233
234// 39835 - Needle Spine
254
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterGameObjectAI(ai_name)
Definition ScriptMgr.h:1157
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TARGET_UNIT_SRC_AREA_ENEMY
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_HIGH_WARLORD_NAJENTUS
@ GO_NAJENTUS_SPINE
@ ACTION_RESET_IMPALING_TARGET
@ DATA_REMOVE_IMPALING_SPINE
@ SPELL_NEEDLE_SPINE_TARGETING
@ SPELL_IMPALING_SPINE
@ SPELL_NEEDLE_SPINE_EXPLOSION
@ 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
bool _EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Creature *const me
Definition CreatureAI.h:82
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:52
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
GameObject *const me
void Delete()
Creature * GetCreature(uint32 type)
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_najentus_needle_spine_explosion)
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_najentus_needle_spine)
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