Skip to content

Commit

Permalink
Core/Scripts: Fixed issues with Drakkari Colossus/Elemental after rec…
Browse files Browse the repository at this point in the history
…ent changes.
  • Loading branch information
maanuel committed Jan 16, 2011
1 parent 58564cc commit 7b7327a
Showing 1 changed file with 41 additions and 16 deletions.
57 changes: 41 additions & 16 deletions src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
Expand Up @@ -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,
Expand Down Expand Up @@ -92,36 +92,51 @@ class boss_drakkari_colossus : public CreatureScript

void Reset()
{
_Reset();

if (GetData(DATA_INTRO_DONE))
{
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE);
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)
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}
}
}
Expand All @@ -337,7 +367,6 @@ class boss_drakkari_elemental : public CreatureScript
if (Creature* colossus = target->ToCreature())
{
colossus->AI()->DoAction(ACTION_UNFREEZE_COLOSSUS);

me->DespawnOrUnsummon();
}
}
Expand All @@ -354,7 +383,6 @@ class boss_drakkari_elemental : public CreatureScript
}
};


class npc_living_mojo : public CreatureScript
{
public:
Expand Down Expand Up @@ -464,9 +492,6 @@ class npc_living_mojo : public CreatureScript
};
};




void AddSC_boss_drakkari_colossus()
{
new boss_drakkari_colossus();
Expand Down

0 comments on commit 7b7327a

Please sign in to comment.