AI draws from its own dice: the range-sample offset and the patrol circuit leave ItemManager.Random
Combat.SampleDps and Zone.CreateAgent's patrol circuit drew from the item stream, so minting items moved how a pilot fights and where it patrols. Both now draw SimulationDice.For(CombatSeed, stream, Agent.Id); Agent.Id is the zone-scoped ordinal Zone.NextAgentId gives a pilot at admission (ruling ai-sample-offset-off-item-stream). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2891b9a807
commit
72d7e25df0
5 changed files with 40 additions and 3 deletions
|
|
@ -133,6 +133,10 @@ public class Zone
|
|||
// The death ordinal of the loot dice: the nth death in this zone rolls on SimulationDice.For(CombatSeed, LootStream, n).
|
||||
private uint _deaths;
|
||||
|
||||
// The zone-scoped agent ordinal, from 1, never reused: the key of a pilot's own dice.
|
||||
private uint _lastAgentId;
|
||||
public uint NextAgentId() => ++_lastAgentId;
|
||||
|
||||
// One death subscription per member entity: Admit creates it together with the membership, Remove disposes it
|
||||
// together with the membership, and nothing else touches either.
|
||||
private readonly Dictionary<Entity, IDisposable> _deathWatches = new Dictionary<Entity, IDisposable>();
|
||||
|
|
@ -301,9 +305,11 @@ public class Zone
|
|||
var key = ship.Faction ?? Unaffiliated;
|
||||
if (!_flights.TryGetValue(key, out var flight))
|
||||
_flights[key] = flight = new Flight(ship.Faction?.Doctrine, _itemManager.GameplaySettings);
|
||||
var agent = new Minion(ship, flight.Combatant);
|
||||
var id = NextAgentId();
|
||||
var agent = new Minion(ship, flight.Combatant) { Id = id };
|
||||
var task = new PatrolOrbitsTask();
|
||||
task.Circuit = Orbits.OrderBy(_ => _itemManager.Random.NextFloat()).Take(4).Select(x => x.Key).ToArray();
|
||||
var dice = SimulationDice.For(CombatSeed, SimulationDice.PatrolStream, id);
|
||||
task.Circuit = Orbits.OrderBy(_ => dice.NextFloat()).Take(4).Select(x => x.Key).ToArray();
|
||||
flight.Join(agent, task);
|
||||
return agent;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue