chore(Scripts/BloodFurnace): Clean up Keli'dan script (#16321)

* init

* Update rev_1684449165991504600.sql

* leftover
This commit is contained in:
Gultask
2023-05-20 18:25:38 -03:00
committed by GitHub
parent be48e3c249
commit c5f2031833
2 changed files with 54 additions and 171 deletions
@@ -0,0 +1,39 @@
--
SET @CGUID := 138519;
DELETE FROM `creature` WHERE `id1` IN (17653, 17377) AND `map` = 542;
INSERT INTO `creature` (`guid`, `id1`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `VerifiedBuild`) VALUES
(@CGUID+0, 17653, 542, 3713, 3713, 3, 1, 0, 316.273651123046875, -108.876602172851562, -24.6027107238769531, 1.256637096405029296, 86400, 0, 0, 0, 0, 0, 0, 0, 0, 46366),
(@CGUID+1, 17653, 542, 3713, 3713, 3, 1, 0, 345.848419189453125, -74.4559097290039062, -24.6402416229248046, 3.59537816047668457, 86400, 0, 0, 0, 0, 0, 0, 0, 0, 46366),
(@CGUID+2, 17653, 542, 3713, 3713, 3, 1, 0, 343.5838623046875, -103.630592346191406, -24.5688228607177734, 2.356194496154785156, 86400, 0, 0, 0, 0, 0, 0, 0, 0, 46366),
(@CGUID+3, 17653, 542, 3713, 3713, 3, 1, 0, 301.987579345703125, -86.74652099609375, -24.4516544342041015, 0.157079637050628662, 86400, 0, 0, 0, 0, 0, 0, 0, 0, 46366),
(@CGUID+4, 17653, 542, 3713, 3713, 3, 1, 0, 320.75, -63.6120796203613281, -24.6360912322998046, 4.886921882629394531, 86400, 0, 0, 0, 0, 0, 0, 0, 0, 46366),
(@CGUID+5, 17377, 542, 3713, 3713, 3, 1, 1, 326.502899169921875, -86.0027542114257812, -24.5770149230957031, 3.59537816047668457, 86400, 0, 0, 0, 0, 0, 0, 0, 0, 46366);
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE (`entry` = 17653);
UPDATE `creature_template` SET `flags_extra` = `flags_extra`|67108864 WHERE (`entry` IN (17653, 18620));
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 17653);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(17653, 0, 0, 0, 0, 0, 100, 0, 1200, 2400, 6000, 7200, 0, 11, 12739, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - In Combat - Cast \'Shadow Bolt\''),
(17653, 0, 1, 0, 0, 0, 100, 0, 5000, 6500, 16000, 17500, 0, 11, 30937, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - In Combat - Cast \'Mark of Shadow\''),
(17653, 0, 2, 0, 6, 0, 100, 512, 0, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 0, 10, @CGUID+5, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - On Just Died - Do Action 1 on Keli\'dan the Breaker'),
(17653, 0, 3, 0, 4, 0, 100, 512, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 9, 17653, 0, 100, 1, 0, 0, 0, 0, 'Shadowmoon Channeler - On Aggro - Set In Combat With Zone');
DELETE FROM `creature_formations` WHERE `memberGUID` IN (@CGUID+0,@CGUID+1,@CGUID+2,@CGUID+3,@CGUID+4,@CGUID+5);
INSERT INTO `creature_formations` (`memberGUID`, `leaderGUID`, `groupAI`) VALUES
(@CGUID+0, @CGUID+5, 24),
(@CGUID+1, @CGUID+5, 24),
(@CGUID+2, @CGUID+5, 24),
(@CGUID+3, @CGUID+5, 24),
(@CGUID+4, @CGUID+5, 24),
(@CGUID+5, @CGUID+5, 24);
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` IN (-138519,-138519,-138520,-138521,-138522,-138523));
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(-(@CGUID+0), 0, 1000, 0, 1, 0, 100, 0, 3600, 3600, 15000, 15000, 0, 11, 30888, 0, 0, 0, 0, 0, 10, @CGUID+4, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - Out of Combat - Cast \'Star Beam\''),
(-(@CGUID+0), 0, 1001, 0, 4, 0, 100, 0, 0, 0, 0, 0, 0, 223, 2, 0, 0, 0, 0, 0, 10, @CGUID+5, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - On Aggro - Do Action 2 on Keli\'dan the Breaker'),
(-(@CGUID+1), 0, 1000, 0, 1, 0, 100, 0, 3600, 3600, 15000, 15000, 0, 11, 30888, 0, 0, 0, 0, 0, 10, @CGUID+0, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - Out of Combat - Cast \'Star Beam\''),
(-(@CGUID+2), 0, 1000, 0, 1, 0, 100, 0, 3600, 3600, 15000, 15000, 0, 11, 30888, 0, 0, 0, 0, 0, 10, @CGUID+3, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - Out of Combat - Cast \'Star Beam\''),
(-(@CGUID+3), 0, 1000, 0, 1, 0, 100, 0, 3600, 3600, 15000, 15000, 0, 11, 30888, 0, 0, 0, 0, 0, 10, @CGUID+1, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - Out of Combat - Cast \'Star Beam\''),
(-(@CGUID+4), 0, 1000, 0, 1, 0, 100, 0, 3600, 3600, 15000, 15000, 0, 11, 30888, 0, 0, 0, 0, 0, 10, @CGUID+2, 0, 0, 0, 0, 0, 0, 0, 'Shadowmoon Channeler - Out of Combat - Cast \'Star Beam\'');
@@ -31,33 +31,23 @@ enum Says
enum Spells enum Spells
{ {
// Keldian
SPELL_CORRUPTION = 30938, SPELL_CORRUPTION = 30938,
SPELL_EVOCATION = 30935, SPELL_EVOCATION = 30935,
SPELL_FIRE_NOVA = 33132, SPELL_FIRE_NOVA = 33132,
SPELL_SHADOW_BOLT_VOLLEY = 28599, SPELL_SHADOW_BOLT_VOLLEY = 28599,
SPELL_BURNING_NOVA = 30940, SPELL_BURNING_NOVA = 30940,
SPELL_VORTEX = 37370, SPELL_VORTEX = 37370
};
// Channelers enum Misc
SPELL_SHADOW_BOLT = 12739, {
SPELL_MARK_OF_SHADOW = 30937, NPC_SHADOWMOON_CHANNELER = 17653
SPELL_CHANNELING = 39123
}; };
enum Actions enum Actions
{ {
ACTION_CHANNELER_ENGAGED = 1, ACTION_CHANNELER_DIED = 1,
ACTION_CHANNELER_DIED = 2 ACTION_CHANNELER_AGGRO = 2
};
const float ShadowmoonChannelers[5][4] =
{
{302.0f, -87.0f, -24.4f, 0.157f},
{321.0f, -63.5f, -24.6f, 4.887f},
{346.0f, -74.5f, -24.6f, 3.595f},
{344.0f, -103.5f, -24.5f, 2.356f},
{316.0f, -109.0f, -24.6f, 1.257f}
}; };
struct boss_kelidan_the_breaker : public BossAI struct boss_kelidan_the_breaker : public BossAI
@@ -70,20 +60,13 @@ struct boss_kelidan_the_breaker : public BossAI
}); });
} }
ObjectGuid channelers[5];
uint32 checkTimer;
bool addYell;
void Reset() override void Reset() override
{ {
addYell = false;
checkTimer = 5000;
_Reset(); _Reset();
ApplyImmunities(true); ApplyImmunities(true);
SummonChannelers();
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(true); DoCastSelf(SPELL_EVOCATION);
if (instance) if (instance)
{ {
instance->SetData(DATA_KELIDAN, NOT_STARTED); instance->SetData(DATA_KELIDAN, NOT_STARTED);
@@ -136,80 +119,20 @@ struct boss_kelidan_the_breaker : public BossAI
void DoAction(int32 param) override void DoAction(int32 param) override
{ {
if (param == ACTION_CHANNELER_ENGAGED) if (param == ACTION_CHANNELER_DIED)
{ {
if (!addYell) if (me->FindNearestCreature(NPC_SHADOWMOON_CHANNELER, 100.0f))
{ {
addYell = true;
Talk(SAY_ADD_AGGRO);
for (uint8 i = 0; i < 5; ++i)
{
Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]);
if (channeler && !channeler->IsInCombat())
{
channeler->SetInCombatWithZone();
}
}
}
}
else if (param == ACTION_CHANNELER_DIED)
{
for (uint8 i = 0; i < 5; ++i)
{
Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]);
if (channeler && channeler->IsAlive())
return; return;
} }
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE); me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); me->SetInCombatWithZone();
me->SetImmuneToAll(false);
if (Unit* target = me->SelectNearestPlayer(100.0f))
{
AttackStart(target);
}
} }
}
void CheckChannelers() else if (param == ACTION_CHANNELER_AGGRO)
{
if (addYell)
{ {
if (!SelectTargetFromPlayerList(100.0f)) Talk(SAY_ADD_AGGRO);
{
EnterEvadeMode();
}
return;
}
SummonChannelers();
for (uint8 i = 0; i < 5; ++i)
{
Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]);
if (channeler && !channeler->HasUnitState(UNIT_STATE_CASTING) && !channeler->IsInCombat())
{
Creature* target = ObjectAccessor::GetCreature(*me, channelers[(i + 2) % 5]);
if (target)
{
channeler->CastSpell(target, SPELL_CHANNELING, false);
}
}
}
}
void SummonChannelers()
{
for (uint8 i = 0; i < 5; ++i)
{
Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]);
if (channeler && channeler->isDead())
{
channeler->DespawnOrUnsummon(1);
channeler = nullptr;
}
if (!channeler)
{
channeler = me->SummonCreature(NPC_CHANNELER, ShadowmoonChannelers[i][0], ShadowmoonChannelers[i][1], ShadowmoonChannelers[i][2], ShadowmoonChannelers[i][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
}
channelers[i] = channeler ? channeler->GetGUID() : ObjectGuid::Empty;
} }
} }
@@ -248,88 +171,9 @@ struct boss_kelidan_the_breaker : public BossAI
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
} }
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
{
checkTimer += diff;
if (checkTimer >= 5000)
{
checkTimer = 0;
CheckChannelers();
if (!me->HasUnitState(UNIT_STATE_CASTING))
{
me->CastSpell(me, SPELL_EVOCATION, false);
}
}
return;
}
scheduler.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
DoMeleeAttackIfReady();
}
};
struct npc_shadowmoon_channeler : public ScriptedAI
{
npc_shadowmoon_channeler(Creature* creature) : ScriptedAI(creature) {}
Creature* GetKelidan()
{
if (InstanceScript* instance = me->GetInstanceScript())
{
return instance->GetCreature(DATA_KELIDAN);
}
return nullptr;
}
void JustEngagedWith(Unit* /*who*/) override
{
if (Creature* kelidan = GetKelidan())
{
kelidan->AI()->DoAction(ACTION_CHANNELER_ENGAGED);
}
me->InterruptNonMeleeSpells(false);
_scheduler.Schedule(1200ms, 2400ms, [this](TaskContext context)
{
DoCastVictim(SPELL_SHADOW_BOLT);
context.Repeat(6s, 7200ms);
}).Schedule(5s, 6500ms, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_MARK_OF_SHADOW);
context.Repeat(16s, 17500ms);
});
}
void JustDied(Unit* /*killer*/) override
{
if (Creature* kelidan = GetKelidan())
{
kelidan->AI()->DoAction(ACTION_CHANNELER_DIED);
}
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
DoMeleeAttackIfReady();
}
private:
TaskScheduler _scheduler;
}; };
void AddSC_boss_kelidan_the_breaker() void AddSC_boss_kelidan_the_breaker()
{ {
RegisterBloodFurnaceCreatureAI(boss_kelidan_the_breaker); RegisterBloodFurnaceCreatureAI(boss_kelidan_the_breaker);
RegisterBloodFurnaceCreatureAI(npc_shadowmoon_channeler);
} }