From fe46b74afa4791fc558bacd44ee331073103c3b0 Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Sat, 31 Oct 2026 10:56:35 +0100 Subject: [PATCH] feat: copies cost double: instance_cost_factor 2.0 for every type that allows copies Co-Authored-By: Claude Opus 5.5 (1M context) --- config/game/buildings.php | 20 ++++++++++---------- tests/Feature/BuildQueueTest.php | 2 +- tests/Unit/Game/BuildingRulesTest.php | 5 ++++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/config/game/buildings.php b/config/game/buildings.php index 7780790..f847d2c 100644 --- a/config/game/buildings.php +++ b/config/game/buildings.php @@ -30,7 +30,7 @@ return [ 'workers' => ['base' => 1, 'factor' => 1.1], 'production' => null, 'capacity' => ['base' => 1000, 'factor' => 1.23], - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 6, 'factor' => 1.2], 'requires' => [], ], @@ -42,7 +42,7 @@ return [ 'build_time' => ['base' => 120, 'factor' => 1.2], 'workers' => ['base' => 2, 'factor' => 1.1], 'production' => ['resource' => 'food', 'base' => 30, 'factor' => 1.17], - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 5, 'factor' => 1.2], 'requires' => [], ], @@ -54,7 +54,7 @@ return [ 'build_time' => ['base' => 90, 'factor' => 1.2], 'workers' => ['base' => 2, 'factor' => 1.12], 'production' => ['resource' => 'wood', 'base' => 30, 'factor' => 1.163], - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 6, 'factor' => 1.2], 'requires' => [], ], @@ -66,7 +66,7 @@ return [ 'build_time' => ['base' => 90, 'factor' => 1.2], 'workers' => ['base' => 2, 'factor' => 1.12], 'production' => ['resource' => 'clay', 'base' => 30, 'factor' => 1.163], - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 6, 'factor' => 1.2], 'requires' => [], ], @@ -78,7 +78,7 @@ return [ 'build_time' => ['base' => 110, 'factor' => 1.2], 'workers' => ['base' => 2, 'factor' => 1.12], 'production' => ['resource' => 'iron', 'base' => 30, 'factor' => 1.163], - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 6, 'factor' => 1.2], 'requires' => [], ], @@ -92,7 +92,7 @@ return [ 'production' => null, // Wood, clay and iron each that raiders can't take; instances add up. 'hides' => ['base' => 150, 'factor' => 1.3335], - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 5, 'factor' => 1.2], 'requires' => [], ], @@ -146,7 +146,7 @@ return [ 'build_time' => ['base' => 600, 'factor' => 1.2], 'workers' => ['base' => 3, 'factor' => 1.1], 'production' => null, - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 16, 'factor' => 1.2], 'requires' => [], ], @@ -158,7 +158,7 @@ return [ 'build_time' => ['base' => 1200, 'factor' => 1.2], 'workers' => ['base' => 3, 'factor' => 1.1], 'production' => null, - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 20, 'factor' => 1.2], 'requires' => ['barracks' => 3], ], @@ -170,7 +170,7 @@ return [ 'build_time' => ['base' => 1800, 'factor' => 1.2], 'workers' => ['base' => 4, 'factor' => 1.1], 'production' => null, - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 24, 'factor' => 1.2], 'requires' => ['barracks' => 5], ], @@ -199,7 +199,7 @@ return [ 'workers' => ['base' => 2, 'factor' => 1.1], 'production' => null, 'beds' => ['base' => 20, 'factor' => 1.2], - 'instance_cost_factor' => 1.5, + 'instance_cost_factor' => 2.0, 'points' => ['base' => 12, 'factor' => 1.2], 'requires' => ['barracks' => 1], ], diff --git a/tests/Feature/BuildQueueTest.php b/tests/Feature/BuildQueueTest.php index 9975852..e570a9a 100644 --- a/tests/Feature/BuildQueueTest.php +++ b/tests/Feature/BuildQueueTest.php @@ -88,7 +88,7 @@ it('makes a later instance of a type cost more', function () { $village = startVillage(); $farms = collect(shown($village)['buildable'])->firstWhere('type', 'farm'); - expect($farms['cost'])->toBe(['wood' => 68, 'clay' => 60, 'iron' => 45]); + expect($farms['cost'])->toBe(['wood' => 90, 'clay' => 80, 'iron' => 60]); }); it('keeps a third order waiting and starts it when a builder frees up', function () { diff --git a/tests/Unit/Game/BuildingRulesTest.php b/tests/Unit/Game/BuildingRulesTest.php index 49683b4..d1c63be 100644 --- a/tests/Unit/Game/BuildingRulesTest.php +++ b/tests/Unit/Game/BuildingRulesTest.php @@ -16,7 +16,10 @@ it('costs the base at level 1 and grows by the factor per level', function () { it('makes later instances of a type more expensive', function () { $rules = new BuildingRules(gameConfig()); - expect($rules->cost('farm', 1, 1))->toBe(['wood' => 68, 'clay' => 60, 'iron' => 45]) + // The n-th copy costs 2^n as much, at every level. + expect($rules->cost('farm', 1, 1))->toBe(['wood' => 90, 'clay' => 80, 'iron' => 60]) + ->and($rules->cost('farm', 1, 2))->toBe(['wood' => 180, 'clay' => 160, 'iron' => 120]) + ->and($rules->cost('timber_camp', 3, 1))->toBe(['wood' => 156, 'clay' => 188, 'iron' => 125]) ->and($rules->cost('headquarters', 1, 3))->toBe($rules->cost('headquarters', 1)); });