Delete Faction.BossHull (key 10 retired), GenerateBossLoadout and the three tests that pin its fallback
A boss is a Loadout the faction references, never drawn (rulings faction-boss-is-a-loadout-reference, boss-gear-is-a-loadout, demo-boss-hull-invented). This commit does not build: ZoneGenerator, Galaxy, AetherDb and the tests still read the deleted members; the next commit replaces them. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d28ce42df9
commit
900fa51e43
3 changed files with 1 additions and 82 deletions
|
|
@ -39,8 +39,7 @@ public class Faction
|
|||
|
||||
// Key 9 was the faction's name-file link, retired by ruling faction-curated-place-names; never reuse it.
|
||||
|
||||
[Inspectable, JsonProperty("bossHull"), Key(10)]
|
||||
public CultRecordRef<HullData> BossHull;
|
||||
// Key 10 was the faction's boss hull reference, retired by ruling faction-boss-is-a-loadout-reference; never reuse it.
|
||||
|
||||
[Inspectable, JsonProperty("influence"), Key(11)]
|
||||
public int InfluenceDistance = 4;
|
||||
|
|
|
|||
|
|
@ -209,26 +209,6 @@ public class LoadoutGenerator
|
|||
return (available, preferManufacturers);
|
||||
}
|
||||
|
||||
// A faction's boss: its BossHull when the faction sets one and a product sells it, else the most expensive ship hull
|
||||
// the faction can be offered, with the gap logged. Null only when no ship hull is on offer at all.
|
||||
public EntityPack GenerateBossLoadout()
|
||||
{
|
||||
var bossHull = Faction != null && Faction.BossHull.IsSet() ? ItemManager.ItemData.Get(Faction.BossHull) : null;
|
||||
if (bossHull != null)
|
||||
{
|
||||
var boss = GenerateShipLoadout(hull => hull == bossHull);
|
||||
if (boss != null) return boss;
|
||||
ItemManager.Log($"{Faction.Name}'s BossHull {bossHull.Name} is not sold by any product; its boss flies the most expensive ship hull instead.");
|
||||
}
|
||||
else
|
||||
ItemManager.Log($"{Faction?.Name ?? "This faction"} has no BossHull; its boss flies the most expensive ship hull instead.");
|
||||
|
||||
var (available, _) = AvailableProducts<HullData>(hull => hull.HullType == HullType.Ship, required: true);
|
||||
if (available.Length == 0) return null;
|
||||
var priciest = available.OrderByDescending(entry => entry.design.Price).ThenBy(entry => entry.design.Name, StringComparer.Ordinal).First().design;
|
||||
return GenerateShipLoadout(hull => hull == priciest);
|
||||
}
|
||||
|
||||
// Hardpoint gear that no hull in the catalog can mount has no home (operator, 2026-09-30: "we'll need to author a
|
||||
// bunch more hulls before all the gear variety in the game has a home"): generation never offers it, so no station
|
||||
// stocks it. It gains one the moment a hull with a hardpoint that takes it exists. Tool gear goes in any interior.
|
||||
|
|
|
|||
|
|
@ -70,50 +70,6 @@ public sealed partial class RunStartTests
|
|||
Assert.DoesNotContain(pack.Entities, entity => !entity.Boss && entity is ShipPack);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Boss_hull_from_BossHull_else_fallback()
|
||||
{
|
||||
var galaxy = DemoGalaxy(1);
|
||||
var antagonist = Zhestokost(galaxy);
|
||||
var hulls = SoldShipHulls().OrderByDescending(hull => hull.Price).ThenBy(hull => hull.Name, StringComparer.Ordinal).ToArray();
|
||||
var priciest = hulls.First();
|
||||
var cheaper = hulls.Last();
|
||||
Assert.True(cheaper.Price < priciest.Price, "the catalog needs two ship hulls of different price for this test to tell them apart");
|
||||
|
||||
// Set and sold: the boss flies it, and nothing is logged about a gap.
|
||||
antagonist.BossHull = _cache.RefOf(cheaper);
|
||||
var log = new List<string>();
|
||||
var items = LoggingItems(log);
|
||||
var boss = Assert.Single(BossZonePack(galaxy, items, galaxy.Exit).Entities, entity => entity.Boss);
|
||||
Assert.Equal(cheaper.Name, HullName(items, boss));
|
||||
Assert.DoesNotContain(log, line => line.Contains("BossHull"));
|
||||
|
||||
// Unset: the most expensive ship hull on offer, and the log names the missing BossHull.
|
||||
antagonist.BossHull = default;
|
||||
log.Clear();
|
||||
boss = Assert.Single(BossZonePack(galaxy, items, galaxy.Exit).Entities, entity => entity.Boss);
|
||||
Assert.Equal(priciest.Name, HullName(items, boss));
|
||||
Assert.Contains(log, line => line.Contains("Zhestokost") && line.Contains("no BossHull"));
|
||||
}
|
||||
|
||||
// Set but sold by no product: the boss falls back the same way, and the log says which hull has no seller.
|
||||
[Fact]
|
||||
public void Boss_hull_nobody_sells_falls_back()
|
||||
{
|
||||
var galaxy = DemoGalaxy(1);
|
||||
var antagonist = Zhestokost(galaxy);
|
||||
var sold = SoldShipHulls();
|
||||
// A ship hull no product sells, dearer than any that is sold: the fallback must not pick it.
|
||||
var unsold = new HullData { Name = "Unsold Test Hull", HullType = HullType.Ship, Price = sold.Max(hull => hull.Price) + 1 };
|
||||
_cache.Upsert(unsold);
|
||||
antagonist.BossHull = _cache.RefOf(unsold);
|
||||
var log = new List<string>();
|
||||
var items = LoggingItems(log);
|
||||
var boss = Assert.Single(BossZonePack(galaxy, items, galaxy.Exit).Entities, entity => entity.Boss);
|
||||
Assert.Equal(sold.OrderByDescending(hull => hull.Price).ThenBy(hull => hull.Name, StringComparer.Ordinal).First().Name, HullName(items, boss));
|
||||
Assert.Contains(log, line => line.Contains(unsold.Name) && line.Contains("BossHull"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exit_sealed_until_boss_dies()
|
||||
{
|
||||
|
|
@ -211,22 +167,6 @@ public sealed partial class RunStartTests
|
|||
Assert.False(RunGoal.ExitOpen(zone));
|
||||
}
|
||||
|
||||
// A boss that cannot be generated (no ship hull on offer at all) never marks the zone as having spawned one.
|
||||
[Fact]
|
||||
public void Exit_sealed_when_no_ship_hull_is_on_offer()
|
||||
{
|
||||
var galaxy = DemoGalaxy(1);
|
||||
foreach (var product in _cache.GetAll<FactionProductData>().Where(product => _cache.Get(product.Design) is HullData { HullType: HullType.Ship }).ToArray())
|
||||
Assert.True(_cache.Remove(_cache.RefOf(product).Key));
|
||||
var log = new List<string>();
|
||||
var items = LoggingItems(log);
|
||||
var pack = BossZonePack(galaxy, items, galaxy.Exit, ambient: false);
|
||||
Assert.False(pack.BossSpawned);
|
||||
Assert.DoesNotContain(pack.Entities, entity => entity.Boss);
|
||||
Assert.Contains(log, line => line.Contains("No boss could be generated for Zhestokost"));
|
||||
Assert.False(RunGoal.ExitOpen(new Zone(items, _planetSettings, pack, galaxy.Exit, galaxy)));
|
||||
}
|
||||
|
||||
// A boss killed before the save stays dead after it, and the gate stays open: the spawn fact travels with the zone.
|
||||
[Fact]
|
||||
public void Exit_open_after_save_of_a_slain_boss()
|
||||
|
|
|
|||
Loading…
Reference in a new issue