using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; using UnityEngine.InputSystem; namespace Auralis { public sealed partial class PrototypeQA { [Serializable] sealed class RootTurnResponse {public string id,stage;public int attacks,hits,health,shots;public Vector2 player,target;public bool warning;} [Serializable] sealed class RootTurnResponses {public List observations=new();} [Serializable] sealed class RootTurnOrbRecord {public int reflections;public string thread,termination;public float distance;} [Serializable] sealed class RootTurnOrbRecords {public List orbs=new();} IEnumerator ObserveRootTurnOrbs(List observed) { while(true){foreach(var orb in MirrorEnergyOrb.All)if(orb&&orb.Group=="root-turn"&&!observed.Contains(orb))observed.Add(orb);yield return new WaitForFixedUpdate();} } RootTurnResponses rootTurnResponses; public IEnumerator RemainingLateRoutesChecks() { File.WriteAllText(Path.Combine(folder,"scope.txt"),"Two independent declared minimum chapter-arrival fixtures: fresh middle cathedral arm and previously earned middle arm. Earlier mandatory Orvo/Aster/Mist progression gives health9, damage14/range3; no optional purchases, equipment, healing, gentle mode or flight. One declared initial room arrival each. Thereafter ordinary walking, five jumps, two finite hostile responses/arrows (fresh only), original ladder, lower resonance, warned source/reflection/capsule, optional chest and original return door. No mid-route placement, velocity, health, kill, reward or progress injection. Old arm is a valid intermediate save, not a completed Velis chapter. Separate reload verifies receipts. This is a bounded route test, not a whole-campaign or human visual/audio acceptance."); StoryTransition.EnableInQA=false;menuPad=InputSystem.AddDevice(); try { yield return RemainingRootTurn(false); yield return RemainingRootTurn(true); } finally{if(menuPad!=null){InputSystem.RemoveDevice(menuPad);menuPad=null;}g.Input.Automated=true;Clear();} } IEnumerator RemainingRootFixture(bool old) { RootCathedralPrerequisite();var d=g.Save.Data; d.bowLevel=d.bowRangeLevel=d.healCharges=0;d.purchases.Clear();d.equipped.Clear();d.gentle=d.autoHeal=d.fallRescue=d.flight=false; if(old)d.levels.Find(p=>p.id==RootCathedralWorld.LevelId).mechanisms.AddRange(new[]{"root-arm-1","mirror-capsule-root-turn"}); g.Save.Write();yield return Travel(RootCathedralWorld.LevelId);Clear(); if(VoiceDirector.I){VoiceDirector.I.AutomaticObjectives=false;VoiceDirector.I.Stop();} RootCathedralWorld.I.Enter(2,280,823);yield return new WaitForSecondsRealtime(1.4f);Clear(); var w=RootCathedralWorld.I;connectedRoute=w.TurnPassage.Route; CheckResult("Declared middle-arm arrival fixture · "+old,connectedRoute&&g.Player.Grounded&&CourierFootSupport()==w.TurnPassage.Floor&&g.Player.Invincible<=0); ConnectedProfileMetadata("root-turn"+(old?"-old-arm":""),9,14); File.WriteAllText(Path.Combine(folder,"root-turn"+(old?"-old-arm":"")+"-fixture.json"),JsonUtility.ToJson(g.Save.Data,true)); } IEnumerator RemainingRootBuds(BoxCollider2D bank) { foreach(var foe in connectedRoute.Groups[0].Members) { float direction=foe.Target.x>=ConnectedFeet.x?1:-1; float x=Mathf.Clamp(foe.Target.x-direction*2,bank.bounds.min.x+.5f,bank.bounds.max.x-.5f); yield return ConnectedWalk(x,bank,"Ordinary supported approach to the middle-arm bud");if(!connectedStep)yield break; Clear();connectedPhase="bud-response-before-arrow";float end=Time.realtimeSinceStartup+5; while(!foe.AttackCommitted&&foe.Attacks==0&&Time.realtimeSinceStartup0),"stage="+foe.Stage+", attacks="+foe.Attacks+", player="+ConnectedFeet+", target="+foe.Target); if(!foe.AttackCommitted&&foe.Attacks==0){connectedStep=false;yield break;} yield return ConnectedArrows(()=>foe.Alive,()=>foe.Target,()=>foe.CanPierceArrow,bank,"Actual finite middle-arm Dämmerknospe · "+foe.Id); CheckResult("The finite bud receives its actual one arrow and durable receipt",!foe.Alive&&foe.AcceptedHits==1&&g.Save.Data.mechanisms.Contains(foe.SaveKey));if(!connectedStep)yield break; } } IEnumerator RemainingRootLadder(RootCathedralTurnPassage p,bool up) { var ladder=p.Owner.Ladders.Find(l=>Mathf.Abs(l.X-RootCathedralWorld.At(2,522,823).x)<.01f); var from=up?p.Floor:p.OriginalGallery;var to=up?p.OriginalGallery:p.Floor; yield return ConnectedWalk(ladder.X,from,up?"Old ladder approached from the original floor":"Old ladder approached from the original gallery");if(!connectedStep)yield break; connectedAllowClimb=true;Clear();connectedPhase=up?"original-ladder-up":"original-ladder-down"; float end=Time.realtimeSinceStartup+9; while(!ConnectedOn(to)&&Time.realtimeSinceStartupMathf.Abs(l.X-RootCathedralWorld.At(2,522,823).x)<.01f)); for(int i=0;i=i+1,"reached="+connectedRoute.Reached);if(connectedRoute.Reachedb.bounds.max.xlane+MirrorEnergyOrb.Radius); CheckResult("Every new middle-arm bank leaves the original finite-radius orb fall clear",clear,"fallX="+lane+", radius="+MirrorEnergyOrb.Radius); var observed=new List();var orbObserver=StartCoroutine(ObserveRootTurnOrbs(observed)); try{connectedPhase="original-mirror-reflection";yield return NightReflected(w.TurnSource,w.TurnThread,w.TurnCapsule,"Actual cathedral middle-arm redirected energy",false);} finally { StopCoroutine(orbObserver);var records=new RootTurnOrbRecords(); foreach(var orb in observed)if(!ReferenceEquals(orb,null))records.orbs.Add(new RootTurnOrbRecord{reflections=orb.ReflectionCount,thread=orb.LastThreadId,termination=orb.Termination,distance=orb.Travelled}); File.WriteAllText(Path.Combine(folder,id+"-orbs.json"),JsonUtility.ToJson(records,true)); } CheckResult("Real source reflection opens the original arm, leaving other arms and flight unearned",w.TurnCapsule.Open&&w.TurnCapsule.Accepted==1&&RootCathedralWorld.Arm(1)&&!RootCathedralWorld.Arm(0)&&!RootCathedralWorld.Arm(2)&&!RootCathedralWorld.Gift&&!g.Save.Data.flight); if(!RootCathedralWorld.Arm(1))yield break; yield return RemainingRootLadder(p,true);if(!connectedStep)yield break; } else CheckResult("Earlier earned middle arm keeps the new optional path peaceful",connectedRoute.Peaceful&&connectedRoute.Groups[0].Members.All(f=>f.Alive&&!f.Emerged)&&w.TurnSource.Emitted==0); yield return new WaitForSecondsRealtime(.4f); CheckResult("Physical path plus actual arm solution earns the optional chest",p.Earned&&connectedRoute.Reached==6&&!p.Reward.Opened);if(!p.Earned)yield break; yield return ConnectedWalk(p.Reward.transform.position.x,p.OriginalGallery,"Ordinary gallery walk reaches the optional middle-arm chest");if(!connectedStep)yield break; int before=g.Save.Data.sparks;yield return MemoryPressInteract();yield return new WaitForSecondsRealtime(1.1f); CheckResult("Actual optional middle-arm chest pays 35 once",p.Reward.Opened&&g.Save.Data.sparks==before+35); int paid=g.Save.Data.sparks;yield return MemoryPressInteract();yield return new WaitForSecondsRealtime(.2f); CheckResult("Repeated ordinary chest input cannot repay the optional fund",g.Save.Data.sparks==paid); var disk=new SaveService(g.Save.FilePath);var progress=disk.Data.levels.Find(a=>a.id==RootCathedralWorld.LevelId); CheckResult("Disk retains actual middle-arm capsule, route and chest receipts",progress.mechanisms.Contains("root-arm-1")&&progress.mechanisms.Contains("mirror-capsule-root-turn")&&progress.mechanisms.Contains("connected-route-earned-"+RootCathedralTurnPassage.RouteId)&&progress.mechanisms.Contains("chest-open-"+RootCathedralTurnPassage.RouteId+"-gift")); yield return Shot(id+"-earned-chest"); yield return RemainingRootLadder(p,false);if(!connectedStep)yield break; yield return ConnectedWalk(connectedRoute.Finish.x,p.Floor,"Original lower catch floor reaches the old return arch");if(!connectedStep)yield break; connectedAllowDoor=true;yield return MemoryPressInteract();yield return new WaitForSecondsRealtime(1.7f); CheckResult("Ordinary original middle-arm return door reaches the quiet hub",RootCathedralWorld.Area==0&&g.Player.Grounded); connectedProof.finished=ConnectedContinuous&&!connectedProof.forbidden; CheckResult("Local middle-arm sequence remains continuous with no mid-route placement or death",connectedProof.finished,"health="+connectedProof.healthStart+"→"+g.Player.HealthHalfUnits+", arrows="+(g.Combat.ShotsFired-connectedProof.shotsStart)); } finally { File.WriteAllText(Path.Combine(folder,id+"-responses.json"),JsonUtility.ToJson(rootTurnResponses,true)); File.WriteAllText(Path.Combine(folder,id+"-reflection.json"),JsonUtility.ToJson(nightEvidence,true));ConnectedEnd(id); } yield return Travel(RootCathedralWorld.LevelId);Clear(); CheckResult("Reload restores earned optional middle-arm fund without replay or repayment",RootCathedralWorld.I.TurnPassage.Earned&&RootCathedralWorld.I.TurnPassage.Reward.Opened&&RootCathedralWorld.Arm(1)); } } }