mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
fix(Scripts/Steamvault): Rework Mekgineer Steamrigger (#15896)
This commit is contained in:
@@ -33,20 +33,22 @@ enum MekgineerSteamrigger
|
||||
SPELL_REPAIR_N = 31532,
|
||||
SPELL_REPAIR_H = 37936,
|
||||
|
||||
NPC_STREAMRIGGER_MECHANIC = 17951,
|
||||
SPELL_SUMMON_MECHANICS_1 = 31528,
|
||||
SPELL_SUMMON_MECHANICS_2 = 31529,
|
||||
SPELL_SUMMON_MECHANICS_3 = 31530,
|
||||
|
||||
EVENT_CHECK_HP25 = 1,
|
||||
EVENT_CHECK_HP50 = 2,
|
||||
EVENT_CHECK_HP75 = 3,
|
||||
EVENT_SPELL_SHRINK = 4,
|
||||
EVENT_SPELL_SAW = 5,
|
||||
EVENT_SPELL_NET = 6,
|
||||
EVENT_ENRAGE = 7
|
||||
NPC_STREAMRIGGER_MECHANIC = 17951
|
||||
};
|
||||
|
||||
struct boss_mekgineer_steamrigger : public BossAI
|
||||
{
|
||||
boss_mekgineer_steamrigger(Creature* creature) : BossAI(creature, DATA_MEKGINEER_STEAMRIGGER) { }
|
||||
boss_mekgineer_steamrigger(Creature* creature) : BossAI(creature, DATA_MEKGINEER_STEAMRIGGER)
|
||||
{
|
||||
scheduler.SetValidator([this]
|
||||
{
|
||||
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||
});
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
@@ -57,131 +59,73 @@ struct boss_mekgineer_steamrigger : public BossAI
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
if (victim->IsPlayer())
|
||||
{
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
_JustEngagedWith();
|
||||
events.ScheduleEvent(EVENT_SPELL_SHRINK, 26550);
|
||||
events.ScheduleEvent(EVENT_SPELL_SAW, 6050, 17650);
|
||||
events.ScheduleEvent(EVENT_SPELL_NET, 14400);
|
||||
events.ScheduleEvent(EVENT_ENRAGE, 300000);
|
||||
events.ScheduleEvent(EVENT_CHECK_HP75, 5000);
|
||||
events.ScheduleEvent(EVENT_CHECK_HP50, 5000);
|
||||
events.ScheduleEvent(EVENT_CHECK_HP25, 5000);
|
||||
}
|
||||
|
||||
void SummonMechanics()
|
||||
{
|
||||
Talk(SAY_MECHANICS);
|
||||
|
||||
me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX() + 15.0f, me->GetPositionY() + 15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
|
||||
me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX() - 15.0f, me->GetPositionY() + 15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
|
||||
me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX() - 15.0f, me->GetPositionY() - 15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
|
||||
if (urand(0, 1))
|
||||
me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX() + 15.0f, me->GetPositionY() - 15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* cr) override
|
||||
{
|
||||
cr->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
switch (uint32 eventId = events.ExecuteEvent())
|
||||
scheduler.Schedule(26550ms, [this](TaskContext context)
|
||||
{
|
||||
DoCastVictim(SPELL_SUPER_SHRINK_RAY);
|
||||
context.Repeat(35100ms, 54100ms);
|
||||
}).Schedule(6050ms, 17650ms, [this](TaskContext context)
|
||||
{
|
||||
if (DoCastRandomTarget(SPELL_SAW_BLADE, 1) != SPELL_CAST_OK)
|
||||
{
|
||||
DoCastVictim(SPELL_SAW_BLADE);
|
||||
}
|
||||
|
||||
context.Repeat(6050ms, 17650ms);
|
||||
}).Schedule(14400ms, [this](TaskContext context)
|
||||
{
|
||||
DoCastRandomTarget(SPELL_ELECTRIFIED_NET);
|
||||
context.Repeat(21800ms, 34200ms);
|
||||
}).Schedule(5min, [this](TaskContext /*context*/)
|
||||
{
|
||||
case EVENT_SPELL_SHRINK:
|
||||
me->CastSpell(me->GetVictim(), SPELL_SUPER_SHRINK_RAY, false);
|
||||
events.Repeat(35100ms, 54100ms);
|
||||
break;
|
||||
case EVENT_SPELL_SAW:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
|
||||
me->CastSpell(target, SPELL_SAW_BLADE, false);
|
||||
else
|
||||
me->CastSpell(me->GetVictim(), SPELL_SAW_BLADE, false);
|
||||
events.Repeat(6050ms, 17650ms);
|
||||
break;
|
||||
case EVENT_SPELL_NET:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
|
||||
me->CastSpell(target, SPELL_ELECTRIFIED_NET, false);
|
||||
events.Repeat(21800ms, 34200ms);
|
||||
break;
|
||||
case EVENT_ENRAGE:
|
||||
DoCastSelf(SPELL_ENRAGE, true);
|
||||
break;
|
||||
case EVENT_CHECK_HP25:
|
||||
case EVENT_CHECK_HP50:
|
||||
case EVENT_CHECK_HP75:
|
||||
if (me->HealthBelowPct(eventId * 25))
|
||||
{
|
||||
SummonMechanics();
|
||||
return;
|
||||
}
|
||||
events.RepeatEvent(2000);
|
||||
break;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
struct npc_steamrigger_mechanic : public ScriptedAI
|
||||
{
|
||||
npc_steamrigger_mechanic(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_scheduler.CancelAll();
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* victim) override
|
||||
{
|
||||
ScriptedAI::JustEngagedWith(victim);
|
||||
|
||||
_scheduler.Schedule(2s, [this](TaskContext context)
|
||||
{
|
||||
if (InstanceScript* instance = me->GetInstanceScript())
|
||||
{
|
||||
if (Creature* boss = instance->GetCreature(DATA_MEKGINEER_STEAMRIGGER))
|
||||
{
|
||||
if (me->IsWithinDistInMap(boss, 13.0f))
|
||||
{
|
||||
if (!me->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
me->CastSpell(me, DUNGEON_MODE(SPELL_REPAIR_N, SPELL_REPAIR_H), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context.Repeat();
|
||||
});
|
||||
|
||||
if (!IsHeroic())
|
||||
{
|
||||
ScheduleHealthCheckEvent({ 75, 50, 25 }, [&] {
|
||||
Talk(SAY_MECHANICS);
|
||||
|
||||
for (auto const& spell : { SPELL_SUMMON_MECHANICS_1, SPELL_SUMMON_MECHANICS_2, SPELL_SUMMON_MECHANICS_3 })
|
||||
{
|
||||
DoCastAOE(spell, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
scheduler.Schedule(15600ms, [this](TaskContext context)
|
||||
{
|
||||
if (roll_chance_i(15))
|
||||
{
|
||||
Talk(SAY_MECHANICS);
|
||||
}
|
||||
|
||||
DoCastAOE(RAND(SPELL_SUMMON_MECHANICS_1, SPELL_SUMMON_MECHANICS_2, SPELL_SUMMON_MECHANICS_3), true);
|
||||
context.Repeat(15600ms, 25400ms);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* /*who*/) override {}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
void JustSummoned(Creature* creature) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff,
|
||||
std::bind(&BossAI::DoMeleeAttackIfReady, this));
|
||||
if (creature->GetEntry() == NPC_STREAMRIGGER_MECHANIC)
|
||||
{
|
||||
creature->GetMotionMaster()->MoveFollow(me, 5.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
TaskScheduler _scheduler;
|
||||
};
|
||||
|
||||
void AddSC_boss_mekgineer_steamrigger()
|
||||
{
|
||||
RegisterSteamvaultCreatureAI(boss_mekgineer_steamrigger);
|
||||
RegisterSteamvaultCreatureAI(npc_steamrigger_mechanic);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user