Persist fatal encounters and audit resident readiness with party outcome metrics
Core tests / core (push) Successful in 42s

This commit is contained in:
Codex
2026-09-24 08:05:16 +12:00
parent 900b926b8e
commit d57d793a84
16 changed files with 254 additions and 15 deletions
+5 -3
View File
@@ -55,7 +55,7 @@ local function dangerousSelection(p,r,now)
local target=p:GetSelection()
if not target then return false end
local key=tostring(target:GetGUID())
if not dangerous(p,target) and not (r.avoidTargets and (r.avoidTargets[key] or 0)>now) then return false end
if not dangerous(p,target) and not (AzerothAILearnedDanger and AzerothAILearnedDanger(p,target)) and not (r.avoidTargets and (r.avoidTargets[key] or 0)>now) then return false end
for _,enemy in pairs(p:GetUnfriendlyUnitsInRange(40)) do
if enemy:GetGUID()==target:GetGUID() then return true end
end
@@ -91,7 +91,7 @@ end
function AzerothAISurvivalState(p)
local r=observed[p:GetGUIDLow()]
if not r then return 0,'',0 end
return r.dangerAt or 0,r.action or '',r.actionAt or 0
return r.dangerAt or 0,r.action or '',r.actionAt or 0,r.actionSince or r.actionAt or 0
end
-- Prevent slower model intentions from undoing an immediate safety action.
function AzerothAISurvivalOverride(p)
@@ -105,6 +105,7 @@ local function sample()
if previous then outcome(p,previous,now) end
if managed(p) then
local id=p:GetGUIDLow();local ai=p:GetBotAI();local r=observed[id] or {};observed[id]=r
local previousAction,previousAt=r.action,r.actionAt or 0
local hp=p:GetHealthPct()
local falling=r.hp and r.hp-hp>=20
local mana=p:GetPowerType()==0 and p:GetPowerPct(0) or 100
@@ -125,7 +126,7 @@ local function sample()
for _,m in pairs(peers) do if m~=p and m:GetMapId()==p:GetMapId() and m:GetPhaseMask()==p:GetPhaseMask() and p:GetDistance(m)<=35 and m:GetHealthPct()>=70 then support=support+1 end end
local attackers=0;for _ in pairs(p:GetAttackers()) do attackers=attackers+1 end
local enemy=p:GetVictim()
local overmatched=dangerous(p,enemy)
local overmatched=dangerous(p,enemy) or (AzerothAILearnedDanger and AzerothAILearnedDanger(p,enemy))
r.avoidTargets=r.avoidTargets or {}
for key,expires in pairs(r.avoidTargets) do if expires<=now then r.avoidTargets[key]=nil end end
if enemy and (overmatched or attackers>support+1 or falling and hp<80) then r.avoidTargets[tostring(enemy:GetGUID())]=now+600 end
@@ -195,6 +196,7 @@ local function sample()
end
end
end
if r.actionAt and (r.action~=previousAction or now-previousAt>30) then r.actionSince=now end
end
end
for id,r in pairs(observed) do if now-(r.seen or 0)>600 then observed[id]=nil;ownedMasters[id]=nil end end