-- Read-only AI difficulty probe. Answers whether Hellwalker's AI can follow a single summoned unit. -- 1. Once a map is loaded: which parts of GlobalConfig_Combined_ differ between the five -- difficulties. The three sub-configs and every reflected field on them are compared -- (PDA_GlobalConfig_Combined.hpp, PDA_GlobalCombatConfig.hpp, PDA_GlobalMechanicConfig.hpp, -- PDA_GlobalTechnicalConfig.hpp), and each Combat config's OverrideAIParameters is listed -- (SGameAI.hpp FSGameAIParameterCollection). -- 2. While an arena fight runs, a bounded window shows who asks for the difficulty: the blueprint -- behaviour-tree check BTDecorator_SwitchDifficulty_C and -- UPBZBlueprintFunctionLibrary.GetDiffcultMode/GetDifficulty, with the pawn or context object of -- each call and whether it belongs to the app's units. -- Hooks only count and log; they never return a value or write a field. local U=require('ue_observe') local Probe={} local DIFFICULTIES={'Handicapped','Easy','Normal','Hard','Nightmare'} local SUBCONFIGS={'Combat Config','Mechanic Config','Technical Config'} local AI_MAPS={'BoolParameters','IntParameters','FloatParameters','VectorParameters','RotatorParameters','ObjectParameters', 'InstancedObjectParameters','ClassParameters','EnumParameters','StringParameters','NameParameters'} local DECORATOR='/PBZCombatAsset/Prototypes/AI/BTDecorator_SwitchDifficulty.BTDecorator_SwitchDifficulty_C:PerformConditionCheckAI' local LIBRARY='/Script/ProjectPBZ.PBZBlueprintFunctionLibrary:' local WINDOW_SECONDS,MAX_LINES,MAX_TEXT=150,60,360 local function assetPath(name)return '/PBZCombatAsset/Config/GlobalConfig_Combined_'..name..'.GlobalConfig_Combined_'..name end local function clip(s,limit)s=tostring(s);limit=limit or MAX_TEXT;return #s<=limit and s or s:sub(1,limit)..'…' end local function objectName(object) local ok,full=pcall(function()return object:GetFullName()end) if ok and type(full)=='string' then return full:match('^%S+ (.+)$') or full end return U.kind(object) end local function className(object) if not U.valid(object) then return 'invalid' end local ok,class=pcall(function()return object:GetClass()end) if not ok or not U.valid(class) then return objectName(object) end local okName,name=pcall(function()return class:GetFName():ToString()end) return okName and type(name)=='string' and name or objectName(class) end -- A comparable text for one reflected value; maps and arrays list their entries (capped). local text local function entries(v,limit) local parts,count={},0 local ok=pcall(function() v:ForEach(function(a,b) count=count+1 if count<=limit then if b==nil then parts[#parts+1]=text(a,1) else parts[#parts+1]=text(a,1)..'='..text(b,1) end end end) end) if not ok then return nil end table.sort(parts) return parts,count end text=function(v,depth) v=U.unwrap(v);depth=depth or 0 if v==nil then return 'nil' end if type(v)=='number' then return string.format('%.6g',v) end if type(v)=='boolean' or type(v)=='string' then return tostring(v) end local kind=U.kind(v) if kind=='TArray' or kind=='TMap' or kind=='TSet' then if depth>0 then return kind end local parts,count=entries(v,30) if not parts then return kind..'?' end return kind..'['..count..']{'..table.concat(parts,',')..'}' end local tag=U.struct(v,'TagName') if tag~=nil then return text(tag,depth) end local attribute=U.struct(v,'AttributeName') if attribute~=nil then return text(attribute,depth) end if U.valid(v) then return objectName(v) end local ok,s=pcall(function()return v:ToString()end) if ok and type(s)=='string' then return s end return kind end Probe.text=text local function properties(object) local names,seen={},{} local ok,class=pcall(function()return object:GetClass()end) for _=1,4 do if not ok or not U.valid(class) then break end pcall(function() class:ForEachProperty(function(property) local okName,name=pcall(function()return property:GetFName():ToString()end) if okName and type(name)=='string' and not seen[name] then seen[name]=true;names[#names+1]=name end end) end) ok,class=pcall(function()return class:GetSuperStruct()end) end return names end function Probe.new(options) local log=options.log or function()end local clock=options.clock or os.time local self={configsDone=false,state='idle',alive=true,token=0} local function say(message)log('[AIDifficulty] '..message)end local hooks,tally,logged,cache={},{},{},{} local lines,calls,startedAt,uncertain=0,{},nil,false local function config(name) local path=assetPath(name) local object=StaticFindObject(path) local resident=U.valid(object) if not resident and options.load then local ok,value=pcall(LoadAsset,path) object=ok and value or nil end say(name..' Combined 已在内存='..tostring(resident)..' 可读='..tostring(U.valid(object))) return U.valid(object) and object or nil end function self:compareConfigs() say('开始只读对比5档 GlobalConfig_Combined:子配置引用、逐字段差异、OverrideAIParameters;不写任何游戏对象') local combined={} for _,name in ipairs(DIFFICULTIES)do combined[name]=config(name)end for _,sub in ipairs(SUBCONFIGS)do local objects,refs={}, {} for _,name in ipairs(DIFFICULTIES)do local value=combined[name] and U.field(combined[name],sub) objects[name]=U.valid(value) and value or nil refs[#refs+1]=name..'='..(objects[name] and objectName(objects[name]) or 'nil') end say(sub..' 引用:'..table.concat(refs,' | ')) local first=objects.Easy or objects.Normal or objects.Hard if first then local same,different,skipped=0,0,{} for _,field in ipairs(properties(first))do local texts,distinct,last={},0,nil -- Structs have no generic reader; OverrideAIParameters is listed in full below. local sample=U.field(first,field) local kind=U.kind(sample) if kind=='UScriptStruct' or (kind=='table' and not U.valid(sample)) then skipped[#skipped+1]=field;distinct=-1 end for _,name in ipairs(DIFFICULTIES)do -- U.field also returns its read flag; keep only the value. local value=objects[name] and text((U.field(objects[name],field))) or 'nil' if distinct>=0 then texts[#texts+1]=name..'='..clip(value) if value~=last then distinct=distinct+1;last=value end end end if distinct<0 then elseif distinct>1 then different=different+1 say(' 差异 '..sub..'.'..field..':'..table.concat(texts,' | ')) else same=same+1 end end say(sub..' 字段相同='..same..' 不同='..different..' 未比较='..#skipped..(#skipped>0 and '('..table.concat(skipped,',')..')' or '')) end if sub=='Combat Config' then for _,name in ipairs(DIFFICULTIES)do local params=objects[name] and U.field(objects[name],'OverrideAIParameters') local filled={} for _,map in ipairs(AI_MAPS)do local value=U.struct(params,map) if value~=nil then local parts,count=entries(U.unwrap(value),40) if parts and count>0 then filled[#filled+1]=map..'['..count..']{'..clip(table.concat(parts,','),600)..'}' end end end say(name..' OverrideAIParameters='..(#filled>0 and table.concat(filled,' ') or '全空')) end end end end -- Which of the app's units an object belongs to: the pawn itself, its controller, or anything -- whose outer chain reaches one of them. Cached per object address for the window. local function owner(object) local key=U.key(object) if not key then return nil,'invalid' end local hit=cache[key] if hit then return hit.owner,hit.class end local units=self.units or {} local found local current=object for _=1,8 do if not U.valid(current) then break end local k=U.key(current) if units[k] then found=units[k];break end local okPawn,pawn=pcall(function()return current:K2_GetPawn()end) if okPawn and U.valid(pawn) and units[U.key(pawn)] then found=units[U.key(pawn)];break end local okOuter,outer=pcall(function()return current:GetOuter()end) if not okOuter then break end current=outer end hit={owner=found,class=className(object)} cache[key]=hit return hit.owner,hit.class end local function record(kind,detail,signature) calls[kind]=(calls[kind] or 0)+1 tally[signature]=(tally[signature] or 0)+1 if not logged[signature] and lines=WINDOW_SECONDS then self:stop('时间到') end end return self end return Probe