refactor(Scripts/BlackwingLair): Refactor Chromaggus (#11501)
* refactor(Scripts/BlackwingLair): Refactor Chromaggus * Update boss_chromaggus.cpp * eof * Update boss_chromaggus.cpp
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1650762150293897700');
|
||||||
|
|
||||||
|
SET @NPC := 14020;
|
||||||
|
SET @PATH := @NPC * 10;
|
||||||
|
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
|
||||||
|
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES
|
||||||
|
(@PATH,1,-7488.41,-1074.58,476.54404,0.197437033057212829,0,0,0,100,0),
|
||||||
|
(@PATH,2,-7488.41,-1074.58,476.54404,5.272660255432128906,0,0,0,100,0),
|
||||||
|
(@PATH,3,-7488.41,-1074.58,476.54404,0,0,0,0,100,0),
|
||||||
|
(@PATH,4,-7488.41,-1074.58,476.54404,0.46780097484588623,0,0,0,100,0);
|
||||||
+35
-130
@@ -56,19 +56,17 @@ enum Spells
|
|||||||
enum Events
|
enum Events
|
||||||
{
|
{
|
||||||
EVENT_SHIMMER = 1,
|
EVENT_SHIMMER = 1,
|
||||||
EVENT_BREATH_1 = 2,
|
EVENT_BREATH = 2,
|
||||||
EVENT_BREATH_2 = 3,
|
EVENT_AFFLICTION = 3,
|
||||||
EVENT_AFFLICTION = 4,
|
EVENT_FRENZY = 4
|
||||||
EVENT_FRENZY = 5
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Misc
|
enum Misc
|
||||||
{
|
{
|
||||||
DATA_LEVER_USED = 0
|
GUID_LEVER_USER = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// not sniffed yet.
|
Position const homePos = { -7491.1587f, -1069.718f, 476.59094, 476.59094f };
|
||||||
Position const homePos = { -7487.577148f, -1074.366943f, 476.555023f, 5.325001f };
|
|
||||||
|
|
||||||
class boss_chromaggus : public CreatureScript
|
class boss_chromaggus : public CreatureScript
|
||||||
{
|
{
|
||||||
@@ -81,107 +79,10 @@ public:
|
|||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
|
|
||||||
Breath1_Spell = 0;
|
// Select the 2 breaths that we are going to use until despawned so we don't end up casting 2 of the same breath.
|
||||||
Breath2_Spell = 0;
|
_breathSpells = { SPELL_INCINERATE, SPELL_TIMELAPSE, SPELL_CORROSIVEACID, SPELL_IGNITEFLESH, SPELL_FROSTBURN };
|
||||||
|
|
||||||
// Select the 2 breaths that we are going to use until despawned
|
Acore::Containers::RandomResize(_breathSpells, 2);
|
||||||
// 5 possiblities for the first breath, 4 for the second, 20 total possiblites
|
|
||||||
// This way we don't end up casting 2 of the same breath
|
|
||||||
// TL TL would be stupid
|
|
||||||
switch (urand(0, 19))
|
|
||||||
{
|
|
||||||
// B1 - Incin
|
|
||||||
case 0:
|
|
||||||
Breath1_Spell = SPELL_INCINERATE;
|
|
||||||
Breath2_Spell = SPELL_TIMELAPSE;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
Breath1_Spell = SPELL_INCINERATE;
|
|
||||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
Breath1_Spell = SPELL_INCINERATE;
|
|
||||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
Breath1_Spell = SPELL_INCINERATE;
|
|
||||||
Breath2_Spell = SPELL_FROSTBURN;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// B1 - TL
|
|
||||||
case 4:
|
|
||||||
Breath1_Spell = SPELL_TIMELAPSE;
|
|
||||||
Breath2_Spell = SPELL_INCINERATE;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
Breath1_Spell = SPELL_TIMELAPSE;
|
|
||||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
Breath1_Spell = SPELL_TIMELAPSE;
|
|
||||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
Breath1_Spell = SPELL_TIMELAPSE;
|
|
||||||
Breath2_Spell = SPELL_FROSTBURN;
|
|
||||||
break;
|
|
||||||
|
|
||||||
//B1 - Acid
|
|
||||||
case 8:
|
|
||||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
|
||||||
Breath2_Spell = SPELL_INCINERATE;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
|
||||||
Breath2_Spell = SPELL_TIMELAPSE;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
|
||||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
Breath1_Spell = SPELL_CORROSIVEACID;
|
|
||||||
Breath2_Spell = SPELL_FROSTBURN;
|
|
||||||
break;
|
|
||||||
|
|
||||||
//B1 - Ignite
|
|
||||||
case 12:
|
|
||||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
|
||||||
Breath2_Spell = SPELL_INCINERATE;
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
|
||||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
|
||||||
Breath2_Spell = SPELL_TIMELAPSE;
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
Breath1_Spell = SPELL_IGNITEFLESH;
|
|
||||||
Breath2_Spell = SPELL_FROSTBURN;
|
|
||||||
break;
|
|
||||||
|
|
||||||
//B1 - Frost
|
|
||||||
case 16:
|
|
||||||
Breath1_Spell = SPELL_FROSTBURN;
|
|
||||||
Breath2_Spell = SPELL_INCINERATE;
|
|
||||||
break;
|
|
||||||
case 17:
|
|
||||||
Breath1_Spell = SPELL_FROSTBURN;
|
|
||||||
Breath2_Spell = SPELL_TIMELAPSE;
|
|
||||||
break;
|
|
||||||
case 18:
|
|
||||||
Breath1_Spell = SPELL_FROSTBURN;
|
|
||||||
Breath2_Spell = SPELL_CORROSIVEACID;
|
|
||||||
break;
|
|
||||||
case 19:
|
|
||||||
Breath1_Spell = SPELL_FROSTBURN;
|
|
||||||
Breath2_Spell = SPELL_IGNITEFLESH;
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
EnterEvadeMode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize()
|
void Initialize()
|
||||||
@@ -189,14 +90,6 @@ public:
|
|||||||
Enraged = false;
|
Enraged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetData(uint32 id, uint32 /*data*/) override
|
|
||||||
{
|
|
||||||
if (id == DATA_LEVER_USED)
|
|
||||||
{
|
|
||||||
me->SetHomePosition(homePos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
_Reset();
|
_Reset();
|
||||||
@@ -209,8 +102,8 @@ public:
|
|||||||
BossAI::EnterCombat(victim);
|
BossAI::EnterCombat(victim);
|
||||||
|
|
||||||
events.ScheduleEvent(EVENT_SHIMMER, 1000);
|
events.ScheduleEvent(EVENT_SHIMMER, 1000);
|
||||||
events.ScheduleEvent(EVENT_BREATH_1, 30000);
|
events.ScheduleEvent(EVENT_BREATH, 30000);
|
||||||
events.ScheduleEvent(EVENT_BREATH_2, 60000);
|
events.ScheduleEvent(EVENT_BREATH, 60000);
|
||||||
events.ScheduleEvent(EVENT_AFFLICTION, 10000);
|
events.ScheduleEvent(EVENT_AFFLICTION, 10000);
|
||||||
events.ScheduleEvent(EVENT_FRENZY, 15000);
|
events.ScheduleEvent(EVENT_FRENZY, 15000);
|
||||||
}
|
}
|
||||||
@@ -220,6 +113,22 @@ public:
|
|||||||
return !victim->HasAura(SPELL_TIMELAPSE);
|
return !victim->HasAura(SPELL_TIMELAPSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetGUID(ObjectGuid guid, int32 id) override
|
||||||
|
{
|
||||||
|
if (id == GUID_LEVER_USER)
|
||||||
|
{
|
||||||
|
_playerGUID = guid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathEndReached(uint32 /*pathId*/) override
|
||||||
|
{
|
||||||
|
if (Unit* player = ObjectAccessor::GetUnit(*me, _playerGUID))
|
||||||
|
{
|
||||||
|
me->SetInCombatWith(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
@@ -242,13 +151,10 @@ public:
|
|||||||
events.ScheduleEvent(EVENT_SHIMMER, urand(17000, 25000));
|
events.ScheduleEvent(EVENT_SHIMMER, urand(17000, 25000));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EVENT_BREATH_1:
|
case EVENT_BREATH:
|
||||||
DoCastVictim(Breath1_Spell);
|
DoCastVictim(_breathSpells.front());
|
||||||
events.ScheduleEvent(EVENT_BREATH_1, 60000);
|
_breathSpells.reverse();
|
||||||
break;
|
events.ScheduleEvent(EVENT_BREATH, 60000);
|
||||||
case EVENT_BREATH_2:
|
|
||||||
DoCastVictim(Breath2_Spell);
|
|
||||||
events.ScheduleEvent(EVENT_BREATH_2, 60000);
|
|
||||||
break;
|
break;
|
||||||
case EVENT_AFFLICTION:
|
case EVENT_AFFLICTION:
|
||||||
{
|
{
|
||||||
@@ -305,9 +211,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 Breath1_Spell;
|
std::list<uint32> _breathSpells;
|
||||||
uint32 Breath2_Spell;
|
|
||||||
bool Enraged;
|
bool Enraged;
|
||||||
|
ObjectGuid _playerGUID;
|
||||||
};
|
};
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
CreatureAI* GetAI(Creature* creature) const override
|
||||||
@@ -331,12 +237,11 @@ class go_chromaggus_lever : public GameObjectScript
|
|||||||
{
|
{
|
||||||
if (_instance->GetBossState(DATA_CHROMAGGUS) != DONE && _instance->GetBossState(DATA_CHROMAGGUS) != IN_PROGRESS)
|
if (_instance->GetBossState(DATA_CHROMAGGUS) != DONE && _instance->GetBossState(DATA_CHROMAGGUS) != IN_PROGRESS)
|
||||||
{
|
{
|
||||||
_instance->SetBossState(DATA_CHROMAGGUS, IN_PROGRESS);
|
|
||||||
|
|
||||||
if (Creature* creature = _instance->instance->GetCreature(_instance->GetGuidData(DATA_CHROMAGGUS)))
|
if (Creature* creature = _instance->instance->GetCreature(_instance->GetGuidData(DATA_CHROMAGGUS)))
|
||||||
{
|
{
|
||||||
creature->AI()->AttackStart(player);
|
creature->SetHomePosition(homePos);
|
||||||
creature->AI()->SetData(DATA_LEVER_USED, 1);
|
creature->GetMotionMaster()->MovePath(creature->GetEntry() * 10, false);
|
||||||
|
creature->AI()->SetGUID(player->GetGUID(), GUID_LEVER_USER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameObject* go = _instance->instance->GetGameObject(_instance->GetGuidData(DATA_GO_CHROMAGGUS_DOOR)))
|
if (GameObject* go = _instance->instance->GetGameObject(_instance->GetGuidData(DATA_GO_CHROMAGGUS_DOOR)))
|
||||||
|
|||||||
Reference in New Issue
Block a user