Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_elder_nadox.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "SpellScript.h"
9#include "ahnkahet.h"
10
19
21{
24 SPELL_ENRAGE = 26662, // Enraged if too far away from home
25 SPELL_SUMMON_SWARMERS = 56119, // 2x 30178 -- 2x every 10secs
26 SPELL_SUMMON_SWARM_GUARD = 56120, // 1x 30176 -- every 25%
27 // Spells Adds
28 SPELL_SPRINT = 56354,
30};
31
41
43{
44 public:
45 boss_elder_nadox() : CreatureScript("boss_elder_nadox") { }
46
47 struct boss_elder_nadoxAI : public BossAI
48 {
50
52 {
53 _Reset();
55 GuardianDied = false;
56 }
57
58 void EnterCombat(Unit* /*who*/) OVERRIDE
59 {
62
63 events.ScheduleEvent(EVENT_PLAGUE, 13 * IN_MILLISECONDS);
64 events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10 * IN_MILLISECONDS);
65
66 if (IsHeroic())
67 {
68 events.ScheduleEvent(EVENT_RAGE, 12 * IN_MILLISECONDS);
69 events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5 * IN_MILLISECONDS);
70 }
71 }
72
73 void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) OVERRIDE
74 {
75 if (summon->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
76 GuardianDied = true;
77 }
78
80 {
81 if (type == DATA_RESPECT_YOUR_ELDERS)
82 return !GuardianDied ? 1 : 0;
83
84 return 0;
85 }
86
88 {
89 if (who->GetTypeId() == TypeID::TYPEID_PLAYER)
91 }
92
93 void JustDied(Unit* /*killer*/) OVERRIDE
94 {
95 _JustDied();
97 }
98
100 {
101 if (!UpdateVictim())
102 return;
103
104 events.Update(diff);
105
106 while (uint32 eventId = events.ExecuteEvent())
107 {
108 switch (eventId)
109 {
110 case EVENT_PLAGUE:
112 events.ScheduleEvent(EVENT_PLAGUE, 15 * IN_MILLISECONDS);
113 break;
114 case EVENT_RAGE:
116 events.ScheduleEvent(EVENT_RAGE, std::rand() % (50 * IN_MILLISECONDS) + (10 * IN_MILLISECONDS));
117 break;
120 if ((std::rand() % 3 + 1) == 3) // 33% chance of dialog
122 events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10 * IN_MILLISECONDS);
123 break;
125 if (me->HasAura(SPELL_ENRAGE))
126 return;
127 if (me->GetPositionZ() < 24.0f)
128 DoCast(me, SPELL_ENRAGE, true);
129 events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5 * IN_MILLISECONDS);
130 break;
131 default:
132 break;
133 }
134 }
135
136 if (me->HealthBelowPct(100 - AmountHealthModifier* 25))
137 {
141 }
142
144 }
145
146 private:
149 };
150
152 {
153 return GetAhnKahetAI<boss_elder_nadoxAI>(creature);
154 }
155};
156
158{
159 public:
160 npc_ahnkahar_nerubian() : CreatureScript("npc_ahnkahar_nerubian") { }
161
163 {
164 npc_ahnkahar_nerubianAI(Creature* creature) : ScriptedAI(creature) { }
165
167
169 {
170 if (me->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
172
173 events.ScheduleEvent(EVENT_SPRINT, 13 * IN_MILLISECONDS);
174 }
175
176 void JustDied(Unit* /*killer*/) OVERRIDE
177 {
178 if (me->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
179 me->RemoveAurasDueToSpell(SPELL_GUARDIAN_AURA);
180 }
181
183 {
184 if (!UpdateVictim())
185 return;
186
187 events.Update(diff);
188
189 if (me->HasUnitState(UNIT_STATE_CASTING))
190 return;
191
192 while (uint32 eventId = events.ExecuteEvent())
193 {
194 switch (eventId)
195 {
196 case EVENT_SPRINT:
198 events.ScheduleEvent(EVENT_SPRINT, 20 * IN_MILLISECONDS);
199 break;
200 }
201 }
203 }
204 };
205
207 {
208 return new npc_ahnkahar_nerubianAI(creature);
209 }
210};
211
212//HACK: No, AI. Replace with proper db content?
214{
215public:
216 npc_nadox_eggs() : CreatureScript("npc_nadox_eggs") { }
217
219 {
225
226 void Reset() OVERRIDE { }
227 void EnterCombat(Unit* /*who*/) OVERRIDE { }
228 void AttackStart(Unit* /*victim*/) OVERRIDE { }
229 void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { }
230
231 void UpdateAI(uint32 /*diff*/) OVERRIDE { }
232 };
233
235 {
236 return new npc_nadox_eggsAI(creature);
237 }
238};
239
241{
242public:
243 bool operator()(const WorldObject* target) const
244 {
245 if (target->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
246 return true;
247
248 return false;
249 }
250};
251
278
280{
281public:
282 achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders") { }
283
284 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
285 {
286 if (!target)
287 return false;
288
289 if (Creature* Nadox = target->ToCreature())
290 if (Nadox->AI()->GetData(DATA_RESPECT_YOUR_ELDERS))
291 return true;
292
293 return false;
294 }
295};
296
@ IN_MILLISECONDS
Definition Common.h:125
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TYPEID_PLAYER
Definition Object.h:55
@ EFFECT_1
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ALLY
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ NPC_AHNKAHAR_GUARDIAN
Definition ahnkahet.h:43
AI * GetAhnKahetAI(Creature *creature)
Definition ahnkahet.h:71
@ DATA_ELDER_NADOX
Definition ahnkahet.h:16
@ SPELL_ENRAGE
@ SAY_SLAY
@ EVENT_SUMMON_SWARMER
#define SAY_DEATH
#define SAY_AGGRO
void AddSC_boss_elder_nadox()
@ SAY_DEATH
@ EMOTE_HATCHES
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_EGG_SAC
@ SPELL_ENRAGE
@ H_SPELL_BROOD_RAGE
@ SPELL_SUMMON_SWARMERS
@ SPELL_GUARDIAN_AURA
@ SPELL_SPRINT
@ SPELL_SUMMON_SWARM_GUARD
@ SPELL_BROOD_PLAGUE
@ EVENT_PLAGUE
@ EVENT_SPRINT
@ DATA_RESPECT_YOUR_ELDERS
@ EVENT_CHECK_ENRAGE
@ EVENT_SUMMON_SWARMER
@ EVENT_RAGE
AchievementCriteriaScript(const char *name)
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
bool UpdateAllStats() OVERRIDE
CreatureScript(const char *name)
bool operator()(const WorldObject *target) const
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:1261
uint32 GetEntry() const
Definition Object.h:125
Creature * ToCreature()
Definition Object.h:207
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellScriptLoader(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
Definition Unit.h:1367
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareSpellScript(spell_elder_nadox_guardian_SpellScript)
SpellScript * GetSpellScript() const OVERRIDE
bool IsHeroic() const
Creature * me
ScriptedAI(Creature *creature)
uint32 GetData(uint32 type) const OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SummonedCreatureDies(Creature *summon, Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================
void MoveInLineOfSight(Unit *) OVERRIDE