diff options
author | Malcrom <malcromdev@gmail.com> | 2013-12-22 14:41:37 -0330 |
---|---|---|
committer | Malcrom <malcromdev@gmail.com> | 2013-12-22 14:41:37 -0330 |
commit | 5055a8fde4f0423c1b5a8328a21ccae9db2ac619 (patch) | |
tree | 7d9a39bd98837212d0861519c30feb19aeacf446 | |
parent | bc9961ec5c96c174e494eb1813601429049271af (diff) |
Scripting/Bloodmaul Brute: CombatAI moved to cpp for quest 10512.
-rw-r--r-- | sql/updates/world/2013_12_22_05_world_misc.sql | 5 | ||||
-rw-r--r-- | src/server/scripts/Outland/zone_blades_edge_mountains.cpp | 344 |
2 files changed, 209 insertions, 140 deletions
diff --git a/sql/updates/world/2013_12_22_05_world_misc.sql b/sql/updates/world/2013_12_22_05_world_misc.sql new file mode 100644 index 00000000000..cf0734f0d6d --- /dev/null +++ b/sql/updates/world/2013_12_22_05_world_misc.sql @@ -0,0 +1,5 @@ +-- Bloodmaul Brute +SET @ENTRY := 19991; +UPDATE `creature_template` SET `AIName`='',`ScriptName`= 'npc_bloodmaul_brute' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=@ENTRY; diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index acc3317d7bd..31e4fd88cb5 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -24,7 +24,8 @@ SDCategory: Blade's Edge Mountains EndScriptData */ /* ContentData -npc_bladespire_ogre +npc_bloodmaul_brutebane +npc_bloodmaul_brute npc_nether_drake npc_daranelle npc_overseer_nuaar @@ -45,14 +46,173 @@ EndContentData */ #include "SpellAuras.h" #include "SpellAuraEffects.h" -//Support for quest: You're Fired! (10821) -bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five; +/*###### +## npc_bloodmaul_brutebane +######*/ + +enum Bloodmaul +{ + NPC_OGRE_BRUTE = 19995, + NPC_QUEST_CREDIT = 21241, + GO_KEG = 184315, + QUEST_GETTING_THE_BLADESPIRE_TANKED = 10512, + QUEST_BLADESPIRE_KEGGER = 10545 +}; + +class npc_bloodmaul_brutebane : public CreatureScript +{ +public: + npc_bloodmaul_brutebane() : CreatureScript("npc_bloodmaul_brutebane") { } + + struct npc_bloodmaul_brutebaneAI : public ScriptedAI + { + npc_bloodmaul_brutebaneAI(Creature* creature) : ScriptedAI(creature) + { + if (Creature* Ogre = me->FindNearestCreature(NPC_OGRE_BRUTE, 50, true)) + { + Ogre->SetReactState(REACT_DEFENSIVE); + Ogre->GetMotionMaster()->MovePoint(1, me->GetPositionX()-1, me->GetPositionY()+1, me->GetPositionZ()); + } + } + + uint64 OgreGUID; + + void Reset() OVERRIDE + { + OgreGUID = 0; + } -#define LEGION_OBELISK_ONE 185193 -#define LEGION_OBELISK_TWO 185195 -#define LEGION_OBELISK_THREE 185196 -#define LEGION_OBELISK_FOUR 185197 -#define LEGION_OBELISK_FIVE 185198 + void UpdateAI(uint32 /*diff*/) OVERRIDE { } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_bloodmaul_brutebaneAI(creature); + } +}; + +/*###### +## npc_bloodmaul_brute +######*/ + +enum BloodmaulBrute +{ + EVENT_CLEAVE = 1, + EVENT_DEBILITATING_STRIKE = 2, + SAY_AGGRO = 0, + SAY_DEATH = 1, + SAY_ENRAGE = 2, + SPELL_CLEAVE = 15496, + SPELL_DEBILITATING_STRIKE = 37577, + SPELL_ENRAGE = 8599, + QUEST_INTO_THE_SOULGRINDER = 11000 +}; + +class npc_bloodmaul_brute : public CreatureScript +{ +public: + npc_bloodmaul_brute() : CreatureScript("npc_bloodmaul_brute") { } + + struct npc_bloodmaul_bruteAI : public ScriptedAI + { + npc_bloodmaul_bruteAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + PlayerGUID = 0; + hp30 = false; + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + if (urand (0, 100) < 35) + Talk(SAY_AGGRO); + + events.ScheduleEvent(EVENT_CLEAVE, urand(9000,12000)); + events.ScheduleEvent(EVENT_DEBILITATING_STRIKE, 15000); + } + + void JustDied(Unit* killer) OVERRIDE + { + if (killer->ToPlayer()->GetQuestRewardStatus(QUEST_INTO_THE_SOULGRINDER)) + Talk(SAY_DEATH); + } + + void MoveInLineOfSight(Unit* who) OVERRIDE + { + if (!who || (!who->IsAlive())) + return; + + if (me->IsWithinDistInMap(who, 50.0f)) + { + if (who->GetTypeId() == TYPEID_PLAYER) + if (who->ToPlayer()->GetQuestStatus(QUEST_GETTING_THE_BLADESPIRE_TANKED) == QUEST_STATUS_INCOMPLETE + || who->ToPlayer()->GetQuestStatus(QUEST_BLADESPIRE_KEGGER) == QUEST_STATUS_INCOMPLETE) + PlayerGUID = who->GetGUID(); + } + } + + void MovementInform(uint32 /*type*/, uint32 id) OVERRIDE + { + if (id == 1) + { + if (GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20)) + Keg->Delete(); + + me->HandleEmoteCommand(7); + me->SetReactState(REACT_AGGRESSIVE); + me->GetMotionMaster()->MoveTargetedHome(); + + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); + Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); + if (player && Credit) + player->KilledMonster(Credit->GetCreatureTemplate(), Credit->GetGUID()); + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CLEAVE: + DoCast(me, SPELL_CLEAVE); + events.ScheduleEvent(EVENT_CLEAVE, urand(9000,12000)); + break; + case EVENT_DEBILITATING_STRIKE: + DoCastVictim(SPELL_DEBILITATING_STRIKE); + events.ScheduleEvent(EVENT_DEBILITATING_STRIKE, urand(18000,22000)); + break; + } + } + + if (!hp30 && HealthBelowPct(30)) + { + hp30 = true; + Talk(SAY_ENRAGE); + DoCast(me, SPELL_ENRAGE); + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap events; + uint64 PlayerGUID; + bool hp30; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_bloodmaul_bruteAI(creature); + } +}; /*###### ## npc_nether_drake @@ -85,11 +245,6 @@ class npc_nether_drake : public CreatureScript public: npc_nether_drake() : CreatureScript("npc_nether_drake") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_nether_drakeAI(creature); - } - struct npc_nether_drakeAI : public ScriptedAI { npc_nether_drakeAI(Creature* creature) : ScriptedAI(creature) { } @@ -233,6 +388,11 @@ public: DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_nether_drakeAI(creature); + } }; /*###### @@ -250,11 +410,6 @@ class npc_daranelle : public CreatureScript public: npc_daranelle() : CreatureScript("npc_daranelle") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_daranelleAI(creature); - } - struct npc_daranelleAI : public ScriptedAI { npc_daranelleAI(Creature* creature) : ScriptedAI(creature) { } @@ -279,6 +434,11 @@ public: ScriptedAI::MoveInLineOfSight(who); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_daranelleAI(creature); + } }; /*###### @@ -354,6 +514,20 @@ public: } }; +//Support for quest: You're Fired! (10821) +bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five; + +enum LegionObelisk +{ + GO_LEGION_OBELISK_ONE = 185193, + GO_LEGION_OBELISK_TWO = 185195, + GO_LEGION_OBELISK_THREE = 185196, + GO_LEGION_OBELISK_FOUR = 185197, + GO_LEGION_OBELISK_FIVE = 185198, + NPC_DOOMCRYER = 19963, + QUEST_YOURE_FIRED = 10821 +}; + /*###### ## go_legion_obelisk ######*/ @@ -365,30 +539,30 @@ public: bool OnGossipHello(Player* player, GameObject* go) OVERRIDE { - if (player->GetQuestStatus(10821) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_YOURE_FIRED) == QUEST_STATUS_INCOMPLETE) { switch (go->GetEntry()) { - case LEGION_OBELISK_ONE: + case GO_LEGION_OBELISK_ONE: obelisk_one = true; break; - case LEGION_OBELISK_TWO: + case GO_LEGION_OBELISK_TWO: obelisk_two = true; break; - case LEGION_OBELISK_THREE: + case GO_LEGION_OBELISK_THREE: obelisk_three = true; break; - case LEGION_OBELISK_FOUR: + case GO_LEGION_OBELISK_FOUR: obelisk_four = true; break; - case LEGION_OBELISK_FIVE: + case GO_LEGION_OBELISK_FIVE: obelisk_five = true; break; } if (obelisk_one == true && obelisk_two == true && obelisk_three == true && obelisk_four == true && obelisk_five == true) { - go->SummonCreature(19963, 2943.40f, 4778.20f, 284.49f, 0.94f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + go->SummonCreature(NPC_DOOMCRYER, 2943.40f, 4778.20f, 284.49f, 0.94f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); //reset global var obelisk_one = false; obelisk_two = false; @@ -403,117 +577,6 @@ public: }; /*###### -## npc_bloodmaul_brutebane -######*/ - -enum Bloodmaul -{ - NPC_OGRE_BRUTE = 19995, - NPC_QUEST_CREDIT = 21241, - GO_KEG = 184315, - QUEST_GETTING_THE_BLADESPIRE_TANKED = 10512, - QUEST_BLADESPIRE_KEGGER = 10545, -}; - -class npc_bloodmaul_brutebane : public CreatureScript -{ -public: - npc_bloodmaul_brutebane() : CreatureScript("npc_bloodmaul_brutebane") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_bloodmaul_brutebaneAI(creature); - } - - struct npc_bloodmaul_brutebaneAI : public ScriptedAI - { - npc_bloodmaul_brutebaneAI(Creature* creature) : ScriptedAI(creature) - { - if (Creature* Ogre = me->FindNearestCreature(NPC_OGRE_BRUTE, 50, true)) - { - Ogre->SetReactState(REACT_DEFENSIVE); - Ogre->GetMotionMaster()->MovePoint(1, me->GetPositionX()-1, me->GetPositionY()+1, me->GetPositionZ()); - } - } - - uint64 OgreGUID; - - void Reset() OVERRIDE - { - OgreGUID = 0; - } - - void UpdateAI(uint32 /*uiDiff*/) OVERRIDE { } - }; -}; - -/*###### -## npc_ogre_brute -######*/ - -class npc_ogre_brute : public CreatureScript -{ -public: - npc_ogre_brute() : CreatureScript("npc_ogre_brute") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_ogre_bruteAI(creature); - } - - struct npc_ogre_bruteAI : public ScriptedAI - { - npc_ogre_bruteAI(Creature* creature) : ScriptedAI(creature) { } - - uint64 PlayerGUID; - - void Reset() OVERRIDE - { - PlayerGUID = 0; - } - - void MoveInLineOfSight(Unit* who) OVERRIDE - { - if (!who || (!who->IsAlive())) - return; - - if (me->IsWithinDistInMap(who, 50.0f)) - { - if (who->GetTypeId() == TYPEID_PLAYER) - if (who->ToPlayer()->GetQuestStatus(QUEST_GETTING_THE_BLADESPIRE_TANKED) == QUEST_STATUS_INCOMPLETE - || who->ToPlayer()->GetQuestStatus(QUEST_BLADESPIRE_KEGGER) == QUEST_STATUS_INCOMPLETE) - PlayerGUID = who->GetGUID(); - } - } - - void MovementInform(uint32 /*type*/, uint32 id) OVERRIDE - { - if (id == 1) - { - if (GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20)) - Keg->Delete(); - - me->HandleEmoteCommand(7); - me->SetReactState(REACT_AGGRESSIVE); - me->GetMotionMaster()->MoveTargetedHome(); - - Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); - Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); - if (player && Credit) - player->KilledMonster(Credit->GetCreatureTemplate(), Credit->GetGUID()); - } - } - - void UpdateAI(uint32 /*diff*/) OVERRIDE - { - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); - } - }; -}; - -/*###### ## go_thunderspike ######*/ @@ -1123,6 +1186,7 @@ class go_apexis_relic : public GameObjectScript enum ScannerMasterBunny { NPC_OSCILLATING_FREQUENCY_SCANNER_TOP_BUNNY = 21759, + GO_OSCILLATING_FREQUENCY_SCANNER = 184926, SPELL_OSCILLATION_FIELD = 37408, QUEST_GAUGING_THE_RESONANT_FREQUENCY = 10594 }; @@ -1143,8 +1207,8 @@ public: else { // Spell 37392 does not exist in dbc, manually spawning - me->SummonCreature(21759, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 0.5f, me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 50000); - me->SummonGameObject(184926, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 50000); + me->SummonCreature(NPC_OSCILLATING_FREQUENCY_SCANNER_TOP_BUNNY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 0.5f, me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 50000); + me->SummonGameObject(GO_OSCILLATING_FREQUENCY_SCANNER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 50000); me->DespawnOrUnsummon(50000); } @@ -1211,13 +1275,13 @@ class spell_oscillating_field : public SpellScriptLoader void AddSC_blades_edge_mountains() { + new npc_bloodmaul_brutebane(); + new npc_bloodmaul_brute(); new npc_nether_drake(); new npc_daranelle(); new npc_overseer_nuaar(); new npc_saikkal_the_elder(); new go_legion_obelisk(); - new npc_bloodmaul_brutebane(); - new npc_ogre_brute(); new go_thunderspike(); new npc_simon_bunny(); new go_simon_cluster(); |