2026-10-29 15:31:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use App\Game\Map\Season;
|
|
|
|
|
use Carbon\CarbonImmutable;
|
|
|
|
|
|
2026-11-03 11:18:39 +00:00
|
|
|
it('brings the crowns after 30 real days and lets a holder win after 7, on every world speed', function () {
|
2026-10-29 15:31:34 +00:00
|
|
|
$start = CarbonImmutable::parse('2026-11-01 00:00:00');
|
2026-11-03 11:18:39 +00:00
|
|
|
$fast = new Season(gameConfig(['world' => ['speed' => 100]]));
|
2026-10-29 15:31:34 +00:00
|
|
|
|
|
|
|
|
expect((new Season(gameConfig()))->crownsAt($start)->toDateTimeString())->toBe('2026-12-01 00:00:00')
|
2026-11-03 11:18:39 +00:00
|
|
|
->and($fast->crownsAt($start)->toDateTimeString())->toBe('2026-12-01 00:00:00')
|
|
|
|
|
->and((new Season(gameConfig()))->holdSeconds())->toBe(7 * 86400)
|
|
|
|
|
->and($fast->holdSeconds())->toBe(7 * 86400);
|
2026-10-29 15:31:34 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('places five crowns evenly round 0|0', function () {
|
|
|
|
|
expect((new Season(gameConfig()))->spots())->toBe([[0, -10], [10, -3], [6, 8], [-6, 8], [-10, -3]]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('needs more than half of the crowns to hold them', function () {
|
|
|
|
|
$season = new Season(gameConfig());
|
|
|
|
|
|
|
|
|
|
expect($season->needed())->toBe(3)
|
|
|
|
|
->and($season->holder([4, 4, 4, null, 9]))->toBe(4)
|
|
|
|
|
->and($season->holder([4, 4, 9, 9, null]))->toBeNull()
|
|
|
|
|
->and($season->holder([null, null, null, null, null]))->toBeNull();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('names the next world', function () {
|
|
|
|
|
expect(Season::next('w1'))->toBe('w2')
|
|
|
|
|
->and(Season::next('World 9'))->toBe('World 10')
|
|
|
|
|
->and(Season::next('dev'))->toBe('dev2');
|
|
|
|
|
});
|