diff options
author | kaelima <jeppo_meyer@msn.com> | 2011-05-13 00:15:32 +0200 |
---|---|---|
committer | kaelima <jeppo_meyer@msn.com> | 2011-05-13 00:15:32 +0200 |
commit | 82dcb31eeec24b4be24243b5e95164305759efa7 (patch) | |
tree | 9e07fb8552339bb42cd561703402c2c6e1119e64 | |
parent | 6b794f65f30323a66689c3a76f67c1a87c098ced (diff) |
Scripts/Doomlord Kazzak: Fix spell Mark of Kazzak, further cleanup and fix sqls added with this commit.
4 files changed, 94 insertions, 52 deletions
diff --git a/sql/updates/world/2011_05_12_09_world_creature_text.sql b/sql/updates/world/2011_05_12_09_world_creature_text.sql deleted file mode 100644 index f63c3ed3e63..00000000000 --- a/sql/updates/world/2011_05_12_09_world_creature_text.sql +++ /dev/null @@ -1,14 +0,0 @@ -DELETE FROM `creature_text` WHERE `entry` IN (18728); -INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`sound`,`language`,`probability`,`emote`,`duration`,`comment`) VALUES -(18728,0,0,'I remember well the sting of defeat at the conclusion of the Third War. I have waited far too long for my revenge. Now the shadow of the Legion falls over this world. It is only a matter of time until all of your failed creation... is undone.',1,11332,'kazzak SAY_INTRO'), -(18728,1,0,'The Legion will conquer all!',1,11333,'kazzak SAY_AGGRO1'), -(18728,1,1,'All mortals will perish!',1,11334,'kazzak SAY_AGGRO2'), -(18728,2,0,'All life must be eradicated!',1,11335,'kazzak SAY_SURPREME1'), -(18728,2,1,'I''ll rip the flesh from your bones!',1,11336,'kazzak SAY_SURPREME2'), -(18728,3,0,'Kirel Narak!',1,11337,'kazzak SAY_KILL1'), -(18728,3,1,'Contemptible wretch!',1,11338,'kazzak SAY_KILL2'), -(18728,3,2,'The universe will be remade.',1,11339,'kazzak SAY_KILL3'), -(18728,4,0,'The Legion... will never... fall.',1,11340,'kazzak SAY_DEATH'), -(18728,5,0,'%s goes into a frenzy!',2,0,'kazzak EMOTE_FRENZY'), -(18728,6,0,'Invaders, you dangle upon the precipice of oblivion! The Burning Legion comes and with it comes your end.',1,0,'kazzak SAY_RAND1'), -(18728,6,1,'Impudent whelps, you only delay the inevitable. Where one has fallen, ten shall rise. Such is the will of Kazzak...',1,0,'kazzak SAY_RAND2'); diff --git a/sql/updates/world/2011_05_12_14_world_creature_text.sql b/sql/updates/world/2011_05_12_14_world_creature_text.sql new file mode 100644 index 00000000000..a370289ae3e --- /dev/null +++ b/sql/updates/world/2011_05_12_14_world_creature_text.sql @@ -0,0 +1,15 @@ +DELETE FROM `script_texts` WHERE `npc_entry` IN (10427,20129); +DELETE FROM `creature_text` WHERE `entry`=18728; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`sound`,`comment`) VALUES +(18728,0,0, 'I remember well the sting of defeat at the conclusion of the Third War. I have waited far too long for my revenge. Now the shadow of the Legion falls over this world. It is only a matter of time until all of your failed creation... is undone.',1,11332,'kazzak SAY_INTRO'), +(18728,1,0, 'The Legion will conquer all!',1,11333,'kazzak SAY_AGGRO1'), +(18728,1,1, 'All mortals will perish!',1,11334,'kazzak SAY_AGGRO2'), +(18728,2,0, 'All life must be eradicated!',1,11335,'kazzak SAY_SURPREME1'), +(18728,2,1, 'I''ll rip the flesh from your bones!',1,11336,'kazzak SAY_SURPREME2'), +(18728,3,0, 'Kirel Narak!',1,11337,'kazzak SAY_KILL1'), +(18728,3,1, 'Contemptible wretch!',1,11338,'kazzak SAY_KILL2'), +(18728,3,2, 'The universe will be remade.',1,11339,'kazzak SAY_KILL3'), +(18728,4,0, 'The Legion... will never... fall.',1,11340,'kazzak SAY_DEATH'), +(18728,5,0, '%s goes into a frenzy!',2,0,'kazzak EMOTE_FRENZY'), +(18728,6,0, 'Invaders, you dangle upon the precipice of oblivion! The Burning Legion comes and with it comes your end.',1,0,'kazzak SAY_RAND1'), +(18728,6,1, 'Impudent whelps, you only delay the inevitable. Where one has fallen, ten shall rise. Such is the will of Kazzak...',1,0,'kazzak SAY_RAND2'); diff --git a/sql/updates/world/2011_05_12_15_world_spell_script_names.sql b/sql/updates/world/2011_05_12_15_world_spell_script_names.sql new file mode 100644 index 00000000000..92072afc0d6 --- /dev/null +++ b/sql/updates/world/2011_05_12_15_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=32960 AND `ScriptName`= 'spell_doomlord_kazzak_mark_of_kazzak'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(32960, 'spell_doomlord_kazzak_mark_of_kazzak'); diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 20512a448b6..101fbe549bd 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -16,13 +16,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Doomlord_Kazzak -SD%Complete: 70 -SDComment: Using incorrect spell for Mark of Kazzak -SDCategory: Hellfire Peninsula -EndScriptData */ - #include "ScriptPCH.h" enum Yells @@ -43,12 +36,13 @@ enum Spells SPELL_THUNDERCLAP = 36706, SPELL_VOIDBOLT = 39329, SPELL_MARKOFKAZZAK = 32960, + SPELL_MARKOFKAZZAK_DAMAGE = 32961, SPELL_ENRAGE = 32964, SPELL_CAPTURESOUL = 32966, SPELL_TWISTEDREFLECTION = 21063 }; -enum Events +enum _events { EVENT_SHADOW_VOLLEY = 1, EVENT_CLEAVE = 2, @@ -72,14 +66,14 @@ class boss_doomlord_kazzak : public CreatureScript void Reset() { - events.Reset(); - events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(6000, 10000)); - events.ScheduleEvent(EVENT_CLEAVE, 7000); - events.ScheduleEvent(EVENT_THUNDERCLAP, urand(14000, 18000)); - events.ScheduleEvent(EVENT_VOIDBOLT, 30000); - events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 25000); - events.ScheduleEvent(EVENT_ENRAGE, 60000); - events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 33000); + _events.Reset(); + _events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(6000, 10000)); + _events.ScheduleEvent(EVENT_CLEAVE, 7000); + _events.ScheduleEvent(EVENT_THUNDERCLAP, urand(14000, 18000)); + _events.ScheduleEvent(EVENT_VOIDBOLT, 30000); + _events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 25000); + _events.ScheduleEvent(EVENT_ENRAGE, 60000); + _events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 33000); } void JustRespawned() @@ -87,7 +81,7 @@ class boss_doomlord_kazzak : public CreatureScript Talk(SAY_INTRO); } - void EnterCombat(Unit * /*who*/) + void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); } @@ -103,78 +97,122 @@ class boss_doomlord_kazzak : public CreatureScript Talk(SAY_KILL); } - void JustDied(Unit * /*victim*/) + void JustDied(Unit* /*victim*/) { Talk(SAY_DEATH); } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { - //Return since we have no target + // Return since we have no target if (!UpdateVictim()) return; - - events.Update(diff); + + _events.Update(diff); if (me->HasUnitState(UNIT_STAT_CASTING)) return; - - while (uint32 eventId = events.ExecuteEvent()) + + while (uint32 eventId = _events.ExecuteEvent()) { switch(eventId) { case EVENT_SHADOW_VOLLEY: DoCastVictim(SPELL_SHADOWVOLLEY); - events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(4000, 6000)); + _events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(4000, 6000)); break; case EVENT_CLEAVE: DoCastVictim(SPELL_CLEAVE); - events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 12000)); + _events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 12000)); break; case EVENT_THUNDERCLAP: DoCastVictim(SPELL_THUNDERCLAP); - events.ScheduleEvent(EVENT_THUNDERCLAP, urand(10000, 14000)); + _events.ScheduleEvent(EVENT_THUNDERCLAP, urand(10000, 14000)); break; case EVENT_VOIDBOLT: DoCastVictim(SPELL_VOIDBOLT); - events.ScheduleEvent(EVENT_VOIDBOLT, urand(15000, 18000)); + _events.ScheduleEvent(EVENT_VOIDBOLT, urand(15000, 18000)); break; case EVENT_MARK_OF_KAZZAK: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) if (target->GetPower(POWER_MANA)) DoCast(target, SPELL_MARKOFKAZZAK); - events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 20000); + _events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 20000); break; case EVENT_ENRAGE: Talk(EMOTE_FRENZY); DoCast(me, SPELL_ENRAGE); - events.ScheduleEvent(EVENT_ENRAGE, 30000); + _events.ScheduleEvent(EVENT_ENRAGE, 30000); break; case EVENT_TWISTED_REFLECTION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_TWISTEDREFLECTION); - events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 15000); + std::list<Unit*> targetList; + { + const std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA) + targetList.push_back((*itr)->getTarget()); + } + + std::list<Unit*>::iterator itr = targetList.begin(); + advance(itr, urand(0, targetList.size()-1)); + DoCast(*itr, SPELL_TWISTEDREFLECTION); + _events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 15000); break; default: break; } } - + DoMeleeAttackIfReady(); } private: - EventMap events; - + EventMap _events; }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_doomlordkazzakAI (creature); } }; +class spell_doomlord_kazzak_mark_of_kazzak : public SpellScriptLoader +{ + public: + spell_doomlord_kazzak_mark_of_kazzak() : SpellScriptLoader("spell_doomlord_kazzak_mark_of_kazzak") { } + + class spell_doomlord_kazzak_mark_of_kazzak_AuraScript : public AuraScript + { + PrepareAuraScript(spell_doomlord_kazzak_mark_of_kazzak_AuraScript); + + void HandlePeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + + int32 curmana = GetHitUnit()->GetPower(POWER_MANA); + int32 maxmana = GetHitUnit()->GetMaxPower(POWER_MANA); + + // If mana is above 5 procent, drain. Otherwise cast 32961 (player on self with Doomlord Kazzak as casterguid) + if (curmana * 100 > maxmana * 5) + GetHitUnit()->ModifyPower(POWER_MANA, -5); + else + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_MARKOFKAZZAK_DAMAGE, true, NULL, NULL, GetCasterGUID()); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_doomlord_kazzak_mark_of_kazzak_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_doomlord_kazzak_mark_of_kazzak_AuraScript(); + } +}; + void AddSC_boss_doomlordkazzak() { new boss_doomlord_kazzak(); + new spell_doomlord_kazzak_mark_of_kazzak(); } |