mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-14 16:03:45 +00:00
refactor(Core/ScriptedAI): few improvements with threat methods (#13146)
improve threat scripts Co-authored-by: Maelthyrr <lynethris@protonmail.ch>
This commit is contained in:
@@ -429,7 +429,7 @@ public:
|
||||
{
|
||||
case SPELL_CLAW_N:
|
||||
case SPELL_CLAW_H:
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f))
|
||||
{
|
||||
me->AddThreat(target, 100.0f);
|
||||
|
||||
@@ -927,7 +927,7 @@ public:
|
||||
Player* player = itr->GetSource();
|
||||
if( player && me->IsInRange(player, 8.0f, 25.0f, false) )
|
||||
{
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->AddThreat(player, 5.0f);
|
||||
me->CastSpell(player, SPELL_INTERCEPT, false);
|
||||
break;
|
||||
|
||||
@@ -767,7 +767,7 @@ public:
|
||||
me->RemoveAllAuras();
|
||||
}
|
||||
DoZoneInCombat();
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 250.0f, true) )
|
||||
{
|
||||
if (!next)
|
||||
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
case EVENT_SPELL_FEL_STEAK:
|
||||
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 44.0f, true) )
|
||||
{
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->AddThreat(target, 50000.0f);
|
||||
me->CastSpell(target, SPELL_FEL_STEAK_MORPH, true);
|
||||
me->CastSpell(target, SPELL_FEL_STEAK, true);
|
||||
|
||||
@@ -593,7 +593,7 @@ struct boss_jormungarAI : public ScriptedAI
|
||||
}
|
||||
me->UpdatePosition(Locs[LOC_CENTER].GetPositionX() + cos(angle)*dist, Locs[LOC_CENTER].GetPositionY() + std::sin(angle)*dist, me->GetPositionZ(), me->GetOrientation(), true);
|
||||
me->StopMovingOnCurrentPos();
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
|
||||
events.RescheduleEvent(EVENT_EMERGE, 6000);
|
||||
}
|
||||
|
||||
@@ -971,7 +971,7 @@ public:
|
||||
case EVENT_SHADOW_STEP:
|
||||
if (Unit* target = SelectTargetFromPlayerList(100.0f, 0, true))
|
||||
{
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->AddThreat(target, 5000.0f);
|
||||
AttackStart(target);
|
||||
me->CastSpell(target, SPELL_SHADOW_STEP, false);
|
||||
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
Unit* unit = ObjectAccessor::GetUnit((*me), (*itr)->getUnitGuid());
|
||||
|
||||
if (unit && DoGetThreat(unit))
|
||||
DoModifyThreatPercent(unit, -100);
|
||||
DoModifyThreatByPercent(unit, -100);
|
||||
}
|
||||
|
||||
Talk(SAY_PHASE_2);
|
||||
|
||||
@@ -383,7 +383,7 @@ public:
|
||||
me->CastSpell(me, SPELL_WEAK_RADIATING_OOZE, true);
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_STICKY_OOZE, 5000);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->SetInCombatWithZone();
|
||||
if (TempSummon* ts = me->ToTempSummon())
|
||||
if (Unit* summoner = ts->GetSummonerUnit())
|
||||
@@ -468,7 +468,7 @@ public:
|
||||
me->CastSpell(me, SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC, true);
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_STICKY_OOZE, 5000);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->SetInCombatWithZone();
|
||||
if (Player* p = me->SelectNearestPlayer(100.0f))
|
||||
AttackStart(p);
|
||||
|
||||
@@ -1777,7 +1777,7 @@ public:
|
||||
c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation());
|
||||
const ThreatContainer::StorageType me_tl = me->GetThreatMgr().GetThreatList();
|
||||
const ThreatContainer::StorageType target_tl = c->GetThreatMgr().GetThreatList();
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter)
|
||||
me->GetThreatMgr().AddThreat((*iter)->getTarget(), (*iter)->GetThreat());
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
StartBalconyPhase();
|
||||
break;
|
||||
case EVENT_BLINK:
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->CastSpell(me, RAID_MODE(SPELL_CRIPPLE_10, SPELL_CRIPPLE_25), false);
|
||||
me->CastSpell(me, SPELL_BLINK, true);
|
||||
Talk(EMOTE_BLINK);
|
||||
|
||||
@@ -835,7 +835,7 @@ public:
|
||||
_flyTargetGUID.Clear();
|
||||
me->RemoveAura(SPELL_LIGHTNING_TENDRILS);
|
||||
me->RemoveAura(61883);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
break;
|
||||
case EVENT_ENRAGE:
|
||||
Talk(SAY_BRUNDIR_BERSERK);
|
||||
|
||||
@@ -412,7 +412,7 @@ public:
|
||||
|
||||
if (_feralRushTimer >= 6000)
|
||||
{
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
|
||||
@@ -1184,7 +1184,7 @@ public:
|
||||
break;
|
||||
case EVENT_DETONATING_LASHER_FLAME_LASH:
|
||||
me->CastSpell(me->GetVictim(), SPELL_FLAME_LASH, false);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
if (Unit* target = SelectTargetFromPlayerList(80))
|
||||
AttackStart(target);
|
||||
else
|
||||
|
||||
@@ -1033,7 +1033,7 @@ public:
|
||||
break;
|
||||
case 4:
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
Phase = 4;
|
||||
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
if (Unit* target = SelectTargetFromPlayerList(75.0f))
|
||||
@@ -1613,7 +1613,7 @@ public:
|
||||
break;
|
||||
case 4:
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
Phase = 4;
|
||||
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
if (Unit* target = SelectTargetFromPlayerList(75.0f))
|
||||
|
||||
@@ -518,7 +518,7 @@ public:
|
||||
Talk(EMOTE_PERMA_GROUND);
|
||||
me->SetControlled(false, UNIT_STATE_ROOT);
|
||||
me->DisableRotate(false);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
Unit* target = SelectTarget(SelectTargetMethod::MaxDistance, 0, 0.0, true);
|
||||
if (!target)
|
||||
target = me->SelectNearestPlayer(200.0f);
|
||||
|
||||
@@ -552,7 +552,7 @@ public:
|
||||
summons.DoAction(ACTION_SIF_JOIN_FIGHT, pred);
|
||||
}
|
||||
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
if (Player* player = GetArenaPlayer())
|
||||
me->AddThreat(player, 1000.0f);
|
||||
}
|
||||
|
||||
@@ -1511,7 +1511,7 @@ public:
|
||||
{
|
||||
if (who && damagetype == DIRECT_DAMAGE)
|
||||
{
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->AddThreat(who, 100000);
|
||||
AttackStart(who);
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
@@ -1539,7 +1539,7 @@ public:
|
||||
return;
|
||||
|
||||
me->CastSpell(me, SPELL_DIMINISH_POWER, false);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
case EVENT_SHARVALD_CHARGE:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, (IsHeroic() ? 100.0f : 30.0f), true))
|
||||
{
|
||||
ScriptedAI::DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->AddThreat(target, 10000.0f);
|
||||
me->CastSpell(target, SPELL_CHARGE, false);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
break;
|
||||
case EVENT_SPELL_ARCANE_VACUUM:
|
||||
me->CastSpell((Unit*)nullptr, SPELL_ARCANE_VACUUM, false);
|
||||
DoResetThreat();
|
||||
DoResetThreatList();
|
||||
me->SetControlled(true, UNIT_STATE_ROOT);
|
||||
me->setAttackTimer(BASE_ATTACK, 3000);
|
||||
events.RepeatEvent(30000);
|
||||
|
||||
Reference in New Issue
Block a user