Boss gate: TryWin is the one way to win; equal-gap tie-break and two exit pins tested
Win() becomes TryWin(), which checks RunGoal.ExitOpen itself; the call site no longer reads it. Pins: first-of-equal-gaps, exit-zone-only, no ship hull on offer. Not yet built or run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
da6fe0334e
commit
dca660e448
3 changed files with 69 additions and 5 deletions
|
|
@ -362,9 +362,8 @@ public class ActionGameManager : MonoBehaviour
|
|||
if (!(length(wormhole.Position - CurrentEntity.Position.xz) < Settings.GameplaySettings.WormholeExitRadius)) continue;
|
||||
if (wormhole.Exit)
|
||||
{
|
||||
// The exit gate leads nowhere: RunGoal decides whether it is open, and an open one ends the run.
|
||||
if (RunGoal.ExitOpen(Zone)) Win();
|
||||
else
|
||||
// The exit gate leads nowhere: TryWin consults RunGoal and ends the run when the gate is open.
|
||||
if (!TryWin())
|
||||
{
|
||||
Dialog.Clear();
|
||||
Dialog.Title.text = $"The exit gate is sealed. {RunGoal.Boss(Zone)?.Name ?? "Its guardian"} holds it shut.";
|
||||
|
|
@ -1199,13 +1198,17 @@ public class ActionGameManager : MonoBehaviour
|
|||
SavePlayerSettings();
|
||||
}
|
||||
|
||||
private void Win()
|
||||
// The one way a run is won: RunGoal decides whether the exit is open (read before EndRun clears the galaxy), the
|
||||
// caller shows its own refusal.
|
||||
private bool TryWin()
|
||||
{
|
||||
if (!RunGoal.ExitOpen(Zone)) return false;
|
||||
EndRun();
|
||||
Dialog.Clear();
|
||||
Dialog.Title.text = "You have escaped the Terminus. This was the demo; the whole of it is yet to come.";
|
||||
Dialog.Show();
|
||||
Dialog.MoveToCursor();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void Die(CauseOfDeath cause)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ public static class RunGoal
|
|||
zone.Galaxy?.Exit != null && zone.GalaxyZone == zone.Galaxy.Exit && zone.Pack.BossSpawned && !BossAlive(zone);
|
||||
|
||||
// Where the exit gate sits: at the adjacency wormholes' radius (the zone's radius times the ratio), in the middle of
|
||||
// the widest angular gap between them, so it shares a point with none. A zone with no neighbours gets the +x axis.
|
||||
// the widest angular gap between them, so it shares a point with none. Of exactly equal gaps the first in ascending angle
|
||||
// wins (the <= below): placement is not saved, so this rule is what keeps the gate still between builds. A zone with no
|
||||
// neighbours gets the +x axis.
|
||||
public static float2 ExitGatePosition(Zone zone, float wormholeDistanceRatio)
|
||||
{
|
||||
var radius = zone.Pack.Radius * wormholeDistanceRatio;
|
||||
|
|
|
|||
Loading…
Reference in a new issue