<!-- SOLID-PLAYTIME · part 165 -->
x=t,this.z=e+18,this.y=this.ground(this.x,this.z)+0.15,this.velX=0,this.velZ=0,this.syncProgress()}completeHomecoming(){if(this.progress.homecoming=!0,!this.progress.chest.includes("KING'S SEAL"))this.progress.chest.push("KING'S SEAL");this.x=0,this.z=22,this.y=this.ground(this.x,this.z)+0.15,this.syncProgress()}getProgress(){return{...this.progress,shards:[...this.progress.shards],chest:[...this.progress.chest],posX:this.x,posZ:this.z}}updateSettings(t){this.progress.settings={...t},this.syncProgress()}syncProgress(){this.progress.posX=this.x,this.progress.posZ=this.z,this.onEvent({type:"progress",progress:this.getProgress()})}rank(){return this.progress.cleared>=6?Qf[3]:this.progress.cleared>=4?Qf[2]:this.progress.cleared>=2?Qf[1]:Qf[0]}emitHud(t=!1){if(!t&&this.t-this.lastHud<0.12)return;this.lastHud=this.t;let e="THE OPEN HIGHLANDS",n="THE KING'S CASTLE BURNS ON THE HORIZON",i=null;if(this.trialIndex!==null){let s=le[this.trialIndex];if(e=s?.name??"THE NIGHTMARE",n=this.enemies.some((r)=>r.alive)?"BREAK THE SENTINELS":`FACE ${s?.boss??"THE BOSS"}`,this.trialIndex===le.length-1&&this.boss)i=["THE CROWN DESCENDS","THE VOID ANSWERS","THE LAST LIGHT"][this.boss.phase]??null}else if(this.nearby?.kind==="palace")e=le[this.nearby.index]?.name??"THE THRESHOLD",n=this.nearby.index===this.progress.cleared?"ATTACK TO ENTER":this.nearby.index<this.progress.cleared?"THIS NIGHTMARE IS DREAMED":"THIS THRESHOLD IS SEALED";else if(this.nearby?.kind==="castle")e="THE KING'S CASTLE",n=this.progress.cleared===le.length?"THE GOLDEN ROAD IS OPEN":"THE ROAD HOME IS NOT YET OPEN";else if(this.nearby?.kind==="haven")e="THE FAR SHORE",n="THE LANTERNS HOLD THE DARK BACK";this.onHud({health:this.health,radiance:this.radiance,rank:this.rank(),place:e,objective:n,nearby:this.nearby?.kind??null,cleared:this.progress.cleared,shards:[...this.progress.shards],chest:[...this.progress.chest],bossPhase:i})}burst(t,e,n,i){let s=this.mobile||this.qualityLevel>=2?8:16;for(let a=0;a<s;a+=1){if(this.sparks.length>=this.sparkCapacity)this.sparks.shift();let r=Math.random()*Math.PI*2,o=2+Math.random()*5,l=0.35+Math.random()*0.35;this.sparks.push({position:new C(t,e,n),velocity:new C(Math.cos(r)*o,2+Math.random()*4,Math.sin(r)*o),life:l,maxLife:l,color:new Xt(a%3===0?65535:i)})}}updateMovement(t){let e=Math.hypot(this.moveX,this.moveY),n=this.runHeld?22:11.5,i=0,s=0;if(e>0.08){let h=this.moveX/e,p=this.moveY/e,v=Math.sin(this.yaw),y=Math.cos(this.yaw);i=(v*p+y*h)*n,s=(y*p-v*h)*n}let a=e>0.08?this.grounded?10:3.8:8,r=Math.min(1,a*t);this.velX+=(i-this.velX)*r,this.velZ+=(s-this.velZ)*r;let o=this.x,l=this.z;this.x=Math.max(-248,Math.min(248,this.x+this.velX*t)),this.z=Math.max(-248,Math.min(248,this.z+this.velZ*t));let c=Math.hypot(this.x-o,this.z-l);if(this.distanceTravelled+=c,c>0.01)this.hasMoved=!0;let u=this.trialIndex===null?this.ground(this.x,this.z)+0.15:0.15;if(this.grounded)if(this.coyote=0.13,u<this.y-0.38)this.grounded=!1;else this.y=u;else this.coyote=Math.max(0,this.coyote-t);if(this.jumpQueued&&this.jumpAnticipation>0){if(this.jumpAnticipation-=t,this.jumpAnticipation<=0)this.jumpQueued=!1,this.vy=13.2,this.grounded=!1,this.coyote=0}if(!this.grounded){if(this.vy-=32*t,this.y+=this.vy*t,this.y<=u&&this.vy<0)this.y=u,this.vy=0,this.grounded=!0,this.landing=0.18,this.burst(this.x,this.y+0.1,this.z,16765514)}this.landing=Math.max(0,this.landing-t);let f=Math.hypot(this.velX,this.velZ);if(f>0.25)this.walkCycle+=t*(6+f*0.32);if(this.hero.position.set(this.x,this.y,this.z),f>0.3){let p=Math.atan2(this.velX,this.velZ)-this.facing;while(p>Math.PI)p-=Math.PI*2;while(p<-Math.PI)p+=Math.PI*2;this.facing+=p*Math.min(1,t*(this.grounded?12:5)),this.hero.rotation.y=this.facing}this.poseHero(f)}poseHero(t){let e=Math.min(1,t/10),n=Math.min(1,Math.max(0,(t-8)/10)),i=Math.sin(this.walkCycle)*(0.55+n*0.5)*e,s=this.heroRig.leftArm,a=this.heroRig.rightArm,r=this.heroRig.leftLeg,o=this.heroRig.rightLeg,l=this.heroRig.leftShin,c=this.heroRig.rightShin,u=this.heroRig.hips,f=this.heroRig.spine;if(!s||!a||!r||!o||!l||!c||!u||!f)return;if(s.rotation.x=i,a.rotation.x=-i,r.rotation.x=-i*0.82,o.rotation.x=i*0.82,l.rotation.x=Math.max(0,-Math.sin(this.walkCycle))*e*0.7,c.rotation.x=Math.max(0,Math.sin(this.walkCycle))*e*0.7,u.position.y=2.25+Math.abs(Math.sin(this.walkCycle))*e*0.08,f.rotation.z=Math.sin(this.walkCycle)*0.035*e,this.jumpAnticipation>0)u.position.y=1.93,r.rotation.x=0.48,o.rotation.x=0.48,l.rotation.x=-0.72,c.rotation.x=-0.72;else if(!this.grounded)r.rotation.x=0.25,o.rotation.x=-0.2,l.rotation.x=-0.5,c.rotation.x=-0.25,s.rotation.x=-0.65,a.rotation.x=-0.72;else if(this.landing>0)u.position.y=2.02,r.rotation.x=o.rotation.x=0.32,l.rotation.x=c.rotation.x=-0.55;if(this.cape)this.cape.rotation.x=0.12+e*0.25+Math.max(0,this.vy)*0.012;if(this.sword){if(this.sword.scale.z=this.rank()==="FLICKER"?1:this.rank()==="SPARK"?1.25:this.rank()==="BLAZE"?1.5:1.82,this.attackClock<=0)this.sword.rotation.x=0.68}}updateEnemies(t){