diff options
author | Lopin <davca.hr@seznam.cz> | 2011-06-23 10:19:43 +0200 |
---|---|---|
committer | Lopin <davca.hr@seznam.cz> | 2011-06-23 10:19:43 +0200 |
commit | 90a34fdc0644a6165bdd2dc9dcf2adf87e74807a (patch) | |
tree | 6438850d2122fe0ac3b4def8ea1ab6f7a62ac971 /src | |
parent | 9a5279079aecfc339087a340a1be20e18af157eb (diff) |
Scripts/Drak'Tharon Keep: Properly fixed achievement King Dred and small cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp | 353 |
1 files changed, 190 insertions, 163 deletions
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp index 55d93f6997d..36b5a133905 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp @@ -22,7 +22,7 @@ #include "ScriptPCH.h" #include "drak_tharon_keep.h" -enum eSpells +enum Spells { SPELL_BELLOWING_ROAR = 22686, // fears the group, can be resisted/dispelled SPELL_GRIEVOUS_BITE = 48920, @@ -35,240 +35,267 @@ enum eSpells SPELL_REND = 13738 }; -enum eArchivements -{ - ACHIEV_BETTER_OFF_DRED = 2039 -}; - enum Creatures { NPC_RAPTOR_1 = 26641, NPC_RAPTOR_2 = 26628 }; +#define ACTION_RAPTOR_KILLED 1 +#define DATA_KING_DRED 2 + class boss_dred : public CreatureScript { -public: - boss_dred() : CreatureScript("boss_dred") { } + public: + boss_dred() : CreatureScript("boss_dred") { } - struct boss_dredAI : public ScriptedAI - { - boss_dredAI(Creature *c) : ScriptedAI(c) + struct boss_dredAI : public ScriptedAI { - pInstance = c->GetInstanceScript(); - } + boss_dredAI(Creature* creature) : ScriptedAI(creature) + { + instance = me->GetInstanceScript(); + } - uint32 uiBellowingRoarTimer; - uint32 uiGrievousBiteTimer; - uint32 uiManglingSlashTimer; - uint32 uiFearsomeRoarTimer; - uint32 uiPiercingSlashTimer; - uint32 uiRaptorCallTimer; + uint32 uiBellowingRoarTimer; + uint32 uiGrievousBiteTimer; + uint32 uiManglingSlashTimer; + uint32 uiFearsomeRoarTimer; + uint32 uiPiercingSlashTimer; + uint32 uiRaptorCallTimer; + uint8 raptorsKilled; - InstanceScript* pInstance; + InstanceScript* instance; - void Reset() - { - if (pInstance) + void Reset() { - pInstance->SetData(DATA_DRED_EVENT, NOT_STARTED); - pInstance->SetData(DATA_KING_DRED_ACHIEV, 0); + if (instance) + instance->SetData(DATA_DRED_EVENT, NOT_STARTED); + + uiBellowingRoarTimer = 33000; + uiGrievousBiteTimer = 20000; + uiManglingSlashTimer = 18500; + uiFearsomeRoarTimer = urand(10000, 20000); + uiPiercingSlashTimer = 17000; + uiRaptorCallTimer = urand(20000, 25000); } - uiBellowingRoarTimer = 33*IN_MILLISECONDS; - uiGrievousBiteTimer = 20*IN_MILLISECONDS; - uiManglingSlashTimer = 18500; - uiFearsomeRoarTimer = urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS); - uiPiercingSlashTimer = 17*IN_MILLISECONDS; - uiRaptorCallTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } + void EnterCombat(Unit* /*who*/) + { + if (instance) + instance->SetData(DATA_DRED_EVENT, IN_PROGRESS); + } - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_DRED_EVENT, IN_PROGRESS); - } + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (uiBellowingRoarTimer <= diff) + { + DoCastAOE(SPELL_BELLOWING_ROAR, false); + uiBellowingRoarTimer = 40000; + } + else + uiBellowingRoarTimer -=diff; - if (uiBellowingRoarTimer < diff) - { - DoCastAOE(SPELL_BELLOWING_ROAR, false); - uiBellowingRoarTimer = 40*IN_MILLISECONDS; - } else uiBellowingRoarTimer -=diff; + if (uiGrievousBiteTimer <= diff) + { + DoCastVictim(SPELL_GRIEVOUS_BITE , false); + uiGrievousBiteTimer = 20000; + } + else + uiGrievousBiteTimer -= diff; - if (uiGrievousBiteTimer < diff) - { - DoCastVictim(SPELL_GRIEVOUS_BITE , false); - uiGrievousBiteTimer = 20*IN_MILLISECONDS; - } else uiGrievousBiteTimer -=diff; + if (uiManglingSlashTimer <= diff) + { + DoCastVictim(SPELL_MANGLING_SLASH, false); + uiManglingSlashTimer = 20000; + } + else + uiManglingSlashTimer -= diff; - if (uiManglingSlashTimer < diff) - { - DoCastVictim(SPELL_MANGLING_SLASH, false); - uiManglingSlashTimer = 20*IN_MILLISECONDS; - } else uiManglingSlashTimer -=diff; + if (uiFearsomeRoarTimer <= diff) + { + DoCastAOE(SPELL_FEARSOME_ROAR, false); + uiFearsomeRoarTimer = urand(16000, 18000); + } + else + uiFearsomeRoarTimer -= diff; - if (uiFearsomeRoarTimer < diff) - { - DoCastAOE(SPELL_FEARSOME_ROAR, false); - uiFearsomeRoarTimer = urand(16*IN_MILLISECONDS, 18*IN_MILLISECONDS); - } else uiFearsomeRoarTimer -=diff; + if (uiPiercingSlashTimer <= diff) + { + DoCastVictim(SPELL_PIERCING_SLASH, false); + uiPiercingSlashTimer = 20000; + } + else + uiPiercingSlashTimer -= diff; - if (uiPiercingSlashTimer < diff) - { - DoCastVictim(SPELL_PIERCING_SLASH, false); - uiPiercingSlashTimer = 20*IN_MILLISECONDS; - } else uiPiercingSlashTimer -=diff; + if (uiRaptorCallTimer <= diff) + { + DoCastVictim(SPELL_RAPTOR_CALL, false); - if (uiRaptorCallTimer < diff) - { - DoCastVictim(SPELL_RAPTOR_CALL, false); + float x, y, z; - float x, y, z; + me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 10.0f); + me->SummonCreature(RAND(NPC_RAPTOR_1, NPC_RAPTOR_2), x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000); - me->GetClosePoint(x, y, z, me->GetObjectSize()/3, 10.0f); - me->SummonCreature(RAND(NPC_RAPTOR_1, NPC_RAPTOR_2), x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1*IN_MILLISECONDS); + uiRaptorCallTimer = urand(20000, 25000); + } + else + uiRaptorCallTimer -= diff; - uiRaptorCallTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else uiRaptorCallTimer -=diff; + DoMeleeAttackIfReady(); + } - DoMeleeAttackIfReady(); - } + void DoAction(int32 const action) + { + if (action == ACTION_RAPTOR_KILLED) + ++raptorsKilled; + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + uint32 GetData(uint32 type) { - pInstance->SetData(DATA_DRED_EVENT, DONE); + if (type == DATA_KING_DRED) + return raptorsKilled; - if (IsHeroic() && pInstance->GetData(DATA_KING_DRED_ACHIEV) == 6) - pInstance->DoCompleteAchievement(ACHIEV_BETTER_OFF_DRED); + return 0; } - } - }; - CreatureAI *GetAI(Creature *creature) const - { - return new boss_dredAI(creature); - } + void JustDied(Unit* /*who*/) + { + if (instance) + instance->SetData(DATA_DRED_EVENT, DONE); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_dredAI(creature); + } }; class npc_drakkari_gutripper : public CreatureScript { -public: - npc_drakkari_gutripper() : CreatureScript("npc_drakkari_gutripper") { } + public: + npc_drakkari_gutripper() : CreatureScript("npc_drakkari_gutripper") { } - struct npc_drakkari_gutripperAI : public ScriptedAI - { - npc_drakkari_gutripperAI(Creature *c) : ScriptedAI(c) + struct npc_drakkari_gutripperAI : public ScriptedAI { - pInstance = c->GetInstanceScript(); - } - - InstanceScript* pInstance; - - uint32 GutRipTimer; + npc_drakkari_gutripperAI(Creature* creature) : ScriptedAI(creature) + { + instance = me->GetInstanceScript(); + } - void Reset() - { - GutRipTimer = urand(10000, 15000); - } + InstanceScript* instance; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 GutRipTimer; - if (GutRipTimer < diff) + void Reset() { - DoCastVictim(SPELL_GUT_RIP, false); GutRipTimer = urand(10000, 15000); - }else GutRipTimer -=diff; - - DoMeleeAttackIfReady(); - } + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void UpdateAI(uint32 const diff) { - if (IsHeroic() && pInstance->GetData(DATA_DRED_EVENT) == IN_PROGRESS && pInstance->GetData(DATA_KING_DRED_ACHIEV) < 6) + if (!UpdateVictim()) + return; + + if (GutRipTimer <= diff) { - pInstance->SetData(DATA_KING_DRED_ACHIEV, pInstance->GetData(DATA_KING_DRED_ACHIEV) + 1); + DoCastVictim(SPELL_GUT_RIP, false); + GutRipTimer = urand(10000, 15000); } + else + GutRipTimer -= diff; + + DoMeleeAttackIfReady(); } - } - }; - CreatureAI *GetAI(Creature *creature) const - { - return new npc_drakkari_gutripperAI(creature); - } + void JustDied(Unit* /*who*/) + { + if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED))) + Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_drakkari_gutripperAI(creature); + } }; class npc_drakkari_scytheclaw : public CreatureScript { -public: - npc_drakkari_scytheclaw() : CreatureScript("npc_drakkari_scytheclaw") { } + public: + npc_drakkari_scytheclaw() : CreatureScript("npc_drakkari_scytheclaw") { } - struct npc_drakkari_scytheclawAI : public ScriptedAI - { - npc_drakkari_scytheclawAI(Creature *c) : ScriptedAI(c) + struct npc_drakkari_scytheclawAI : public ScriptedAI { - pInstance = c->GetInstanceScript(); - } + npc_drakkari_scytheclawAI(Creature* creature) : ScriptedAI(creature) + { + instance = me->GetInstanceScript(); + } - InstanceScript* pInstance; + InstanceScript* instance; - uint32 uiRendTimer; + uint32 uiRendTimer; - void Reset() - { - uiRendTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } + void Reset() + { + uiRendTimer = urand(10000, 15000); + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; - if (uiRendTimer < diff) + if (uiRendTimer <= diff) + { + DoCastVictim(SPELL_REND, false); + uiRendTimer = urand(10000, 15000); + } + else + uiRendTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*who*/) { - DoCastVictim(SPELL_REND, false); - uiRendTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - }else uiRendTimer -=diff; + if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED))) + Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); + } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new npc_drakkari_scytheclawAI(creature); } +}; - void JustDied(Unit* /*killer*/) +class achievement_king_dred : public AchievementCriteriaScript +{ + public: + achievement_king_dred() : AchievementCriteriaScript("achievement_king_dred") { - if (pInstance) - { - if (IsHeroic() && pInstance->GetData(DATA_DRED_EVENT) == IN_PROGRESS && pInstance->GetData(DATA_KING_DRED_ACHIEV) < 6) - { - pInstance->SetData(DATA_KING_DRED_ACHIEV, pInstance->GetData(DATA_KING_DRED_ACHIEV) + 1); - } - } } - }; - CreatureAI *GetAI(Creature *creature) const - { - return new npc_drakkari_scytheclawAI(creature); - } + bool OnCheck(Player* /*player*/, Unit* target) + { + sLog->outString("OnCheck()"); + if (Creature* Dred = target->ToCreature()) + if (Dred->AI()->GetData(DATA_KING_DRED) >= 6) + return true; + + return false; + } }; void AddSC_boss_dred() { + new boss_dred; new npc_drakkari_gutripper; new npc_drakkari_scytheclaw; - new boss_dred; + new achievement_king_dred(); } |