public void OnPost() { if (!Request.Form.TryGetValue("x", out var strX)) { IsError = true; StatusMsg = "Missing x coordinate!"; return; } if (!Request.Form.TryGetValue("y", out var strY)) { IsError = true; StatusMsg = "Missing y coordinate!"; return; } // Check if the specified location can be attacked if (!InputValidator.CheckValidAttackLocation(ActiveGame.NextPlayer, strX, strY, out var pos)) { IsError = true; StatusMsg = "Invalid attack location!"; return; } // Make the attack var result = PlayerLogic.AttackPlayer(ActiveGame.NextPlayer, pos); // Return whatever var move = new Move(ActiveGame.CurrentPlayer, ActiveGame.NextPlayer, pos, result); // Get next player var lastTurn = ActiveGame.RoundCounter; ActiveGame.CyclePlayers(); if (lastTurn != ActiveGame.RoundCounter) { IsDisplaySave = true; } IsStatus = true; StatusMsg = $"It was a {result}!"; }