Derive ship scrap drop from threat
This commit is contained in:
@@ -41,16 +41,15 @@ TEST_CASE("ThreatCostCalculator: assembler takes max across recipes", "[threat]"
|
||||
CHECK(table.itemThreat.at("circuit_board") == Approx(28.0));
|
||||
}
|
||||
|
||||
TEST_CASE("ThreatCostCalculator: scrap threat from cheapest ship", "[threat]")
|
||||
TEST_CASE("ThreatCostCalculator: scrap threat is 1 / scrap_per_threat", "[threat]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
const ThreatCostTable& table = cfg.threatCosts;
|
||||
|
||||
// Cheapest ship by scrap_drop is interceptor (scrap_drop=2).
|
||||
// Interceptor threat: 10 + iron_ingot(4)*3 + circuit_board(28)*1
|
||||
// + laser_cannon(5 + iron_ingot(4)*1) = 10 + 12 + 28 + 9 = 59.0
|
||||
// scrapThreat = 59.0 / 2 = 29.5
|
||||
CHECK(table.scrapThreat == Approx(29.5));
|
||||
// REQ-THREAT-SCRAP: scrap threat is the constant 1 / world.scrap_per_threat.
|
||||
// The test config sets scrap_per_threat = 1.0, so scrapThreat = 1.0.
|
||||
CHECK(table.scrapThreat == Approx(1.0 / cfg.world.scrapPerThreat));
|
||||
CHECK(table.scrapThreat == Approx(1.0));
|
||||
}
|
||||
|
||||
TEST_CASE("ThreatCostCalculator: reprocessing-only item threat", "[threat]")
|
||||
@@ -59,8 +58,8 @@ TEST_CASE("ThreatCostCalculator: reprocessing-only item threat", "[threat]")
|
||||
const ThreatCostTable& table = cfg.threatCosts;
|
||||
|
||||
// advanced_alloy: reprocessing recipe with scrap*5, duration 3.0, probability 0.1
|
||||
// (29.5 * 5 + 3.0) / 0.1 = 1505.0
|
||||
CHECK(table.itemThreat.at("advanced_alloy") == Approx(1505.0));
|
||||
// scrapThreat = 1.0 (= 1 / scrap_per_threat), so (1.0 * 5 + 3.0) / 0.1 = 80.0
|
||||
CHECK(table.itemThreat.at("advanced_alloy") == Approx(80.0));
|
||||
}
|
||||
|
||||
TEST_CASE("ThreatCostCalculator: ship threat with default modules", "[threat]")
|
||||
|
||||
Reference in New Issue
Block a user