From 7b7327acdcbeadc5ec509da4520190205d640f52 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sun, 16 Jan 2011 15:12:51 -0300 Subject: [PATCH] Core/Scripts: Fixed issues with Drakkari Colossus/Elemental after recent changes. --- .../Gundrak/boss_drakkari_colossus.cpp | 57 +++++++++++++------ 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 193f8c6cb4cde..8b1813d6857cc 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -25,7 +25,7 @@ enum Spells { SPELL_EMERGE = 54850, - SPELL_ELEMENTAL_SPAWN_EFEFCT = 54888, + SPELL_ELEMENTAL_SPAWN_EFFECT = 54888, SPELL_MOJO_VOLLEY = 54849, SPELL_SURGE_VISUAL = 54827, SPELL_MERGE = 54878, @@ -92,6 +92,8 @@ class boss_drakkari_colossus : public CreatureScript void Reset() { + _Reset(); + if (GetData(DATA_INTRO_DONE)) { me->SetReactState(REACT_AGGRESSIVE); @@ -99,29 +101,42 @@ class boss_drakkari_colossus : public CreatureScript me->RemoveAura(SPELL_FREEZE_ANIM); } - events.Reset(); + //events.Reset(); -> done in _Reset(); events.ScheduleEvent(EVENT_MIGHTY_BLOW, urand(10000,30000)); phase = COLOSSUS_PHASE_NORMAL; - instance->SetBossState(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED); + + // Note: This should not be called, but before use SetBossState function we should use BossAI + // in all the bosses of the instance + instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) { - instance->SetBossState(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS); - + _EnterCombat(); + me->RemoveAura(SPELL_FREEZE_ANIM); + + // Note: This should not be called, but before use SetBossState function we should use BossAI + // in all the bosses of the instance + instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS); } void JustDied(Unit* /*killer*/) { - instance->SetBossState(DATA_DRAKKARI_COLOSSUS_EVENT, DONE); + _JustDied(); + + // Note: This should not be called, but before use SetBossState function we should use BossAI + // in all the bosses of the instance + instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, DONE); } void JustReachedHome() { - instance->SetBossState(DATA_DRAKKARI_COLOSSUS_EVENT, FAIL); + // Note: This should not be called, but before use SetBossState function we should use BossAI + // in all the bosses of the instance + instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, FAIL); } void DoAction(const int32 action) @@ -244,8 +259,7 @@ class boss_drakkari_elemental : public CreatureScript { boss_drakkari_elementalAI(Creature* creature) : ScriptedAI(creature) { - DoCast(me,SPELL_ELEMENTAL_SPAWN_EFEFCT); - + DoCast(me,SPELL_ELEMENTAL_SPAWN_EFFECT); instance = creature->GetInstanceScript(); } @@ -304,7 +318,8 @@ class boss_drakkari_elemental : public CreatureScript if (instance) { if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) - DoCast(colossus,SPELL_MERGE); + // what if the elemental is more than 80 yards from drakkari colossus ? + DoCast(colossus,SPELL_MERGE,true); } break; } @@ -318,8 +333,23 @@ class boss_drakkari_elemental : public CreatureScript { if (colossus->AI()->GetData(DATA_COLOSSUS_PHASE) == COLOSSUS_PHASE_FIRST_ELEMENTAL_SUMMON) { - DoAction(ACTION_RETURN_TO_COLOSSUS); damage = 0; + + // to prevent spell spaming + if (me->HasUnitState(UNIT_STAT_CHARGING)) + return; + + // not sure about this, the idea of this code is to prevent bug the elemental + // if it is not in a acceptable distance to cast the charge spell. + /*if (me->GetDistance(colossus) > 80.0f) + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) + return; + + me->GetMotionMaster()->MovePoint(0,colossus->GetPositionX(),colossus->GetPositionY(),colossus->GetPositionZ()); + return; + }*/ + DoAction(ACTION_RETURN_TO_COLOSSUS); } } } @@ -337,7 +367,6 @@ class boss_drakkari_elemental : public CreatureScript if (Creature* colossus = target->ToCreature()) { colossus->AI()->DoAction(ACTION_UNFREEZE_COLOSSUS); - me->DespawnOrUnsummon(); } } @@ -354,7 +383,6 @@ class boss_drakkari_elemental : public CreatureScript } }; - class npc_living_mojo : public CreatureScript { public: @@ -464,9 +492,6 @@ class npc_living_mojo : public CreatureScript }; }; - - - void AddSC_boss_drakkari_colossus() { new boss_drakkari_colossus();