-- 怪对怪处决(实验,v0.37.7). The player executes a unit through its execution component: -- PlayExactExecution({ExecutionAbility=, ExecutedAbility=}, target, StartTime) -- and each side plays its own montage: the target its being-executed one on its own skeleton, the executor one made -- for the player's skeleton (Hun_Skin_Skeleton). The pair is the target config's TargetExecutionAnims (60 configs: -- 魔渊, 金面/铁面, 鬼差, 暴徒, 人偶, 大头娃娃, 武轩/浊碧 …) or, for 彭猛 and 毕峰, the one their own finishing skill -- starts. Every NPC has the same component (BP_RenewalNPC 'Execution Component'), so in a fight the nearest enemy makes -- that call when the target could be executed by the player: it carries CharacterState.CanWeakExecute.Weak (broken) -- or .LowHealth (under its execution threshold), which GA_CommonUtilitiesPassive sets through GE_CanWeakExecute / -- GE_CanLowHealthExecute; or it is a boss that has sat on its health lock for a second. -- The executor turns to face the target first (the game warps the player that way). Its body cannot play the player's -- montage, so it borrows one: a hidden component with the player's mesh plays the clip inside that montage, and the -- executor's meshes follow that component's bones by name (SetLeaderPoseComponent; 176 of the game's character -- skeletons share the player's core bone names). The primary mesh keeps TickPose enabled for its native montage -- and root-motion warping. Other parts retain their prior tick policy; original policies are restored at the end. -- Proportions differ, so it clips. The executor's clip plays to its -- end even when the target falls earlier; then the borrowed body goes. A minion (config Difficulty Tag Mob, Standard -- or Elite, the app's 小怪) still standing is ended with GE_Kill, as an execution ends it for the player; a boss -- (MiniBoss … UltimateBoss) is left standing, it may have another phase, and can be executed again later, except one -- executed on its health lock: that lock comes off and GE_Kill ends it. One execution at a time; -- every step is logged with what it read back. Found offline (audit-tools), see REVERSE_ENGINEERING v0.37.7. -- A lock is the config's own *LockHealth* effect, a pair's, or any Health_Min floor at most 1% of the unit's health: -- 火流星:磷火意识 gets GE_LockHealth from its blueprint. Its execution is the player's QTE (GA_GuiChai_Red_P2_CA_04: a -- dodge prompt at the lock, then heavy attack mashed through the execution), which another monster cannot press, so -- the mod presses for it: the game's GameplayEvent.QTE.HuoLiuXing goes to the player's ability system, where the -- executed side listens, every GAP seconds; the executor's ability and borrowed body play a hit each time and their -- finale once the executed side has moved to its own. -- 随从处决 BOSS (the app switch, companion_executions.lua): outside the arena's teams, a boss on a companion's hatred list, -- summoned with no team or of the map, can be executed the same way by the nearest companion. Minions stay the player's. -- 随从处决小怪 (a second app switch, same file): a minion on a companion's hatred list that the player could execute is -- executed by the nearest companion too, with the minion's own pair; one the player has taken stays the player's. -- A minion with no pair of its own is finished with the Hun's generic pair (hun_execution_pairs.lua), the executor -- borrowing the player's body for it as it does for a boss's pair, when the minion's skeleton is that pair's. -- 随从魂 (a Hun body summoned as a companion) finishes what the player could finish, whatever that switch says: a -- minion as well as a boss on a companion's hatred list. For a minion it takes the pair of the weapon it holds now, -- then the generic pair, then the minion's own (Look.STEPS.companionWeaponFirst=false: the minion's own first, as -- before); a boss keeps its own pair (made for the player's skeleton, which the Hun body shares, so it plays on the -- Hun's own mesh; it carries the boss's lock handling), and one with none gets the weapon's, then the generic one. -- 随从魂谁都能处决: when no pair was made for the foe's skeleton (and the foe's own pair, if it has one, cannot be -- used), the Hun still plays the first pair of its weapon, or the generic one. The foe's half is then the game's to -- play on a skeleton it was not made for; when the foe shows no being-executed montage in 1.5 s the run goes on all -- the same: the foe's AI is paused where it stands, the Hun's clip plays out, and the end is the usual one (a minion -- dies, a boss stays unless it was on its lock). Off with Look.STEPS.companionAnyone=false. -- A target the player is executing or has executed stays the player's. Off with Look.STEPS.companionExecutions=false. local U=require('ue_observe') local Stats=require('character_stats') local PoseProbe=require('execution_pose_probe') local Chain=require('execution_chain') local CopyPose=require('execution_copy_pose') local Playback=require('execution_playback') local Opportunities=require('execution_opportunities') local Rules=require('execution_rules') local Exec={} local MOBS='/PBZCombatAsset/ActorData/Mobs/' local GE_LOCK='/PBZCombatAsset/Prototypes/GameplayEffects/GE_LockHealth.GE_LockHealth_C' -- Bosses whose pair is started from their own skill, not listed in their config. start: the StartTime the skill -- passes; locks: the lock effects it removes, with unlock='start' when it removes them as the execution starts. local Lion=require('lion_challenge') local LAST_LION_CLASS=Lion.CUB local LION_EXEC='GA_Hun_BEx_HouHouHou_01_C' local LION_VICTIM='GA_Hun_BEd_HouHouHou_01_C' local LION_FLOOR_FRACTION=0.01 local PAIRS={ BP_Monster_GuiChai_Red_P2={ execution=MOBS..'075_GuiChai_Red_P2/Ability/GA_GuiChai_Red_P2_BEx_01.GA_GuiChai_Red_P2_BEx_01_C', executed=MOBS..'075_GuiChai_Red_P2/Ability/GA_GuiChai_Red_P2_BEd_01.GA_GuiChai_Red_P2_BEd_01_C', start=0.1,locks={GE_LOCK},unlock='start'}, BP_Monster_PengMeng_Axe={ execution=MOBS..'044_PengMeng/Ability/Axe/Abilities/CA/GA_Hun_BEx_Common_PengMeng_V2.GA_Hun_BEx_Common_PengMeng_V2_C', executed=MOBS..'044_PengMeng/Ability/Axe/Abilities/CA/GA_Hun_BEd_Common_PengMeng.GA_Hun_BEd_Common_PengMeng_C'}, BP_Monster_GreatBladeMan={ execution=MOBS..'008_GreatBladeMan/Ability/Abilities/GA_Hun_BEx_Common_BladeMan.GA_Hun_BEx_Common_BladeMan_C', executed='/PBZCombatAsset/ActorData/Players/Hun/Abilities/Common/ExE/GA_Hun_BDEd_Common_AttackBladeMan_01.GA_Hun_BDEd_Common_AttackBladeMan_01_C'}, } local TYPES={'Execution.Type.Custom.HorseCartCombat','Execution.Type.CombatRider','Execution.Type.Combat','Execution.Type.Custom.JiangJun'} local GENERALS={'CharacterType.JiangJun'} local CONTEXTUAL={['Execution.Type.CombatRider']=true,['Execution.Type.Custom.HorseCartCombat']=true} -- The player could execute it now (GA_CommonUtilitiesPassive). local EXECUTABLE={'CharacterState.CanWeakExecute.Weak','CharacterState.CanWeakExecute.LowHealth'} local GE_KILL='/Game/PBZContent/Blueprint/Ability/GameplayEffects/GE_Kill.GE_Kill_C' local PROLOGUE_FINAL_LOCK=MOBS..'054_ZuoShang/AIConfig/GE_ZuoShang_MinHealth_04.GE_ZuoShang_MinHealth_04_C' -- Locks applied outside configs (blueprints, skills, AI scripts, summons); taken off too when they are loaded. local GENERIC_LOCKS={GE_LOCK,'/PBZCombatAsset/Prototypes/GameplayEffects/GE_LockHealthButCanExecuted.GE_LockHealthButCanExecuted_C'} local DEATH_LOCK=0.01 -- a floor of unknown source counts as a lock up to this share of Health_Max (not a phase) local ABILITY_LIBRARY='/Script/GameplayAbilities.Default__AbilitySystemBlueprintLibrary' -- The executor's own AI kept choosing moves during the first test (魔渊 started attacks 1.1 s in and his capsule -- wandered from 2 m to 14 m off the boss while his body played the execution), so its brain is paused meanwhile. local AI_LIBRARY='/Script/SGameAI.Default__SGameAIFunctionLibrary' local PAUSE_REASON='PhantomGladiator execution' local MESH_CLASS='/Script/Engine.SkeletalMeshComponent' -- Both original victim montages use this sequence. The start plays for 0.9 s at 0.6x, -- then the finish montage jumps to source 0.4 at 3x and continues from 0.7 at 1.5x. local GUILLOTINE_GRAB={clip='/HuaShira/Characters/EliteBoss/MBoss/Anim/Hun_EXD_ByMBoss.Hun_EXD_ByMBoss', rate=0.6000000238418579,same_skeleton=true} local GUILLOTINE_POSES={ {limit=0.54}, {from=0.4,rate=3,limit=0.7}, {from=0.7,rate=1.5,limit=6.233333}, {from=6.233333,rate=0}, } -- A victim on Hun_Skin_Skeleton (the Hun body) plays the original victim montages on its own anim instance: the start -- (0.6x inside the montage) held at the 0.9 s catch point, then the finish (its two rates are in the montage). local GUILLOTINE_SELF={start='/PBZCombatAsset/ActorData/Players/Hun/Montage/Execution/Hun_EXD_ByMBoss_Start_Montage.Hun_EXD_ByMBoss_Start_Montage', finish='/PBZCombatAsset/ActorData/Players/Hun/Montage/Execution/Hun_EXD_ByMBoss_Montage.Hun_EXD_ByMBoss_Montage', skeleton='Hun_Skin_Skeleton',catch=0.9,finishLength=3.788884} -- An executor whose own mesh is on its clip's skeleton plays the execution on that mesh; when its montage has not -- shown up this long after the call, it borrows a body as any other executor does, for the rest of the battle. local DIRECT_WAIT=0.3 local GUILLOTINE_PAUSE='PhantomGladiator guillotine' local GUILLOTINE_TIMEOUT=12 -- game seconds, longer than the original victim sequence local MOVE_NONE=0 local IDENTITY={Rotation={X=0,Y=0,Z=0,W=1},Translation={X=0,Y=0,Z=0},Scale3D={X=1,Y=1,Z=1}} -- Skinned parts that can follow a body: meshes, and Chaos cloth (魔渊's hair CA_Motian_Hair01 and three cloth pieces, -- 彭猛's cape). The first build left the cloth on the body while the body followed the borrowed skeleton, and the -- hair and cloth were left floating after the execution. local MESH_KINDS={'SkeletalMeshComponent','ChaosClothComponent'} local RESET_PHYSICS=2 -- ETeleportType::ResetPhysics local SNAP=2 -- EAttachmentRule::SnapToTarget local TICK_REFRESH=0 -- EVisibilityBasedAnimTickOption::AlwaysTickPoseAndRefreshBones (hidden, still posed) local KEEP_ROOT_MOTION=0 -- ERootMotionMode::NoRootMotionExtraction: the borrowed body moves as the montage does local HOLD=1.0 -- seconds on the floor before an execution starts local REACH=600 -- cm: the executor is the nearest enemy within this (the game's Combat point: 500) local LOCK_REACH=2000 -- a locked boss waits for no one else, so its executor may come from further away local TAIL=0.3 -- the run ends this long after the executor's clip local AGAIN=15 -- seconds before a boss that survived an execution can be executed again -- 雷当, 献祭之蛇's second phase and 冷荼 lock at the end of their fight with no pair to be executed by: in their own fight -- a level script ends them, here nothing would and the fight could not finish. After this long on the death lock they are -- ended the way that script does it (SpawnerToDieNS: the lock off, GE_Kill), unless they are out of reach by design. local STUCK_SECONDS=20 local GAP=0.5 -- seconds between the presses the mod makes in a QTE execution local PRESSES=30 -- presses before it stops waiting for the executed side's finale and plays it itself local THRESHOLDS={'FirstThreshold','SecondThreshold','ThirdThreshold'} local LOG_CAP=160 local function short(object) if not U.valid(object) then return '?' end local ok,name=pcall(function()return object:GetFName():ToString()end) return ok and type(name)=='string' and name or '?' end local function className(actor) if not U.valid(actor) then return '?' end local ok,cls=pcall(function()return actor:GetClass()end) return ok and (short(cls):gsub('_C$','')) or '?' end local function fmt(v)return type(v)=='number' and string.format('%.1f',v) or tostring(v) end -- A TWeakObjectPtr property may come back as the object or as a wrapper with Get(). local function weak(value) value=U.unwrap(value) if U.key(value) then return value end local ok,object=pcall(function()return value:Get()end) return ok and U.valid(object) and object or nil end local function tickPoseOf(component) local value=U.field(component,'bFollowerShouldTickPose') if type(value)=='boolean' then return value end if value==0 or value==1 then return value==1 end end function Exec.new(options) local log=options.log or function()end local stats=options.attributes or Stats.new() local find=options.staticFind or function(path)return StaticFindObject(path)end local load=options.loadAsset or function(path)return LoadAsset(path)end local findAll=options.findAll or FindAllOf local name=options.fname or FName local now=options.now local function paused()return options.paused and options.paused()==true end local function inNativeExecution(actor) if not options.nativeExecution then return false end local ok,value=pcall(options.nativeExecution,actor) return not ok or value~=false end local function phaseBusy(actor) if not options.phaseBusy then return false end local ok,value=pcall(options.phaseBusy,actor) return not ok or value~=false end local data=options.data or require('execution_data') -- The Hun body's switches (hun_look.lua) and its weapon's generic pairs (hun_execution_pairs.lua). local hunSteps=options.hunSteps or require('hun_look').STEPS local hunPairs=options.hunPairs or require('hun_execution_pairs') local isHun=options.isHun local directFailed={} -- executor key -> true: its own-mesh execution did not show, it borrows for this battle local dataFold={};for key,value in pairs(data)do dataFold[key:lower()]=value end local function animationData(key)return data[key] or dataFold[key:lower()]end local poseProbe=PoseProbe.new({log=log,now=now,fname=name,staticFind=find}) local chain=Chain.new({log=log,fname=name,staticFind=find,loadAsset=load,findAll=findAll,getPlayer=options.getPlayer,getWorld=options.getWorld, members=options.members,isImmortal=options.isImmortal,registerHook=options.registerHook,unregisterHook=options.unregisterHook, health=function(actor)local value=stats:read(actor,'Health');return value and value.current end}) local self={enabled=options.enabled~=false,started=0,finished=0,failures=0,kills=0,message=''} local policy=require('execution_policy').new({configured=options.executionPolicyConfigured,rule=options.executionPolicy,log=log,random=options.executionRandom,world=options.getWorld}) local units={} -- actor key -> {state='none'|'nopair'|'nodata'|'ready'|'done', pair, locks, timing, since, waited} local humanoidLines=0 local tagRead=nil -- how the executable tags read back the first time, logged once local active=nil local grabPoses,pendingGrabControls={},{} local finish local callingNative=false local pendingBodies={} local lines=0 local function say(m)if lines0) then return false end end return true end local function ruleAllows(actor,rule,role,knownLionFloor) if not rule then return true end if not tagsMatch(actor,rule[role..'_required'],true) or not tagsMatch(actor,rule[role..'_ignored'],false) then return false end if role=='target' and not knownLionFloor and #(rule.any_target or {})>0 then for _,t in ipairs(rule.any_target)do if tagsMatch(actor,{t},true)then return true end end return false end return true end local function inspect(actor,checkConditions,locked,knownLionFloor) local info={state='none',locks={}} local config=U.field(actor,'Actor Config') if not U.valid(config) then return info end local actorClass=className(actor) info.prologue=actorClass=='BP_Monster_ZuoShang' local rank=U.struct(U.field(config,'Difficulty Tag'),'TagName') local okRank,text=pcall(function()return rank:ToString()end) info.rank=okRank and type(text)=='string' and text:gsub('^CharacterType%.Difficulty%.','') or '?' info.boss=info.rank:find('Boss$')~=nil info.mob=info.rank=='Mob' or info.rank=='Standard' or info.rank=='Elite' for _,ge in ipairs(U.array(U.field(config,'Passive GameplayEffects')) or {}) do if U.valid(ge) and short(ge):find('LockHealth',1,true) then info.locks[#info.locks+1]=ge end end local execution,executed,source,missing local entries=U.array(U.field(config,'TargetExecutionAnims')) or {} for _,wanted in ipairs(TYPES) do for _,entry in ipairs(entries) do local tag=U.struct(U.struct(entry,'ExecutionType'),'TagName') local ok,text=pcall(function()return tag:ToString()end) local a,b=U.struct(entry,'ExecutionAbility'),U.struct(entry,'ExecutedAbility') local eligible=true if checkConditions and ok and text==wanted then eligible=tagsMatch(actor,U.struct(entry,'TargetRequiredTags'),true) and tagsMatch(actor,U.struct(entry,'TargetIgnoredTags'),false) if knownLionFloor then eligible=eligible and wanted=='Execution.Type.Combat' and short(a)==LION_EXEC and short(b)==LION_VICTIM end if locked and wanted=='Execution.Type.Combat' then -- A death floor can supply the opening, but cannot change a general's execution channel. eligible=eligible and tagsMatch(actor,GENERALS,false) else eligible=eligible and ruleAllows(actor,Rules[wanted],'target',knownLionFloor) end if CONTEXTUAL[wanted] then local readType,hasType=call(U.field(actor,'Execution Component'),'HasExecutionType',{TagName=name(wanted)}) eligible=eligible and readType and U.unwrap(hasType)==true -- These points are serialized even for an unmounted spearman. The rider/cart actions -- dereference the current vehicle, so a static point alone is not a mounted opportunity. if wanted=='Execution.Type.CombatRider' then local driver=U.field(actor,'BP_SGameDriverComponent') if not U.valid(driver) then local got,found=call(actor,'GetDriverComponent');driver=got and U.unwrap(found) end eligible=eligible and U.valid(U.field(driver,'DrivingVehicle')) end end end if ok and text==wanted and U.valid(a) and U.valid(b) and eligible then if animationData(short(a)) then execution,executed,source=a,b,'配置 TargetExecutionAnims '..text;info.executionType=text;break end missing=missing or a end end if execution then break end end if not execution and missing and not PAIRS[actorClass] then info.state='nodata';info.pair={execution=missing};return info end local known=not execution and PAIRS[actorClass] or nil if known then local why1,why2 execution,why1=object(known.execution);executed,why2=object(known.executed) source='BOSS 自己的收尾技能(执行方 '..why1..',被处决方 '..why2..')' for _,path in ipairs(known.locks or {}) do local ge=object(path) if ge then info.locks[#info.locks+1]=ge end end end if not (U.valid(execution) and U.valid(executed)) then info.state='nopair';return info end -- A move that writes story progress (story_writes.lua) only when that progress is already there. if options.storyAllows then local allowed,why=options.storyAllows(execution) if not allowed then info.state='story';info.storyWhy=why;info.pair={execution=execution,executed=executed,source=source};return info end end info.timing=animationData(short(execution)) if not info.timing then info.state='nodata';info.pair={execution=execution};return info end info.state='ready' info.pair={execution=execution,executed=executed,source=source,start=known and known.start,unlock=known and known.unlock,type=info.executionType} if info.executionType and info.executionType~='Execution.Type.Combat' then for _,point in ipairs(U.array(U.field(config,'Execution Target Points')) or {})do local tagName=U.struct(U.struct(point,'ExecutionTag'),'TagName') local got,text=pcall(function()return tagName:ToString()end) if type(tagName)=='string' then got,text=true,tagName end local radius=U.struct(point,'Radius') if got and text==info.executionType and type(radius)=='number' and radius>0 then info.pair.reach=math.min(1000,math.max(info.pair.reach or 0,radius)) end end end -- A pair taken from the boss's own skill is its finisher (彭猛's last segment kills whatever its health): the -- skill starts it on the lock, so that lock is its only trigger, not a break or a low-health mark. info.lockOnly=known~=nil return info end -- Sitting on a health lock: a Health_Min floor, the unit's known lock or one low enough to be a death lock. local function onLock(actor,unit,hp) local floor=read(actor,'Health_Min') if not floor or floor<=0 or hp>floor+1+floor*0.01 then return false end return #unit.locks>0 or floor<=DEATH_LOCK*(read(actor,'Health_Max') or 0)+1 end -- The verified wave applies GE_LockHealthButCanExecuted, which captures 1% of the -- summoner's Health_Max. The separate native Weak tag uses 20% of the cub's own health. local function lastLionFloor(actor,hp,owner) local floor=read(actor,'Health_Min') if type(floor)~='number' or not (floor>0 and floor0 and ownerMax0 then return tag end end end local function isHumanoid(actor) local ok,bone=call(U.field(actor,'Mesh'),'GetBoneIndex',name('pelvis')) bone=ok and U.unwrap(bone) or nil local yes=type(bone)=='number' and bone>=0 if humanoidLines<6 then humanoidLines=humanoidLines+1 say('检查当前身体 '..className(actor)..' pelvis读回='..tostring(bone)..' 人形='..tostring(yes)) end return yes end -- The profile's outgoing thresholds cap mod-initiated finishers, including weapon-pair fallbacks. local function healthWindow(target) local hp,max=read(target,'Health'),read(target,'Health_Max') local ok,count=call(U.field(target,'AbilitySystemComponent'),'GetGameplayTagCount',{TagName=name('CharacterState.Stand.Break')}) count=ok and U.unwrap(count) if type(hp)~='number' or not (hp>0 and hp0 and max=0) then return false end return hp/max,count>0 end local function hunWithinLimit(actor,ratio,broken) local profile=options.hunProfile and options.hunProfile(actor) local field=broken and 'ExecutionExecutorBreakHealthThreshold' or 'ExecutionExecutorNormalHealthThreshold' local limit=profile and profile.attributes and profile.attributes[field] if limit==nil then limit=broken and 0.20 or 0.10 end return ratio and type(limit)=='number' and limit>0 and limit0 and distance(target,other) if d and d<=reach and (not bestDistance or d