Patchwerk: melee DPS stay under the soakers' threat; scenario add route and patrol label

- Hateful Strike hits the highest-health player in melee among his top
  four on threat. The threat hold kept melee DPS at up to the main tank's
  threat, with a timed release, so rogues and warriors were among those four
  (naxx_patchwerk 1115f/1115g: 31 and 36 dead to Hateful Strike). A melee
  DPS on a melee-soak enemy now holds under 90% of the lowest soaker's
  threat while a soaker is in his reach, with no timed release.
- A staged raid that opens on an add: when the add is not in the world near
  the boss (naxx_thaddius 1115f: still checked to Thaddius), the route is
  checked to the add's own spawn row nearest the boss's spawn, and a
  [scenario] line says which.
- The patrol wait line says "home", "walking home" or "walking away" from
  the measured direction; it printed the order condition, so a boss 59 y
  from home and closing read "walking away".
This commit is contained in:
Karrz1
2026-11-15 14:28:05 +00:00
parent 5cd819c0b0
commit 9daaeef257
2 changed files with 84 additions and 16 deletions
+57 -13
View File
@@ -3659,6 +3659,23 @@ void ElectBerserkerDance(Election& e)
// Melee soak (Patchwerk's Hateful Strike): the matching bots keep attacking the enemy in melee so they stay among its top
// threat and soak the strike instead of a DPS. Never the main tank, at most rule.count bots, lowest guid first.
constexpr float kSoakReach = 20.0f; // a soaker this close to the enemy is in his melee (Patchwerk's reach is long)
constexpr float kSoakThreatShare = 0.9f; // a melee DPS stays under this share of the lowest soaker's threat
// The bots that soak for <rule>: never the main tank, at most rule.count, lowest guid first (plan.members is sorted by guid).
std::vector<Player*> MeleeSoakers(Plan const& plan, MeleeSoak const& rule)
{
std::vector<Player*> out;
for (Member const& m : plan.members)
{
if (out.size() >= rule.count)
break;
if (m.bot && m.p != plan.mainTank && m.p->IsAlive() && Matches(rule.who, m, plan.mainTank))
out.push_back(m.p);
}
return out;
}
void PublishMeleeSoak(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders)
{
for (MeleeSoak const& rule : plan.rules->meleeSoak)
@@ -3666,22 +3683,47 @@ void PublishMeleeSoak(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
{
if (enemy->GetEntry() != rule.enemy)
continue;
uint32_t taken = 0;
for (Member const& m : plan.members)
{
if (taken >= rule.count)
break;
if (!m.bot || m.p == plan.mainTank || !Matches(rule.who, m, plan.mainTank))
continue;
auto it = orders.find(m.p->GetGUID().GetCounter());
if (it == orders.end())
continue;
it->second.attack_target = enemy->GetGUID();
++taken;
}
for (Player* p : MeleeSoakers(plan, rule))
if (auto it = orders.find(p->GetGUID().GetCounter()); it != orders.end())
it->second.attack_target = enemy->GetGUID();
}
}
// A melee DPS on a melee-soak enemy stays under the threat of the soakers in his reach, with no timed release: the strike takes the
// highest-health player in melee among his top four on threat (classic_boss_patchwerk.cpp DoHatefulStrike), and a melee DPS held at the
// main tank's threat was one of those four. naxx_patchwerk 1115f/1115g: 31 and 36 of the raid died to Hateful Strike, rogues and warriors
// among the first, at 12-20k a strike. True when this bot is held (out.hold_target set).
bool HoldUnderSoakers(Plan const& plan, Member const& m, Unit* target, RaidOrder& o)
{
if (!plan.rules || m.ranged || m.healer || m.tank)
return false;
for (MeleeSoak const& rule : plan.rules->meleeSoak)
{
if (target->GetEntry() != rule.enemy)
continue;
std::vector<Player*> const soakers = MeleeSoakers(plan, rule);
if (std::find(soakers.begin(), soakers.end(), m.p) != soakers.end())
return false;
float lowest = -1.0f;
for (Player* s : soakers)
if (s->IsWithinDistInMap(target, kSoakReach))
{
float const t = target->GetThreatManager().GetThreat(s);
lowest = lowest < 0.0f ? t : std::min(lowest, t);
}
if (lowest < 0.0f)
return false; // no soaker in his reach: nothing to stay under (the strike goes to whoever is there either way)
float myThreat = target->GetThreatManager().GetThreat(m.p);
if (Pet* pet = m.p->GetPet())
myThreat = std::max(myThreat, target->GetThreatManager().GetThreat(pet));
if (myThreat < lowest * kSoakThreatShare)
return false;
o.hold_target = target->GetGUID();
return true;
}
return false;
}
bool MechanicsMove(Plan const& plan, Member const& self, uint32_t now, RaidOrder& out)
{
switch (plan.mapId)
@@ -4417,6 +4459,8 @@ void PublishThreatHolds(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& ord
if (!vm || !vm->tank)
continue; // it is already hitting a non-tank: everybody fights
}
if (HoldUnderSoakers(plan, m, target, o))
continue;
float tankThreat = 0.0f;
bool tankNear = false;
for (Member const& t : plan.members)
@@ -1339,8 +1339,31 @@ bool PickArrival(Run& run, Player* leader)
tz = add->GetPositionZ();
}
else
TC_LOG_INFO("playerbot.v2", "[scenario] {} no living creature {} within 200 y of the boss's spawn: the staging route is checked to the boss",
run.def->name, run.def->start_add);
{
// Not up yet (a summon the boss's script brings in later) or not found from him: the add's own spawn row nearest his spawn
// is where it stands (naxx_thaddius 1115f: no Stalagg found, the route checked to Thaddius again; Stalagg and Feugen have
// world DB rows on their platforms, which the instance script despawns as duplicates of its summons).
float best = 200.f;
bool found = false;
for (auto const& kv : sObjectMgr->GetAllCreatureData())
{
CreatureData const& cd = kv.second;
if (cd.id != run.def->start_add || cd.mapId != run.def->map)
continue;
float const d = std::hypot(cd.spawnPoint.GetPositionX() - run.boss_x, cd.spawnPoint.GetPositionY() - run.boss_y);
if (d < best)
{
best = d;
tx = cd.spawnPoint.GetPositionX();
ty = cd.spawnPoint.GetPositionY();
tz = cd.spawnPoint.GetPositionZ();
found = true;
}
}
TC_LOG_INFO("playerbot.v2", "[scenario] {} creature {} not in the world near the boss ({}): the staging route is checked to {}",
run.def->name, run.def->start_add, boss ? "boss found" : "boss not found",
found ? fmt::format("its spawn row at {:.1f},{:.1f},{:.1f}", tx, ty, tz) : std::string("the boss (no spawn row either)"));
}
}
PathGenerator pg(leader);
::Playerbot::BotMovement::SehSafeCalculatePathFrom(pg, run.stage_x, run.stage_y, run.stage_z, tx, ty, tz);
@@ -4165,7 +4188,8 @@ static void TickRun(Run& run, std::uint32_t diff_ms)
TC_LOG_INFO("playerbot.v2", "[scenario] {} the attack waits for {}'s patrol: {:.0f} y from the main tank at {:.1f},{:.1f},{:.1f}, "
"{:.0f} y from his home, {}, {} s waited",
run.def->name, boss->GetName(), tank->GetDistance(boss), boss->GetPositionX(), boss->GetPositionY(),
boss->GetPositionZ(), run.patrol_home_dist, walking_home ? "walking home" : "walking away",
boss->GetPositionZ(), run.patrol_home_dist,
run.patrol_home_dist <= kPatrolHomeYards ? "home" : run.patrol_homeward ? "walking home" : "walking away",
(run.run_ms - run.patrol_wait_ms) / 1000u);
}
attack_due = false;