21 lines
579 B
PHP
21 lines
579 B
PHP
<?php
|
|
|
|
namespace App\Actions;
|
|
|
|
use App\Engine\Rally;
|
|
use App\Engine\Simulation;
|
|
use App\Models\User;
|
|
use App\Models\Village;
|
|
use Carbon\CarbonImmutable;
|
|
|
|
/** Call an attack or support back within the cancel window. */
|
|
final class CancelMovement extends VillageAction
|
|
{
|
|
public function __invoke(User $user, int $villageId, int $movementId): Village
|
|
{
|
|
return $this->mutate($user, $villageId, function (Simulation $sim, Village $village, CarbonImmutable $now) use ($movementId) {
|
|
Rally::of($village, $sim)->cancel($movementId, $now);
|
|
});
|
|
}
|
|
}
|