diff --git a/tests/Feature/MapRelationsTest.php b/tests/Feature/MapRelationsTest.php index 36b0b06..3cf1b52 100644 --- a/tests/Feature/MapRelationsTest.php +++ b/tests/Feature/MapRelationsTest.php @@ -26,7 +26,9 @@ it('colours villages by what their owner is to the viewer', function () { $ally = startVillage(); $foe = startVillage(); $stranger = startVillage(); - $barbarian = app(VillageFactory::class)->create($me->world, null, 'Barbarian village', $me->x + 2, $me->y + 2, ['headquarters' => 1]); + // A free field near me: the other players settle at random and may take any given one. + $spot = collect(range(2, 10))->first(fn (int $d) => ! Village::where('world_id', $me->world_id)->where('x', $me->x + $d)->where('y', $me->y + 2)->exists()); + $barbarian = app(VillageFactory::class)->create($me->world, null, 'Barbarian village', $me->x + $spot, $me->y + 2, ['headquarters' => 1]); foreach ([[$me, 'AAA'], [$ally, 'BBB'], [$foe, 'CCC']] as [$v, $tag]) { app(Tribes::class)->found(owner($v), $v->world_id, "Tribe $tag", $tag); }