Faction play 1: s1/s2 fix batch (Engaged-first anchor, doctrine pins, follow verb)
Flight anchors a blind member on an Engaged track before a nearer Hailing one and keeps its anchor only while nothing outranks it. Doctrine.cs states the trespass rule as the zone owner's permission. DoctrineCatalog matches the faction by exact name and its comment names the landed Pirates record. VerseGrammarCommand gains the follow verb. Tests pin default and authored standoff, Grace against ComplySpeed, nearest hail, the Identified boundary, off-origin direction and anchor choice and switch, the unseen-member rule across geometry, combat from follow, the doctrine-catalog dry run and the turret's global hit threshold. Not yet run: this commit's tests have not been built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
86c3a94880
commit
04516c72cf
6 changed files with 222 additions and 34 deletions
|
|
@ -314,6 +314,47 @@ public sealed class FireControlPerWeaponTests : IDisposable
|
|||
Assert.True(r.Gun.Weapon.Firing, "the turret must fire a fused weapon at a designated target out of arc");
|
||||
}
|
||||
|
||||
// The turret keeps the AgentMinHitProbability threshold for a direct-hit weapon: a shot priced near .5 is held at a
|
||||
// threshold of .6 and taken at .4. Kills: the turret's fire threshold dropped to zero or fixed to a constant.
|
||||
[Theory]
|
||||
[InlineData(.6f, false)]
|
||||
[InlineData(.4f, true)]
|
||||
public void ATurretKeepsTheGlobalHitProbabilityThresholdForADirectHitWeapon(float minHit, bool fires)
|
||||
{
|
||||
var r = Build(accuracy: .5f, minHit: minHit, turret: true);
|
||||
var p = FireControl.HitProbability(r.Gun.Weapon, r.Shooter, r.Target);
|
||||
Assert.True(p > .4f && p < .6f, $"fixture: the shot must price near .5, priced {p}");
|
||||
|
||||
r.Zone.Update(1f);
|
||||
r.Zone.Update(1f);
|
||||
|
||||
Assert.Equal(fires, r.Gun.Weapon.Firing);
|
||||
}
|
||||
|
||||
// A flight's members hold off at 1.1 x their longest gun when the doctrine authors no standoff (every authored
|
||||
// doctrine leaves it 0), and at the authored distance otherwise. Guns of Range 50 and 100 on one ship. Kills: the
|
||||
// default zeroed, inverted, taken from the shortest gun, or the authored value ignored.
|
||||
[Theory]
|
||||
[InlineData(0f, 110f)]
|
||||
[InlineData(40f, 40f)]
|
||||
public void AFlightHoldsOffAtTheDefaultOrAuthoredStandoff(float holdStandoff, float expected)
|
||||
{
|
||||
var r = Build(range: 50f, decoy: true);
|
||||
r.Shooter.SetIff(r.Target, null);
|
||||
if (!r.Shooter.VisibleEnemies.Contains(r.Target)) r.Shooter.VisibleEnemies.Add(r.Target);
|
||||
var settings = r.Shooter.ItemManager.GameplaySettings;
|
||||
var flight = new Flight(new FactionDoctrine
|
||||
{
|
||||
EngageOn = EngageOn.Detection, Grace = 5, Combatant = new RoleDoctrine { MinHitProbability = .2f, HoldStandoff = holdStandoff }
|
||||
}, settings);
|
||||
var agent = new Minion(r.Shooter, flight.Combatant);
|
||||
flight.Join(agent, new PatrolOrbitsTask());
|
||||
|
||||
flight.Update(.1f);
|
||||
|
||||
Assert.Equal(expected, ((FollowTask) agent.Task).Standoff, 2);
|
||||
}
|
||||
|
||||
// The AI aims at the height a target rides at (Entity.RideHeight: field plus the layer the target's kind rides on),
|
||||
// not at the plane and not at the shooter's own layer. A target on a layer 40 u up against a shooter on the ship
|
||||
// layer, a shot fast enough to be predicted: the turret's and Combat's aim point at the target's stepped pose.
|
||||
|
|
|
|||
Loading…
Reference in a new issue