refactor(Core/ScriptedAI): few improvements with threat methods (#13146)

improve threat scripts

Co-authored-by: Maelthyrr <lynethris@protonmail.ch>
This commit is contained in:
Maelthyr
2022-11-12 13:29:28 +01:00
committed by GitHub
parent 758ed35db3
commit c1c9dc6105
50 changed files with 100 additions and 73 deletions

View File

@@ -354,7 +354,7 @@ public:
me->AttackStop();
me->SetReactState(REACT_PASSIVE);
me->StopMoving();
DoResetThreat();
DoResetThreatList();
me->GetMotionMaster()->MovePoint(10, OnyxiaMoveData[0].x, OnyxiaMoveData[0].y, OnyxiaMoveData[0].z);
break;
}
@@ -404,7 +404,7 @@ public:
Talk(SAY_PHASE_3_TRANS);
me->SendMeleeAttackStop(me->GetVictim());
me->GetMotionMaster()->MoveLand(13, OnyxiaMoveData[0].x + 1.0f, OnyxiaMoveData[0].y, OnyxiaMoveData[0].z, 12.0f);
DoResetThreat();
DoResetThreatList();
break;
}
case EVENT_SPELL_FIREBALL_FIRST:

View File

@@ -221,7 +221,7 @@ struct boss_ayamiss : public BossAI
me->SetCanFly(false);
me->SetDisableGravity(false);
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
DoResetThreat();
DoResetThreatList();
_scheduler.CancelGroup(PHASE_AIR);
}

View File

@@ -120,7 +120,7 @@ struct boss_buru : public BossAI
events.ScheduleEvent(EVENT_GATHERING_SPEED, 2s);
if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0, 0.f, true))
{
DoResetThreat();
DoResetThreatList();
AttackStart(victim);
me->AddThreat(victim, 1000000.f);
Talk(EMOTE_TARGET, victim);
@@ -143,7 +143,7 @@ struct boss_buru : public BossAI
events.Reset();
_phase = PHASE_TRANSFORM;
instance->SetData(DATA_BURU_PHASE, _phase);
DoResetThreat();
DoResetThreatList();
events.ScheduleEvent(EVENT_CREEPING_PLAGUE, 2s);
DoCastSelf(SPELL_BURU_TRANSFORM);
}

View File

@@ -166,7 +166,7 @@ public:
me->SetSpeed(MOVE_RUN, 15.f/7.f); // From sniffs
DoCastSelf(SPELL_FULL_HEAL, true);
if (me->GetThreatMgr().GetThreatListSize())
DoResetThreat();
DoResetThreatList();
if (Creature* dying = instance->GetCreature(_creatureDying))
{
dying->AI()->DoAction(ACTION_EXPLODE);
@@ -419,7 +419,7 @@ struct boss_yauj : public boss_bug_trio
.Schedule(12s, [this](TaskContext context)
{
DoCastAOE(SPELL_FEAR);
DoResetThreat();
DoResetThreatList();
context.Repeat(20600ms);
})
.Schedule(11s, 14500ms, [this](TaskContext context)

View File

@@ -352,7 +352,7 @@ struct npc_dirt_mound : ScriptedAI
void ChaseNewTarget()
{
DoResetThreat();
DoResetThreatList();
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 200.f, true))
{
me->AddThreat(target, 1000000.f);

View File

@@ -178,7 +178,7 @@ struct boss_skeram : public BossAI
break;
case EVENT_BLINK:
DoCast(me, BlinkSpells[urand(0, 2)]);
DoResetThreat();
DoResetThreatList();
events.ScheduleEvent(EVENT_BLINK, 10s, 30s);
break;
case EVENT_EARTH_SHOCK:
@@ -196,7 +196,7 @@ struct boss_skeram : public BossAI
DoTeleport(image);
}
}
DoResetThreat();
DoResetThreatList();
events.RescheduleEvent(EVENT_BLINK, 10s, 30s);
break;
case EVENT_INIT_IMAGE:

View File

@@ -158,7 +158,7 @@ struct boss_twinemperorsAI : public BossAI
if (action == ACTION_AFTER_TELEPORT)
{
DoResetThreat();
DoResetThreatList();
me->SetReactState(REACT_PASSIVE);
DoCastSelf(SPELL_TWIN_TELEPORT_VISUAL, true);
_scheduler.DelayAll(2300ms);

View File

@@ -195,7 +195,7 @@ struct boss_viscidus : public BossAI
me->SetAuraStack(SPELL_VISCIDUS_SHRINKS, me, 20);
me->LowerPlayerDamageReq(me->GetMaxHealth());
me->SetHealth(me->GetMaxHealth() * 0.01f); // set 1% health
DoResetThreat();
DoResetThreatList();
me->NearTeleportTo(roomCenter.GetPositionX(),
roomCenter.GetPositionY(),
roomCenter.GetPositionZ(),