Materialize refuses an unbuildable Loadout before minting or drawing; delete the boss item-stream restore
Materialize now settles what the catalog alone decides, tries the cells on a throwaway ItemManager (own ledger and stream, designs built unbranded), and only then asks the chooser and mints lots. ZoneGenerator's copy-and-restore of itemManager.Random is deleted, and the boss faction's LoadoutGenerator is created on the first choice instead of as an argument. Resolve keeps its signature and is Settle then Build. Tests: an unbuildable boss zone equals the no-boss zone (serialized pack, ledger, roster and gear, next item draw) for one failure, several failures and design-only slots, across every faction as boss faction. Not yet built or run when committed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
af993acf07
commit
8ae052bb47
3 changed files with 165 additions and 51 deletions
|
|
@ -433,11 +433,9 @@ public static class ZoneGenerator
|
|||
continue;
|
||||
}
|
||||
var failures = new List<string>();
|
||||
var streamBefore = itemManager.Random;
|
||||
var entity = Loadouts.Materialize(itemManager, null, loadout, GetLoadoutGenerator(bossFaction).ChooseProduct, failures);
|
||||
var entity = Loadouts.Materialize(itemManager, null, loadout, design => GetLoadoutGenerator(bossFaction).ChooseProduct(design), failures); // the generator exists only once the Loadout is known to fit
|
||||
if (entity == null)
|
||||
{
|
||||
itemManager.Random = streamBefore; // a failed fit has drawn lots; an unbuildable boss draws nothing, as a refused one does
|
||||
itemManager.Log($"{bossFaction.Name}'s boss Loadout {loadout.Name} cannot be built: {string.Join("; ", failures)}");
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue