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

@@ -115,7 +115,7 @@ public:
case EVENT_KNOCKBACK:
DoCastVictim(SPELL_KNOCKBACK);
if (DoGetThreat(me->GetVictim()))
DoModifyThreatPercent(me->GetVictim(), -50);
DoModifyThreatByPercent(me->GetVictim(), -50);
events.ScheduleEvent(EVENT_KNOCKBACK, 15000, 30000);
break;
case EVENT_CHECK:

View File

@@ -72,7 +72,7 @@ public:
case EVENT_WINGBUFFET:
DoCastVictim(SPELL_WINGBUFFET);
if (DoGetThreat(me->GetVictim()))
DoModifyThreatPercent(me->GetVictim(), -75);
DoModifyThreatByPercent(me->GetVictim(), -75);
events.ScheduleEvent(EVENT_WINGBUFFET, 30000);
break;
case EVENT_FLAMEBUFFET:

View File

@@ -77,7 +77,7 @@ public:
case EVENT_WINGBUFFET:
DoCastVictim(SPELL_WINGBUFFET);
if (DoGetThreat(me->GetVictim()))
DoModifyThreatPercent(me->GetVictim(), -75);
DoModifyThreatByPercent(me->GetVictim(), -75);
events.ScheduleEvent(EVENT_WINGBUFFET, 30000);
break;
case EVENT_FRENZY:

View File

@@ -411,7 +411,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->InterruptNonMeleeSpells(false);
me->AttackStop();
DoResetThreat();
DoResetThreatList();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);
DoCastSelf(SPELL_RAGNA_SUBMERGE_VISUAL, true);

View File

@@ -496,7 +496,7 @@ public:
{
if (me->GetVictim())
{
DoModifyThreatPercent(me->GetVictim(), -100);
DoModifyThreatByPercent(me->GetVictim(), -100);
}
me->AddThreat(target, 1000000.0f);

View File

@@ -915,7 +915,7 @@ public:
DoCast(target, SPELL_LITTLE_RED_RIDING_HOOD, true);
TempThreat = DoGetThreat(target);
if (TempThreat)
DoModifyThreatPercent(target, -100);
DoModifyThreatByPercent(target, -100);
HoodGUID = target->GetGUID();
me->AddThreat(target, 1000000.0f);
ChaseTimer = 20000;
@@ -930,7 +930,7 @@ public:
{
HoodGUID.Clear();
if (DoGetThreat(target))
DoModifyThreatPercent(target, -100);
DoModifyThreatByPercent(target, -100);
me->AddThreat(target, TempThreat);
TempThreat = 0;
}

View File

@@ -462,7 +462,7 @@ public:
{
case EVENT_SPELL_VANISH:
me->CastSpell(me, SPELL_VANISH, false);
DoResetThreat();
DoResetThreatList();
if (Unit* unit = SelectTarget(SelectTargetMethod::Random, 0))
me->AddThreat(unit, 1000.0f);

View File

@@ -313,7 +313,7 @@ public:
case 3:
case 4:
me->NearTeleportTo(CENTER_X, CENTER_Y, CENTER_Z, me->GetOrientation());
DoResetThreat();
DoResetThreatList();
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0);
me->RemoveAurasDueToSpell(Transform[Phase].unaura);
DoCast(me, Transform[Phase].spell);

View File

@@ -232,7 +232,7 @@ public:
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP));
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(EQUIP_UNEQUIP));
me->AttackStop();
DoResetThreat();
DoResetThreatList();
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCastSelf(SPELL_VANISH_VISUAL);

View File

@@ -91,7 +91,7 @@ public:
}
DoCast(me, SPELL_AVATAR);
me->SetReactState(REACT_PASSIVE);
DoResetThreat();
DoResetThreatList();
events.ScheduleEvent(EVENT_START_PURSUIT, 2s);
events.ScheduleEvent(EVENT_STOP_PURSUIT, 15s);
events.ScheduleEvent(EVENT_AVATAR, 45s, 50s);

View File

@@ -164,7 +164,7 @@ struct boss_jeklik : public BossAI
if (events.IsInPhase(PHASE_ONE) && !HealthAbovePct(50))
{
me->RemoveAurasDueToSpell(SPELL_BAT_FORM);
DoResetThreat();
DoResetThreatList();
events.SetPhase(PHASE_TWO);
events.CancelEventGroup(PHASE_ONE);

View File

@@ -163,7 +163,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->AttackStop();
DoResetThreat();
DoResetThreatList();
WasDead = true;
CheckPhaseTransition();
Talk(EMOTE_THEKAL_DIES);
@@ -245,7 +245,7 @@ public:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
DoCast(target, SPELL_CHARGE);
DoResetThreat();
DoResetThreatList();
AttackStart(target);
}
context.Repeat(15s, 22s);
@@ -407,7 +407,7 @@ public:
if (DoGetThreat(me->GetVictim()))
{
DoModifyThreatPercent(me->GetVictim(), -100);
DoModifyThreatByPercent(me->GetVictim(), -100);
}
context.Repeat(17s, 27s);

View File

@@ -252,7 +252,7 @@ public:
// shapeshift at 50% health
DoCast(me, SPELL_VENOXIS_TRANSFORM);
Talk(SAY_VENOXIS_TRANSFORM);
DoResetThreat();
DoResetThreatList();
// phase two events (snakeform)
events.ScheduleEvent(EVENT_VENOM_SPIT, 5000, 0, PHASE_TWO);