game-village-politics-backend/app/Actions/Levy.php

21 lines
559 B
PHP
Raw Normal View History

<?php
namespace App\Actions;
use App\Engine\Military;
use App\Engine\Simulation;
use App\Models\User;
use App\Models\Village;
use Carbon\CarbonImmutable;
/** Draft villagers as militia for the world's levy duration. */
final class Levy extends VillageAction
{
public function __invoke(User $user, int $villageId, int $count): Village
{
return $this->mutate($user, $villageId, function (Simulation $sim, Village $village, CarbonImmutable $now) use ($count) {
Military::of($village, $sim)->levy($count, $now);
});
}
}