-- These profiles follow the release paths of the granted ability, including inherited moves. local U=require('ue_observe') local M={} local inputPath='/PBZInput/InputActions/IA_ShachiAbility_Hold.IA_ShachiAbility_Hold' local componentClass='/Script/SGameInputSystem.SGameInputComponent' local inputLibrary='/Script/SGameInputSystem.Default__SGameInputUtils' 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}} local state='CharacterState.AbilityState.' local axe={kind='axe',tier=2,limit=4,tail=7,result={'Release3','Release2','Release1','SprintRelease2','SprintRelease1'}} local sprintAxe={kind='axe',tier=1,limit=4,tail=7,result=axe.result} local mace={kind='mace',limit=5,tail=6,result={'Release3'}} local bow={kind='aim',ranged=true,window=state..'ShachiBow.Perfect',limit=4.5,tail=4,result={'ShootMax','Shoot'}} local fist={kind='poll',window=state..'TieKuangQuanTao.Charge.PerfectTime',limit=2,tail=4, upgrade='CharacterState.WeaponUpgrade.TieKuangQuanTao.CanCharge',success=state..'TieKuangQuanTao.Charge.PeffectSuccess'} local channel={kind='channel',limit=2,tail=3} local profiles={ GA_BrutalAxe_Normal=axe,GA_BrutalAxe_Sprint=sprintAxe,GA_JinGua_Normal=mace, GA_TigerCannon={kind='aim',ranged=true,window=state..'TigerCannon.Perfect',limit=3.8,tail=4,result={'LaunchPerfect','Launch'}}, GA_UnnamedBow=bow,GA_YouLongCha_Normal=bow, GA_DuYan_Bow_Normal={kind='aim',ranged=true,window=bow.window,limit=4.5,tail=4,result={'Shoot'}}, GA_TieKuangQuanTao_Charge_A=fist,GA_TieKuangQuanTao_Charge_AA=fist,GA_TieKuangQuanTao_Charge_AAA=fist, GA_Hun_HuoLiuXing_AAAA={kind='poll',window=state..'HuoLiuXing.CanJumpTimeline',limit=4,tail=5,result={'Final'}}, } function M.profile(move) return profiles[move.cls:match('%.([%w_]+)_C$')] or (move.release and move.release:match('^OnRelease_') and channel or nil) end function M.opportunity(p,move,ctx) if not p or not ctx.target or ctx.busy or ctx.underThreat or (ctx.hpRatio or 1)<.25 then return false end local distance=ctx.distance if type(distance)~='number' or not (distance>=0 and distance<=3000) then return false end local opening=ctx.opening or ctx.targetBroken if p.ranged then return opening or distance>=550 end return distance<=math.min(move.radius,650) and (opening or distance>=300) end local function same(a,b) local key=U.key(a) return key~=nil and key==U.key(b) end local function number(v)return type(v)=='number' and v>=0 and v=p.tier then return '斧蓄力段 '..level end elseif p.kind=='mace' and hasTag(state..'JinGua.CanRelease') and hasTag(state..'JinGua.Charge3') then return '金瓜三段' end end local function directRelease(p,inst,hasTag) local _,charging=call(inst,'Is Charging') local allowed=U.field(inst,'Min Duration Reached')==true if p.kind=='mace' then allowed=hasTag(state..'JinGua.CanRelease') end if charging==true and allowed then return call(inst,'To Release') end end function self:observe(r,cast,inst,ctx,now,hasTag) local h,p=cast.hold,cast.profile if not h or not p or cast.confirmed or not owned(r,h.component) then return end local result=feedback(p,cast,inst,hasTag) if result then self:finish(r,h) cast.confirmed=true;cast.released=true;cast.awaitWindow=false say(r,'影武释放结果读回 '..cast.choice.meta.label..' '..result) return end if cast.released then if cast.awaitWindow and directRelease(p,inst,hasTag) then cast.awaitWindow=false;say(r,'影武已在可释放窗口补发松手 '..cast.choice.meta.label) end return end if not same(U.field(r.actor,'InputComponent'),h.component) or mapValue(U.field(h.component,'HoldingInputs'),h.action)~=h.stamp then self:finish(r,h);cast.released=true say(r,'影武输入归属发生变化,停止驱动本次蓄力') return end local reason if ctx.busy or ctx.underThreat or (ctx.hpRatio or 1)<.25 then reason='受压' elseif not M.opportunity(p,cast.move,ctx) or (cast.opening and not (ctx.targetBroken or ctx.opening)) then reason='机会结束' else reason=whenReady(p,inst,hasTag) end if not reason and now-cast.started>=p.limit then reason='达到最长等待' end if not reason then return end local receiver=cast.move.release local task=p.kind=='aim' or p.kind=='channel' -- A delegate on a different task, action or component cannot release this cast. if task and not waiting(inst,h) then return end local _,heldTime=call(h.component,'GetHoldTime',h.action) if not drop(r,h) then return end cast.released=true local sent if task then sent=call(inst,receiver,number(heldTime) and heldTime or now-cast.started) elseif p.kind=='axe' or p.kind=='mace' then sent=directRelease(p,inst,hasTag) cast.awaitWindow=sent==nil end say(r,'影武松手 '..cast.choice.meta.label..' '..reason..' 输入读回=false 回调='..tostring(sent)) local after=feedback(p,cast,inst,hasTag) if after then cast.confirmed=true;say(r,'影武释放结果读回 '..cast.choice.meta.label..' '..after) end end return self end return M