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
51
60
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
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
227
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
#define RegisterGameObjectAI(ai_name)
Definition ScriptMgr.h:1410
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
#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
@ 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 ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:56
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:79
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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