Aetheria/tests/Aetheria.Shared.Tests/RunSeedFixture.cs
Meta Vens f23d3c6542 Drops roll on the run's seed: Zone.DropSeed feeds the loot and mine dice
DropSeed = CombatSeed ^ Mix(Galaxy.Seed), derived at construction. A zone with
no galaxy, or a restored seed of 0, keeps its dice bit for bit; CombatSeed
still roots shot, patrol and range-sample dice. RunSeedFixture builds a test
zone's galaxy through RunSave.Commit and the Continue constructor.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 17:30:50 +02:00

26 lines
1.1 KiB
C#

using System.Collections.Generic;
using GameCult.Caching;
// A fixture's run at a fixed seed, restored as Continue restores it: one zone, committed through RunSave.Commit and
// read back by the Galaxy save constructor, so a test's galaxy carries the seed the way a real run's does.
internal static class RunSeedFixture
{
public static Galaxy Continue(CultCache cache, string zoneName, uint seed)
{
var game = new SavedGame
{
Seed = seed,
Factions = new CultRecordRef<Faction>[0],
Relationships = new FactionRelationship[0],
HomeZones = new Dictionary<int, int>(),
BossZones = new Dictionary<int, int>(),
DiscoveredZones = new[] { 0 },
ActionBarBindings = new SavedActionBarBinding[0],
Entrance = 0,
Exit = -1
};
var zone = new SavedZone { Name = zoneName, AdjacentZones = new int[0], Factions = new int[0], Owner = -1 };
RunSave.Commit(cache, game, new[] { zone }, new ProvenanceLedger());
return new Galaxy(cache, cache.GetGlobal<SavedGame>(), _ => { });
}
}