async public Task <ActionResult> Yield() { string userId = User.Identity.GetUserId(); Match match = await GladiatorHandler.GetActiveMatch(userId); if (match == null) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new string[] { "Tried to yield when there's no match." })); } if (match.NextAttacker.Owner.Id != userId) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new string[] { "Not user's turn." })); } await GladiatorHandler.YieldTurn(match); //If npc didnt accept the yield, attack if (match.Winner == null && match.NextAttacker.IsNPC) { await GladiatorHandler.AttackTurn(match); } return(PartialView("Index", match)); }
async public Task <ActionResult> Index() { string userId = User.Identity.GetUserId(); Match match = await GladiatorHandler.GetActiveMatch(userId); if (match == null) { return(RedirectToAction("CreateMatch")); } return(PartialView(match)); }