Staged fits: a scenario states the quality of a fit its checks rest on

ScenarioStage.Fit(hull, quality, slots) mints every lot of the fit at the stated quality through Loadouts.Materialize/Resolve, so Crossing's fighter and EvasionTermTests' hand-fitted Longinus and Djinni do not ride the item stream. No seed changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 19:03:20 +02:00
commit 7b2a6d064d
5 changed files with 65 additions and 16 deletions

View file

@ -22,6 +22,9 @@ public sealed partial class RunStartTests
{
private const float EvDt = 1f / 60f;
// The quality the hand-fitted ships are staged at, so their measured constants do not ride the item stream.
private const float EvStagedQuality = .6f;
// The Longinus's drive train, fitted by name: its cockpit and power and the generated Longinus's thrusters (two Large Drive
// forward, two Rugged Drive on the flanks).
private static readonly (string design, int2 cell, ItemRotation rotation)[] EvLonginusDrive =
@ -32,7 +35,7 @@ public sealed partial class RunStartTests
};
// The Duel's guns on a Longinus: the drive train above, its Targeting Computer, and the Duel's guns, launchers and sensor.
private static ScenarioFit EvLonginus(ScenarioStage stage, string gun = "Cell Blaster", string second = null) => stage.Fit("Longinus",
private static ScenarioFit EvLonginus(ScenarioStage stage, string gun = "Cell Blaster", string second = null) => stage.Fit("Longinus", EvStagedQuality,
EvLonginusDrive.Concat(new (string design, int2 cell, ItemRotation rotation)[]
{
("Guided Missile Launcher", int2(0, 5), ItemRotation.None), ("Guided Missile Launcher", int2(5, 5), ItemRotation.None), (gun, int2(1, 8), ItemRotation.None),
@ -70,7 +73,7 @@ public sealed partial class RunStartTests
{
stage.Player(stage.Bare("Djinni"), float2(-50000, -50000));
djinni = stage.Place(EvDjinni(stage), float2(-10000, -30000), facing: float2(0, 1)) as Ship;
longinus = stage.Place(stage.Fit("Longinus", EvLonginusDrive), float2(-30000, -30000), facing: float2(0, 1)) as Ship;
longinus = stage.Place(stage.Fit("Longinus", EvStagedQuality, EvLonginusDrive), float2(-30000, -30000), facing: float2(0, 1)) as Ship;
});
var (_, arena, _, failures) = Launch(scenario, Inputs(() => GalaxySeed));
Assert.True(failures.Count == 0, string.Join("; ", failures));
@ -621,7 +624,7 @@ public sealed partial class RunStartTests
// The target's fit, written out: the Djinni's own hardpoints filled with the Rugged Drive it is generated with, its
// reactor, cockpit and radiators. What the evasion tests price is this ship's strafing, not whatever the generator
// rolls for it from the galaxy.
private static ScenarioFit EvDjinni(ScenarioStage stage) => stage.Fit("Djinni",
private static ScenarioFit EvDjinni(ScenarioStage stage) => stage.Fit("Djinni", EvStagedQuality,
("Cockpit 2x2", int2(6, 3), ItemRotation.None), ("Compact Reactor", int2(6, 11), ItemRotation.None),
("Rugged Drive", int2(6, 0), ItemRotation.Reversed), ("Rugged Drive", int2(5, 1), ItemRotation.Reversed), ("Rugged Drive", int2(7, 1), ItemRotation.Reversed),
("Rugged Drive", int2(4, 4), ItemRotation.CounterClockwise), ("Rugged Drive", int2(4, 11), ItemRotation.CounterClockwise),

View file

@ -291,6 +291,35 @@ public sealed partial class RunStartTests
Assert.Contains("No Such Gun", Assert.Single(failures));
}
// A fit that states its quality mints every lot it builds at it, assembly and role fills alike; the same fit without one
// draws them from the item stream, so some lot comes out otherwise. A scenario's checks rest on the first.
[Fact]
public void StagedFitMintsAtItsQuality()
{
(string design, int2 cell, ItemRotation rotation)[] slots =
{
("Cockpit 2x2", int2(2, 6), ItemRotation.None), ("Compact Reactor", int2(2, 4), ItemRotation.None),
("Large Drive", int2(1, 0), ItemRotation.Reversed), ("Radiator", int2(2, 2), ItemRotation.CounterClockwise)
};
var staged = Stage(Arena(true), new Scripted(true, stage =>
{
stage.Player(stage.Bare("Djinni"), float2(0, 0));
stage.Place(stage.Fit("Longinus", .6f, slots), float2(300, 0));
stage.Place(stage.Fit("Longinus", slots), float2(-300, 0));
}));
IEnumerable<Lot> Lots(Entity entity) =>
EntitySerializer.Items(EntitySerializer.Pack(entity)).OfType<CraftedItemInstance>().Select(_items.GetLot);
var stated = Lots(staged.Entities[0]).ToArray();
var drawn = Lots(staged.Entities[1]).ToArray();
Assert.True(stated.Length > slots.Length);
Assert.All(stated, lot =>
{
Assert.Equal(.6f, lot.Quality, 3);
Assert.All(lot.Roles ?? new List<RoleFill>(), fill => Assert.Equal(.6f, fill.Quality, 3));
});
Assert.Contains(drawn, lot => Math.Abs(lot.Quality - .6f) > .001f);
}
// A stance holds both ways between an entity and the player. A piloted entity has exactly one agent; an unpiloted
// one has none, and nothing steers it. (It is not frozen: the zone's gravity still moves it, as it moves any ship,
// so the rule is observed on its steering inputs.)