diff options
| author | jackpoz <giacomopoz@gmail.com> | 2014-09-20 20:16:00 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2014-09-20 20:21:54 +0200 |
| commit | b5e3535dbf9032bab06a1dc35201d2db72d265d6 (patch) | |
| tree | b79fe2c146f3510d401bb521ea87ac331f8c5bc7 /src/server/scripts/Outland/Auchindoun | |
| parent | 53dbab809f1df35e051ad5ab52f5adf1929f376b (diff) | |
Core/Misc: Refactor scripts to fix static analysis warnings
Sixth batch of fixes targeting 100 issues reported by Coverity
Diffstat (limited to 'src/server/scripts/Outland/Auchindoun')
5 files changed, 91 insertions, 28 deletions
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 1cfd7a23f39..99cda91b866 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -318,13 +318,21 @@ public: struct npc_avatar_of_martyredAI : public ScriptedAI { - npc_avatar_of_martyredAI(Creature* creature) : ScriptedAI(creature) { } + npc_avatar_of_martyredAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Mortal_Strike_timer = 10000; + } uint32 Mortal_Strike_timer; void Reset() override { - Mortal_Strike_timer = 10000; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index 9a94096c2de..b354df9d63a 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -62,6 +62,16 @@ public: { boss_shirrak_the_dead_watcherAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + } + + void Initialize() + { + Inhibitmagic_Timer = 0; + Attractmagic_Timer = 28000; + Carnivorousbite_Timer = 10000; + FocusFire_Timer = 17000; + FocusedTargetGUID.Clear(); } uint32 Inhibitmagic_Timer; @@ -73,11 +83,7 @@ public: void Reset() override { - Inhibitmagic_Timer = 0; - Attractmagic_Timer = 28000; - Carnivorousbite_Timer = 10000; - FocusFire_Timer = 17000; - FocusedTargetGUID.Clear(); + Initialize(); } void EnterCombat(Unit* /*who*/) override @@ -174,6 +180,13 @@ public: { npc_focus_fireAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + } + + void Initialize() + { + FieryBlast_Timer = 3000 + (rand32() % 1000); + fiery1 = fiery2 = true; } uint32 FieryBlast_Timer; @@ -181,8 +194,7 @@ public: void Reset() override { - FieryBlast_Timer = 3000 + (rand32() % 1000); - fiery1 = fiery2 = true; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index 67cc6b99e93..5f6fde8ad98 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -78,7 +78,22 @@ public: struct boss_nexusprince_shaffarAI : public ScriptedAI { - boss_nexusprince_shaffarAI(Creature* creature) : ScriptedAI(creature), summons(me) { HasTaunted = false; } + boss_nexusprince_shaffarAI(Creature* creature) : ScriptedAI(creature), summons(me) + { + Initialize(); + HasTaunted = false; + } + + void Initialize() + { + Blink_Timer = 1500; + Beacon_Timer = 10000; + FireBall_Timer = 8000; + Frostbolt_Timer = 4000; + FrostNova_Timer = 15000; + + CanBlink = false; + } uint32 Blink_Timer; uint32 Beacon_Timer; @@ -93,13 +108,7 @@ public: void Reset() override { - Blink_Timer = 1500; - Beacon_Timer = 10000; - FireBall_Timer = 8000; - Frostbolt_Timer = 4000; - FrostNova_Timer = 15000; - - CanBlink = false; + Initialize(); float dist = 8.0f; float posX, posY, posZ, angle; @@ -241,6 +250,14 @@ public: { npc_ethereal_beaconAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + } + + void Initialize() + { + Apprentice_Timer = DUNGEON_MODE(20000, 10000); + ArcaneBolt_Timer = 1000; + Check_Timer = 1000; } uint32 Apprentice_Timer; @@ -254,9 +271,7 @@ public: void Reset() override { - Apprentice_Timer = DUNGEON_MODE(20000, 10000); - ArcaneBolt_Timer = 1000; - Check_Timer = 1000; + Initialize(); } void EnterCombat(Unit* who) override @@ -331,7 +346,16 @@ public: struct npc_ethereal_apprenticeAI : public ScriptedAI { - npc_ethereal_apprenticeAI(Creature* creature) : ScriptedAI(creature) { } + npc_ethereal_apprenticeAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + Cast_Timer = 3000; + isFireboltTurn = true; + } uint32 Cast_Timer; @@ -339,8 +363,7 @@ public: void Reset() override { - Cast_Timer = 3000; - isFireboltTurn = true; + Initialize(); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp index 1787933143c..e2d6bee85ca 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp @@ -67,14 +67,22 @@ class boss_anzu : public CreatureScript struct boss_anzuAI : public BossAI { - boss_anzuAI(Creature* creature) : BossAI(creature, DATA_ANZU) { } + boss_anzuAI(Creature* creature) : BossAI(creature, DATA_ANZU) + { + Initialize(); + } + + void Initialize() + { + _under33Percent = false; + _under66Percent = false; + } void Reset() override { //_Reset(); events.Reset(); - _under33Percent = false; - _under66Percent = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index b3aac6becc4..109174f5807 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -86,13 +86,19 @@ class boss_grandmaster_vorpil : public CreatureScript { boss_grandmaster_vorpilAI(Creature* creature) : BossAI(creature, DATA_GRANDMASTER_VORPIL) { + Initialize(); _intro = false; } + void Initialize() + { + _helpYell = false; + } + void Reset() override { _Reset(); - _helpYell = false; + Initialize(); } void SummonPortals() @@ -223,15 +229,21 @@ class npc_voidtraveler : public CreatureScript { npc_voidtravelerAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); _instance = creature->GetInstanceScript(); } - void Reset() override + void Initialize() { _moveTimer = 0; _sacrificed = false; } + void Reset() override + { + Initialize(); + } + void EnterCombat(Unit* /*who*/) override { } void UpdateAI(uint32 diff) override |
