test: a barbarian in the rally tests steps aside when another player spawned on its field
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
68f901e3d9
commit
550f7625eb
|
|
@ -27,8 +27,13 @@ function rallied(Village $village, array $units = []): Village
|
|||
return $village->fresh();
|
||||
}
|
||||
|
||||
/** A barbarian village at the offset, or the next free field to the east when another player spawned there. */
|
||||
function barbarianNear(Village $near, int $dx, int $dy): Village
|
||||
{
|
||||
while (Village::where('world_id', $near->world_id)->where('x', $near->x + $dx)->where('y', $near->y + $dy)->exists()) {
|
||||
$dx++;
|
||||
}
|
||||
|
||||
return app(VillageFactory::class)->create($near->world, null, 'Barbarian village', $near->x + $dx, $near->y + $dy, ['headquarters' => 1, 'storage' => 1, 'farm' => 1]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue