territory claiming modification
This commit is contained in:
@@ -100,19 +100,22 @@ public class LocationsController : ControllerBase
|
||||
{
|
||||
return Ok(LocationResponse.FromLocation(existingLocation));
|
||||
}
|
||||
}
|
||||
|
||||
return Conflict("Location is already controlled by another player.");
|
||||
if (!User.IsInRole("SUPER") && !await _locations.CanScoutClaimAsync(username, request.Q, request.R))
|
||||
{
|
||||
return BadRequest("Scouts can only claim neutral territory or empty enemy territory without units or buildings.");
|
||||
}
|
||||
|
||||
if (!User.IsInRole("SUPER") && !await _units.TryConsumeCompletedScoutAsync(username))
|
||||
{
|
||||
return BadRequest("A completed scout is required to claim unclaimed territory.");
|
||||
return BadRequest("A completed scout is required to claim territory.");
|
||||
}
|
||||
|
||||
var location = await _locations.ClaimAsync(request.Q, request.R, username);
|
||||
if (location is null)
|
||||
{
|
||||
return Conflict("Location is already controlled by another player.");
|
||||
return Conflict("Location cannot be claimed while occupied or built up.");
|
||||
}
|
||||
|
||||
return Ok(LocationResponse.FromLocation(location));
|
||||
|
||||
Reference in New Issue
Block a user