loyalty(40, 10))->toBe(50.0) ->and((new Conquest(gameConfig(['world' => ['speed' => 5]])))->loyalty(40, 10))->toBe(90.0) ->and((new Conquest(gameConfig()))->loyalty(95, 10))->toBe(100.0); }); it('drops loyalty by 20 to 35 per nobleman', function () { $conquest = new Conquest(gameConfig()); expect($conquest->drop(0.0))->toBe(20.0) ->and($conquest->drop(0.5))->toBe(28.0) ->and($conquest->drop(0.9999))->toBe(35.0); }); it('gives the n-th slot for n more coins', function () { expect(array_map(Conquest::slots(...), [0, 1, 2, 3, 5, 6, 10]))->toBe([0, 1, 1, 2, 2, 3, 4]) ->and(Conquest::coinsFor(4))->toBe(10); }); it('lets coins pay for villages: 1 for the 2nd, 3 in total for the 3rd, 6 for the 4th', function () { expect(Conquest::canTake(0, 0))->toBeTrue() ->and(Conquest::canTake(0, 1))->toBeFalse() ->and(Conquest::canTake(1, 1))->toBeTrue() ->and(Conquest::canTake(2, 2))->toBeFalse() ->and(Conquest::canTake(3, 2))->toBeTrue() ->and(Conquest::canTake(5, 3))->toBeFalse() ->and(Conquest::canTake(6, 3))->toBeTrue(); }); it('knows the noblemen and what a coin costs', function () { $conquest = new Conquest(gameConfig()); expect($conquest->nobleUnits())->toBe(['nobleman']) ->and($conquest->coinCost(2))->toBe(['wood' => 56000, 'clay' => 60000, 'iron' => 50000]); });