Created
October 2, 2012 22:50
-
-
Save Retriman/3823811 to your computer and use it in GitHub Desktop.
Boss Elder Nadox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -23,65 +23,74 @@ enum Yells | |
{ | |
SAY_AGGRO = 0, | |
SAY_SLAY = 1, | |
SAY_DEATH = 2, | |
SAY_EGG_SAC = 3, | |
- EMOTE_HATCHES = 4 | |
+ EMOTE_HATCHES = 4 | |
}; | |
enum Spells | |
{ | |
- SPELL_BROOD_PLAGUE = 56130, | |
- H_SPELL_BROOD_PLAGUE = 59467, | |
- H_SPELL_BROOD_RAGE = 59465, | |
- SPELL_ENRAGE = 26662, // Enraged if too far away from home | |
- SPELL_SUMMON_SWARMERS = 56119, //2x 30178 -- 2x every 10secs | |
- SPELL_SUMMON_SWARM_GUARD = 56120, //1x 30176 -- every 25secs | |
+ SPELL_BROOD_PLAGUE = 56130, | |
+ H_SPELL_BROOD_RAGE = 59465, | |
+ SPELL_ENRAGE = 26662, // Enraged if too far away from home | |
+ SPELL_SUMMON_SWARMERS = 56119, // 2x 30178 -- 2x every 10secs | |
+ SPELL_SUMMON_SWARM_GUARD = 56120, // 1x 30176 -- every 25% | |
+ // Spells Adds | |
+ SPELL_SPRINT = 56354, | |
+ SPELL_GUARDIAN_AURA = 56151 | |
}; | |
- | |
+/* | |
+-- Boss Elder Nadox Move Heroic Spell in spelldifficulty | |
+DELETE FROM `spelldifficulty_dbc` WHERE `id` =56130; | |
+INSERT INTO `spelldifficulty_dbc`(`id`,`spellid0`,`spellid1`) VALUES | |
+(56130,56130,59467); -- Spell Pound | |
+DELETE FROM `spell_script_names` WHERE `spell_id`=56153; | |
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES | |
+(56153, 'spell_elder_nadox_guardian'); | |
+*/ | |
enum Creatures | |
{ | |
- MOB_AHNKAHAR_SWARMER = 30178, | |
- MOB_AHNKAHAR_GUARDIAN_ENTRY = 30176 | |
+ NPC_AHNKAHAR_SWARMER = 30178, | |
+ NPC_AHNKAHAR_GUARDIAN = 30176 | |
}; | |
-#define ACTION_AHNKAHAR_GUARDIAN_DEAD 1 | |
-#define DATA_RESPECT_YOUR_ELDERS 2 | |
+enum Events | |
+{ | |
+ EVENT_PLAGUE = 1, | |
+ EVENT_RAGE, | |
+ EVENT_SUMMON_SWARMER, | |
+ EVENT_CHECK_ENRAGE, | |
+ EVENT_SPRINT, | |
+ DATA_RESPECT_YOUR_ELDERS | |
+}; | |
class boss_elder_nadox : public CreatureScript | |
{ | |
public: | |
boss_elder_nadox() : CreatureScript("boss_elder_nadox") { } | |
struct boss_elder_nadoxAI : public ScriptedAI | |
{ | |
- boss_elder_nadoxAI(Creature* creature) : ScriptedAI(creature) | |
+ boss_elder_nadoxAI(Creature* creature) : ScriptedAI(creature), summons(me) | |
{ | |
instance = creature->GetInstanceScript(); | |
} | |
- uint32 uiPlagueTimer; | |
- uint32 uiRagueTimer; | |
- | |
- uint32 uiSwarmerSpawnTimer; | |
- uint32 uiGuardSpawnTimer; | |
- uint32 uiEnrageTimer; | |
- | |
- bool bGuardSpawned; | |
- bool respectYourElders; | |
- | |
+ bool GuardianDied; | |
+ uint8 AmountHealthModifier; | |
InstanceScript* instance; | |
+ SummonList summons; | |
+ EventMap events; | |
void Reset() | |
{ | |
- uiPlagueTimer = 13000; | |
- uiRagueTimer = 20000; | |
- uiSwarmerSpawnTimer = 10000; | |
- uiGuardSpawnTimer = 25000; | |
- uiEnrageTimer = 5000; | |
- bGuardSpawned = false; | |
- respectYourElders = true; | |
+ events.Reset(); | |
+ summons.DespawnAll(); | |
+ | |
+ AmountHealthModifier = 1; | |
+ GuardianDied = false; | |
if (instance) | |
instance->SetData(DATA_ELDER_NADOX_EVENT, NOT_STARTED); | |
} | |
@@ -89,102 +98,99 @@ class boss_elder_nadox : public CreatureScript | |
{ | |
Talk(SAY_AGGRO); | |
if (instance) | |
instance->SetData(DATA_ELDER_NADOX_EVENT, IN_PROGRESS); | |
- } | |
- void KilledUnit(Unit* /*who*/) | |
- { | |
- Talk(SAY_SLAY); | |
+ events.ScheduleEvent(EVENT_PLAGUE, 13000); | |
+ events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10000); | |
+ | |
+ if (IsHeroic()) | |
+ { | |
+ events.ScheduleEvent(EVENT_RAGE, 12000); | |
+ events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5000); | |
+ } | |
} | |
- void JustDied(Unit* /*killer*/) | |
+ void JustSummoned(Creature* summon) | |
{ | |
- Talk(SAY_DEATH); | |
- | |
- if (instance) | |
- instance->SetData(DATA_ELDER_NADOX_EVENT, DONE); | |
+ summons.Summon(summon); | |
+ summon->AI()->DoZoneInCombat(); | |
} | |
- void DoAction(int32 const action) | |
+ void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) | |
{ | |
- if (action == ACTION_AHNKAHAR_GUARDIAN_DEAD) | |
- respectYourElders = false; | |
+ if (summon->GetEntry() == NPC_AHNKAHAR_GUARDIAN) | |
+ GuardianDied = true; | |
} | |
uint32 GetData(uint32 type) | |
{ | |
if (type == DATA_RESPECT_YOUR_ELDERS) | |
- return respectYourElders ? 1 : 0; | |
+ return !GuardianDied ? 1 : 0; | |
return 0; | |
} | |
+ void KilledUnit(Unit* /*victim*/) | |
+ { | |
+ Talk(SAY_SLAY); | |
+ } | |
+ | |
+ void JustDied(Unit* /*killer*/) | |
+ { | |
+ Talk(SAY_DEATH); | |
+ | |
+ summons.DespawnAll(); | |
+ | |
+ if (instance) | |
+ instance->SetData(DATA_ELDER_NADOX_EVENT, DONE); | |
+ } | |
+ | |
void UpdateAI(uint32 const diff) | |
{ | |
if (!UpdateVictim()) | |
return; | |
- if (uiPlagueTimer <= diff) | |
- { | |
- DoCastVictim(SPELL_BROOD_PLAGUE); | |
- uiPlagueTimer = 15000; | |
- } | |
- else | |
- uiPlagueTimer -= diff; | |
+ events.Update(diff); | |
- if (IsHeroic()) | |
+ while (uint32 eventId = events.ExecuteEvent()) | |
{ | |
- if (uiRagueTimer <= diff) | |
+ switch (eventId) | |
{ | |
- if (Creature* Swarmer = me->FindNearestCreature(MOB_AHNKAHAR_SWARMER, 35.0f)) | |
- { | |
- DoCast(Swarmer, H_SPELL_BROOD_RAGE, true); | |
- uiRagueTimer = 15000; | |
- } | |
+ case EVENT_PLAGUE: | |
+ DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_BROOD_PLAGUE,true); | |
+ events.ScheduleEvent(EVENT_PLAGUE, 15000); | |
+ break; | |
+ case EVENT_RAGE: | |
+ DoCast(H_SPELL_BROOD_RAGE); | |
+ events.ScheduleEvent(EVENT_RAGE, urand(5000, 10000)); | |
+ break; | |
+ case EVENT_SUMMON_SWARMER: | |
+ DoCast(me, SPELL_SUMMON_SWARMERS); | |
+ if (urand(1, 3) == 3) // 33% chance of dialog | |
+ Talk(SAY_EGG_SAC); | |
+ events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10000); | |
+ break; | |
+ case EVENT_CHECK_ENRAGE: | |
+ if (me->HasAura(SPELL_ENRAGE)) | |
+ return; | |
+ if (me->GetPositionZ() < 24.0f) | |
+ DoCast(me, SPELL_ENRAGE, true); | |
+ events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5000); | |
+ break; | |
+ default: | |
+ break; | |
} | |
- else | |
- uiRagueTimer -= diff; | |
} | |
- if (uiSwarmerSpawnTimer <= diff) | |
- { | |
- DoCast(me, SPELL_SUMMON_SWARMERS, true); | |
- DoCast(me, SPELL_SUMMON_SWARMERS); | |
- if (urand(1, 3) == 3) // 33% chance of dialog | |
- Talk(SAY_EGG_SAC); | |
- | |
- uiSwarmerSpawnTimer = 10000; | |
- } | |
- else | |
- uiSwarmerSpawnTimer -= diff; | |
- | |
- if (!bGuardSpawned && uiGuardSpawnTimer <= diff) | |
+ if (me->HealthBelowPct(100 - AmountHealthModifier * 25)) | |
{ | |
Talk(EMOTE_HATCHES, me->GetGUID()); | |
DoCast(me, SPELL_SUMMON_SWARM_GUARD); | |
- bGuardSpawned = true; | |
+ ++AmountHealthModifier; | |
} | |
- else | |
- uiGuardSpawnTimer -= diff; | |
- | |
- if (uiEnrageTimer <= diff) | |
- { | |
- if (me->HasAura(SPELL_ENRAGE, 0)) | |
- return; | |
- | |
- float x, y, z, o; | |
- me->GetHomePosition(x, y, z, o); | |
- if (z < 24) | |
- if (!me->IsNonMeleeSpellCasted(false)) | |
- DoCast(me, SPELL_ENRAGE, true); | |
- | |
- uiEnrageTimer = 5000; | |
- } | |
- else | |
- uiEnrageTimer -= diff; | |
DoMeleeAttackIfReady(); | |
} | |
}; | |
@@ -192,67 +198,55 @@ class boss_elder_nadox : public CreatureScript | |
{ | |
return new boss_elder_nadoxAI(creature); | |
} | |
}; | |
-enum AddSpells | |
-{ | |
- SPELL_SPRINT = 56354, | |
- SPELL_GUARDIAN_AURA = 56151 | |
-}; | |
- | |
class mob_ahnkahar_nerubian : public CreatureScript | |
{ | |
public: | |
mob_ahnkahar_nerubian() : CreatureScript("mob_ahnkahar_nerubian") { } | |
struct mob_ahnkahar_nerubianAI : public ScriptedAI | |
{ | |
- mob_ahnkahar_nerubianAI(Creature* creature) : ScriptedAI(creature) | |
- { | |
- instance = creature->GetInstanceScript(); | |
- } | |
+ mob_ahnkahar_nerubianAI(Creature* creature) : ScriptedAI(creature) { } | |
- InstanceScript* instance; | |
- uint32 uiSprintTimer; | |
+ EventMap events; | |
void Reset() | |
{ | |
- if (me->GetEntry() == MOB_AHNKAHAR_GUARDIAN_ENTRY) | |
+ if (me->GetEntry() == NPC_AHNKAHAR_GUARDIAN) | |
DoCast(me, SPELL_GUARDIAN_AURA, true); | |
- uiSprintTimer = 10000; | |
+ | |
+ events.ScheduleEvent(EVENT_SPRINT, 13*IN_MILLISECONDS); | |
} | |
void JustDied(Unit* /*killer*/) | |
{ | |
- if (me->GetEntry() == MOB_AHNKAHAR_GUARDIAN_ENTRY) | |
- if (Creature* Nadox = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ELDER_NADOX))) | |
- Nadox->AI()->DoAction(ACTION_AHNKAHAR_GUARDIAN_DEAD); | |
+ if (me->GetEntry() == NPC_AHNKAHAR_GUARDIAN) | |
+ me->RemoveAurasDueToSpell(SPELL_GUARDIAN_AURA); | |
} | |
- void EnterCombat(Unit* /*who*/) {} | |
- | |
- void UpdateAI(uint32 const diff) | |
+ void UpdateAI(const uint32 diff) | |
{ | |
if (!UpdateVictim()) | |
return; | |
- if (me->GetEntry() == MOB_AHNKAHAR_GUARDIAN_ENTRY) | |
- me->RemoveAurasDueToSpell(SPELL_GUARDIAN_AURA); | |
+ events.Update(diff); | |
- if (instance) | |
- if (instance->GetData(DATA_ELDER_NADOX_EVENT) != IN_PROGRESS) | |
- me->DespawnOrUnsummon(); | |
+ if (me->HasUnitState(UNIT_STATE_CASTING)) | |
+ return; | |
- if (uiSprintTimer <= diff) | |
+ while (uint32 eventId = events.ExecuteEvent()) | |
{ | |
- DoCast(me, SPELL_SPRINT); | |
- uiSprintTimer = 25000; | |
+ switch (eventId) | |
+ { | |
+ case EVENT_SPRINT: | |
+ DoCast(me, SPELL_SPRINT); | |
+ events.ScheduleEvent(EVENT_SPRINT, 20*IN_MILLISECONDS); | |
+ break; | |
+ } | |
} | |
- else | |
- uiSprintTimer -= diff; | |
- | |
DoMeleeAttackIfReady(); | |
} | |
}; | |
CreatureAI* GetAI(Creature* creature) const | |
@@ -272,10 +266,11 @@ public: | |
mob_nadox_eggsAI(Creature* creature) : Scripted_NoMovementAI(creature) | |
{ | |
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); | |
creature->UpdateAllStats(); | |
} | |
+ | |
void Reset() {} | |
void EnterCombat(Unit* /*who*/) {} | |
void AttackStart(Unit* /*victim*/) {} | |
void MoveInLineOfSight(Unit* /*who*/) {} | |
void UpdateAI(const uint32 /*diff*/) {} | |
@@ -285,30 +280,70 @@ public: | |
{ | |
return new mob_nadox_eggsAI(creature); | |
} | |
}; | |
-class achievement_respect_your_elders : public AchievementCriteriaScript | |
+class GuardianCheck | |
{ | |
- public: | |
- achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders") {} | |
+public: | |
+ bool operator()(const WorldObject* target) const | |
+ { | |
+ if (target->GetEntry() == NPC_AHNKAHAR_GUARDIAN) | |
+ return true; | |
+ | |
+ return false; | |
+ } | |
+}; | |
- bool OnCheck(Player* /*player*/, Unit* target) | |
+class spell_elder_nadox_guardian : public SpellScriptLoader | |
+{ | |
+public: | |
+ spell_elder_nadox_guardian() : SpellScriptLoader("spell_elder_nadox_guardian") { } | |
+ | |
+ class spell_elder_nadox_guardian_SpellScript : public SpellScript | |
+ { | |
+ PrepareSpellScript(spell_elder_nadox_guardian_SpellScript); | |
+ | |
+ void FilterTargets(std::list<WorldObject*>& targets) | |
{ | |
- if (!target) | |
- return false; | |
+ targets.remove_if(GuardianCheck()); | |
+ } | |
+ | |
+ void Register() | |
+ { | |
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_elder_nadox_guardian_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); | |
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_elder_nadox_guardian_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY); | |
+ } | |
+ }; | |
+ | |
+ SpellScript* GetSpellScript() const | |
+ { | |
+ return new spell_elder_nadox_guardian_SpellScript(); | |
+ } | |
+}; | |
- if (Creature* Nadox = target->ToCreature()) | |
- if (Nadox->AI()->GetData(DATA_RESPECT_YOUR_ELDERS)) | |
- return true; | |
+class achievement_respect_your_elders : public AchievementCriteriaScript | |
+{ | |
+public: | |
+ achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders") {} | |
+ bool OnCheck(Player* /*player*/, Unit* target) | |
+ { | |
+ if (!target) | |
return false; | |
- } | |
+ | |
+ if (Creature* Nadox = target->ToCreature()) | |
+ if (Nadox->AI()->GetData(DATA_RESPECT_YOUR_ELDERS)) | |
+ return true; | |
+ | |
+ return false; | |
+ } | |
}; | |
void AddSC_boss_elder_nadox() | |
{ | |
- new boss_elder_nadox; | |
- new mob_ahnkahar_nerubian; | |
- new mob_nadox_eggs; | |
+ new boss_elder_nadox(); | |
+ new mob_ahnkahar_nerubian(); | |
+ new mob_nadox_eggs(); | |
+ new spell_elder_nadox_guardian(); | |
new achievement_respect_your_elders(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment