TrinityCore
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
26{
32};
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
49{
56};
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
79 void JustEngagedWith(Unit* who) override
80 {
83
86
87 if (IsHeroic())
88 {
91 }
92 }
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 }
171
172private:
175};
176
178{
179 npc_ahnkahar_nerubian(Creature* creature) : ScriptedAI(creature) { }
180
181 void Reset() override
182 {
183 _events.Reset();
185 }
186
187 void UpdateAI(uint32 diff) override
188 {
189 if (!UpdateVictim())
190 return;
191
192 _events.Update(diff);
193
195 return;
196
197 while (uint32 eventId = _events.ExecuteEvent())
198 {
199 switch (eventId)
200 {
201 case EVENT_SPRINT:
204 break;
205 }
206 }
207 }
208
209private:
211};
212
213// 56159 - Swarm
215{
216 bool Validate(SpellInfo const* /*spellInfo*/) override
217 {
219 }
220
221 void CountTargets(std::list<WorldObject*>& targets)
222 {
223 _targetCount = targets.size();
224 }
225
226 void HandleDummy(SpellEffIndex /*effIndex*/)
227 {
228 if (_targetCount)
229 {
230 if (Aura* aura = GetCaster()->GetAura(SPELL_SWARM_BUFF))
231 {
232 aura->SetStackAmount(_targetCount);
233 aura->RefreshDuration();
234 }
235 else
236 {
241 }
242 }
243 else
245 }
246
247 void Register() override
248 {
251 }
252
254};
255
257{
258 public:
259 achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders") { }
260
261 bool OnCheck(Player* /*player*/, Unit* target) override
262 {
263 return target && target->GetAI()->GetData(DATA_RESPECT_YOUR_ELDERS);
264 }
265};
266
268{
273}
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ALLY
@ SPELL_EFFECT_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
@ SPELLVALUE_AURA_STACK
Definition: SpellDefines.h:231
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ 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()
NadoxSpells
@ SPELL_SUMMON_SWARMERS
@ SPELL_BROOD_RAGE
@ SPELL_SPRINT
@ SPELL_SUMMON_SWARM_GUARD
@ SPELL_BERSERK
@ SPELL_SWARM_BUFF
@ SPELL_BROOD_PLAGUE
NadoxTexts
@ SAY_DEATH
@ EMOTE_HATCHES
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_EGG_SAC
ParallelogramBoundary const ElderNadoxRoomBoundary
NadoxEvents
@ EVENT_PLAGUE
@ EVENT_SPRINT
@ DATA_RESPECT_YOUR_ELDERS
@ EVENT_BROOD_RAGE
@ EVENT_CHECK_ENRAGE
@ EVENT_SUMMON_SWARMER
bool IsWithinBoundary(Position const *pos) const
Definition: AreaBoundary.h:26
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
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 Reset()
Definition: EventMap.cpp:21
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
virtual uint32 GetData(uint32) const
Definition: UnitAI.h:73
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
UnitAI * GetAI() const
Definition: Unit.h:660
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:780
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
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
bool OnCheck(Player *, Unit *target) override
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
void CountTargets(std::list< WorldObject * > &targets)
TriggerCastFlags TriggerFlags
Definition: SpellDefines.h:478
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
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