TrinityCore
Loading...
Searching...
No Matches
boss_elder_nadox.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 "ahnkahet.h"
19#include "AreaBoundary.h"
20#include "ScriptedCreature.h"
21#include "ScriptMgr.h"
22#include "SpellAuras.h"
23#include "SpellScript.h"
24
33
35{
36 // Elder Nadox
39 SPELL_BERSERK = 26662, // Enraged if too far away from home
40 SPELL_SUMMON_SWARMERS = 56119, // 2x 30178 -- 2x every 10secs
41 SPELL_SUMMON_SWARM_GUARD = 56120, // 1x 30176
42
43 // Adds
45 SPELL_SPRINT = 56354
46};
47
57
58ParallelogramBoundary const ElderNadoxRoomBoundary = ParallelogramBoundary(Position(690.96f, -858.93f, -25.69f), Position(571.f, -937.f, -25.69f), Position(722.93f, -908.05f, -25.69f));
59
60struct boss_elder_nadox : public BossAI
61{
63 {
64 Initialize();
65 }
66
68 {
69 _guardianSummoned = false;
70 _guardianDied = false;
71 }
72
73 void Reset() override
74 {
75 _Reset();
76 Initialize();
77 }
78
93
94 void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
95 {
96 if (summon->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
97 _guardianDied = true;
98 }
99
100 uint32 GetData(uint32 type) const override
101 {
102 if (type == DATA_RESPECT_YOUR_ELDERS)
103 return !_guardianDied ? 1 : 0;
104
105 return 0;
106 }
107
108 void KilledUnit(Unit* who) override
109 {
110 if (who->GetTypeId() == TYPEID_PLAYER)
111 Talk(SAY_SLAY);
112 }
113
114 void JustDied(Unit* /*killer*/) override
115 {
116 _JustDied();
118 }
119
120 void UpdateAI(uint32 diff) override
121 {
122 if (!UpdateVictim())
123 return;
124
125 events.Update(diff);
126
127 while (uint32 eventId = events.ExecuteEvent())
128 {
129 switch (eventId)
130 {
131 case EVENT_PLAGUE:
132 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
133 DoCast(target, SPELL_BROOD_PLAGUE, true);
134 events.Repeat(15s);
135 break;
136 case EVENT_BROOD_RAGE:
138 events.Repeat(10s, 50s);
139 break;
143 if (roll_chance_i(33)) // 33% chance of dialog
145 events.Repeat(10s);
146 break;
149 return;
151 DoCast(me, SPELL_BERSERK, true);
152 else
153 events.Repeat(5s);
154 break;
155 default:
156 break;
157 }
158
160 return;
161 }
162
164 {
168 _guardianSummoned = true;
169 }
170
172 }
173
174private:
177};
178
180{
181 npc_ahnkahar_nerubian(Creature* creature) : ScriptedAI(creature) { }
182
183 void Reset() override
184 {
185 _events.Reset();
187 }
188
189 void UpdateAI(uint32 diff) override
190 {
191 if (!UpdateVictim())
192 return;
193
194 _events.Update(diff);
195
197 return;
198
199 while (uint32 eventId = _events.ExecuteEvent())
200 {
201 switch (eventId)
202 {
203 case EVENT_SPRINT:
206 break;
207 }
208 }
209
211 }
212
213private:
215};
216
217// 56159 - Swarm
219{
221
222 bool Validate(SpellInfo const* /*spellInfo*/) override
223 {
225 }
226
227 void CountTargets(std::list<WorldObject*>& targets)
228 {
229 _targetCount = targets.size();
230 }
231
232 void HandleDummy(SpellEffIndex /*effIndex*/)
233 {
234 if (_targetCount)
235 {
236 if (Aura* aura = GetCaster()->GetAura(SPELL_SWARM_BUFF))
237 {
238 aura->SetStackAmount(_targetCount);
239 aura->RefreshDuration();
240 }
241 else
242 {
247 }
248 }
249 else
251 }
252
258
260};
261
263{
264 public:
265 achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders") { }
266
267 bool OnCheck(Player* /*player*/, Unit* target) override
268 {
269 return target && target->GetAI()->GetData(DATA_RESPECT_YOUR_ELDERS);
270 }
271};
272
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ TARGET_UNIT_SRC_AREA_ALLY
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_AURA_STACK
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ DATA_ELDER_NADOX
Definition ahnkahet.h:31
#define RegisterAhnKahetCreatureAI(ai_name)
Definition ahnkahet.h:87
@ NPC_AHNKAHAR_GUARDIAN
Definition ahnkahet.h:52
void AddSC_boss_elder_nadox()
@ SPELL_SUMMON_SWARMERS
@ SPELL_BROOD_RAGE
@ SPELL_SPRINT
@ SPELL_SUMMON_SWARM_GUARD
@ SPELL_BERSERK
@ SPELL_SWARM_BUFF
@ SPELL_BROOD_PLAGUE
@ SAY_DEATH
@ EMOTE_HATCHES
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_EGG_SAC
ParallelogramBoundary const ElderNadoxRoomBoundary
@ EVENT_PLAGUE
@ EVENT_SPRINT
@ DATA_RESPECT_YOUR_ELDERS
@ EVENT_BROOD_RAGE
@ EVENT_CHECK_ENRAGE
@ EVENT_SUMMON_SWARMER
bool IsWithinBoundary(Position const *pos) const
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
virtual uint32 GetData(uint32) const
Definition UnitAI.h:155
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
UnitAI * GetAI() const
Definition Unit.h:800
bool HealthBelowPct(int32 pct) const
Definition Unit.h:917
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool OnCheck(Player *, Unit *target) override
PrepareSpellScript(spell_ahn_kahet_swarm)
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
void CountTargets(std::list< WorldObject * > &targets)
TriggerCastFlags TriggerFlags
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
bool IsHeroic() const
void JustDied(Unit *) override
void KilledUnit(Unit *who) override
boss_elder_nadox(Creature *creature)
void SummonedCreatureDies(Creature *summon, Unit *) override
void Reset() override
void UpdateAI(uint32 diff) override
uint32 GetData(uint32 type) const override
void JustEngagedWith(Unit *who) override
npc_ahnkahar_nerubian(Creature *creature)
void UpdateAI(uint32 diff) override