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 "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
39
54
63
69
70// 22887 - High Warlord Naj'entus
71struct boss_najentus : public BossAI
72{
74
75 void Reset() override
76 {
77 _Reset();
79 }
80
81 void EnterEvadeMode(EvadeReason /*why*/) override
82 {
85 }
86
87 void KilledUnit(Unit* victim) override
88 {
89 if (victim->GetTypeId() == TYPEID_PLAYER)
91 }
92
93 void JustDied(Unit* /*killer*/) override
94 {
95 _JustDied();
97 }
98
99 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
100 {
101 if (spellInfo->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
102 {
106 }
107 }
108
119
120 uint32 GetData(uint32 data) const override
121 {
122 if (data == DATA_REMOVE_IMPALING_SPINE)
123 return RemoveImpalingSpine() ? 1 : 0;
124 return 0;
125 }
126
127 void DoAction(int32 actionId) override
128 {
129 if (actionId == ACTION_RESET_IMPALING_TARGET)
131 }
132
134 {
135 if (!_spineTargetGUID)
136 return false;
137
139 if (target && target->HasAura(SPELL_IMPALING_SPINE))
141 return true;
142 }
143
144 void ExecuteEvent(uint32 eventId) override
145 {
146 switch (eventId)
147 {
148 case EVENT_SHIELD:
151 events.Repeat(55s, 60s);
152 break;
153 case EVENT_BERSERK:
156 break;
157 case EVENT_SPINE:
158 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 200.0f, true))
159 {
160 DoCast(target, SPELL_IMPALING_SPINE, true);
161 _spineTargetGUID = target->GetGUID();
162 //must let target summon, otherwise you cannot click the spine
163 target->SummonGameObject(GO_NAJENTUS_SPINE, *target, QuaternionData(), 30s);
165 }
166 events.Repeat(20s, 25s);
167 break;
168 case EVENT_NEEDLE:
170 events.Repeat(2s);
171 break;
172 case EVENT_YELL:
174 events.Repeat(25s, 100s);
175 break;
176 default:
177 break;
178 }
179 }
180
181private:
183};
184
185// 185584 - Naj'entus Spine
187{
188 go_najentus_spine(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { }
189
190 bool OnGossipHello(Player* player) override
191 {
192 if (!_instance)
193 return false;
194
196 if (najentus->AI()->GetData(DATA_REMOVE_IMPALING_SPINE))
197 {
198 najentus->AI()->DoAction(ACTION_RESET_IMPALING_TARGET);
200 me->Delete();
201 }
202 return true;
203 }
204private:
206};
207
208// 39992 - Needle Spine Targeting
232
233// 39835 - Needle Spine
251
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define RegisterGameObjectAI(ai_name)
Definition ScriptMgr.h:1410
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
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)
EvadeReason
#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()
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Creature *const me
Definition CreatureAI.h:63
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:56
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
GameObject *const me
Creature * GetCreature(uint32 type)
void Clear()
Definition ObjectGuid.h:329
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool Validate(SpellInfo const *) override
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