The run's credits are saved and seeded: SavedGame key 13, ScenarioStage.Credits, Staged.Credits
RunSave.Capture takes the credits; a scenario may set the starting amount, defaulting to the gameplay settings'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
39b6d28f3a
commit
9651f62ad4
5 changed files with 50 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ public static class RunStart
|
|||
public sealed class Staged
|
||||
{
|
||||
public Ship Player;
|
||||
public int Credits; // the run's starting credits, as the scenario left them
|
||||
public List<Entity> Entities; // what the scenario placed besides the player, in its order
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ public static class RunStart
|
|||
player.SetIff(placed.Entity, hostile);
|
||||
arena.Admit(placed.Entity, placed.Piloted);
|
||||
}
|
||||
return new Staged { Player = player, Entities = stage.Placed.Select(placed => placed.Entity).ToList() };
|
||||
return new Staged { Player = player, Credits = stage.Credits, Entities = stage.Placed.Select(placed => placed.Entity).ToList() };
|
||||
}
|
||||
|
||||
// A new run's item draws (each lot's quality, each generated fit) come from its galaxy's seed, not the process clock,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ public class SavedGame
|
|||
|
||||
[Key(12)]
|
||||
public FactionRelationship[] Relationships;
|
||||
|
||||
[Key(13)]
|
||||
public int Credits;
|
||||
}
|
||||
|
||||
// The run's lifecycle over the run store. Only Commit creates SavedGame, SavedZone and ProvenanceLedger records;
|
||||
|
|
@ -55,7 +58,7 @@ public static class RunSave
|
|||
{
|
||||
// The live run as plain documents. Writes nothing.
|
||||
public static (SavedGame Game, SavedZone[] Zones) Capture(CultCache cache, Galaxy galaxy, Zone currentZone,
|
||||
Entity currentEntity, SavedActionBarBinding[] actionBar)
|
||||
Entity currentEntity, SavedActionBarBinding[] actionBar, int credits)
|
||||
{
|
||||
var factions = galaxy.HomeZones.Keys.ToArray();
|
||||
var game = new SavedGame
|
||||
|
|
@ -75,7 +78,8 @@ public static class RunSave
|
|||
Entrance = Array.IndexOf(galaxy.Zones, galaxy.Entrance),
|
||||
Exit = Array.IndexOf(galaxy.Zones, galaxy.Exit),
|
||||
IsTutorial = galaxy.IsPrelude,
|
||||
ActionBarBindings = actionBar
|
||||
ActionBarBindings = actionBar,
|
||||
Credits = credits
|
||||
};
|
||||
|
||||
// A zone generated earlier but not loaded this session has no live Contents; its packed contents carry over.
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public sealed class ScenarioStage
|
|||
Arena = arena;
|
||||
StartingHull = startingHull;
|
||||
TutorialGenerationSettings = tutorialGenerationSettings;
|
||||
Credits = items.GameplaySettings.StartingCredits;
|
||||
// A fit names designs, not manufacturers, so what the galaxy offers decides which product builds each one.
|
||||
_available = new LoadoutGenerator(ref items.Random, items, arena.Galaxy, arena.GalaxyZone, null, 2).IsAvailable;
|
||||
}
|
||||
|
|
@ -33,6 +34,9 @@ public sealed class ScenarioStage
|
|||
public string StartingHull { get; }
|
||||
public TutorialGenerationSettings TutorialGenerationSettings { get; }
|
||||
|
||||
// What the run starts with: the gameplay settings' starting credits unless the scenario sets another amount.
|
||||
public int Credits { get; set; }
|
||||
|
||||
internal IReadOnlyList<string> Failures => _failures;
|
||||
internal bool PlayerPlaced { get; private set; }
|
||||
internal Ship PlayerShip { get; private set; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue