public ActionResult GetActions(string gameId, string pid) { var theGame = Game.GetGame(gameId); var player = theGame.GetPlayer(pid); if (player.IsDead) { return(Content("You have been staked. But don't worry, as a ghost, you can observe everything that goes on.... [coming soon]")); } if (!theGame.CurrentTurn().NightComplete) { if (player.IsInJail) { return(Content("It is night time. You are in protective custody (i.e. jail). At least you can't get bitten.")); } else { var model = new NightFormModel() { GameId = gameId, ActorId = player.Id, OtherPlayers = theGame.MobilePlayers.Exclude(pid).ToSelectList(), IsVampire = player.IsVampire, TurnId = theGame.CurrentTurn().Id }; return(PartialView("_NightActions", model)); } } else if (!theGame.CurrentTurn().DayComplete) { var model = new DayFormModel() { GameId = gameId, ActorId = player.Id, OtherPlayers = theGame.MobilePlayers.Exclude(pid).ToSelectList(), AllPlayers = theGame.MobilePlayers.ToSelectList(), TurnId = theGame.CurrentTurn().Id }; return(PartialView("_DayActions", model)); } else { return(Content("Turn already complete. Something has gone wrong.")); } }
public ActionResult DayInstruction(DayFormModel model) { var theGame = Game.GetGame(model.GameId); if (theGame.CurrentTurn().DayComplete || theGame.CurrentTurn().Id != model.TurnId) { theGame.Error += "Turn already complete! theGame.CurrentTur().Id = " + theGame.CurrentTurn().Id + ". theGame.CurrentTurn().DayComplete = " + theGame.CurrentTurn().DayComplete + ". model.TurnId = " + model.TurnId ; return(Content("Turn already complete! Did you use the back button in your browser??")); } else { var instruction = new DayInstruction(theGame, model); theGame.ProcessDayInstruction(instruction); return(Content(null)); } }