$units */ public function __invoke(User $user, int $villageId, string $type, int $x, int $y, array $units, ?string $mode, ?string $catapultTarget): Village { return $this->mutate($user, $villageId, function (Simulation $sim, Village $village, CarbonImmutable $now) use ($type, $x, $y, $units, $mode, $catapultTarget) { $target = Village::where('world_id', $village->world_id)->where('x', $x)->where('y', $y)->first() ?? throw new GameRuleViolation('not_found', 'No village there.'); $rally = Rally::of($village, $sim); $rally->send($type, $target, $units, $mode ?: $rally->travel()->defaultMode(), $catapultTarget ?: null, $now); }); } }